Where can I find out date of Windows last install on current machine?
Thanks,
Mike
Posted on 2002-09-21 08:51:16 by Mike
Wild guess:



// HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\FirstInstallDateTime


// Open the registry key
IF RegOpenKeyEx(HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion', 0,0, Key) = 0
THEN BEGIN
DataLength := SizeOf(Data);
RegQueryValueEx(Key, 'FirstInstallDateTime', NIL, @ValueType, @Data[0], @DataLength);
MemoInfo.Lines.Add(' ' +
FormatDateTime('mm/dd/yyyy hh:nn', FileDateToDateTime(DataValue)));

// Close the registry key
RegCloseKey(Key);
END;

:grin:

Click here for more: http://groups.google.com/groups?hl=en&lr=&ie=ISO-8859-1&q=installation+date+of+windows&sa=N&tab=wg
Posted on 2002-09-21 09:05:20 by bazik
Thank you. That's code for masm32. Please change it because
it works not properly.
And I have two questions.
1. What format uses in registry in FirstInstallDateTime?
2. I can't see this value (FirstInstallDateTime) in regedit. Why?
Mike.

;********************************************************************
.data?
sysTime SYSTEMTIME <>
fileTime FILETIME <>
szData db 8 dup (?)
szOut db 16 dup (?)
szOut1 db 16 dup (?)
hKey dd ?
MaxValueLen dd ?


.code
start:
invoke RegOpenKeyEx, HKEY_LOCAL_MACHINE, CStr("SOFTWARE\Microsoft\Windows\CurrentVersion"), 0, KEY_QUERY_VALUE, ADDR hKey
.if !eax ; If there are no problems
; Read opened key
mov MaxValueLen, 4 ;SIZEOF szData
invoke RegQueryValueEx, hKey, CStr("FirstInstallDateTime"), 0, 0, addr szData, ADDR MaxValueLen
; > value > buffer > length
.if eax==ERROR_SUCCESS
invoke DosDateTimeToFileTime, addr szData, addr szData+2, addr fileTime
invoke FileTimeToSystemTime, addr fileTime, addr sysTime
invoke GetDateFormat,
LOCALE_SYSTEM_DEFAULT,
0,
addr sysTime,
CStr("dd-MM-yyyy"),
offset szOut1,
99

;invoke dw2hex, szData, addr szOut
invoke MessageBox, 0, ADDR szOut1, ADDR szOut1, MB_OK
.else
invoke MessageBox, 0, CStr("Can't find such value"), 0, MB_OK

.endif
invoke RegCloseKey, hKey

.else
invoke MessageBox, 0, CStr("Can't open key"), 0, MB_OK
.endif

invoke ExitProcess, 0

end start
;************************************************************
Posted on 2002-09-22 08:33:34 by Mike
Is it last install or first install?
Posted on 2002-09-22 21:34:02 by roaknog
Thank you, roaknog, but that's output of your program:

**********************************************

This program gets the insatllation date of you Windows
operating system on your computer from the registry.


The installation time and date of your OS is: .


Freehafer's 32 Bit Assemblly Windows Program Is Terminated!

(c)2002 INNIEA PUBLISHING COMPANY! R??K NOG!

Hit enter key to exit . . .
**********************************************
in which I can't see any date...
Posted on 2002-09-23 01:48:14 by Mike
roaknog,
from your source code:



SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18
\Products\904000001E872D116BF00006799C897E\InstallProperties


You used your own SID :) The SID is a unique identifier for your username under NT systems.
In fact this app only works on your machine ;)
Posted on 2002-09-23 02:17:07 by bazik
Ok, I tweaked my zip in my previous message to enumerate the 32 character
key so it may be different on each computer. Plus there is an os test.
Let me know how it works.
Posted on 2002-09-23 22:19:49 by roaknog
Roaknog, that's output of your new program in my Win98se:

************************************************
ROAK NOG IS PERFECT IN EVERY WAY!

LET US LOOK AT YOUR OPERATING SYSTEM . . .

dwOSVersionInfoSize = 148
dwMajorVersion = 4
dwMinorVersion = 10
dwBuildNumber = 67766446
dwPlatformId = 1

Your operating system is Windows 98 Second Edition.


This program gets the insatllation date of your Windows
operating system on your computer from the registry.


The installation date of your OS is: .


Freehafer's 32 Bit Assemblly Windows Program Is Terminated!

(c)2002 INNIEA PUBLISHING COMPANY! R??K NOG!

Hit enter key to exit . . .
****************************************************
Posted on 2002-09-24 05:48:26 by Mike
Thanks to all. There are no some problems. This program works and works properly.
My previous questions were because of damage in regedit.exe - who can think?!
Now one more question: where is written the date of last installation?

Mike
Posted on 2002-09-24 10:49:22 by Mike
Your way is best in 95 98 and ME. However in XP and 2000 the key path:
SOFTWARE\Microsoft\Windows NT\CurrentVersion
and value:
InstallDate
will disappoint you. I searched the registry and there was
no FirstInstallDateTime in XP or 2000.

And to find a value in the registry click edit and click find.
I could find no lastinstall.
Posted on 2002-09-24 12:28:50 by roaknog
Thank you, roaknog. I'll modify program.
Mike
Posted on 2002-09-24 21:22:28 by Mike