Below code generates:
Unhandled exception at 0x749ab763 in MyProgram1.exe: 0xC0000005: Access violation writing location 0x00d4eb38.
SECURITY_ATTRIBUTES sa = {0};
sa.nLength = sizeof(sa);
STARTUPINFO si = {0};
si.cb = sizeof(si);
//si.cbReserved2 = sizeof(si);
si.lpDesktop = L"winsta0\\default";
CreateProcessAsUser(hUserTokenDup, NULL, L"Setup.exe", &sa, &sa, false, NORMAL_PRIORITY_CLASS | CREATE_NEW_CONSOLE, NULL, NULL, &si, &procinfo);
Is there anything wrong with the code? Please help
From
CreateProcessAsUser(), referring to the third parameter:Change to:
and pass
exeNameas the third parameter instead.