News:

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

Main Menu

Retrieving Windows OS Version

Started by bluedevil, June 06, 2017, 01:40:10 AM

Previous topic - Next topic

bluedevil

Quote from: jj2007 on June 15, 2017, 05:09:24 AM
Quote from: blue_devil on June 15, 2017, 12:53:31 AMit 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


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:
BlueDeviL Github

jj2007

#46
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:

TWell

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

Quote from: TWell on June 19, 2017, 06:04:12 PMand 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

My XP don't have gdiplus 1.1
ManifestedConsoleProgram.exe have depedency with it.
After removing that, it runs in XP.Running with common controls version 6.00 on Windows version 5.1

Siekmanski

Hi nidud,

Quote from: nidud on June 18, 2017, 06:44:15 PM
Quote from: Siekmanski on June 15, 2017, 12:34:42 AM
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.

bluedevil

@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:
BlueDeviL Github

nidud

#52
deleted

jj2007

Quote from: blue_devil on June 19, 2017, 07:25:05 PMI 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.

bluedevil

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.

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:
BlueDeviL Github

TWell

is that 4 missing from that link line?
polink can link .res file without cvtres.exe

jj2007

Quote from: blue_devil on June 21, 2017, 09:37:36 PMYour 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?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:

bluedevil

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:
BlueDeviL Github

jj2007

Quote from: blue_devil 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)

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

Re options, here is what the output windows says:

** 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: