UAC has something special about osk. This code fails with the error code 740 ERROR_ELEVATION_REQUIRED. The requested operation requires a promotion.
var
si: TStartupInfo;
pi: TProcessInformation;
....
si.cb := SizeOf(si);
GetStartupInfo(si);
Win32Check(CreateProcess('C:\Windows\system32\osk.exe', nil, nil, nil,
False, 0, nil, nil, si, pi));
32, 64- UAC. : http://blog.delphi-jedi.net/2008/05/17/the-case-of-shellexecute-shellexecuteex-createprocess-and-oskexe/
, 32 64 , , XP UAC.
, , , ShellExecute. 16- . , ShellExecuteEx. , , CreateProcess API .
, osk , CreateProcess. ShellExecute ShellExecuteEx. UAC. , 32- WOW64-. osk 64- ShellExecuteEx.
:
- 32-
ShellExecuteEx, osk. - 64- , 64 ,
ShellExecuteEx, osk. - 64- , 32- WOW64-, 64- ,
ShellExecuteEx, osk.
, , 64- Delphi, 64- . 64- fpc 64- ++-. ++ :
#include <Windows.h>
#include <Shellapi.h>
int CALLBACK WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
SHELLEXECUTEINFOW sei = { sizeof(sei) };
sei.lpVerb = L"open";
sei.lpFile = L"osk.exe";
sei.nShow = SW_SHOW;
ShellExecuteExW(&sei);
}
64- ++, 32- WOW64-. , !