Dzień dobry, nazywam się Mateusz Piechnat i mam pytanie na temat zamykania Windows 2000/NT z Delphi.
W poniższej funkcji pojawia się błąd:
[Error] Unit1.pas(55): There is no overloaded version of 'AdjustTokenPrivileges' that can be called with these arguments
function DelphiExitWindows( Flags : Word):Boolean;
var
iVersionInfo: TOSVersionInfo;
iToken : THandle;
iPriveleg : TTokenPrivileges;
iaresult : Integer;
begin
Result:=FALSE;
FillChar (iPriveleg, SizeOf (iPriveleg), #0);
iVersionInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
GetVersionEx(iVersionInfo);
if iVersionInfo.dwPlatformId <> VER_PLATFORM_WIN32_NT then
Result:=ExitWindowsEx (Flags, 0)
else
if OpenProcessToken (GetCurrentProcess,
TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, iToken) then
if LookupPrivilegeValue (NIL,'SeShutdownPrivilege',
iPriveleg.Privileges[0].Luid) then
begin
iPriveleg.PrivilegeCount := 1;
iPriveleg.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
if AdjustTokenPrivileges (iToken,False,iPriveleg,
Sizeof(iPriveleg),iPriveleg,iaresult) then // TO TA LINIA Z BŁĘDEM
Result:=ExitWindowsEx (Flags, 0);
end;
end;
Czy jest z nią jakoś nie tak czy to ja jej źle używam?
piechnat
;(