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, March 08, 2024, 12:23:52 AM

Previous topic - Next topic

jimg

does anyone know how to fix this warning-

LNK4078: multiple ".drectve" sections found with different attributes (00000A00)

I'm just tacking the manifest on the end of the code like this -

Program:
    inv InitCommonControls
    inv GetModuleHandle, NULL
    inv DialogBoxParam, eax, 101, 0, ADDR DlgProc, 0
    inv ExitProcess, eax

; add worthless manifest to keep crap antivirus programs happy.
; note, can't run from winasm with this manifest, use sxstrace if problems
OPTION DOTNAME
.drectve SEGMENT INFO DISCARD
db "'"
db '-manifestuac:level="requireAdministrator" uiAccess="false" '
db "'"
db '-manifestdependency:type="Win32"'
db ' name="Microsoft.Windows.Common-Controls"'
db ' version="1.0"'
db ' processorArchitecture="X86"'
db ' publicKeyToken="6595b64144ccf1df"'
db ' language="*"'
db '-manifest:embed'
.drectve ENDS

end Program

sinsi

You have 2 section flags defined (0A00h)
IMAGE_SCN_LNK_INFO = 0x00000200
IMAGE_SCN_LNK_REMOVE = 0x00000800
ML defines this section as IMAGE_SCN_LNK_INFO only, so when the linker tries to coalesce ML's section and yours the flags don't match. Just remove the DISCARD flag and you should be good to go (no need for it, see the bolded part below).

QuoteA section is a directive section if it has the IMAGE_SCN_LNK_INFO flag set in the section header and has the .drectve section name. The linker removes a .drectve section after processing the information, so the section does not appear in the image file that is being linked.

jimg

Removing DISCARD didn't change anything for me.  Still got the same warning.
I just got this from a post from Hutch, I think.  A long time ago.
I have no idea what any of this stuff is.
I kind of expected the version number to show up in the properties for the .exe, but now that I stare at it, I guess that's supposed to be the version number of the common controls, so I'll put 6.0.0.0 back in before someone spots it.  Gave same results.


Vortex

Hi jimg,

I am not sure if ml.exe supplied with the Masm32 package can process the instructions under the segment .drectve
Could you try Uasm and Polink?

jimg

I'm using uasm, so I think we should be good, no?

Vortex

Hi jimg,

Here is a quick example. Could you check it?

sinsi

The version of ML with MASM32 (6.14?) doesn't recognise INFO but Vortex's example builds OK with the VS version (14.39.33519)

jimg

Lots of stuff to test, I'm working on it.  I'm using uasm64, hope that's okay.

jimg

When I run your build.bat, the resulting .exe file is smaller.  yours=3584 bytes, mine=2560 bytes.  They look the same to ResHacker, so I don't know the difference.  I'll download uasm32 and try it.

jimg

Same result with uasm32.

But...

neither one gave the warning.

let me move you code into my environment and see what happen.

jimg

This is what polink has to say-
EmbedManifest.asm: 101 lines, 2 passes, 58 ms, 0 warnings, 0 errors

F:\masm32\BIN\Polink @"F:\WinAsm\Progs\EmbedManifest\link.war"

POLINK: error: Symbol '_WinMain@16' is multiply defined: 'EmbedManifest.obj' and 'F:\WinAsm\Progs\EmbedManifest\EmbedManifest.obj'.
POLINK: error: Symbol '_WndProc@16' is multiply defined: 'EmbedManifest.obj' and 'F:\WinAsm\Progs\EmbedManifest\EmbedManifest.obj'.
POLINK: error: Symbol '_start' is multiply defined: 'EmbedManifest.obj' and 'F:\WinAsm\Progs\EmbedManifest\EmbedManifest.obj'.



But...

When I link without the "EmbedManifest.obj" it works without complaint. It came out the same size as from your build.bat, so I don't know if the manifest is actually being added or not.  I need a program to examine an exe and show the manifest inside if any.  What's a good program to use? 

sinsi

HxD - Freeware Hex Editor and Disk Editor

7-zip will open an exe and show you the sections. I've configured it to use HxD as the viewer.

jimg

Success!  Both have the manifest.  The extra stuff in Erol's exe was a .reloc file.

Thank you guys, very much :)

TimoVJL

link.exe and polink.exe differs, as link don't support some options in .drectve SEGMENT and /manifest:embed have to be in commandline and it came with msvc 2013
warning LNK4229: invalid directive '/manifest:embed' encountered; ignored
May the source be with you

Vortex

Hi jimg,

I would recommend to download the latest version of Pelles C to obtain a new version of Polink. Pelles linker supplied with the Masm32 pacakge is old.