jak chcesz aby nie można było uruchomić nic innego poaza Twoim programem to zamiast tak kombinować utwórz sobie nowe konto w windowsie, przeloguj się tam, odpal regedita i w kluczu
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\winlogon
dodaj wartość o nazwie Shell i z wartością ścieżki do Twojego exe. Zamiast exploratora będzie się odpalał Twój program, nie będą działały żadne skróty windowsowe poza CTRL+ALT+DEL, nie będzie menu start itp.
tu masz unit, który rejestruje program jako nowy shell
unit untChangeShell;
interface
uses
Windows, SysUtils;
function IsSeperateExplorerFixApplied: boolean;
function ApplySeperateExplorerFix: boolean;
function SetNewShell(path: PChar): boolean;
function IsWow64(): boolean;
const
cSeperateExplorerKey = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer';
cWinLogonKey = 'Software\Microsoft\Windows NT\CurrentVersion\winlogon';
cIniFileMap = 'Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot';
cUserWinLogon = 'USR:Software\Microsoft\Windows NT\CurrentVersion\Winlogon';
implementation
const
KEY_WOW64_32KEY = $0200;
KEY_WOW64_64KEY = $0100;
function IsWow64(): boolean;
type
TIsWow64Process = function(Handle: THandle; var Res: boolean): boolean; stdcall;
var
IsWow64Result: boolean;
IsWow64Process: TIsWow64Process;
begin
Result := False;
IsWow64Process := GetProcAddress(GetModuleHandle('kernel32'), 'IsWow64Process');
if Assigned(IsWow64Process) then
if IsWow64Process(GetCurrentProcess, IsWow64Result) then
Result := IsWow64Result;
end;
function SetNewShell(path: PChar): boolean;
var
hndReg: HKey;
regVal: PChar;
regValSize: DWord;
regValType: DWord;
regMask: DWord;
begin
Result := False;
regValType := REG_SZ;
if RegOpenKeyEx(HKEY_CURRENT_USER, cWinLogonKey, 0, KEY_ALL_ACCESS, hndReg) =
ERROR_SUCCESS then
begin
if RegSetValueEx(hndReg, 'Shell', 0, REG_SZ, path, Length(path) + 1) =
ERROR_SUCCESS then
Result := True;
RegCloseKey(hndReg);
end;
regMask := 0;
if IsWow64 then
regMask := KEY_WOW64_64KEY;
if RegOpenKeyEx(HKEY_LOCAL_MACHINE, cIniFileMap, 0, KEY_ALL_ACCESS or
regMask, hndReg) = ERROR_SUCCESS then
if RegQueryValueEx(hndReg, 'Shell', nil, @regValType, nil, @regValSize) =
ERROR_SUCCESS then
begin
GetMem(regVal, regValSize);
if RegQueryValueEx(hndReg, 'Shell', nil, nil, PByte(regVal), @regValSize) =
ERROR_SUCCESS then
if CompareText(cUserWinLogon, regVal) <> 0 then
begin
if RegSetValueEx(hndReg, 'Shell', 0, REG_SZ, PChar(cUserWinLogon),
Length(cUserWinLogon) + 1) = ERROR_SUCCESS then
Result := True;
RegCloseKey(hndReg);
end;
end;
end;
function ApplySeperateExplorerFix: boolean;
const
intEnable: Dword = 1;
var
hndReg: HKey;
begin
Result := False;
if RegOpenKeyEx(HKEY_CURRENT_USER, cSeperateExplorerKey, 0, KEY_ALL_ACCESS, hndReg) =
ERROR_SUCCESS then
begin
if RegSetValueEx(hndReg, 'DesktopProcess', 0, REG_DWORD, @intEnable, SizeOf(DWord)) =
ERROR_SUCCESS then
Result := True;
RegCloseKey(hndReg);
end;
end;
function IsSeperateExplorerFixApplied: boolean;
var
hndReg: HKey;
regVal: PByte;
regValSize: DWord;
regValType: DWord;
begin
Result := False;
regValType := REG_DWORD;
if RegOpenKeyEx(HKEY_CURRENT_USER, cSeperateExplorerKey, 0, KEY_READ, hndReg) =
ERROR_SUCCESS then
begin
if RegQueryValueEx(hndReg, 'DesktopProcess', nil, @regValType, nil, @regValSize) =
ERROR_SUCCESS then
begin
GetMem(regVal, regValSize);
if RegQueryValueEx(hndReg, 'DesktopProcess', nil, nil, @regVal, @regValSize) =
ERROR_SUCCESS then
Result := (integer(regVal) = 1);
RegCloseKey(hndReg);
end;
end;
end;
end.