Also, it is possible to tell what service packs were installed?
Bill
----------------------
Bill Artemik
Programmer / Analyst
bi...@droste1.com
"He who procrastinates
BA> Using Delphi 5 how can I tell whether the version of Windows I"m
BA> running on is a SERVER version or a workstation class (like Windows
=========Beginning of the citation==============
See
http://www.win2000mag.com/Articles/Index.cfm?ArticleID=2816 or
http://support.microsoft.com/support/kb/articles/Q124/3/05.asp
sV1="HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType\"
sV1_C="ServerNT"
sV2="HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType\"
sV1_C="WinNT"
sV3="HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType\"
sV1_C="LANManNT"
Sub Plugin_Initialize
sT="No"
s=RegReadValue(sv1)
If s="ServerNT" then sT="Detected"
Call SetUIElement(1,sT)
sT="No"
s=RegReadValue(sv2)
If s="WinNT" then sT="Detected"
Call SetUIElement(2,sT)
sT="No"
s=RegReadValue(sv3)
If s="LANManNT" then sT="Detected"
Call SetUIElement(3,sT)
Call Disable 'user can't change anything!
End Sub
Sub Plugin_CheckData(ElementIndex)
End Sub
Sub Plugin_Apply(ElementIndex,ElementSubIndex)
End Sub
Sub Plugin_Terminate
End Sub
[ ww.xteq.com -> x-setup ]
=========The end of the citation================
BA> 2000 Pro versus Windows 2000 Server )
BA> Also, it is possible to tell what service packs were installed?
=========Beginning of the citation==============
sP="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\"
sV1="CurrentVersion"
sV2="CurrentBuildNumber"
sV3="Plus! VersionNumber"
sV4="ProductId"
sV5="CSDVersion"
Sub Plugin_Initialize
if GetWinVer=2 or GetWinVer=4 or GetWinVer=6 then
s=RegReadValue(sP & sV1)
Call SetUIElement(1,s)
s=RegReadValue(sP & sV2)
Call SetUIElement(2,s)
s=RegReadValue(sP & sV3)
Call SetUIElement(3,s)
s=RegReadValue(sP & sV4)
Call SetUIElement(4,s)
s=RegReadValue(sP & sV5)
Call SetUIElement(5,s)
else
Call SetUIElement(1,"N/A")
Call SetUIElement(2,"N/A")
Call SetUIElement(3,"N/A")
Call SetUIElement(4,"N/A")
Call SetUIElement(5,"N/A")
end if
Call Disable 'user can't change anything!
End Sub
Sub Plugin_CheckData(ElementIndex)
End Sub
Sub Plugin_Apply(ElementIndex,ElementSubIndex)
End Sub
Sub Plugin_Terminate
End Sub
=========The end of the citation================
With best regards, . E-mail:
_OSVersionInfo : TOSVersionInfo;
_OSVersionInfo.dwOSVersionInfoSize := SizeOf(_OSVersionInfo);
if GetVersionEx(_OSVersionInfo) then
with _OSVersionInfo do begin
_OSVerStr := Format('%s%s%s%s%s%s%s%s%s',
['Windows: ', IntToStr(dwMajorVersion), '.',
IntToStr(dwMinorVersion), ' (Build ',
IntToStr(dwBuildNumber), ' '+szCSDVersion, ') Platform
ID:',
IntToStr(dwPlatformId)]);
end;
You need to include one of these units I think.
TLHelp32, PSAPI
"Bill Artemik" <Bi...@droste1.com> wrote in message
news:od787ukhivo91edpm...@4ax.com...
Do you know if the PlatformID tells me the server or not part? What
means "server" or "advanced server" versus workstation?
Thanks for this function!
> Great! This ran and told me MOST of what I need to know and I suspect
> the last thing I need (is this NT Server or WS?) is in that Platform
> ID piece?
>
> Do you know if the PlatformID tells me the server or not part? What
> means "server" or "advanced server" versus workstation?
>
I use the following technique to determine if there is server or workstation
running
type
TOsVersionInfoExA = packed record
old : TOsVersionInfoA;
wServicePackMajor : Word;
wServicePackMinor : Word;
wSuiteMask : Word;
{wProductType
Indicates additional information about the system. This member can be one of
the following values. Value Meaning
VER_NT_WORKSTATION The system is running Windows NT 4.0 Workstation, Windows
2000 Professional, Windows XP Home Edition, or Windows XP Professional.
VER_NT_DOMAIN_CONTROLLER The system is a domain controller.
VER_NT_SERVER The system is a server.
}
wProductType : Byte;
wReserved : Byte;
end;
const VER_NT_WORKSTATION = 1;
VER_NT_DOMAIN_CONTROLLER = 2;
VER_NT_SERVER = 3;
function IsServer : Boolean;
var
VerInfo : TOsVersionInfoExA;
begin
FillChar(VerInfo, sizeof(VerInfo), 0);
VerInfo.old.dwOSVersionInfoSize := VerInfo;
if NOT GetVersionExA(VerInfo.old) then
RaiseLastWin32Error();
Result := VerInfo.wProductType <> VER _NT_WORKSTATION;
end;
Hope this helps
Igor Schevchenko
Well, I recon I am gonna become a nag one of these days :)
I would look at the JEDI Code Library (JCL) which can be found at:
or downloaded from:
ftp://delphi-jedi.org/Code_Library/Release_1_11/JCL.zip
This has a unit named JclSysInfo which has a number of functions to help you
with this information. This accounts for the Workstation, Server, Advanced
Server stuff, as I tested it for Marcel van Brakel not too-long ago!
Hope that helps with the final parts you need.
Regards,
Scott Price
----------------------
----------------------
Incompatible Types: 'Cardinal' and 'TOsVersionInfoExA'
on the line:
VerInfo.old.dwOSVersionInfoSize := VerInfo;
Did I miss something?
On Thu, 21 Feb 2002 15:54:55 +0300, "Igor Schevchenko"
<i...@hypersoft.ru> wrote:
----------------------
You could probably also use Windows.getversionEx using an
OSVERSIONINFOEX record:
type
OSVERSIONINFOEX = packed record
dwOSVersionInfoSize: DWORD;
dwMajorVersion: DWORD;
dwMinorVersion: DWORD;
dwBuildNumber: DWORD;
dwPlatformId: DWORD;
szCSDVersion: Array [0..127 ] of Char;
wServicePackMajor: WORD;
wServicePackMinor: WORD;
wSuiteMask: WORD;
wProductType: BYTE;
wReserved: BYTE;
End;
TOSVersionInfoEx = OSVERSIONINFOEX;
POSVersionInfoEx = ^TOSVersionInfoEx;
POSVersionInfo = ^Windows.TOSVersionInfo;
Var
osv: TOSVersionInfoEx;
Begin
FillChar( osv, sizeof(osv), 0 );
osv.dwOSVersionInfoSize := sizeof(osv);
If GetVersionEx( PVersionInfo(@osv)^ ) Then Begin
...look at osv.wSuiteMask and osv.ProductType
End
Else
... not Win 2K
The ugly typecasting is a hack needed to get the compiler to accept the
osv parameter, since GetVersionEx is declared with a Var parameter of
type TOSVersionInfo.
Go to http://msdn.microsoft.com and search for OSVERSIONINFOEX, that
should turn up the docs for the record and explain which values you can
expect in the fields I mentioned above. Oh, you will need the constant
values:
#define VER_SUITE_SMALLBUSINESS 0x00000001
#define VER_SUITE_ENTERPRISE 0x00000002
#define VER_SUITE_BACKOFFICE 0x00000004
#define VER_SUITE_COMMUNICATIONS 0x00000008
#define VER_SUITE_TERMINAL 0x00000010
#define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
#define VER_SUITE_EMBEDDEDNT 0x00000040
#define VER_SUITE_DATACENTER 0x00000080
#define VER_SUITE_SINGLEUSERTS 0x00000100
#define VER_NT_WORKSTATION 0x0000001
#define VER_NT_DOMAIN_CONTROLLER 0x0000002
#define VER_NT_SERVER 0x0000003
--
Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
VerInfo.old.dwOSVersionInfoSize := SizeOf(VerInfo);