21.11.2019, 14:03
|
|
Исполняемый Ретровирус
|
|
Регистрация: 09.08.2008
Адрес: Umbrella Corporation
Сообщения: 743
Репутация: 1293
|
|
Попробуйте данный код:
Код:
function GetWindowsInstallDateTime: TDateTime;
const
RegKeyNT = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion';
RegValNT = 'InstallDate';
RegKey95 = 'SOFTWARE\Microsoft\Windows\CurrentVersion';
RegVal95 = 'FirstInstallDateTime';
function RegReadDWORD(const Key, Name: string): DWORD;
begin
Result := 0;
with TRegistry.Create do
try
RootKey := HKEY_LOCAL_MACHINE;
if KeyExists(Key) and OpenKeyReadOnly(Key) and ValueExists(Name) and
(GetDataType(Name) in [rdInteger, rdBinary, rdUnknown]) and
(GetDataSize(Name) = SizeOf(Result)) then
if GetDataType(Name) = rdInteger then
Result := DWORD(ReadInteger(Name))
else
ReadBinaryData(Name, Result, SizeOf(Result));
finally
Free;
end;
end;
var
Value: DWORD;
begin
Value := RegReadDWORD(RegKeyNT, RegValNT);
if Value <> 0 then
Result := EncodeDate(1970, 1, 1) + (Value / SecsPerDay)
else
begin
Value := RegReadDWORD(RegKey95, RegVal95);
if Value <> 0 then
Result := FileDateToDateTime(Value)
else
Result := 0.0;
end;
end;
|