Author Topic: Targetting your application four windows getVersionEx  (Read 6183 times)

ToutEnMasm

  • Member
  • *****
  • Posts: 1189
    • EditMasm
Targetting your application four windows getVersionEx
« on: October 30, 2015, 07:22:58 PM »
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

  • Member
  • *****
  • Posts: 8751
  • Still using Abacus 2.0
    • DednDave
Re: Targetting your application four windows getVersionEx
« Reply #1 on: October 30, 2015, 10:43:54 PM »
there is no manifest in this console-mode program

http://masm32.com/board/index.php?topic=4653.msg50128#msg50128

ToutEnMasm

  • Member
  • *****
  • Posts: 1189
    • EditMasm
Re: Targetting your application four windows getVersionEx
« Reply #2 on: October 31, 2015, 01:03:47 AM »
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

  • Member
  • ****
  • Posts: 748
Re: Targetting your application four windows getVersionEx
« Reply #3 on: October 31, 2015, 03:53:58 AM »
Code: [Select]
    .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
Code: [Select]
LIBRARY ntdll.dll
EXPORTS
_RtlGetVersion@4=RtlGetVersion
« Last Edit: November 01, 2015, 10:15:03 PM by TWell »

jj2007

  • Member
  • *****
  • Posts: 7752
  • Assembler is fun ;-)
    • MasmBasic
Re: Targetting your application four windows getVersionEx
« Reply #4 on: October 31, 2015, 03:54:10 AM »
Let 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:

NetWkstaGetInfo returns         JOHN runs OS version 10.0

dedndave

  • Member
  • *****
  • Posts: 8751
  • Still using Abacus 2.0
    • DednDave
Re: Targetting your application four windows getVersionEx
« Reply #5 on: October 31, 2015, 04:20:30 AM »
try this program Yves
no manifest, no compatibilty mode, no UAC

TWell

  • Member
  • ****
  • Posts: 748
Re: Targetting your application four windows getVersionEx
« Reply #6 on: October 31, 2015, 04:27:05 AM »
Those who don't have masm32
Code: [Select]
    .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
« Last Edit: November 01, 2015, 10:29:06 PM by TWell »

ToutEnMasm

  • Member
  • *****
  • Posts: 1189
    • EditMasm
Re: Targetting your application four windows getVersionEx
« Reply #7 on: October 31, 2015, 06:50:55 AM »
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

  • Member
  • ****
  • Posts: 748
Re: Targetting your application four windows getVersionEx
« Reply #8 on: October 31, 2015, 07:08:21 AM »
I dont see difference
Code: [Select]
typedef 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

  • Member
  • ****
  • Posts: 962
  • slightly red-shifted
Re: Targetting your application four windows getVersionEx
« Reply #9 on: October 31, 2015, 07:11:07 AM »
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
Zen

ToutEnMasm

  • Member
  • *****
  • Posts: 1189
    • EditMasm
Re: Targetting your application four windows getVersionEx
« Reply #10 on: October 31, 2015, 07:51:53 AM »

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

  • Member
  • *****
  • Posts: 8751
  • Still using Abacus 2.0
    • DednDave
Re: Targetting your application four windows getVersionEx
« Reply #11 on: October 31, 2015, 07:54:27 AM »
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

  • Member
  • ****
  • Posts: 962
  • slightly red-shifted
Re: Targetting your application four windows getVersionEx
« Reply #12 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,... ::)
Zen

dedndave

  • Member
  • *****
  • Posts: 8751
  • Still using Abacus 2.0
    • DednDave
Re: Targetting your application four windows getVersionEx
« Reply #13 on: October 31, 2015, 09:14:37 AM »
i've heard that Frenchmen are easily pleased   :biggrin:

Code: [Select]
        INCLUDE \masm32\include\masm32rt.inc

        .CODE

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

        END     Start

Adamanteus

  • Member
  • **
  • Posts: 182
    • LLC "AMS"
Re: Targetting your application four windows getVersionEx
« Reply #14 on: October 31, 2015, 09:23:40 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.