Witam...
Czy może ktoś wie jak zmienić datę i czas programowo w Win NT.
Wykorzystałem funkcję SetLocalTime() i SetSystemTime() i nic się nie zmieniło.
Pomóżnie proszę...
0
0
function SetLocalTime(lpSystemTime : _SYSTEMTIME) : bool;
var
hToken : Cardinal;
luid : Int64;
tp, oldtp : TOKEN_PRIVILEGES;
dwSize : DWORD;
begin
result := false;
if not OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, hToken) then exit;
if not LookupPrivilegeValue (nil, 'SeSystemtimePrivilege', luid) then exit;
ZeroMemory(@tp, sizeof(tp));
tp.PrivilegeCount := 1;
tp.Privileges[0].Luid := luid;
tp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
if not AdjustTokenPrivileges (hToken, false, tp, sizeof(TOKEN_PRIVILEGES), oldtp, dwsize) then exit;
windows.SetLocalTime(lpSystemTime);
AdjustTokenPrivileges (hToken, FALSE, oldtp, dwSize, nil, dwsize);
CloseHandle (hToken);
result := true;
end;