Reputation: 11
In a related question concerning this error:
C101008e: Failed to create manifest from the identity string
I received some much-needed help from @IInspectable and @OldBoy. As a result of their help, I made changes (shown below) in an attempt to compile my CueBannerDemo program, but now I get the following error message:
1>CVTRES : fatal error CVT1100: duplicate resource. type:MANIFEST, name:1, language:0x0409
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
1>Done building project "CueBannerDemo.vcxproj" -- FAILED.
Here are the things I changed, and related information:
First, I deleted the (malformed) dependency identity that I had added to the Assembly Identity field in the Visual Studio Manifest Tool General Options. Specifically, I deleted:
"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'"
Second, I added the following lines to the CueBannerDemo.rc
file:
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define RT_MANIFEST 24
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "CueBannerDemo.exe.Manifest"
Third, I created the file CueBannerDemo.exe.Manifest
and saved it in the same directory with the CueBannerDemo.asm
file and the CueBannerDemo.rc
file. I also saved it in the Debug subdirectory of the VisualStudioCueBannerDemo
directory because that is where the .exe
file would be saved.
The CueBannerDemo.exe.Manifest
file is included below:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="*"
name="Retired.SampleProgram.CueBannerDemo"
type="win32"
/>
<description>CueBannerDemo.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
Fourth, I added a few new lines of code to CueBannerDemo.asm
related to the cuebanner, in addition to the code related to cuebanners that I already had included.
The code related to cuebanners now includes:
includelib \masm32\lib\comctrl32.lib
IDC_Edit1001CueBanner db "This is the CueBanner for IDC_Edit1001",0
invoke InitCommonControls
invoke GetDlgItem,hWnd,IDC_Edit1001
mov hIDC_Edit1001,eax
LEA eax,IDC_Edit1001CueBanner
mov lpIDC_Edit1001CueBanner, eax
invoke SendMessage,hIDC_Edit1001,EM_SETCUEBANNER,lpIDC_Edit1001CueBanner,TRUE
The complete CueBannerDemo.asm
file is:
;*************** INCLUDE MASM32 RUNTIME LIBRARY & MASM32 DEBUG MACROS *************************
include \masm32\include\masm32rt.inc ; MASM32 RUNTIME LIBRARY for MASM32. Includes windows.inc
; (which includes winextra.inc), as well as Windows API
; include & library files (e.g., user32.inc, user32.lib,
; kernel32.inc, etc.), dialogs.inc, & macros.asm
include \masm32\include\debug.inc ; MASM32 DEBUG MACROS for VKDEBUG. Defines 6 "helper" macros
; used to display data in various formats (e.g., HEX, DECIMAL,
; ASCII), 4 constants, and 17 macros for debugging purposes.
includelib \masm32\lib\debug.lib ; MASM32 DEBUG LIBRARY for VKDEBUG. Defines 7 external
; procedures & 9 external variables referenced by
; debug.inc for VKDEBUG
includelib \masm32\lib\comctrl32.lib
;****************************** DEFINE PROCEDURE PROTOTYPES ***********************************
DlgProc proto hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
.const
MAXSIZE equ 260 ; Maximum size of a file name
MEMSIZE equ 65535 ; Maximum size of a memory buffer
; Define Resource Control Identities (must match identity assigned in resource control)
; ---------------- DEFINE EDIT CONTROL IDENTITIES --------------
; ---------------- DEFINE EDIT CONTROL LABEL IDENTITIES --------------
; -------------DEFINE BUTTON IDENTITIES--------------
BTN_Enter equ 1051 ; Enter Button
BTN_Exit equ 1052 ; Exit Button
; ----------DEFINE MENU IDENTITIES------------
MyMenu equ 2000 ; Define Menu Identity
IDC_Edit1001 equ 1001
IDC_STATIC1002 equ 1002
IDM_Exit equ 1003
IDM_Help equ 1004
IDM_About equ 1005
; ----------DEFINE Assembly IDENTITIES------------
;;CREATEPROCESS_MANIFEST_RESOURCE_ID equ 1
;;RT_MANIFEST equ 24
; ---------------- END OF RESOURCE CONTROL DEFINITIONS --------------------------
;******************* DEFINE PROGRAM DATA with INITIALIZED VALUES *******************
.data
;--------------------------- DEFINE ZERO-TERMINATED STRINGS ----------------------------------------
DlgName db "MyDialog",0
MenuName db "MyMenu",0
MsgBoxTitle db "My Test Dialog Box ",0
About_String1 db "CueBanner Demo1/21/2025",0
Help_String db "Help (UNDER CONSTRUCTION).",0
Enter_String db "You Pressed Enter", 0
IDC_Edit1001CueBanner db "This is the CueBanner for IDC_Edit1001",0
;********************* DEFINE PROGRAM DATA with UNINITIALIZED VALUES *********************
.data?
; HANDLES
hInstance HINSTANCE ?
hDlg HWND ?
hCtrl HWND ?
CommandLine LPSTR ?
hIDC_Edit1001 HWND ?
;-----------------------------------------------------------------------------------------------------------------------------------------------------
BIGbuffer db 0FFFFh dup(?) ; Memory variable used to temporarily store data for further processing
;-------------------------------------------------------------------------------------------------------------------------------------------------------
dwPTR TYPEDEF PTR DWORD ; Use of "dwPTR" DATATYPE is KEY to defining PTR as a "POINTER"
lpIDC_Edit1001CueBanner dwPTR ?
;**************************************************************************************************************************************************
.code
;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
start:
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke DialogBoxParam, hInstance, addr DlgName,NULL, addr DlgProc, NULL ; Create Dialog Box
mov hDlg, eax ; Save the handle to the Dialog Box
INVOKE ExitProcess, eax
;******************************************************************************************************************************************************
DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
;================================================================================
;============================= BEGIN MESSAGE LOOP ==============================
; Window Message -- Initialize Dialog Box
;--------------------------------------------------------------------------------------------------------------------------------------------
.IF uMsg==WM_INITDIALOG
invoke InitCommonControls
invoke GetDlgItem,hWnd,IDC_Edit1001
mov hIDC_Edit1001,eax
LEA eax,IDC_Edit1001CueBanner
mov lpIDC_Edit1001CueBanner, eax
invoke SendMessage,hIDC_Edit1001,EM_SETCUEBANNER,lpIDC_Edit1001CueBanner,TRUE
;--------------------------------------------------------------------------------------------------------------------------------------------
.ELSEIF uMsg==WM_NOTIFY
push esi
mov esi,lParam
assume esi:ptr NMHDR
;------------------------------------------
.IF [esi].code==EN_MSGFILTER
assume esi:ptr MSGFILTER
;------------------------------------------
.IF [esi].msg==WM_LBUTTONDBLCLK
invoke GetFocus
mov hCtrl, eax
invoke GetDlgCtrlID,hCtrl
;=========================================
.ENDIF
;----------------------------------------------------------------------------------------------------------------
.ENDIF
;
; Window Message - Close Dialog Box (EXIT Program)
.ELSEIF uMsg==WM_CLOSE
invoke SendMessage,hWnd,WM_COMMAND,IDM_Exit,0
;--------------------------------------------------------------------------------------------------------------------------------------------
; Window COMMAND Messages
.ELSEIF uMsg==WM_COMMAND
mov eax,wParam
;========== Determine SOURCE of WM_COMMAND (MENU or BUTTON) ======================
.IF lParam==0
;=======================================================================
; SOURCE is MENU -- Determine Menu Option Selected
; BEGIN PROGRAM FLOW CONTROL VIA MENU SELECTIONS
;=======================================================================
MenuSelections:
;=======================================================================
.IF ax==IDM_Help
invoke MessageBox, NULL,ADDR Help_String, ADDR MsgBoxTitle,MB_OK
;-------------------------------------------------------------------------------------------------------------------------
.ELSEIF ax==IDM_About
invoke MessageBox,NULL,ADDR About_String1, ADDR MsgBoxTitle, MB_OK
;-------------------------------------------------------------------------------------------------------------------------
.ELSEIF ax==IDM_Exit
invoke EndDialog, hWnd,NULL
.ENDIF
;=======================================================================
.ELSE ; SOURCE is BUTTON -- Determine BUTTON Option Selected
;=======================================================================
mov edx,wParam
shr edx,16
.IF dx==BN_CLICKED
.IF ax==BTN_Enter
invoke MessageBox, NULL,ADDR Enter_String, ADDR MsgBoxTitle,MB_OK
.ELSEIF ax==BTN_Exit
invoke SendMessage,hWnd,WM_COMMAND,IDM_Exit,0
.ENDIF
.ENDIF
.ENDIF
.ELSE
mov eax,FALSE
RET
.ENDIF
mov eax,TRUE
RET
DlgProc ENDP
end start
The complete CueBannerDemo.rc
file is:
; This Resource Script was generated by WinAsm Studio.
#include "resource.h"
#include "richedit.h"
#include "commctrl.h"
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define RT_MANIFEST 24
#define IDC_Edit1001 1001
#define IDC_STATIC1002 1002
#define IDM_Exit 1003
#define IDM_Help 1004
#define IDM_About 1005
#define BTN_Enter 1051
#define BTN_Exit 1052
#define MyMenu 2000
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "CueBannerDemo.exe.Manifest"
MyMenu MENUEX DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit",IDM_Exit
END
POPUP "&Help"
BEGIN
MENUITEM "&Help",IDM_Help
MENUITEM "&About",IDM_About
END
END
MYDIALOG DIALOGEX 10,10,400,200
CAPTION "CueBanner Demo Dialog Box"
FONT 8,"MS Shell Dlg"
MENU MyMenu
STYLE 0x90fb08d8
EXSTYLE 0x00000000
BEGIN
CONTROL "ENTER",BTN_Enter,"Button",NOT 0x00010000 | 0x10400000,63,105,50,20,0x00000000
CONTROL "EXIT",BTN_Exit,"Button",NOT 0x00010000 | 0x10400000,127,105,50,20,0x00000000
CONTROL "",IDC_Edit1001,"Edit",0x50810080,17,22,167,55,0x00000200
CONTROL "Plain Edit Control for CueBanner Demo",IDC_STATIC1002,"Static",0x50000000,20,83,164,10,0x00000000
END
I am using Visual Studio 2022 Community setup to assemble & link Microsoft Assembly (MASM) code. The configuration is set to x86. I'm not sure what information would be most helpful, but I'll start with the linker command line options shown in the project property pages configuration, which is:
/OUT:"C:\VisualStudioWin32Projects\CueBannerSampleCode\Debug\CueBannerDemo.exe" /MANIFEST /NXCOMPAT /PDB:"C:\VisualStudioWin32Projects\CueBannerSampleCode\Debug\CueBannerDemo.pdb" /DYNAMICBASE "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X86 /INCREMENTAL /PGD:"C:\VisualStudioWin32Projects\CueBannerSampleCode\Debug\CueBannerDemo.pgd" /SUBSYSTEM:WINDOWS /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Debug\CueBannerDemo.exe.intermediate.manifest" /LTCGOUT:"Debug\CueBannerDemo.iobj" /ERRORREPORT:PROMPT /ILK:"Debug\CueBannerDemo.ilk" /NOLOGO /TLBID:1
The Manifest Tool command line options shown in the project property pages configuration is:
/verbose /out:"Debug\CueBannerDemo.exe.embed.manifest" /nologo "Debug\CueBannerDemo.exe.embed.manifest.res"
The Resources command line options shown in the project property pages configuration is:
/D "_UNICODE" /D "UNICODE" /l 0x0409 /nologo /fo"Debug\%(Filename).res"
Please let me know if there is something more specific about the build tool that I can provide, or if there is something in these command line options that might be causing the "duplicate resource" error.
I've read about creating manifests, and I've tried identifying the source of the duplicate resource, but I am not experienced enough to understand exactly what I should be looking for.
Upvotes: 0
Views: 47