Author Topic: Retrieving Windows OS Version  (Read 13515 times)

blue_devil

  • Member
  • **
  • Posts: 112
    • SCTZine
Re: Retrieving Windows OS Version
« Reply #45 on: June 19, 2017, 05:00:33 PM »
it is not possible to manifest console programs right?

Why not?

include \masm32\MasmBasic\MasmBasic.inc      ; download
  Init
  Print "Running with common controls version ", ComCtl32$()
  xchg MbWinVersion(), ecx
  Inkey Str$(" on Windows version %i.", MbWinVersion()), Str$(ecx)
EndOfCode


Code: [Select]
Running with common controls version 6.16 on Windows version 6.1

Johen, i have already added manifest to my latest source code, but it is not working on Win8.1 like yours? Do you have any idea of "why"?
And-1 did you compile your app with sussystem console or windows?
And-2 you share xp manifest with your source but it returns true results before and after win8.1 windowses. But according to the MSDN we should use a new manifest which mentioned here:
Targeting your application for Windows
Thanks for reply =)
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
SCTZine Assembly

jj2007

  • Member
  • *****
  • Posts: 9804
  • Assembler is fun ;-)
    • MasmBasic
Re: Retrieving Windows OS Version
« Reply #46 on: June 19, 2017, 05:42:55 PM »
Yes, built as subsystem console (see OPT_Susy Console in the source).

Try the attachment, it incorporates the new MSDN stuff. I am curious to see how it behaves. For me it says 6.16 on Win7-64, and "6.16 on Windows 10.0" on Win10.

But attention, it chokes on Win XP: The system cannot execute the specified program (from a DOS prompt). The pressure to use manifests is part of the Micros**t strategy to force users away from Win XP.

If you like it complicated, read App (executable) manifest :biggrin:
« Last Edit: June 19, 2017, 06:53:12 PM by jj2007 »

TWell

  • Member
  • ****
  • Posts: 748
Re: Retrieving Windows OS Version
« Reply #47 on: June 19, 2017, 06:04:12 PM »
Another test:
 rename OsVersionX.exe to OsVersionX1.exe
 create OsVersionX1.exe.manifest from http://masm32.com/board/index.php?topic=6299.msg67763#msg67763

and now it show 6.3 in Windows 8.1
original exe show 6.2

Quite weird ::)

EDIT:
Oops. That OsVersionX.exe didn't have resource section :(

jj2007

  • Member
  • *****
  • Posts: 9804
  • Assembler is fun ;-)
    • MasmBasic
Re: Retrieving Windows OS Version
« Reply #48 on: June 19, 2017, 06:09:59 PM »
and now it show 6.3 in Windows 8.1
original exe show 6.2

And what does it show in XP? Sorry, no time to build the exe right now...

TWell

  • Member
  • ****
  • Posts: 748
Re: Retrieving Windows OS Version
« Reply #49 on: June 19, 2017, 06:41:32 PM »
My XP don't have gdiplus 1.1
ManifestedConsoleProgram.exe have depedency with it.
After removing that, it runs in XP.
Code: [Select]
Running with common controls version 6.00 on Windows version 5.1

Siekmanski

  • Member
  • *****
  • Posts: 1929
Re: Retrieving Windows OS Version
« Reply #50 on: June 19, 2017, 07:13:15 PM »
Hi nidud,

GetVersionEx give the wrong windows version for Windows 8.1 ( it returns Windows 8 )

What version is the kernel header?


Windows 6.3  :t
Creative coders use backward thinking techniques as a strategy.

blue_devil

  • Member
  • **
  • Posts: 112
    • SCTZine
Re: Retrieving Windows OS Version
« Reply #51 on: June 19, 2017, 07:25:05 PM »
@Johen when i look your executable with CFF explorer there is resource section (with the manifest inside). But when i look up my executable unfortunately there is no resource section, even if i add manifest file :/
I am not sure but maybe i have the wrong parameters on LINK.EXE? I still couldn't fint where i do wrong?
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
SCTZine Assembly

nidud

  • Member
  • *****
  • Posts: 1800
    • https://github.com/nidud/asmc
Re: Retrieving Windows OS Version
« Reply #52 on: June 19, 2017, 07:41:27 PM »
Windows 6.3  :t

That's blue bro  :biggrin:
Code: [Select]
_WIN32_WINNT_NT4 equ 0x0400
_WIN32_WINNT_WIN2K equ 0x0500
_WIN32_WINNT_WINXP equ 0x0501
_WIN32_WINNT_WS03 equ 0x0502
_WIN32_WINNT_WIN6 equ 0x0600
_WIN32_WINNT_VISTA equ 0x0600
_WIN32_WINNT_WS08 equ 0x0600
_WIN32_WINNT_LONGHORN equ 0x0600
_WIN32_WINNT_WIN7 equ 0x0601
_WIN32_WINNT_WIN8 equ 0x0602
_WIN32_WINNT_WINBLUE equ 0x0603
_WIN32_WINNT_WIN10 equ 0x0A00

jj2007

  • Member
  • *****
  • Posts: 9804
  • Assembler is fun ;-)
    • MasmBasic
Re: Retrieving Windows OS Version
« Reply #53 on: June 19, 2017, 07:47:06 PM »
I am not sure but maybe i have the wrong parameters on LINK.EXE? I still couldn't fint where i do wrong?

