Marius0188
asked on
Retrieve Windows OS information
Hi Experts,
How can I retrieve all relevant OS info for Windows.
For example:
Registered user
Product Key
98/Xp/2K etc...
Country (location)
and more...
If there are freeware component it will also help.
Else code examples will be appreciated.
Thanks a million!
How can I retrieve all relevant OS info for Windows.
For example:
Registered user
Product Key
98/Xp/2K etc...
Country (location)
and more...
If there are freeware component it will also help.
Else code examples will be appreciated.
Thanks a million!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Another way to get OS version :
procedure GetOSVersion;
var
VersionInfo: TOSVersionInfo;
Platform: string;
MajorVersion,MinorVersion, Build: DWORD;
begin
VersionInfo.dwOSVersionInf oSize := SizeOf(VersionInfo);
GetVersionEx(VersionInfo);
with VersionInfo do
begin
case dwPlatformId of
VER_PLATFORM_WIN32s: Platform := 'Windows 3x';
VER_PLATFORM_WIN32_WINDOWS : Platform := 'Windows 95';
VER_PLATFORM_WIN32_NT: Platform := 'Windows NT';
end;
MajorVersion := dwMajorVersion;
MinorVersion := dwMinorVersion;
Build := dwBuildNumber;
end;
end;
procedure GetOSVersion;
var
VersionInfo: TOSVersionInfo;
Platform: string;
MajorVersion,MinorVersion,
begin
VersionInfo.dwOSVersionInf
GetVersionEx(VersionInfo);
with VersionInfo do
begin
case dwPlatformId of
VER_PLATFORM_WIN32s: Platform := 'Windows 3x';
VER_PLATFORM_WIN32_WINDOWS
VER_PLATFORM_WIN32_NT: Platform := 'Windows NT';
end;
MajorVersion := dwMajorVersion;
MinorVersion := dwMinorVersion;
Build := dwBuildNumber;
end;
end;
function GetKey: String;
var
dwSize:DWORD;
hReg:HKey;
tmp1, keyChar:Integer;
i, x:Integer;
Key:String;
const
Characters:String = 'BCDFGHJKMPQRTVWXY2346789' ;
begin
if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, 'Software\Microsoft\Window s NT\CurrentVersion', 0, KEY_READ, hReg ) <> ERROR_SUCCESS) then
exit;
SetLength( Result, 512 );
dwSize := 512;
RegQueryValueEx( hReg, 'DigitalProductId', 0, 0, PByte( Pchar( Result ) ), @dwSize );
RegCloseKey( hReg );
Key := Copy( Result, $35, 15 );
Result := '';
i := 29;
while ( i > 0 ) do
begin
if ( (i mod 6) = 0 ) then
begin
Result := '-' + Result;
dec( i );
continue;
end;
tmp1 := 0;
x := 15;
while ( x > 0 ) do
begin
keyChar := ( tmp1 shl 8 ) or Byte( Key[x] );
tmp1 := keyChar mod 24;
Key[x] := Char( keyChar div 24 );
dec( x );
end;
Result := Characters[ tmp1 + 1] + Result;
dec( i );
end;
end;
//gets the 2K/XP Serial Key... (not 9x)
var
dwSize:DWORD;
hReg:HKey;
tmp1, keyChar:Integer;
i, x:Integer;
Key:String;
const
Characters:String = 'BCDFGHJKMPQRTVWXY2346789'
begin
if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, 'Software\Microsoft\Window
exit;
SetLength( Result, 512 );
dwSize := 512;
RegQueryValueEx( hReg, 'DigitalProductId', 0, 0, PByte( Pchar( Result ) ), @dwSize );
RegCloseKey( hReg );
Key := Copy( Result, $35, 15 );
Result := '';
i := 29;
while ( i > 0 ) do
begin
if ( (i mod 6) = 0 ) then
begin
Result := '-' + Result;
dec( i );
continue;
end;
tmp1 := 0;
x := 15;
while ( x > 0 ) do
begin
keyChar := ( tmp1 shl 8 ) or Byte( Key[x] );
tmp1 := keyChar mod 24;
Key[x] := Char( keyChar div 24 );
dec( x );
end;
Result := Characters[ tmp1 + 1] + Result;
dec( i );
end;
end;
//gets the 2K/XP Serial Key... (not 9x)
Hi
Slightly off the requested point here but having seen the general drift from one of your other recent questions you might like to have a look at the link below, especially the last comment in the thread.
https://www.experts-exchange.com/questions/10075254/the-absolute-unique-number-of-each-pc-how-to-get-it-in-d3.html?query=hard+drive+manufacturers+serial+&topics=85
Slightly off the requested point here but having seen the general drift from one of your other recent questions you might like to have a look at the link below, especially the last comment in the thread.
https://www.experts-exchange.com/questions/10075254/the-absolute-unique-number-of-each-pc-how-to-get-it-in-d3.html?query=hard+drive+manufacturers+serial+&topics=85
I use some functions of the JCL (Jedi Code Library) to do that. It can be found at
http://sourceforge.net/projects/jcl/
Regards Jacco
http://sourceforge.net/projects/jcl/
Regards Jacco
procedure TForm1.Button1Click(Sender
var
Result : string ;
begin
Case Win32Platform of
ver_Platform_Win32_NT:
result := 'Your using either Windows NT\2k\XP' + chr(13) + Format('Major Version: %d', [Win32MajorVersion]);
Ver_Platform_Win32_Windows
Result := 'Your using Windows 9x' + Chr(13) + Format('Major Version: %d', [Win32MajorVersion]);
Ver_Platform_win32s:
Result := 'Your using something shitty like 3.1 ' + chr(13) + Format('Major Version: %d', [Win32MajorVersion]);
else
ShowMessage('Unknown');
end;
ShowMessage(Result);
end;
~-~-~-~-~-~-~-~-~-~-~-~-~-
XP Key Stuff:
With this tool you can find the Windows CD-KEY easly.
The zip file contains the executable file, and the Delphi source code!!!
http://www.afsoftware.it/ENG/SOFTWARE.asp?LINGUA=1&TIPO=1