OpenProcessToken fails with Access is Denied Error
From: Manoj (m_s77@hotmail.com)
Date: 07/29/02
- Next message: GEG: "enabling cookies"
- Previous message: karl [x y]: "Re: Windows 2000 Professional Installation Domain Security"
- Next in thread: Michael Howard [MS]: "Re: OpenProcessToken fails with Access is Denied Error"
- Reply: Michael Howard [MS]: "Re: OpenProcessToken fails with Access is Denied Error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Manoj" <m_s77@hotmail.com> Date: Mon, 29 Jul 2002 10:42:54 +0530
Dear All,
I am trying to get the Process Token of a process which is running under
another users context.
Process A : Service Application running under Administrator Account (Not
LocalSystem)
Process B : Application running under a Standard User account.
Priviledges held by Administrator
SE_TCB_NAME
SE_DEBUG_NAME
SE_SECURITY_NAME
SE_TAKE_OWNERSHIP_NAME
SE_CREATE_TOKEN_NAME
SE_ASSIGNPRIMARYTOKEN_NAME
I have modified the DACL of the Process B and given all rights to
Administrator.
ea.grfAccessPermissions =
GENERIC_ALL|STANDARD_RIGHTS_ALL|SPECIFIC_RIGHTS_ALL;
ea.grfAccessMode = SET_ACCESS;
ea.grfInheritance = NO_INHERITANCE;
ea.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
ea.Trustee.TrusteeForm = TRUSTEE_IS_SID;
ea.Trustee.TrusteeType = TRUSTEE_IS_GROUP;
ea.Trustee.ptstrName = (LPTSTR) pSidAdmin;
err = SetEntriesInAcl( 1, ea, NULL, &pDACL );
if ( err )
Err( L"SetEntriesInAcl", err );
err = SetSecurityInfo( hWriteDAC, SE_KERNEL_OBJECT,
DACL_SECURITY_INFORMATION|PROTECTED_DACL_SECURITY_INFORMATION,
0, 0, pDACL, 0 );
No Error occurs and Operation is completed successfully. Then I use
Duplicate Handle to get the handle to the process
if ( !DuplicateHandle( GetCurrentProcess(), hpWriteDAC,
GetCurrentProcess(), &hProcess,
PROCESS_ALL_ACCESS|PROCESS_QUERY_INFORMATION, TRUE, 0 ) )
Err( L"GetProcessHandle- AddAceToProcessDacl -DuplicateHandle" );
After that when I try to open the process token I get access denied error.
if (!OpenProcessToken (hProcess, TOKEN_DUPLICATE, phToken))
Err (L"GetProcessToken - OpenProcessToken - Client");
Am I missing something? I have also tried with setting the SACL with NULL
ACL but that also doesn't help.
Please help me out to get out of this obstruct.
Regards,
Manoj
- Next message: GEG: "enabling cookies"
- Previous message: karl [x y]: "Re: Windows 2000 Professional Installation Domain Security"
- Next in thread: Michael Howard [MS]: "Re: OpenProcessToken fails with Access is Denied Error"
- Reply: Michael Howard [MS]: "Re: OpenProcessToken fails with Access is Denied Error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]