ZwOpenProcessTokenEx throwing error STATUS_NO_SUCH_LOGON_SESSION on vista

Hi

i am trying to query the Linked Token assosiated to a logged on user using the following code on a vista machine
TOKEN_LINKED_TOKEN hTokenHandle ;
NtTokenStatus =ZwOpenProcessTokenEx(NtCurrentProcess(),TOKEN_ALL_ACCESS,NULL,&TokenHandle);
NtLinkedTokenStatus = ZwQueryInformationToken(TokenHandle,TokenLinkedToken,&hTokenHandle,sizeof(TOKEN_LINKED_TOKEN),&dw);

but it is giving me error STATUS_NO_SUCH_LOGON_SESSION

it would be great if some body could help me in this regard.

In what context are you making the call? The context of the app or the system process?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, April 16, 2008 2:34 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] ZwOpenProcessTokenEx throwing error STATUS_NO_SUCH_LOGON_SESSION on vista

Hi

i am trying to query the Linked Token assosiated to a logged on user using the following code on a vista machine
TOKEN_LINKED_TOKEN hTokenHandle ;
NtTokenStatus =ZwOpenProcessTokenEx(NtCurrentProcess(),TOKEN_ALL_ACCESS,NULL,&TokenHandle);
NtLinkedTokenStatus = ZwQueryInformationToken(TokenHandle,TokenLinkedToken,&hTokenHandle,sizeof(TOKEN_LINKED_TOKEN),&dw);

but it is giving me error STATUS_NO_SUCH_LOGON_SESSION

it would be great if some body could help me in this regard.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer