Author Topic: OS Info for Windows 8 and 10  (Read 44357 times)

TouEnMasm

  • Member
  • *****
  • Posts: 1804
    • EditMasm
Re: OS Info for Windows 8 and 10
« Reply #45 on: October 06, 2015, 05:34:01 PM »

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

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: OS Info for Windows 8 and 10
« Reply #46 on: October 07, 2015, 07:33:43 AM »
my goal here is to generate a string like this

Code: [Select]
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

  • Member
  • *****
  • Posts: 1378
Re: OS Info for Windows 8 and 10
« Reply #47 on: October 07, 2015, 08:47:48 AM »
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

  • Member
  • *****
  • Posts: 1804
    • EditMasm
Re: OS Info for Windows 8 and 10
« Reply #48 on: October 07, 2015, 05:56:08 PM »

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

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: OS Info for Windows 8 and 10
« Reply #49 on: October 08, 2015, 03:21:01 AM »
you mean this one ?

and no source to look at   :(

TouEnMasm

  • Member
  • *****
  • Posts: 1804
    • EditMasm
Re: OS Info for Windows 8 and 10
« Reply #50 on: October 08, 2015, 05:18:52 AM »
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

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: OS Info for Windows 8 and 10
« Reply #51 on: October 08, 2015, 05:42:40 AM »
same result on both, Yves

Zen

  • Member
  • ****
  • Posts: 962
  • slightly red-shifted
Re: OS Info for Windows 8 and 10
« Reply #52 on: October 08, 2015, 06:10:42 AM »
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

deepanker

  • Regular Member
  • *
  • Posts: 1
Re: OS Info for Windows 8 and 10
« Reply #53 on: October 08, 2015, 06:22:58 AM »
Hey guys, i m new here so it was mandatory for me to post something to prove i m not a bot. I tried browsing a bit but i couldn't find a way to post so i m posting here.(Hope this counts!). Anyways taking about new membership, i really liked the way we try to filter bots but i guess it's not cool with funny answers coz it flagged mine when i said i didn't know what franco was, (ideologically).
P.S. tried to attach a screenshot but in vain.

rrr314159

  • Member
  • *****
  • Posts: 1378
Re: OS Info for Windows 8 and 10
« Reply #54 on: October 08, 2015, 07:30:21 AM »
Hi deepanker, welcome,

posting here is called "hijacking the thread" :biggrin: I'm sure nobody minds. To post a new thread you would go to the main forum page, click on "Campus" or "Soapbox" or other subforum. You'll see a "New Topic" button towards the right center of the page. There are quite a few subforums, read the description to see where your new post (when you have one) would belong. Perhaps we need a forum "New Members Please Post Here" :biggrin:

Anyway welcome, happy coding

BTW those anti-spam questions go away after a few times
I am NaN ;)

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: OS Info for Windows 8 and 10
« Reply #55 on: October 31, 2015, 04:19:14 AM »
oops

ragdog

  • Member
  • ****
  • Posts: 609
Re: OS Info for Windows 8 and 10
« Reply #56 on: November 05, 2015, 01:02:27 AM »
Hello

I playing a little with Os version and found this

Code: [Select]
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

Code: [Select]
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


Code: [Select]
.if (EqualsMajorVersion(6) && EqualsMinorVersion(1))
invoke crt_printf,chr$ ("System is Windows 6.1",CR,LF),eax
 .endif

ragdog

  • Member
  • ****
  • Posts: 609
Re: OS Info for Windows 8 and 10
« Reply #57 on: November 05, 2015, 01:07:53 AM »
And here a other similar to this

Code: [Select]
;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

Code: [Select]
invoke _IsWindowsVersionOrGreater ,6,1,VER_EQUAL
 .if (eax)
invoke crt_printf,chr$ ("System is Windows 6.1",CR,LF),eax
.endif

Have fun,

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: OS Info for Windows 8 and 10
« Reply #58 on: November 05, 2015, 07:39:46 AM »
i'm not sure i understand this yet
but, thanks for the info

Raistlin

  • Member
  • ****
  • Posts: 544
Re: OS Info for Windows 8 and 10
« Reply #59 on: November 05, 2015, 04:27:17 PM »
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...