I have a 32bit application that must call C:\Windows\System32\regedit.exe
, but instead it runs C:\Windows\SysWOW64\regedit.exe
. How can I call the regedit
in System32
?
void CSecureShellView::OnCommandsRegistry64bit()
{
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
CString szExe;
szExe = "regedit.exe";
if (CreateProcess("C:\\Windows\\Sysnative\\cmd.exe", szExe.GetBuffer(100), 0, 0, FALSE, CREATE_NO_WINDOW, 0, 0, &si, &pi))
{
WaitForSingleObject(pi.hProcess, IGNORE);// optionally wait for process to finish
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
}
The Condition returns True but regedit
does not run.
Instead of SysNative
, I put System32
, but it does not work. In szExe
, I put the string "C:\Windows\regedit"
, but it does not work. And so on ...