FierceRecon Posted June 14, 2005 Share Posted June 14, 2005 If you are to create a user and start a program (cmd.exe will do), WIHU's environment is not passed to the program.E.X.[Environment]HELLO=BLA...[Some section]command.0 = cmd.exedescription.0 = just a testif you don't skip user creation (e.g. you create a new user), and you type in set when the cmd window shows up, you won't see the variable HELLO there.(simple fix - download source and)Open wihu.cFind:LV_EX_ITEM *Parent; DWORD BlankPasswordUsage = 0; WIHU_USER *User;After, add:LPVOID env = NULL;Findwhile (Env) { WCHAR EnvData[MAX_ENVVAL_SHORT_SIZE]; ExpandEnvironmentStrings(Env->Value, EnvData, MAX_ENVVAL_SHORT_SIZE); SetEnvironmentVariable(Env->Key, EnvData); Env = Env->Next; }After, Add (MAKE SURE TO ADD BEFORE } else {: CreateEnvironmentBlock(&env, NULL, TRUE);Find/* Start process in new user account context */ Result = CreateProcessWithLogonW(User->Name, User->Domain, User->Password, LOGON_WITH_PROFILE, NULL, ExeCmd, 0, NULL, CurDir, &sti, π);REPLACE WITH:/* Start process in new user account context */ Result = CreateProcessWithLogonW(User->Name, User->Domain, User->Password, LOGON_WITH_PROFILE, NULL, ExeCmd, CREATE_UNICODE_ENVIRONMENT, env, CurDir, &sti, π);Recompile source...Hope that helps some headaches.Limitation: Generic environment for the user is not loaded, e.g. %USERNAME% will be that of the user that wihu is being run from (use %ThisUser%) Link to comment Share on other sites More sharing options...
BenjaminKalytta Posted June 15, 2005 Share Posted June 15, 2005 Thank you FierceRecon. I fixed this now.Also %USERNAME% may be used instead of %ThisUser% only.Benjamin Kalytta Link to comment Share on other sites More sharing options...
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