Lunchbox Posted February 16, 2012 Posted February 16, 2012 (edited) I have a script (Attached) that does the following:1. Adds a user to have logon as service rights using win32 calls. This works fine.2. Logs on that user using win32 api LogonUser (LogonType=5). This works fine.3. Loads the users profile using LoadProfile win32 API. This works fine.4. Creates an environment block for the user using the users token. This doesn't appear to work. The function returns 1 (true) but the pointer to the block that should be returned appears to be empty. The process is created with the environment from the parent process.5. Runs a process as the user and waits. This works fine6. Unloads the user profile and returns the code from the process launched in step 5.I can't for the life of me figure out why CreateEvironmentBlock is returning true, but not giving me an environment block. I need to have the process have the environment of the user instead of an inherited environment.I thought initially it had something to do with win32 data types. LogonUser returns a pointer to a handle (PHANDLE), but CreateEnvironmentBlock wants a HANDLE.Can anyone look over this script and give me some thoughts? Edited February 16, 2012 by Lunchbox
Lunchbox Posted February 16, 2012 Author Posted February 16, 2012 Nevermind. got it. After staring at it for hours I had variables on the wrong side of an equal sign. Need coffee I guess
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now