News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

OS Info for Windows 8 and 10

Started by dedndave, October 02, 2015, 07:14:44 AM

Previous topic - Next topic

TouEnMasm


on Windows 10 answer 10.0 , need more work to get the name,....
Fa is a musical note to play with CL

dedndave

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

rrr314159

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:
I am NaN ;)

TouEnMasm


WMI answer that easy, "Win32_OperatingSystem".Run the script,and you will see all answers he give.

Fa is a musical note to play with CL

dedndave

you mean this one ?

and no source to look at   :(

TouEnMasm

Perhaps it is a manifest for targetting windows  in the directory who made that.
Try this one.

I have added the source code
Fa is a musical note to play with CL

dedndave


Zen

Hi, DAVE !!!
I posted a thread about WMI about a year ago. Postmodern WMI Access, Sept 2014 (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, and, Win32_Processor Class. 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), 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:
Zen

dedndave


ragdog

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

ragdog

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,

dedndave

i'm not sure i understand this yet
but, thanks for the info

Raistlin

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/
Are you pondering what I'm pondering? It's time to take over the world ! - let's use ASSEMBLY...

TouEnMasm

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...
Fa is a musical note to play with CL

dedndave