Hi,

Anybody has any clue about how to use ImpersonateSelf API?

In C the API call that I want to convert to asm looks like following:

ImpersonateSelf(SecurityImpersonation);

What is the value to use for SecurityImpersonation? In MSDN it says it is a enumeration type. But I have the problem that I even cannot understand what that means :(

Sami
Posted on 2002-02-21 13:31:10 by SamiP
An enum is basically an integer that takes symbolic names...
the enum you want is defined as


typedef enum _SECURITY_IMPERSONATION_LEVEL {
SecurityAnonymous,
SecurityIdentification,
SecurityImpersonation,
SecurityDelegation
} SECURITY_IMPERSONATION_LEVEL;


this should be translateable to asm as


SecurityAnonymous equ 0
SecurityIdentification equ 1
SecurityImpersonation equ 2
SecurityDelegation equ 3
Posted on 2002-02-21 13:47:16 by f0dder
Thank you Fodder!

Next question is where did you get those values?

I tried searching through C header files, but I failed to find the place where those values are.

Sami
Posted on 2002-02-21 13:50:23 by SamiP
Looked up ImpersonateSelf in the PlatformSDK (part of MSDN, or
you can download it separately from microsoft - it's quite a whopping
download, but there's a lot of goof information in it).
Posted on 2002-02-21 14:04:40 by f0dder
In my copy of Platform SDK it only says that SecurityAnonymous is defined with no value given and thus defaults to 0.

Is it because SecurityAnonymous is 0 and thats the first one defined that the next one SecurityIdentification is 1 and the one I needed is the third then its 3?

I really don't get this thing :( and whats really sad is that I can't find those values, exept if it is going like I said above.

Sami
Posted on 2002-02-21 14:31:13 by SamiP
Yes, the first value of an enumeration defaults to 0, and increase
in value unless there's assignments in the middle... easy peasy stuff,
once you realize this.
Posted on 2002-02-21 14:34:37 by f0dder
Thank you! You really saved my day! :alright:
Posted on 2002-02-21 14:37:22 by SamiP