diff options
author | Kapil Chouhan <kapil.chouhan@msystechnologies.com> | 2020-11-03 11:46:30 +0000 |
---|---|---|
committer | Kapil Chouhan <kapil.chouhan@msystechnologies.com> | 2020-11-03 11:46:30 +0000 |
commit | e2250072a2dd5bab1c0fab3bd29f85e28eef6b43 (patch) | |
tree | 12f73abf4794f1b5256bc314591abe43ae5306e8 | |
parent | 68709d3edd76ced2403c01185b1db7b3f3230dc7 (diff) | |
download | mixlib-shellout-e2250072a2dd5bab1c0fab3bd29f85e28eef6b43.tar.gz |
Load a user's profile, before retrieves the environment variables
Signed-off-by: Kapil Chouhan <kapil.chouhan@msystechnologies.com>
-rw-r--r-- | lib/mixlib/shellout/windows/core_ext.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/mixlib/shellout/windows/core_ext.rb b/lib/mixlib/shellout/windows/core_ext.rb index b651df0..2cd0893 100644 --- a/lib/mixlib/shellout/windows/core_ext.rb +++ b/lib/mixlib/shellout/windows/core_ext.rb @@ -186,6 +186,14 @@ module Process logon, passwd, domain = format_creds_from_hash(hash) logon_type = hash["elevated"] ? LOGON32_LOGON_BATCH : LOGON32_LOGON_INTERACTIVE token = logon_user(logon, domain, passwd, logon_type) + logon_ptr = FFI::MemoryPointer.from_string(logon) + profile = PROFILEINFO.new.tap do |dat| + dat[:dwSize] = dat.size + dat[:dwFlags] = 1 + dat[:lpUserName] = logon_ptr + end + + load_user_profile(token, profile.pointer) env_list = retrieve_environment_variables(token) end |