C
Hallo,
ich starte die cmd.exe mit CreateProcessWithLogonW mit anderen Benutzerrechten:
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo;
wchar_t username[USERNAME_SIZE] = L"Remote", password[PASSWORD_SIZE] = L"test", app[APP_SIZE] = L"cmd.exe";
memset(&StartupInfo, 0, sizeof(StartupInfo));
StartupInfo.cb = sizeof(StartupInfo);
if (CreateProcessWithLogonW(username, L".", password, LOGON_WITH_PROFILE,
NULL, app, 0, NULL, NULL, &StartupInfo, &ProcessInfo) == 0)
{
SecureZeroMemory(password, PASSWORD_SIZE);
//ferrorts(stdout, GetLastError());
}
else
{
SecureZeroMemory(password, PASSWORD_SIZE);
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);
}
Allerdings schaff ich es nicht dabei die Handles zu vererben bzw. die cmd.exe im selben Konsolenfenster zu starten. Wie kann ich das bewerkstelligen ?