as a continuation of this thread...
http://www.masmforum.com/board/index.php?topic=11963.0 (http://www.masmforum.com/board/index.php?topic=11963.0)
i would like to see some new runs for Windows 8 and 10, please
this is the archived download link
http://www.masmforum.com/archive2012/6537_OSinfo23.zip (http://www.masmforum.com/archive2012/6537_OSinfo23.zip)
many thanks :t
Hi, DAVE,
I was reading the code, in, OSinfo23.asm (DednDave OS Info Dump - Version 2.03),...and, I thought this might help:
Version Helper Functions, MSDN (https://msdn.microsoft.com/en-us/library/windows/desktop/dn424972(v=vs.85).aspx)
GetVersionEx (https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx), is officially deprecated starting in version 8.1. You CANNOT get accurate version information in a way that works in both Windows 7 and Windows 8. In Windows 8.1, GetVersionEx returns 6.2.9200, which is the version number for Windows 8.0.
...As you know,...I am a huge WMI (https://msdn.microsoft.com/en-us/library/aa394582(v=vs.85).aspx) fan. But, then,...as you also know,...I'm definitely crazy: Win32_OperatingSystem Class, MSDN (https://msdn.microsoft.com/en-us/library/aa394239(v=vs.85).aspx)
...Also, here are a couple of interesting articles:
Overcoming Windows 8.1's Deprecation of GetVersionEx and GetVersion APIs, Part One, CodeProject (http://www.codeproject.com/Articles/678606/Part-Overcoming-Windows-s-deprecation-of-GetVe)
Overcoming Windows 8.1's Deprecation of GetVersionEx and GetVersion APIs, Part Two, CodeProject (http://www.codeproject.com/Articles/678668/Part-Overcoming-Windows-s)
DednDave OS Info Dump Ver 2.03
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows 8.1"
"CurrentVersion"="6.3"
"CurrentBuildNumber"="9600"
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"="9600.winblue_ltsb.150715-0840"
"ProductId"=(Value not found)
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"=(Value not found)
OSVERSIONINFOEX Structure:
Version.Build: 6.2.9200
Platform ID: Win32 on Windows NT
CSD Version:
Service Pack Version: 0.0
Suite Mask: 0000001100000000
Product Type: Windows 2000 Pro/XP/Vista Workstation
Press any key to exit
DednDave OS Info Dump Ver 2.03
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows 8.1 Connected"
"CurrentVersion"="6.3"
"CurrentBuildNumber"="9600"
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"="9600.winblue_ltsb.150715-0840"
"ProductId"=(Value not found)
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"=(Value not found)
OSVERSIONINFOEX Structure:
Version.Build: 6.2.9200
Platform ID: Win32 on Windows NT
CSD Version:
Service Pack Version: 0.0
Suite Mask: 0000001100000000
Product Type: Windows 2000 Pro/XP/Vista Workstation
Can I have some tests for the attached exe? Sample output:
JOCHEN-WXP runs OS version 5.1
JOCHEN-W7-64 runs OS version 6.1
JOCHEN-W8.1 runs OS version 6.3
This is the source:
include \masm32\MasmBasic\MasmBasic.inc ; download (http://masm32.com/board/index.php?topic=94.0)
uselib netapi32
wsi MACRO arg
exitm @CatStr(<[edi.WKSTA_INFO_100].wki100_>, <arg>)
ENDM
Init
PrintLine "Environment variable OS ", Tb$, ExpandEnv$("%OS%")
PrintLine "Return value from DOS 'ver'", Tb$, Trim$(Launch$("cmd.exe /C ver"))
push eax
invoke NetWkstaGetInfo, 0, 100, esp
pop edi
wInkey "NetWkstaGetInfo returns ", wTb$, wsi(computername), wStr$(" runs OS version %i.", wsi(ver_major)), Str$(wsi(ver_minor))
invoke NetApiBufferFree, edi
Exit
EndOfCode
right, Zen - i was aware of that little issue
but, i guess you want to start with the old stuff, then work toward newer OS's :t
here are the results from Jochens GetVersion for XP MCE 2005 SP3, which probably doesn't help - lol
Environment variable OS Windows_NT
Return value from DOS 'ver' Microsoft Windows XP [Version 5.1.2600]
NetWkstaGetInfo returns K7NL runs OS version 5.1
IsWindows8Point1OrGreater
https://msdn.microsoft.com/en-us/library/windows/desktop/dn424962%28v=vs.85%29.aspx (https://msdn.microsoft.com/en-us/library/windows/desktop/dn424962%28v=vs.85%29.aspx)
:biggrin:
QuoteMinimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
;############################################################
.DATA
szKernel32 db 'Kernel32.dll',0
szWin81 db 'IsWindows8Point1OrGreater',0
;############################################################
.CODE
;************************************************************
main PROC
INVOKE GetModuleHandle,offset szKernel32
.if eax
INVOKE GetProcAddress,eax,offset szWin81
.if eax
call eax
.endif
.endif
print str$(eax),13,10
DednDave OS Info Dump Ver 2.03
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows 10 Pro"
"CurrentVersion"="6.3"
"CurrentBuildNumber"="10240"
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"="10240.th1.150819-1946"
"ProductId"=(Value not found)
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"=(Value not found)
OSVERSIONINFOEX Structure:
Version.Build: 6.2.9200
Platform ID: Win32 on Windows NT
CSD Version:
Service Pack Version: 0.0
Suite Mask: 0000000100000000
Product Type: Windows 2000 Pro/XP/Vista Workstation
Environment variable OS Windows_NT
Return value from DOS 'ver' Microsoft Windows [Version 10.0.10240]
NetWkstaGetInfo returns JOHN runs OS version 10.0
DednDave OS Info Dump Ver 2.03
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows 10 Home Insider Preview"
"CurrentVersion"="6.3"
"CurrentBuildNumber"="10547"
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"="10547.th2_release.150913-1511"
"ProductId"=(Value not found)
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"=(Value not found)
OSVERSIONINFOEX Structure:
Version.Build: 6.2.9200
Platform ID: Win32 on Windows NT
CSD Version:
Service Pack Version: 0.0
Suite Mask: 0000001100000000
Product Type: Windows 2000 Pro/XP/Vista Workstation
that's nice, sinsi - windows 10 returns the "edition string" - one of the goals of my little project
this little program should get the correct minor version number for windows 8.1
it uses RtlGetVersion....
Quote from: sinsi on October 02, 2015, 01:42:15 PMEnvironment variable OS Windows_NT
Return value from DOS 'ver' Microsoft Windows [Version 10.0.10240]
NetWkstaGetInfo returns JOHN runs OS version 10.0
Thanks, John :biggrin:
Quote from: dedndave on October 02, 2015, 11:39:48 AM
IsWindows8Point1OrGreater
https://msdn.microsoft.com/en-us/library/windows/desktop/dn424962%28v=vs.85%29.aspx (https://msdn.microsoft.com/en-us/library/windows/desktop/dn424962%28v=vs.85%29.aspx)
:biggrin:
QuoteMinimum supported client
Windows 2000 Professional [desktop apps only]
So they knew about Win 8.1 15 years ago? ::)
VersionHelpers.h should be interesting - this is inlined stuff for C compilers, not built-in functions.
OTOH, from community additions:
Quote
As of Windows 10 build 10041, this lies
New version, output for Win7-64:
RtlGetVersion 6.1 SP1.0 build 7601
Platform ID 2
Suite mask 0300: SINGLEUSERTS PERSONAL
ProductType WORKSTATION
CSDVersion Service Pack 1
Environment variable OS Windows_NT
Return value from DOS 'ver' Microsoft Windows [Versione 6.1.7601]
HKLM\Software\..\CurrentVersion 6.1
HKLM\..\CurrentBuildNumber 7601
LanRoot=[], LanGroup=[HOME] with 1 users
NetWkstaGetInfo returns JOCHEN-DEV runs OS version 6.1
Quote from: dedndavethis little program should get the correct minor version number for windows 8.1
Quote from: this little program on my 8.1 machine6.3
Press any key to continue ...
jj2007's GetVersionInfo, posted above, agrees, so apparently 8.1 = 6.3! Microsoft needs to hire better arithmeticians
RtlGetVersion 6.3 SP0.0 build 9600
Platform ID 2
Suite mask 0300: SINGLEUSERTS PERSONAL
ProductType WORKSTATION
CSDVersion
Environment variable OS Windows_NT
Return value from DOS 'ver' Microsoft Windows [Version 6.3.9600]
HKLM\Software\..\CurrentVersion 6.3
HKLM\..\CurrentBuildNumber 9600
LanRoot=[], LanGroup=[WORKGROUP] with 2 users
NetWkstaGetInfo returns LENOVO-PC runs OS version 6.3
---- hit any key ----
My laptop:
DednDave OS Info Dump Ver 2.03
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows 8.1 Connected"
"CurrentVersion"="6.3"
"CurrentBuildNumber"="9600"
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"="9600.winblue_ltsb.150715-0840"
"ProductId"=(Value not found)
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"=(Value not found)
OSVERSIONINFOEX Structure:
Version.Build: 6.2.9200
Platform ID: Win32 on Windows NT
CSD Version:
Service Pack Version: 0.0
Suite Mask: 0000001100000000
Product Type: Windows 2000 Pro/XP/Vista Workstation
Press any key to exit
For dedndave,
There is a very few dll concerned by Dllgetversion
Here is the full list given by MSDN
Quote
comctl32.dll dwMajorVersion:5h
comctl32.dll dwMinorVersion:52h
Failed to find DllGetVersion in NtDll.dll
Shell32.dll dwMajorVersion:ah
Shell32.dll dwMinorVersion:0h
Shdocvw.dll dwMajorVersion:ah
Shdocvw.dll dwMinorVersion:0h
Shlwapi.dll dwMajorVersion:ah
Shlwapi.dll dwMinorVersion:0h
Press any key
[\quote]
source code and exe in zip
Windows 10 result
Quote
DednDave OS Info Dump Ver 2.03
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows 10 Home"
"CurrentVersion"="6.3"
"CurrentBuildNumber"="10240"
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"="10240.th1.150819-1946"
"ProductId"=(Value not found)
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"=(Value not found)
OSVERSIONINFOEX Structure:
Version.Build: 6.2.9200
Platform ID: Win32 on Windows NT
CSD Version:
Service Pack Version: 0.0
Suite Mask: 0000001100000000
Product Type: Windows 2000 Pro/XP/Vista Workstation
Press any key to exit
Dave, this might be of use - Targeting your application for Windows (https://msdn.microsoft.com/en-us/library/windows/desktop/dn481241(v=vs.85).aspx)
QuoteIn Windows 8.1 and Windows 10, the GetVersion and GetVersionEx APIs have been deprecated and superseded by the Version Helper APIs. While you can still call the deprecated APIs, if your application does not specifically target Windows 8.1 or Windows 10, you will get Windows 8 version (6.2.0.0).
In order to target Windows 8.1 or Windows 10, you need to include the app manifest in the source file.
jj, you can still build exes for 2000 because the version helpers use APIs that 2000 has.
Attached is the header from the Win10 SDK.
The version helper can be very useful with a lib who include it's functions.
Quote
jj2007's GetVersionInfo, posted above, agrees, so apparently 8.1 = 6.3! Microsoft needs to hire better arithmeticians
The Major and minor version must be read with the help of:
https://msdn.microsoft.com/fr-fr/library/windows/desktop/ms724833(v=vs.85).aspx
6.3 = Windows 8 or Windows Server 2012 R2
good advice
Quote
In Windows 8.1 and Windows 10, the GetVersion and GetVersionEx APIs have been deprecated and superseded by the Version Helper APIs. While you can still call the deprecated APIs, if your application does not specifically target Windows 8.1 or Windows 10, you will get Windows 8 version (6.2.0.0).
In order to target Windows 8.1 or Windows 10, you need to include the app manifest in the source file
I try to made that without any modify on the answer of GetVersionInfoEx
I have added that to my rc file
Quote
#define _NT_TARGET_VERSION $(_NT_TARGET_VERSION_LATEST)
#define IDR_VERSION1 1
#define SXS_MANIFEST_RESOURCE_ID 1
#define SXS_MANIFEST "cpusys.manifest"
#define SXS_ASSEMBLY_NAME "Microsoft.Windows.Foo"
#define SXS_ASSEMBLY_VERSION 1.0
#define SXS_ASSEMBLY_LANGUAGE_INDEPENDENT 1
#define SXS_MANIFEST_IN_RESOURCES 1
cpusys.manifest is the same as the html page
Quote from: sinsi on October 03, 2015, 10:57:17 PMjj, you can still build exes for 2000 because the version helpers use APIs that 2000 has.
Yes, it uses VerifyVersionInfoW, which in turn calls good ol' RtlGetVersion, the one I used in my code. Thanks for the header file, I had seen an unofficial one somewhere, good to have the original.
QuoteWhile you can still call the deprecated APIs, if your application does not specifically target Windows 8.1 or Windows 10, you will get Windows 8 version (6.2.0.0).
RtlGetVersion returns 6.3 on Windows 8.1, without manifest. The logic "manifest-wise my application is not specifically targeted for 8.1, so I want the OS to fake an 8.0" is rather redmondish :eusa_boohoo:
http://www.codeproject.com/Articles/678606/Part-Overcoming-Windows-s-deprecation-of-GetVe?msg=5080848#xx5080848xx
return 10.0 with Windows 10
invoke DllRtlGetVersion,TXT("ntdll.dll"),addr osvi ;GetVersionEx
Quote
.data
osvi OSVERSIONINFOEX <>
.code
DllRtlGetVersion PROC pnameddll:DWORD, posversion:DWORD
Local Hlib:DWORD
Local retour:DWORD
mov retour,0 ;failed
invoke LoadLibrary,pnameddll
mov Hlib,eax
.if eax != 0
Invoke GetProcAddress,Hlib,TXT("RtlGetVersion")
.if eax != 0
mov edx,posversion
mov [edx].OSVERSIONINFOEX.dwOSVersionInfoSize,sizeof OSVERSIONINFOEX
push posversion
call eax
pop edx
.if eax != 0
mov retour,1 ;succès
.endif
.endif
invoke FreeLibrary,Hlib
.endif
FindeDllRtlGetVersion:
mov eax,retour
ret
DllRtlGetVersion endp
Here a test prog
i find an inversion on:
Windows OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION
To view Windows 10 in the zip,OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
Perhaps is there the same problem with other system ??
must be 64-bit, Yves - can't run it on XP :(
Seems to work OK on my Win7 64. The "Windows Server 2008 R2" is about of the same vintage which may account for the mis identification.
Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz
Windows Server 2008 R2, Build S 7601
;constants switch for translate.inc
_WIN32_WINNT equ 00000601h
NTDDI_VERSION equ 06010000h
WINVER equ 06010000h
_MSC_VER equ ;defaut value 1500
;Reports the major and minor versions of the compiler. For example, 1310
;for Microsoft Visual C++ .NET 2003. 1310 represents version 13 and a 1.0
;point release. The Visual C++ 2005 compiler version is 1400.
;Type cl /? at the command line to see the major and minor versions of
;your compiler along with the build number.
;http://msdn.microsoft.com/en-us/library/b0084kay(vs.80).aspx
_WIN32_IE equ ;internet explorer version * 100h ,if 8 _WIN32_IE equ 800h
include sdkddkver.sdk
;How to COPY this ?
;select the text,CTRL-C to copy to the clipbord
Hutch,
What do you get from a simple commandline
ver?
Quote from: dedndave on October 04, 2015, 11:37:25 AM
i guess that would formatted as "5.1.2600 SP 3.0"
RtlGetVersion 5.1 SP 3.0 build 2600
Suite mask 0100: SINGLEUSERTS
ProductType WORKSTATION
CSDVersion Service Pack 3
@Dave: Thanks :icon14: So far RtlGetVersion returns correct numbers for all OS versions, including Sinsi's 10.0. It seems to be the lowest level solution, except for reading the PEB directly.
Quote
must be 64-bit, Yves - can't run it on XP
Too bad,there is not real change that justify this.The code worked perfectly in my old xp.
It is 32 bit,it's not so easy to change from 32 to 64 in asm.
Quote from: dedndave on October 04, 2015, 11:33:20 AM
must be 64-bit, Yves - can't run it on XP :(
It is 32-bit indeed, just launch it with Olly. It displays a RichEd control with the text below.
@Yves: The cpu is OK but I'm definitely
not running Windows Server 2008 R2 8)
Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz
Windows Server 2008 R2, Build S 7601
;constants switch for translate.inc
_WIN32_WINNT equ 00000601h
NTDDI_VERSION equ 06010000h
WINVER equ 06010000h
_MSC_VER equ ;defaut value 1500
;Reports the major and minor versions of the compiler. For example, 1310
;for Microsoft Visual C++ .NET 2003. 1310 represents version 13 and a 1.0
;point release. The Visual C++ 2005 compiler version is 1400.
;Type cl /? at the command line to see the major and minor versions of
;your compiler along with the build number.
;http://msdn.microsoft.com/en-us/library/b0084kay(vs.80).aspx
_WIN32_IE equ ;internet explorer version * 100h ,if 8 _WIN32_IE equ 800h
include sdkddkver.sdk
;How to COPY this ?
;select the text,CTRL-C to copy to the clipbord
After some test,Rtlgetversion seems to be a not very good way.
Just answer 0 as wProductType.
The god (MSDN) way is this one:
Quote
To obtain the full version number for the operating system,
call the GetFileVersionInfo function on one of the system DLLs,
such as Kernel32.dll, then call VerQueryValue to obtain
the \\StringFileInfo\\<lang><codepage>\\ProductVersion subblock of the file
version information.
Don't forget
void
__stdcall
RtlGetNtVersionNumbers(
ULONG* pMajor,
ULONG* pMinor,
ULONG* pBuild
);
from XP onwards because 14 methods that return the version just wasn't enough.
Only 14 methods ??????:
If it is a game , the more powerfull is dumpbin
He found "RtlGetNtProductType"
After an acces violation,RtlGetNtProductType PROTO product:LPDWORD
He return 1 (WORKSTATION on Windows 10)
I will try to fulfill others conditions.
Quote from: ToutEnMasm on October 05, 2015, 01:00:55 AMAfter some test,Rtlgetversion seems to be a not very good way.
@Yves: Which test? Show me one example where RtlGetVersion doesn't return the correct OS version number.
@adeyblue: Nice find :t And it looks really, really foolproof :icon_mrgreen:
RtlGetNtVersionNumbers Ú$ 8BFF mov edi, edi
77AF6CEB ³. 55 push ebp
77AF6CEC ³. 8BEC mov ebp, esp
77AF6CEE ³. 8B45 08 mov eax, [ebp+8]
77AF6CF1 ³. 85C0 test eax, eax
77AF6CF3 ³. 74 06 jz short 77AF6CFB
77AF6CF5 ³. C700 06000000 mov dword ptr [eax], 6
77AF6CFB ³> 8B45 0C mov eax, [ebp+0C]
77AF6CFE ³. 85C0 test eax, eax
77AF6D00 ³. 74 06 jz short 77AF6D08
77AF6D02 ³. C700 01000000 mov dword ptr [eax], 1RtlGetNtVersionNumbers:
major 6
minor 1
build 7601
To jj,
offer you a complete read;
Just answer 0 as wProductType.
I add now:
0 as wSuiteMask
Results on Windows 10
i suspect that RtlGetVersion ultimately gets the answer from here...
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"CurrentVersion"="6.3"
and, registry values can be overwritten
it would probably have little effect if you overwrote that with "6.2"
the fact that it could be modified might be the issue
Quote from: dedndave on October 05, 2015, 05:48:03 AM
i suspect that RtlGetVersion ultimately gets the answer from here...
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"CurrentVersion"="6.3"
Not really...
77AEA099 ³. 64:A1 18000000 mov eax, fs:[18]
77AEA09F ³. 53 push ebx
77AEA0A0 ³. 56 push esi
77AEA0A1 ³. 8B75 08 mov esi, [ebp+8]
77AEA0A4 ³. 57 push edi
77AEA0A5 ³. 8B78 30 mov edi, [eax+30]
77AEA0A8 ³. 8B87 A4000000 mov eax, [edi+0A4] ##### 6 #####
77AEA0AE ³. 8946 04 mov [esi+4], eax
77AEA0B1 ³. 8B87 A8000000 mov eax, [edi+0A8] ##### 1 #####
77AEA0B7 ³. 8946 08 mov [esi+8], eax
@Yves: :dazzled: :dazzled: :dazzled:
oh, i see - it gets it from the TEB (or TIB)
well - we could get it from the TEB easier than calling RtlGetVersion - lol
...get the regular OS version struct
then, if it's windows 8, let the TEB decide the minor version
Wmi script: .vbs
set WMI = GetObject("WinMgmts:/root/cimv2")
set objs = WMI.InstancesOf("Win32_OperatingSystem")
for each obj in objs
WScript.Echo obj.GetObjectText_
next
This one use wmi to give the answer
Must be perfectly correct
Quote from: ToutEnMasm on October 06, 2015, 12:13:14 AM
This one use wmi to give the answer
Must be perfectly correct
Umpf... I thought Win7 was 6.1...
_WIN32_WINNT equ 00000600h
In contrast, this gives the correct value:
RtlGetNtVersionNumbers:
major 6
minor 1
build 7601
:biggrin:
Later version seems to get the OS correct.
Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz
Microsoft Windows 7 Ultimate Version: 6.1.7601
;constants switch for translate.inc
_WIN32_WINNT equ 00000601h
NTDDI_VERSION equ 06010000h
WINVER equ 06010000h
_MSC_VER equ ;defaut value 1500
;Reports the major and minor versions of the compiler. For example, 1310
;for Microsoft Visual C++ .NET 2003. 1310 represents version 13 and a 1.0
;point release. The Visual C++ 2005 compiler version is 1400.
;Type cl /? at the command line to see the major and minor versions of
;your compiler along with the build number.
;http://msdn.microsoft.com/en-us/library/b0084kay(vs.80).aspx
_WIN32_IE equ ;internet explorer version * 100h ,if 8 _WIN32_IE equ 800h
include sdkddkver.sdk
;How to COPY this ?
;select the text,CTRL-C to copy to the clipbord
Quote from: hutch-- on October 06, 2015, 01:31:17 AM
:biggrin:
Later version seems to get the OS correct.
I cheated: Vista compatibility mode :biggrin:
But adeyblue's discovery is not affected, because RtlGetNtVersionNumbers returns hardcoded version numbers.
The issue here is whether you really want to know the OS version, then RtlGetNtVersionNumbers is the way to go, or whether you want to tell your app "you are running in xyz, believe it or not". The other options rely on the TIB, and Windows will set it based on compatibility modes.
I really want to have two methods to verify the value of the switch constants,who are importants
Quote
Microsoft Windows 7 Ultimate Version: 6.1.7601
;constants switch for translate.inc
_WIN32_WINNT equ 00000601h
NTDDI_VERSION equ 06010000h
WINVER equ 06010000h
"Microsoft Windows 7 Ultimate Version: 6.1.7601" is given by WMI
_WIN32_WINNT equ 00000601h is given by RtlGetVersion
Here ,I am happy, the two give the same result.
this seems fairly simple...
ASSUME FS:Nothing
mov edx,fs:[30h]
mov eax,[edx+0A4h]
push edx
print ustr$(eax),'.'
pop edx
mov eax,[edx+0A8h]
print ustr$(eax),13,10
ASSUME FS:ERROR
@dedndave,
that gets my vote for simplest routine, works on my machines. It reports compatibility mode value, right?
that method doesn't care about compatibility mode or a manifest
we just need to test it on a windows 8.1 system, is all
i am pretty sure it will work
Quote from: dedndave on October 06, 2015, 08:19:46 AM
that method doesn't care about compatibility mode or a manifest
Indeed! Surprisingly, if I apply Vista to that exe, it still reports 6.1, i.e. Win7. I thought the TIB was modified by the compatibility settings ::)
Quote from: dedndavewe just need to test it on a windows 8.1 system
- yes, it says 6.3
Quote from: jj2007I thought the TIB was modified by the compatibility settings
- so did I ?
on Windows 10 answer 10.0 , need more work to get the name,....
my goal here is to generate a string like this
Intel Pentium 4 CPU 3.00 GHz (0F043) SSE3
2999 MHz, 2 Logical Cores, 4 Gb RAM, 2124 Mb Avail, 4 Mb Virt
Windows XP MCE 2005 (32-bit), SP3
fairly easy for XP - a little more difficult to id something like "Windows 8.1 Home Premium (64-bit)"
at the moment, i am working on each part, individually
soon, i'll put them all together
While you're at it be cool to throw in the ISP address, RAM, cache size, disk, also the owner's name, age, marital status, ethnicity, sexual preference, employment, income ... :biggrin:
WMI answer that easy, "Win32_OperatingSystem".Run the script,and you will see all answers he give.
you mean this one ?
and no source to look at :(
Perhaps it is a manifest for targetting windows in the directory who made that.
Try this one.
I have added the source code
same result on both, Yves
Hi, DAVE !!!
I posted a thread about WMI about a year ago. Postmodern WMI Access, Sept 2014 (http://masm32.com/board/index.php?topic=3629.0) (you probably remember),...
It includes a 32-Bit MASM program (with source code) that demonstrates how to use WMI as a COM client to find information about the Operating System and the Processor. If you run the application, (it takes about 10 seconds and then displays the phrase: "The WMI Test procedure completed" in the main window). It writes a text file (a Log File in the 'Log File Data' directory), and if you scroll to the bottom of it, it displays about 8 or 10 properties of each WMI class: Win32_OperatingSystem Class (https://msdn.microsoft.com/en-us/library/aa394239(v=vs.85).aspx), and, Win32_Processor Class (https://msdn.microsoft.com/en-us/library/aa394373(v=vs.85).aspx). This is just an example showing how to do it in MASM. If you want, you can obtain the values for all the properties listed in each class. The only problem with WMI is UAC (UACBlog, The User Account Control WebLog, MSDN (http://blogs.msdn.com/b/uac/)), which, if you are not running as an Administrator, will filter out some of the data (for instance, for the Network Adapter) for security reasons.
:icon_eek:...There is alot of code in that program that you would not be interested in, (code that was sub-optimal and unnecessary,...like the security stuff,...just to demonstrate what happens,...for instance, GetVersionEx,...)...:icon_eek:
oops
Hello
I playing a little with Os version and found this
BOOL EqualsMajorVersion(DWORD majorVersion)
{
OSVERSIONINFOEX osVersionInfo;
::ZeroMemory(&osVersionInfo, sizeof(OSVERSIONINFOEX));
osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osVersionInfo.dwMajorVersion = majorVersion;
ULONGLONG maskCondition = ::VerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL);
return ::VerifyVersionInfo(&osVersionInfo, VER_MAJORVERSION, maskCondition);
}
BOOL EqualsMinorVersion(DWORD minorVersion)
{
OSVERSIONINFOEX osVersionInfo;
::ZeroMemory(&osVersionInfo, sizeof(OSVERSIONINFOEX));
osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osVersionInfo.dwMinorVersion = minorVersion;
ULONGLONG maskCondition = ::VerSetConditionMask(0, VER_MINORVERSION, VER_EQUAL);
return ::VerifyVersionInfo(&osVersionInfo, VER_MINORVERSION, maskCondition);
}
int _tmain(int argc, _TCHAR* argv[])
{
if (EqualsMajorVersion(6) && EqualsMinorVersion(3))
{
wcout << _T("System is Windows 8.1");
}
return 0;
}
Here is my translate to this
OSVERSIONINFOEX_ STRUCT
dwOSVersionInfoSize dd ?
dwMajorVersion dd ?
dwMinorVersion dd ?
dwBuildNumber dd ?
dwPlatformId dd ?
szCSDVersion db 128 dup(?)
wServicePackMajor dw ?
wServicePackMinor dw ?
wSuiteMask dw ?
wProductType db ?
wReserved db ?
OSVERSIONINFOEX_ ENDS
EqualsMajorVersion MACRO majorVersion:REQ
invoke _EqualsMajorVersion, reparg(majorVersion)
Exitm <eax>
ENDM
EqualsMinorVersion MACRO MinorVersion:REQ
push eax
invoke _EqualsMinorVersion, reparg(MinorVersion)
mov ebx,eax
pop eax
Exitm <ebx>
ENDM
.data?
osVersionInfo OSVERSIONINFOEX_ <>
.code
_EqualsMajorVersion proc uses ebx majorVersion:DWORD
LOCAL dwConditionMask:QWORD
lea ebx,osVersionInfo
invoke RtlZeroMemory,ebx,sizeof OSVERSIONINFOEX_
mov (OSVERSIONINFOEX_ ptr[ebx]).dwOSVersionInfoSize,sizeof OSVERSIONINFOEX_
mov eax,majorVersion
mov (OSVERSIONINFOEX_ ptr[ebx]).dwMajorVersion,eax
invoke VerSetConditionMask,0,0,VER_MAJORVERSION, VER_EQUAL
mov dword ptr [dwConditionMask],eax
mov dword ptr [dwConditionMask+4],edx
invoke VerifyVersionInfo,ebx,VER_MAJORVERSION, dword ptr [dwConditionMask], dword ptr [dwConditionMask+4]
ret
_EqualsMajorVersion endp
_EqualsMinorVersion proc uses ebx minorVersion:DWORD
LOCAL dwConditionMask:QWORD
lea ebx,osVersionInfo
invoke RtlZeroMemory,ebx,sizeof OSVERSIONINFOEX_
mov (OSVERSIONINFOEX_ ptr[ebx]).dwOSVersionInfoSize,sizeof OSVERSIONINFOEX_
mov eax,minorVersion
mov (OSVERSIONINFOEX_ ptr[ebx]).dwMinorVersion,eax
invoke VerSetConditionMask,0,0,VER_MINORVERSION, VER_EQUAL
mov dword ptr [dwConditionMask],eax
mov dword ptr [dwConditionMask+4],edx
invoke VerifyVersionInfo,ebx,VER_MINORVERSION, dword ptr [dwConditionMask], dword ptr [dwConditionMask+4]
ret
_EqualsMinorVersion endp
.if (EqualsMajorVersion(6) && EqualsMinorVersion(1))
invoke crt_printf,chr$ ("System is Windows 6.1",CR,LF),eax
.endif
And here a other similar to this
;VER_EQUAL 1 The current value must be equal to the specified value.
;VER_GREATER 2 The current value must be greater than the specified value.
;VER_GREATER_EQUAL 3 The current value must be greater than or equal to the specified value.
;VER_LESS 4 The current value must be less than the specified value.
;VER_LESS_EQUAL 5 The current value must be less than or equal to the specified value.
_IsWindowsVersionOrGreater proc majorVersion:DWORD,minorVersion:DWORD ,dwCondition:DWORD
LOCAL dwConditionMask:QWORD
lea ebx,osVersionInfo
invoke RtlZeroMemory,ebx,sizeof OSVERSIONINFOEX_
mov (OSVERSIONINFOEX_ ptr[ebx]).dwOSVersionInfoSize,sizeof OSVERSIONINFOEX_
mov eax,majorVersion
mov (OSVERSIONINFOEX_ ptr[ebx]).dwMajorVersion,eax
mov eax,minorVersion
mov (OSVERSIONINFOEX_ ptr[ebx]).dwMinorVersion,eax
invoke VerSetConditionMask,0,0,VER_MAJORVERSION or VER_MINORVERSION, dwCondition
mov dword ptr [dwConditionMask],eax
mov dword ptr [dwConditionMask+4],edx
invoke VerifyVersionInfo,ebx,VER_MAJORVERSION or VER_MINORVERSION, dword ptr [dwConditionMask], dword ptr [dwConditionMask+4]
ret
_IsWindowsVersionOrGreater endp
invoke _IsWindowsVersionOrGreater ,6,1,VER_EQUAL
.if (eax)
invoke crt_printf,chr$ ("System is Windows 6.1",CR,LF),eax
.endif
Have fun,
i'm not sure i understand this yet
but, thanks for the info
I have implemented a working version as part of my "ExtremeID" project. [coming to masm32 soon - hopefully]
Information sources
--------------------------
I used : http://www.codeguru.com/cpp/misc/misc/system/article.php/c8973/Determine-Windows-Version-and-Edition.htm ...for legacy information and https://msdn.microsoft.com/en-us/library/windows/desktop/ms724833(v=vs.85).aspx ... for newer SKU/version vetting.
On the topic of Windows 10 major/minor this explains allot:
http://arstechnica.com/information-technology/2014/11/why-windows-10-isnt-version-6-any-more-and-why-it-will-probably-work/
I must be a guru with c++
http://masm32.com/board/index.php?topic=4763.msg51370#msg51370
Give the good answer for Windows 10 with getversionex.
There is asm in it,but he can be only c++
Answer given by the demo in the precedent post in Windows 10
Quote
Windows
Edition unknown Edition
Platform type: NT
Major version: 6
Minor version: 2
Build number: 9200
Service Pack info: (Build 9200)
32-bit platform: false
64-bit platform: true
Appuyez sur une touche pour continuer...
guru tweety
(http://25.media.tumblr.com/tumblr_mbxmdcE8PH1qabjqlo1_500.jpg)
Quote from: ToutEnMasm on November 05, 2015, 07:13:40 PM
Give the good answer for Windows 10 with getversionex.
Major version: 6
Minor version: 2
Bad answer.
Quote from: sinsi on October 02, 2015, 01:42:15 PM[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows 10 Pro"
"CurrentVersion"="6.3"
must be the answer of masmbasic or another joke.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"CurrentVersion"="6.3"
"ProductName"="Windows 10 Home"
OllyDbg 2Dump - Process Environment Block
Address Hex dump Decoded data Comments
7FFDE0A4 . 0A000000 DD 0000000A ; OSMajorVersion = 10.
7FFDE0A8 . 00000000 DD 00000000 ; OSMinorVersion = 0
7FFDE0AC . 0028 DW 2800 ; OSBuildNumber = 10240.
7FFDE0AE . 0000 DW 0 ; OSCSDVersion = 0
7FFDE0B0 . 02000000 DD 00000002 ; OSPlatformId = 2
The "Dump - Process Environment Block" can be surely a usefull information
seem to be an OSVERSIONINFOEX STRUCT.
Is it right ?
Quote from: ToutEnMasm on November 06, 2015, 05:57:54 PM
must be the answer of masmbasic or another joke.
Sorry, 6.2 was YOUR answer. And yes, I agree it's another joke.
My answer is this one
http://masm32.com/board/index.php?topic=4763.msg51370#msg51370
get pair spectacles trifocals and read the messagebox
You mean version.zip? Doesn't work on Windows 7, the OS says it requires some strange msvcrt.dll.
Seriously, Yves, how can you write a "tell me my OS version" proggie that doesn't even run on all recent versions???
It don't run in my Windows 10. It needs VCRUNTIME140D.dll ucrtbased.dll .....
I think that's because you have craped variation of Longhorn (https://ru.wikipedia.org/wiki/Windows_Longhorn) ..., but with exceptions in threads ... and Metro interface and ... some other 'very useful things' ...
Quote
It don't run in my Windows 10. It needs VCRUNTIME140D.dll ucrtbased.dll
Those one are provided with the redistributable package of c++ 2015,not witn win 10
For JJ :
Quote
"tell me my OS version" proggie that doesn't even run on all recent versions???
update your knowledge of the Windows 10 system and of visual studio 2015,it is not to late.
here is the link for you
https://www.visualstudio.com/en-us/downloads/2015-redistributables-rc-vs.aspx
The signature of the visual studio 2015 is the need of *140*.dll
extract:
Quote
Visual C++ Runtime Files:
For your convenience, we have provided the following folders for use when distributing VC++ runtime files. Subject to the License Terms for the software, you may copy and distribute with your program any of the files within the folders listed below. You may not modify these files.
\VC\redist\arm\Microsoft.VC140.CRT\appcrt140.dll
\VC\redist\arm\Microsoft.VC140.CRT\concrt140.dll
\VC\redist\arm\Microsoft.VC140.CRT\desktopcrt140.dll
\VC\redist\arm\Microsoft.VC140.CRT\msvcp140.dll
\VC\redist\arm\Microsoft.VC140.CRT\vccorlib140.dll
\VC\redist\arm\Microsoft.VC140.CRT\vcruntime140.dll
\VC\redist\arm\Microsoft.VC140.CXXAMP\vcamp140.dll
\VC\redist\arm\Microsoft.VC140.OPENMP\vcomp140.dll
\VC\redist\x64\Microsoft.VC140.CRT\appcrt140.dll
\VC\redist\x64\Microsoft.VC140.CRT\concrt140.dll
\VC\redist\x64\Microsoft.VC140.CRT\desktopcrt140.dll
\VC\redist\x64\Microsoft.VC140.CRT\msvcp140.dll
\VC\redist\x64\Microsoft.VC140.CRT\vccorlib140.dll
\VC\redist\x64\Microsoft.VC140.CRT\vcruntime140.dll
\VC\redist\x64\Microsoft.VC140.CXXAMP\vcamp140.dll
\VC\redist\x64\Microsoft.VC140.MFC\mfc140u.dll
\VC\redist\x64\Microsoft.VC140.MFC\mfcm140u.dll
\VC\redist\x64\Microsoft.VC140.MFCLOC\mfc140chs.dll
\VC\redist\x64\Microsoft.VC140.MFCLOC\mfc140cht.dll
\VC\redist\x64\Microsoft.VC140.MFCLOC\mfc140deu.dll
\VC\redist\x64\Microsoft.VC140.MFCLOC\mfc140enu.dll
\VC\redist\x64\Microsoft.VC140.MFCLOC\mfc140esn.dll
\VC\redist\x64\Microsoft.VC140.MFCLOC\mfc140fra.dll
\VC\redist\x64\Microsoft.VC140.MFCLOC\mfc140ita.dll
\VC\redist\x64\Microsoft.VC140.MFCLOC\mfc140jpn.dll
\VC\redist\x64\Microsoft.VC140.MFCLOC\mfc140kor.dll
\VC\redist\x64\Microsoft.VC140.MFCLOC\mfc140rus.dll
\VC\redist\x64\Microsoft.VC140.OpenMP\vcomp140.dll
\VC\redist\x86\Microsoft.VC140.CRT\appcrt140.dll
\VC\redist\x86\Microsoft.VC140.CRT\concrt140.dll
\VC\redist\x86\Microsoft.VC140.CRT\desktopcrt140.dll
\VC\redist\x86\Microsoft.VC140.CRT\msvcp140.dll
\VC\redist\x86\Microsoft.VC140.CRT\vccorlib140.dll
\VC\redist\x86\Microsoft.VC140.CRT\vcruntime140.dll
\VC\redist\x86\Microsoft.VC140.CXXAMP\vcamp140.dll
\VC\redist\x86\Microsoft.VC140.MFC\mfc140u.dll
\VC\redist\x86\Microsoft.VC140.MFC\mfcm140u.dll
\VC\redist\x86\Microsoft.VC140.MFCLOC\mfc140chs.dll
\VC\redist\x86\Microsoft.VC140.MFCLOC\mfc140cht.dll
\VC\redist\x86\Microsoft.VC140.MFCLOC\mfc140deu.dll
\VC\redist\x86\Microsoft.VC140.MFCLOC\mfc140enu.dll
\VC\redist\x86\Microsoft.VC140.MFCLOC\mfc140esn.dll
\VC\redist\x86\Microsoft.VC140.MFCLOC\mfc140fra.dll
\VC\redist\x86\Microsoft.VC140.MFCLOC\mfc140ita.dll
\VC\redist\x86\Microsoft.VC140.MFCLOC\mfc140jpn.dll
\VC\redist\x86\Microsoft.VC140.MFCLOC\mfc140kor.dll
\VC\redist\x86\Microsoft.VC140.MFCLOC\mfc140rus.dll
\VC\redist\x86\Microsoft.VC140.OPENMP\vcomp140.dll
VCRUNTIME140D.dll ucrtbased.dll are not in that list.
You posted debug version :(
Quote from: ToutEnMasm on November 07, 2015, 06:34:58 PM
For JJ :
QuoteSeriously, Yves, how can you write a "tell me my OS version" proggie that doesn't even run on all recent versions???
update your knowledge of the Windows 10 system and of visual studio 2015,it is not to late.
here is the link for you
https://www.visualstudio.com/en-us/downloads/2015-redistributables-rc-vs.aspx
Yves,
Does Microsoft pay you for this blunt attempt to force Visual Crap down our throats? Plus your "ready to use SDK", of course?
In terms of sheer size, VS 2015 = 800 x Masm32, 7700 x MasmBasic...
Visual Studio Community 2015 has a 3.7 GB ISO, which will take about 2 hours on a 4 mbps connection. (https://www.quora.com/What-is-the-size-and-how-long-does-it-take-Visual-Studio-2015-to-download-and-install)