flat assembler
Message board for the users of flat assembler.

Index > Windows > How to get this new message box UI?

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
FlierMate1



Joined: 31 May 2022
Posts: 118
FlierMate1 09 Jun 2022, 12:30
The "MessageBoxA" or "MessageBoxW" Windows API that I call comes with somewhat older UI.


Description: Older version
Filesize: 11.74 KB
Viewed: 3851 Time(s)

older.png


Description: Newer version of message box UI
Filesize: 8.68 KB
Viewed: 3858 Time(s)

old.png


Post 09 Jun 2022, 12:30
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20590
Location: In your JS exploiting you and your system
revolution 09 Jun 2022, 13:18
You need a manifest in your exe to enable the newer window styles.

There are some old topics about it on this board.
Post 09 Jun 2022, 13:18
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20590
Location: In your JS exploiting you and your system
revolution 09 Jun 2022, 13:24
Post 09 Jun 2022, 13:24
View user's profile Send private message Visit poster's website Reply with quote
FlierMate1



Joined: 31 May 2022
Posts: 118
FlierMate1 09 Jun 2022, 13:45
Thank you!

Code:
format PE GUI 4.0
entry start

include 'win32a.inc'

section '.data' readable writable
       title       db 'FASM',0
       message     db 'Thank you Tomasz and revolution for making this possible!',0

section '.code' code readable writable executable

start:

       push 0x40
       push title
       push message
       push 0
       call [MessageBox]

       push eax
       call [ExitProcess]

section '.idata' import readable writable

       library kernel,'KERNEL32.DLL',\
               user,'USER32.DLL'

       import kernel,\
              ExitProcess,'ExitProcess'

       import user,\
              MessageBox,'MessageBoxA'


section '.rsrc' resource data readable

directory 24,manifest
resource  manifest,\
          1, LANG_NEUTRAL, winxp
resdata winxp
      ;  file 'manifest.xml'
db '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',13,10
db '<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">',13,10
db '<assemblyIdentity',13,10
    db 'version="1.0.0.0"',13,10
    db 'processorArchitecture="X86"',13,10
    db 'name="CompanyName.ProductName.Application"',13,10
    db 'type="win32"',13,10
db  '/>',13,10
db '<description>Your application description here.</description>',13,10
db '<dependency>',13,10
    db '<dependentAssembly>',13,10
        db '<assemblyIdentity',13,10
            db 'type="win32"',13,10
            db  'name="Microsoft.Windows.Common-Controls"',13,10
            db 'version="6.0.0.0"',13,10
            db 'processorArchitecture="X86"',13,10
            db 'publicKeyToken="6595b64144ccf1df"',13,10
            db 'language="*"',13,10
       db  '/>',13,10
    db '</dependentAssembly>',13,10
db '</dependency>',13,10
db '</assembly>'
endres    


Description:
Filesize: 16.08 KB
Viewed: 3842 Time(s)

MSGBOX.png


Post 09 Jun 2022, 13:45
View user's profile Send private message Reply with quote
Mat-Quasar



Joined: 02 Mar 2025
Posts: 82
Mat-Quasar 10 Apr 2025, 04:00
To my surprise, explicitly stating "PE GUI 4.0" or "PE GUI" has different UI layout for Win32 dialog.

"PE GUI 4.0" is Win95 look, while "PE GUI" is all white.

Does anyone know what does the "4.0" mean? All white is Win3.11?


Description: PE GUI 4.0
Filesize: 2.76 KB
Viewed: 833 Time(s)

pegui40.PNG


Description: PE GUI
Filesize: 3.25 KB
Viewed: 833 Time(s)

pegui.PNG


Post 10 Apr 2025, 04:00
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20590
Location: In your JS exploiting you and your system
revolution 10 Apr 2025, 04:46
IIRC "4.0" means you declare your application is capable of using Win95 APIs.

Naturally "5.0" means your application knows about younger versions of Windows APIs for GUI controls. And so on for higher numbers.

Try some other values and see what happens. 0.0? 9.9? 57.57
Post 10 Apr 2025, 04:46
View user's profile Send private message Visit poster's website Reply with quote
Mat-Quasar



Joined: 02 Mar 2025
Posts: 82
Mat-Quasar 10 Apr 2025, 05:00
revolution wrote:
IIRC "4.0" means you declare your application is capable of using Win95 APIs.

Naturally "5.0" means your application knows about younger versions of Windows APIs for GUI controls. And so on for higher numbers.

Try some other values and see what happens. 0.0? 9.9? 57.57


Thanks for your reply.

I tried, the only valid ranges are PE GUI 4.0, PE GUI 5.0 and PE GUI 6.0 and all are 95-look.
PE GUI 0.0 to PE GUI 3.0 don't run. If I use PE GUI 0 to PE GUI 3 (without decimal places) then FASMW complains invalid value.
Value higher than 6.0, e.g. PE GUI 7.0 to PE GUI 10.0 are having error message (see screenshot below).

So only Windows 3.11-look (?) and Windows 95 look.


Description: PE GUI 7.0 to PE GUI 10.0 are the same error message
Filesize: 13.31 KB
Viewed: 814 Time(s)

pegui7.PNG


Post 10 Apr 2025, 05:00
View user's profile Send private message Reply with quote
Mat-Quasar



Joined: 02 Mar 2025
Posts: 82
Mat-Quasar 10 Apr 2025, 05:01
I think it is OS major version and minor version?
Post 10 Apr 2025, 05:01
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20590
Location: In your JS exploiting you and your system
revolution 10 Apr 2025, 05:06
It's GUI version, not OS version.

See the second post above if you want other styles enabled by versions higher than 4.0.
Post 10 Apr 2025, 05:06
View user's profile Send private message Visit poster's website Reply with quote
Mat-Quasar



Joined: 02 Mar 2025
Posts: 82
Mat-Quasar 10 Apr 2025, 06:58
revolution wrote:

See the second post above if you want other styles enabled by versions higher than 4.0.


Yes, I included the manifest and now it has a XP-look.


Description: WinXP manifest
Filesize: 2.79 KB
Viewed: 795 Time(s)

peguiwinxp.PNG


Post 10 Apr 2025, 06:58
View user's profile Send private message Reply with quote
Mat-Quasar



Joined: 02 Mar 2025
Posts: 82
Mat-Quasar 10 Apr 2025, 07:08
Found an old thread, Roman asked a similar question before:
https://board.flatassembler.net/topic.php?t=21290
Post 10 Apr 2025, 07:08
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8376
Location: Kraków, Poland
Tomasz Grysztar 10 Apr 2025, 07:12
Mat-Quasar wrote:
I tried, the only valid ranges are PE GUI 4.0, PE GUI 5.0 and PE GUI 6.0 and all are 95-look.
PE GUI 0.0 to PE GUI 3.0 don't run. If I use PE GUI 0 to PE GUI 3 (without decimal places) then FASMW complains invalid value.
Value higher than 6.0, e.g. PE GUI 7.0 to PE GUI 10.0 are having error message (see screenshot below).
When Win32 API and PE format were first introduced, Windows was at version number 3.1. This was the version number of the first Windows NT, but also the version number of widespread 16-bit Windows release, for which the Win32s extension, allowing to execute 32-bit PE programs, was released. As NT was originally designed to have other subsystems beside the ones providing Windows and DOS API (something similar to what WSL does currently), version 3.1 was considered the subsystem version and used as such in PE header (with OS version set to 1.0).

For this reason, the first Win32 PE executables that existed had subsystem version 3.1 - interestingly, marked with byte values 3 and 10 (see my PE tutorial).

With the introduction of the new "Chicago" interface in Windows 95 and Windows NT 4.0 the windows got a new look, which was the first such substantial change in their appearance. Only the executables created specifically for new systems, marked with subsystem version 4.0, were allowed to have this appearance, therefore old programs would keep looking similar to what they looked in the past.

Windows XP (5.0) introduced the manifest file/resource, and it became the preferred way for executables to specify their compatibility. That's why the subsystem versions 5.0 and higher have no further effect on the appearance.
Post 10 Apr 2025, 07:12
View user's profile Send private message Visit poster's website Reply with quote
Mat-Quasar



Joined: 02 Mar 2025
Posts: 82
Mat-Quasar 10 Apr 2025, 07:33
Ooh, now I understand, "format PE GUI 3.1" is actually "format PE GUI".

I also understand subsystem higher than 4.0 use manifest file/resource. All is clear now.

Thank you Tomasz for your helpful explanation.
Post 10 Apr 2025, 07:33
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8376
Location: Kraków, Poland
Tomasz Grysztar 10 Apr 2025, 07:57
Wait, Windows XP was actually 5.1, 5.0 was Windows 2000.
Post 10 Apr 2025, 07:57
View user's profile Send private message Visit poster's website Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 809
Ali.Z 10 Apr 2025, 09:32
keep in mind you can use any valid version combo even without manifest file, it does affect visual styes for dialog boxes, and message box is dialog box.

the system does not manage visuals for normal window controls, that is, parent of a control that do not belong to dialog box class atom.

edit:
also for completeness, here is a list of valid Major/Minor subsystem versions in Optional header:
- 3.10
- 3.51
- 4.0
- 5.0
- 5.1
- 6.0
- 6.1
- 6.2

depending on version, you may get different visuals for your dialogs without a manifest; with a manifest you can get more stuff.

_________________
Asm For Wise Humans
Post 10 Apr 2025, 09:32
View user's profile Send private message Reply with quote
Mat-Quasar



Joined: 02 Mar 2025
Posts: 82
Mat-Quasar 10 Apr 2025, 11:55
Tomasz Grysztar wrote:
Wait, Windows XP was actually 5.1, 5.0 was Windows 2000.


Just now I edit the formatter syntax for my program (without XP manifest) in Windows XP Pro SP3 to "PE GUI 5.1", it cannot run, and showed an error message (see screenshot).

But if I set to "PE GUI 5.0" then it is okay.


Description: Error when running the program targetting "PE GUI 5.1" in Windows XP Pro SP3
Filesize: 11.62 KB
Viewed: 713 Time(s)

pegui51.PNG




Last edited by Mat-Quasar on 10 Apr 2025, 12:04; edited 2 times in total
Post 10 Apr 2025, 11:55
View user's profile Send private message Reply with quote
Mat-Quasar



Joined: 02 Mar 2025
Posts: 82
Mat-Quasar 10 Apr 2025, 11:58
Ali.Z wrote:

also for completeness, here is a list of valid Major/Minor subsystem versions in Optional header:
- 3.10
- 3.51
- 4.0
- 5.0
- 5.1
- 6.0
- 6.1
- 6.2


Thanks! Useful info. I get only three styles in Windows 10, 95-look for PE GUI 4.0, 5.0, 5.1 and 6.0. PE GUI 6.1 and 6.2 are not supported in this laptop.
And also Windows 3.1 style for PE GUI 3.1 and 3.51 (or even 3.52 also work).
And lastly XP style using manifest resource.


Description: On Windows XP, also need XP manifest for the XP style. Merely state PE GUI 5.0 will still get 95-look.
Filesize: 159.5 KB
Viewed: 711 Time(s)

pemenu1.PNG


Post 10 Apr 2025, 11:58
View user's profile Send private message Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 809
Ali.Z 10 Apr 2025, 12:12
Mat-Quasar wrote:
(without XP manifest) in Windows XP Pro SP3 to "PE GUI 5.1", it cannot run, and showed an error message (see screenshot).


that is weird, for me it runs fine under xp pro sp3.

_________________
Asm For Wise Humans
Post 10 Apr 2025, 12:12
View user's profile Send private message Reply with quote
Mat-Quasar



Joined: 02 Mar 2025
Posts: 82
Mat-Quasar 10 Apr 2025, 12:28
Ali.Z wrote:
Mat-Quasar wrote:
(without XP manifest) in Windows XP Pro SP3 to "PE GUI 5.1", it cannot run, and showed an error message (see screenshot).


that is weird, for me it runs fine under xp pro sp3.


Strange indeed, I only managed to get "PE GUI 5.1" to run for once only, after I mess it with PE GUI 6.0 and PE GUI 5.0 back and forth, the PE GUI 5.1 was not working anymore.

As I check from "winver", this copy of Windows XP is indeed 5.1.


Description: Windows XP build number
Filesize: 102.74 KB
Viewed: 690 Time(s)

winxp.PNG


Post 10 Apr 2025, 12:28
View user's profile Send private message Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 809
Ali.Z 10 Apr 2025, 12:57
perhaps you want to validate your PE.



Image

_________________
Asm For Wise Humans
Post 10 Apr 2025, 12:57
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.