Forum posts for mmc.exe

CreateProcessWithLogonW and mmc.exe

I wrote a program, that should work like RunAs. It works fine, but i have one problem with it. If i want to run for example compmgmt.msc, then i should run mmc.exe and compmgmt.msc as it's parameter. Computer Management will open, but not under the user as i want to run it. It will run under that username who is logged in. Can someone tell me why is that, and how can i correct it? Here is my code :

void createproc(
wchar_t * user,
wchar_t * domain,
wchar_t * pass,
wchar_t * applicationname)
{
int errorcode;
char cmd[Buf_Size];

STARTUPINFO StartInfo;
PROCESS_INFORMATION ProcInfo;
memset(&ProcInfo, 0, sizeof(ProcInfo));
memset(&StartInfo, 0 , sizeof(StartInfo));
StartInfo.cb = sizeof(StartInfo);
StartInfo.wShowWindow = SW_HIDE;

int bFuncRetn =
CreateProcessWithLogonW
(
user,
domain,
pass,
LOGON_NETCREDENTIALS_ONLY,
L'C:\Windows\System32\mmc.exe', //applicationname,
L' compmgmt.msc',
CREATE_UNICODE_ENVIRONMENT,
NULL,
NULL,
(LPSTARTUPINFOW)&StartInfo,
&ProcInfo
);

errorcode = GetLastError();

if ( bFuncRetn == 0 )
{
CloseHandle(ProcInfo.hProcess);
CloseHandle(ProcInfo.hThread);
printf(' GetLastError :: %d CreateProcessWithLogonW Failed!',
errorcode);
printf(' For more information type :: Net Helpmsg %d',
errorcode);
getch();
exit(1);
}

CloseHandle(ProcInfo.hProcess);
CloseHandle(ProcInfo.hThread);

}//createproc


Thanks for your help!

kampi

View complete forum thread with replies

Other posts related to mmc.exe

See Related Forum Messages: Follow the Links Below to View Complete Thread

CreateProcessWithLogonW and mmc.exe
Getting hwnd of MMC.exe started by ShellExecuteEX
run mmc.exe services.msc ' from iis
How to get the process running in the task manager using Install Shield
Access Certificate Store from LocalService Account
How can I access windows root certificate authorities certificates with Delphi?

What is the carbon footprint of your coffee?

Is it low? Is it high? Can this things really kill the planet Earth? Maybe the answer will surprise you. Maybe not.