[Win32utils-devel] GetTokenInformation failure on XP VM

Daniel Berger djberg96 at gmail.com
Fri Aug 21 21:00:45 EDT 2009


Heesob Park wrote:
> Hi,
> 
> 2009/8/22 Daniel Berger <djberg96 at gmail.com>:
>> Hi,
>>
>> Any idea why this would fail on XP Pro, SP 3? It works fine on Vista
>> home premium.
>>
>> I'm getting "The parameter is incorrect."
>>
>> # test.rb
>> require 'windows/security'
>> require 'windows/process'
>> require 'windows/error'
>> include Windows::Error
>> include Windows::Process
>> include Windows::Security
>>
>> token = 0.chr * 4
>>
>> unless OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, token)
>>   raise get_last_error
>> end
>>
>> token = token.unpack('V')[0]
>>
>> te = 0.chr * 4 # TOKEN_ELEVATION
>> rl = 0.chr * 4 # Return length
>>
>> bool = GetTokenInformation(
>>   token,
>>   TokenElevation,
>>   te,
>>   te.size,
>>   rl
>> )
>>
>> unless bool
>>   raise get_last_error  # => The parameter is incorrect.
>> end
>>
>> p te.unpack('L').first
>>
> TOKEN_ELEVATION structure is not supported on Windows XP/2000.
> 
> Refer to http://msdn.microsoft.com/en-us/library/bb530717(VS.85).aspx

Oh, that's right. I forgot that method was implemented for Vista.

It's a bug in the test win32-security test suite then. I need to omit 
the test for that method unless it's Vista or later.

Regards,

Dan


More information about the win32utils-devel mailing list