News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Targetting your application four windows getVersionEx

Started by TouEnMasm, October 30, 2015, 07:22:58 PM

Previous topic - Next topic

TouEnMasm

Hello,
With Windows 10 the getversionEx don't work without following this MSDN article:
"Targetting your application four windows "
Thefunction need a manifest to work.
It's what i do in this vc++ project and it work.
But ....
Try the same thing with masm(jwasm) and he don't work,Why !!!!!!!!

Fa is a musical note to play with CL

dedndave


TouEnMasm

and here is what he return on Windows 10
Quote
〱.0
Press any key to continue ...

Let me know if there is a getversionEx sample who return 10.0
I WANT IT (dead or alive) !!!!!!!!

Fa is a musical note to play with CL

TWell

    .386
    .model flat, stdcall
    option casemap:none

ExitProcess proto stdcall :dword
includelib kernel32.lib

RtlGetVersion proto stdcall :dword
includelib ntdll.lib

printf proto cdecl :vararg
_getch proto cdecl
includelib msvcrt.lib

RTL_OSVERSIONINFOEXW struct
dwOSVersionInfoSize dd ? ; ULONG
dwMajorVersion dd ? ; ULONG
dwMinorVersion dd ? ; ULONG
dwBuildNumber dd ? ; ULONG
dwPlatformId dd ? ; ULONG
szCSDVersion dw 128 dup (?);
wServicePackMajor dw ?
wServicePackMinor dw ?
wSuiteMask dw ?
wProductType db ?
wReserved db ?
RTL_OSVERSIONINFOEXW ends

.data
osviex RTL_OSVERSIONINFOEXW <sizeof RTL_OSVERSIONINFOEXW>
sMsg db "Version %u.%u",13,10,0
sEnd db "Press any key to continue...",13,10,0

.code
mainCRTStartup proc c
    invoke RtlGetVersion, offset osviex
    invoke printf, offset sMsg, osviex.dwMajorVersion, osviex.dwMinorVersion
    invoke printf, offset sEnd
    invoke _getch
    invoke ExitProcess, 0
mainCRTStartup endp
end mainCRTStartup
LIBRARY ntdll.dll
EXPORTS
_RtlGetVersion@4=RtlGetVersion

jj2007

Quote from: ToutEnMasm on October 31, 2015, 01:03:47 AMLet me know if there is a getversionEx sample who return 10.0
I WANT IT (dead or alive) !!!!!!!!

There isn't. You have to use the right API:

Quote from: sinsi on October 02, 2015, 01:42:15 PMNetWkstaGetInfo returns         JOHN runs OS version 10.0

dedndave

try this program Yves
no manifest, no compatibilty mode, no UAC

TWell

Those who don't have masm32
    .386
    .model flat, stdcall
    option casemap:none

ExitProcess proto stdcall :dword
includelib kernel32.lib

printf proto cdecl :vararg
_getch proto cdecl
includelib msvcrt.lib

.data
sMsg db "Version %u.%u",13,10,0
sEnd db "Press any key to continue...",13,10,0

.code
mainCRTStartup proc c
    mov    edx,fs:[30h]
    ;mov    eax,[edx+0A4h]
    ;mov    ebx,[edx+0A8h]
    ;invoke printf, offset sMsg, eax, ebx
    invoke printf, offset sMsg, [edx+0A4h], [edx+0A8h]
    invoke printf, offset sEnd
    invoke _getch
    invoke ExitProcess, 0
mainCRTStartup endp
    end mainCRTStartup

TouEnMasm

Thanks for your help :greenclp:
But all methods (except wmi) don't get as many information as OSVERSIONINFOEX.
Another question is:
Is my prog in masm less compatible with other system if the manifest don't work.The annoying question is here.
Fa is a musical note to play with CL

TWell

I dont see differencetypedef struct _OSVERSIONINFOEXW {
  ULONG  dwOSVersionInfoSize;
  ULONG  dwMajorVersion;
  ULONG  dwMinorVersion;
  ULONG  dwBuildNumber;
  ULONG  dwPlatformId;
  WCHAR  szCSDVersion[128];
  USHORT wServicePackMajor;
  USHORT wServicePackMinor;
  USHORT wSuiteMask;
  UCHAR  wProductType;
  UCHAR  wReserved;
} RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;

typedef struct _OSVERSIONINFOEX {
  DWORD dwOSVersionInfoSize;
  DWORD dwMajorVersion;
  DWORD dwMinorVersion;
  DWORD dwBuildNumber;
  DWORD dwPlatformId;
  TCHAR szCSDVersion[128];
  WORD  wServicePackMajor;
  WORD  wServicePackMinor;
  WORD  wSuiteMask;
  BYTE  wProductType;
  BYTE  wReserved;
} OSVERSIONINFOEX, *POSVERSIONINFOEX, *LPOSVERSIONINFOEX;

Zen

HI, TOUTENMASM,
GetVersionEx, is officially deprecated starting in Windows Operating System 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.
Microsoft recommends that for Operating Systems, 8.1 and higher, you use: Version Helper Functions, MSDN
...I know that you are familiar with WMI:  Win32_OperatingSystem Class, MSDN

TouEnMasm


deprecated but can work with c++ adding a manifest.
https://msdn.microsoft.com/fr-fr/library/office/dn481241.aspx
I have done it it work
Fa is a musical note to play with CL

dedndave

that's not the same as your manifest
yours has a "IA64" line in it that doesn't make sense for 32-bit code

Zen

...Hhhmmm,...
I wonder why Microsoft is making it so difficult just to get accurate Operating System information,...
...It doesn't make sense,...assembly programmers are disgruntled,... ::)

dedndave

i've heard that Frenchmen are easily pleased   :biggrin:

        INCLUDE \masm32\include\masm32rt.inc

        .CODE

Start:
        print   chr$('10.0'),13,10
        inkey
        exit

        END     Start

Adamanteus

Quote from: Zen on October 31, 2015, 07:55:15 AM
...Hhhmmm,...
I wonder why Microsoft is making it so difficult just to get accurate Operating System information,...
...It doesn't make sense,...assembly programmers are disgruntled,... ::)
Looks like : meanwhile system difficult itself - dependences check like in nix-systems package manager appearing, in analogue susbsystem like manifests - means this dependences itself is manifests.