diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/win32/security.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/chef/win32/security.rb b/lib/chef/win32/security.rb index 3894c65b21..acbc1d4c64 100644 --- a/lib/chef/win32/security.rb +++ b/lib/chef/win32/security.rb @@ -721,7 +721,13 @@ class Chef unless LogonUserW(username, domain, password, logon_type, logon_provider, token) Chef::ReservedNames::Win32::Error.raise! end - Token.new(Handle.new(token.read_pointer)) + + # originally this was .read_pointer, but that is interpreted as a non-primitive + # class (FFI::Pointer) and causes an ArgumentError (Invalid Memory Object) when + # compared to GetCurrentProcess(), which returns a HANDLE (void *). Since a + # HANDLE is not a pointer to allocated memory that Ruby C extensions can understand, + # the Invalid Memory Object error is raised. + Token.new(Handle.new(token.read_ulong)) end def self.test_and_raise_lsa_nt_status(result) |