Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2006 Jan : CreateProcessAsUser / AdjustTokenPrivileges

www.cryer.info
Managed Newsgroup Archive

CreateProcessAsUser / AdjustTokenPrivileges

Subject:CreateProcessAsUser / AdjustTokenPrivileges
Posted by:"Kirk Evans" (kirk_eva..@alltel.net)
Date:Mon, 30 Jan 2006 13:03:26 -0600

I am trying to use the CreateProcessAsUser windows call.

I'm using my logonID, and pw, and I am an administrator on the machine.
I've found code snippets in several locations, and am reasonably confident
that I have the details of the coding right.

In my first attempt, the call would fail because "A required privilege is
not held by the client"

After some research, I found that in order for the call to work, the "token"
had to have the SE_ASSIGNPRIMARYTOKEN_NAME, SE_INCREASE_QUOTA_NAME,
SE_TCB_NAME
privileges enabled, so I tried to use the AdjustTokenPrivileges call in
order to make sure that the privileges were enabled for the token.

Step by step, the procdure is to call LogonUser to get a token, call
AdjustTokenPrivileges to enable the needed privilegs, then call
CreateProcessAsUser.

Now AdjustTokenPrivileges fails because "Not all privileges referenced are
assigned to the caller."  I know
that AdjustTokenPrivileges can't add a privilege that doesn't already exist,
but, I am using an administrator login id and pw, so it seems like i should
have all privileges.

Is this a machine setup issue?  Am I leaving something out?  Help!  Anyone!

Glossary

Replies:

www.cryer.info
Managed Newsgroup Archive