Does anyone know how i detect if the OS is a Windows NT Server or Windows NT
Workstation?
Thanks
Marcio
http://groups.google.com/groups?hl=en&threadm=3c75fcf3_2%40dnews&rnum=1&prev
=/groups%3Fhl%3Den%26selm%3D3c75fcf3_2%2540dnews
--
Dave Nottage (TeamB)
The value of "WINNT" is for Windows NT Workstation
The value of "SERVERNT" is for Windows NT Server (3.5 and higher )
The value of "LANMAN" is for Windows NT Advanced Server ver 3.1
Best regards, Vitaliy Jungle
xxm...@grsu.grodno.by
Grodno State University, Physical and Technical Department
"Marcio" <mav...@ig.com.br> сообщил/сообщила в новостях следующее:
news:3cceafee_1@dnews...
As long as you require Windows NT 4.0 SP6+, this'll work on NT4/2000/XP
(though not on '9x, but then you didn't mention if you needed compatibility
with '9x or not). Use GetVersionEx, but instead of specifying an
OSVERSIONINFO record, use the OSVERSIONINFOEX record. This record has a few
additional fields that will be of use, specifically wSuiteMask and
wProductType. If you need compatibility with '9x, you should probably use
the regular OSVERSIONINFO record first, then verify that dwPlatformId is set
to VER_PLATFORM_WIN32_NT. So your code would look something like this--
var
OldVer: OSVERSIONINFO;
NewVer: OSVERSIONINFOEX;
begin
FillChar(OldVer, SizeOf(OldVer), 0);
OldVer.dwOSVersionInfoSize := SizeOf(OldVer);
if (GetVersionEx(OldVer)) then begin
if (OldVer.dwPlatformId = VER_PLATFORM_WIN32_NT) then begin
FillChar(NewVer, SizeOf(NewVer), 0);
NewVer.dwOSVersionInfoSize := SizeOf(NewVer);
if (GetVersionEx(NewVer)) then begin
if (NewVer.wProductType = VER_NT_WORKSTATION) then begin
// Code you want to run if it's NT Workstation/2000
Professional, etc
else begin
// Probably safe to assume it's a server, or you could
inspect wSuiteMask for more details!
end;
end;
end;
end;
end;
The above is totally untested, but hopefully it'll work and be helpful.
Good luck. =)
Will