Yes, check your settings. RichMasm sets the linkers args if it finds either MySourceName.rc or rsrc.rc (see source in Reply #46), but other IDEs may require more explicit instructions; IIRC qEditor checks for rsrc.rc.

blue_devil

  • Member
  • **
  • Posts: 112
    • SCTZine
Re: Retrieving Windows OS Version
« Reply #54 on: June 21, 2017, 09:37:36 PM »
This is my project options. My ML.EXE is now UASM32.exe actually. But i have tried original ml.exe and ml.exe from visual studio. I also tried original LINK.EXE and POLINK.EXE as you see below. Hmm but neither the worked for me. I could't make a console app with .rsrc section.
Code: [Select]
Compile RC : 4,O,$B\RC.EXE /v,1
Assemble   : 3,O,$B\ML.EXE /c /coff /Cp /nologo /I"$I",2
Link       : 5,O,$B\POLINK.EXE /SUBSYSTEM:CONSOLE /RELEASE /VERSION:4.0 /LIBPATH:"$L" /OUT:"$5",3
Run        : 0,0,,5
Res To Obj : rsrc.obj,O,$B\CVTRES.EXE,rsrc.res
Asm Module : *.obj,O,$B\ML.EXE /c /coff /Cp /nologo /I"$I",*.asm

Your MasmBasic wants GuiData.zip [\Masm32\MasmBasic\Res\GuiData\GuiData.zip] even i upgraded the last version of MB. And also i couldn't find the config file of MB to link and assemble. I mean Johen what MB executes when i press F6? I couldn't find that?


..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
SCTZine Assembly

TWell

  • Member
  • ****
  • Posts: 748
Re: Retrieving Windows OS Version
« Reply #55 on: June 21, 2017, 11:18:34 PM »
is that 4 missing from that link line?
polink can link .res file without cvtres.exe

jj2007

  • Member
  • *****
  • Posts: 9804
  • Assembler is fun ;-)
    • MasmBasic
Re: Retrieving Windows OS Version
« Reply #56 on: June 22, 2017, 01:16:49 AM »
Your MasmBasic wants GuiData.zip [\Masm32\MasmBasic\Res\GuiData\GuiData.zip] even i upgraded the last version of MB. And also i couldn't find the config file of MB to link and assemble. I mean Johen what MB executes when i press F6?

By default, it tries to execute Uasm32.exe, with a set of reasonable commandline options. The fact that it asks for GuiData.zip means most probably that you have an old myname.rc or rsrc.rc in the same folder. Or do you have something like this at the end of your code?
Code: [Select]
Rsrc
#include "resource.h"
IDI_APPLICATION ICON "\\Masm32\\MasmBasic\\icons\\Smiley.ico" // Calc, Disk, Editor, Eye, Globe, MasmBasic, Smiley
01 RT_MANIFEST "\\Masm32\\MasmBasic\\Res\\XpManifest.xml" // works with tooltips
59 RCDATA "\\Masm32\\MasmBasic\\Res\\GuiData\\GuiData.zip" // multilanguage menu & toolbar; ID must be 59
Rsrc

In this case, put //59 RCDATA to disable that. And sorry, this is my fault, I didn't check :icon_redface:

blue_devil

  • Member
  • **
  • Posts: 112
    • SCTZine
Re: Retrieving Windows OS Version
« Reply #57 on: June 22, 2017, 01:34:20 AM »
1. You still dont say the "reasonable commandline options" :eusa_dance:
2. I was trying to compile the source that you have shared on post #46. In your asc file it is written that "59 RCDATA   "\\Masm32\\MasmBasic\\Res\\GuiData\\GuiData.zip"   ". That is why i am asking 8)

@TWell 4 is missing because this is compling as a Console program. When the subsystem is "WINDOWS" there will be an extra ",4". Am i wrong?
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
SCTZine Assembly

jj2007

  • Member
  • *****
  • Posts: 9804
  • Assembler is fun ;-)
    • MasmBasic
Re: Retrieving Windows OS Version
« Reply #58 on: June 22, 2017, 01:39:07 AM »
1. You still dont say the "reasonable commandline options" :eusa_dance:
2. I was trying to compile the source that you have shared on post #46. In your asc file it is written that "59 RCDATA   "\\Masm32\\MasmBasic\\Res\\GuiData\\GuiData.zip"   ". That is why i am asking 8)

As I wrote above, comment it out: //59 RCDATA

Re options, here is what the output windows says:

Code: [Select]
** Start C:\Masm32\MasmBasic\Res\bldallRM.bat **
**** 32-bit assembly ****

*** Assemble, link and run ManifestedConsoleProgram ***

*** Assemble using \masm32\bin\HJWasm32 /c /coff  tmp_file.asm ***
HJWasm v2.31, May 15 2017, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.

*** MasmBasic version 19.06.2017 ***
----------------------------------------
WARNING duplicate include file ntdll.inc
----------------------------------------
Tmp_File.asm: 6 lines, 2 passes, 180 ms, 0 warnings, 0 errors

*** Link  ManifestedConsoleProgram.obj rsrc.res  using polink, sub CONSOLE ***


***  build all took 2685 ms  ***
« OK »

Nothing special, but of course, it can't find the GuiData.zip on your machine :icon_redface: