News:

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

Main Menu

manifest

Started by jimg, December 07, 2019, 09:09:21 AM

Previous topic - Next topic

aw27

It was fixed, thank you.

aw27

I produced a Unicode enabled version of the program.
Manifests are supposed to support unicode and, of course, RC.EXE can deal with that (very old versions may not). However, most resource tools are dated and do not support Unicode. I found that Resource Hacker is still being maintained and does support. I don't particularly like Resource Hacker, I am just mentioning it because I have used it to confirm the program works as expected.
Finally, I removed the line MOVEABLE PURE LOADONCALL DISCARDABLE, it is ignored unless you are doing resources for 16-bit applications.


JonasS

Hi AW:

The program Manifest to Resource works in Windows 7, which is my current dev computer.
Will it work in Windows XP? I am asking because I use XP for 32-bit development??

Thks

Jonas

jimg

In the mean time, I've gone back to a previous method of adding a manifest, putting it right in the asm file and using polink.

This entered at the end of the program just before the end statement-
OPTION DOTNAME
.drectve SEGMENT INFO DISCARD

db "'"
db '-manifestdependency:type="Win32"'
db ' name="Microsoft.Windows.Common-Controls"'
db ' version="6.0.0.0"'
db ' processorArchitecture="X86"'
db ' publicKeyToken="6595b64144ccf1df"'
db ' language="*"'
db "'"
db '-manifest:embed'

.drectve ENDS

produces this in the exe file-
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
- <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
- <security>
- <requestedPrivileges>
  <requestedExecutionLevel level="asInvoker" uiAccess="false" />
  </requestedPrivileges>
  </security>
  </trustInfo>
- <dependency>
- <dependentAssembly>
  <assemblyIdentity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" />
  </dependentAssembly>
  </dependency>
  </assembly>


which looks like this using dump-
00000820h: 0€È¥ï]HX0€<?xml version='1.0' enco
00000870h: ding='UTF-8' standalone='yes'?><assembly xmlns='urn:schemas-microsoft-com:asm.
000008C0h: v1' manifestVersion='1.0'>  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3
00000910h: ">    <security>      <requestedPrivileges>        <requestedExecutionLeve
00000960h: l level='asInvoker' uiAccess='false' />      </requestedPrivileges>    </sec
000009B0h: urity>  </trustInfo>  <dependency>    <dependentAssembly>      <assembly
00000A00h: Identity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0"
00000A50h:  processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" />
00000AA0h:     </dependentAssembly>  </dependency></assembly>


jj2007

Quote from: jimg on December 11, 2019, 01:07:34 AM
.drectve SEGMENT INFO DISCARD

Works fine for UAsm, AsmC and ML 8.0 and higher :thumbsup:

aw27

Quote from: JonasS on December 11, 2019, 12:51:21 AM
The program Manifest to Resource works in Windows 7, which is my current dev computer.
Will it work in Windows XP? I am asking because I use XP for 32-bit development??

Hi Jonas,

It will work properly in all Unicode enabled versions of Windows, i.e Windows NT 4 and above.
Since I am using the Tahoma font, viewing all characters will depend on its availability in the system, but even if characters not properly viewed the conversion will be done properly.

The previous version I posted was not Unicode aware, would work properly with Windows 95 and above.

It was produced in old Delphi 5, does not use anything from the Windows C runtime (now officially part of the OS). Has modern look in Windows 10 and had modern look 25 years ago in the Windows 95 times. Good compiler, not the sort of funky things we see these days.

jimg

Now if there was a way to embed the version code in the asm file I could dump rc files all together  :icon_idea:

Vortex

Hi jimg,

If you have very small resource scripts, your method to embed the resource code into the assembly module is practical and easy. For bigger resource files, I am afraid things are getting more difficult. Here is my experiment :

- Compile the resource script as usually :

\masm32\bin\rc.exe Rsrc.rc

Convert the .res file to an object module with the MS tool cvtres :

\masm32\bin\cvtres.exe /MACHINE:x86 Rsrc.RES

Disassemble the file Rsrc.obj with Agner Fog's objconv tool :

objconv.exe -fmasm Rsrc.obj Rsrc.asm

Open Rsrc.asm and copy all the resource segments identified with .rsrc$0X ( X=1,2,... ) to your assembly module :


.386
option dotname

; @comp.id equ 000606C7H                                  ; 394951

.rsrc$01 SEGMENT BYTE PUBLIC 'DATA'                     ; section number 2

        db 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H       ; 0000 _ ........
.
.
.
        db 09H, 04H, 00H, 00H, 0D8H, 00H, 00H, 00H      ; 00B0 _ ........
        dd imagerel($R0001B0)                           ; 00B8 _ 00000000 (imgrel)
        dd 00000048H, 00000000H                         ; 00BC _ 72 0
        dd 00000000H                                    ; 00C4 _ 0
        dd imagerel($R0001F8)                           ; 00C8 _ 00000000 (imgrel)
        dd 000002B8H, 00000000H                         ; 00CC _ 696 0
        dd 00000000H                                    ; 00D4 _ 0
        dd imagerel($R000000)                           ; 00D8 _ 00000000 (imgrel)
        dd 000001B0H, 00000000H                         ; 00DC _ 432 0
        dd 00000000H                                    ; 00E4 _ 0

.rsrc$01 ENDS

.rsrc$02 SEGMENT BYTE PUBLIC 'DATA'                     ; section number 3

$R000000 label byte
        db 3CH, 3FH, 78H, 6DH, 6CH, 20H, 76H, 65H       ; 0000 _ <?xml ve
        db 72H, 73H, 69H, 6FH, 6EH, 3DH, 22H, 31H       ; 0008 _ rsion="1
.
.
.
        db 74H, 00H, 69H, 00H, 6FH, 00H, 6EH, 00H       ; 04A0 _ t.i.o.n.
        db 00H, 00H, 00H, 00H, 09H, 04H, 0B0H, 04H      ; 04A8 _ ........

.rsrc$02 ENDS

END


Maintaining a separate asm file including the db sequences above is a better method.

Since ml.exe V6.1X does not support the statement imagerel, you can assemble your code with ml V8 ( or higher ) , Asmc or Uasm :

C:\asmc-master\bin\asmc.exe /coff DlgBox.asm
\masm32\bin\polink /SUBSYSTEM:WINDOWS DlgBox.obj


You can examine the executable with Resource Hacker to check if the resources are copied correctly to the application. You would also like to check Nidud's Asmc specific resource macros, a very nice work.

jimg

Thanks Vortex, I'm going to have to study this for a bit to figure it out.  And I always use UASM  :thumbsup:

jj2007

I've been using this for several years now - the rc file gets generated on the fly:

include \masm32\MasmBasic\MasmBasic.inc         ; download
  Init
  Inkey "Using common controls version ", ComCtl32$()
EndOfCode

Resources must be put below the end start or EndOfCode label; when pressing F6, content between the two Rsrc lines will be written to [filename].rc

Rsrc
#include "resource.h"
IDI_APPLICATION ICON    "\\Masm32\\MasmBasic\\icons\\Smiley.ico"
01 RT_MANIFEST         "\\Masm32\\MasmBasic\\Res\\XpManifest.xml"
Rsrc

JonasS

Hi AW

Thank you, good to know. The program is useful for purposes other than make the manifest.
I need Unicode, Ansi is not enough for me.

jj2007

Following a complaint by HSE in the dynamic layout thread I made some tests with this macro, forcing the .drectve:

@AddManifest MACRO
  if 1 ;idni @Environ(oLinker), <polink>
OPTION DOTNAME
.drectve SEGMENT INFO
db 34,"-manifestdependency:type='Win32'"
db " name='Microsoft.Windows.Common-Controls' version='6.0.0.0'"
db " processorArchitecture='*' publicKeyToken='6595b64144ccf1df'"
db " language='*'", 34, " -manifest:embed "
.drectve ENDS
echo *** manifest added in EndOfCode  ***
  else
.err <## GuiEnd/EndOfCode option XP works only with polink, sorry ##>
  endif
ENDM


It turns out that this method works fine with PoLink of 21.3.2015 but not with any other versions, including the later version from 2.7.2018 :sad:

TimoVJL

This might help:
db 34,"-manifestdependency:",34,"type='Win32'"
...
May the source be with you

jj2007


TimoVJL

Only within C:...
#pragma comment(linker, "/MANIFESTDEPENDENCY:\"type='Win32' "\
"name='Microsoft.Windows.Common-Controls' "\
"version='6.0.0.0' "\
"processorArchitecture='*' "\
"publicKeyToken='6595b64144ccf1df' "\
"language='*'\"")
#pragma comment(linker, "/MANIFEST:EMBED")

...
so polink 9.0 works.
May the source be with you