Core i7
Joined: 14 Nov 2024
Posts: 160
Location: Socket on motherboard
|
Hello everyone!
I've written a program that requests the required user rights and, based on this information, creates a manifest file that can be included in your project. As a result, the visual appearance of buttons and other controls in the window changes to the modern look of Win10/11 (transparency, rounded edges, shadows). The archive includes the completed application for testing.
format pe64 gui 6.0
include 'win64ax.inc'
entry start
ID_Invok = 101
ID_Admin = 102
ID_High = 103
ID_Logo = 104
;//-----------------
section '.text' code readable executable
start: push rbp
invoke InitCommonControls
invoke GetModuleHandle,0
mov [hModule],eax
invoke DialogBoxParam,rax,37,0,DialogProc,0
invoke ExitProcess,0
proc DialogProc uses rsi rdi rbx, hWnd,Msg,wParam,lParam
mov [hWnd], rcx
mov [wParam],r8
cmp edx,WM_INITDIALOG
je @initialize
cmp edx,WM_COMMAND
je @command
cmp edx,WM_CLOSE
je @close
xor rax,rax
jmp @fin
@initialize:
invoke LoadImage, [hModule], 55, IMAGE_BITMAP, 0, 0, 0
mov [hBitmap],eax
invoke GetDlgItem,[hWnd],ID_Logo
invoke SendMessage,eax, STM_SETIMAGE,IMAGE_BITMAP,[hBitmap]
invoke CheckRadioButton,[hWnd],ID_Invok,ID_High,ID_Invok
jmp @next
@command:
cmp [wParam],BN_CLICKED shl 16 + IDCANCEL
je @close
cmp [wParam],BN_CLICKED shl 16 + IDOK
jne @next
;//**********************************
invoke _lcreat,<'NewManifest.xml',0>,0
mov [hFile],eax
invoke _lwrite,eax,xmlHdr,admin-xmlHdr
invoke IsDlgButtonChecked,[hWnd],ID_Invok
cmp eax,BST_CHECKED
jne @admin
invoke _lwrite,[hFile],user,31
jmp @f
@admin: invoke IsDlgButtonChecked,[hWnd],ID_Admin
cmp eax,BST_CHECKED
jne @hight
invoke _lwrite,[hFile],admin,42
jmp @f
@hight: invoke _lwrite,[hFile],hight,38
@@: invoke _lwrite,[hFile],endHdr,endBss-endHdr
invoke _lclose,[hFile]
invoke MessageBox,0,<'The NewManifest.xml file has been successfully created!',0>,\
<'PE32/64 manifest creating',0>,0
jmp @next
;//**********************************
@close: invoke EndDialog,[hWnd],0
@next: mov rax,1
@fin: ret
endp
;//--------------------
section '.idata' import data readable writeable
library kernel32,'kernel32.dll',\
comctl32,'comctl32.dll',user32,'user32.dll'
include 'api\kernel32.inc'
include 'api\comctl32.inc'
include 'api\user32.inc'
;//--------------------
section '.rsrc' resource data readable
directory RT_DIALOG, dialogs,\
RT_VERSION, version,\
RT_BITMAP, bitmaps,\
RT_MANIFEST,manifest
resource dialogs,\
37,LANG_ENGLISH+SUBLANG_DEFAULT,form
resource version,\
1,LANG_NEUTRAL,vInfo
resource bitmaps,\
55,LANG_NEUTRAL,logo
resource manifest,\
1,LANG_NEUTRAL,manifest_data
dialog form, 'PE32/64 manifest creating',0,0,177,104,WS_CAPTION + WS_SYSMENU + WS_POPUP + DS_CENTER,,,'Verdana',8
dialogitem 'BUTTON',' User rights ',-1,10,10,090,060, WS_VISIBLE + BS_GROUPBOX
dialogitem 'BUTTON','asInvoker', ID_Invok, 20,023,60,13,WS_VISIBLE + BS_AUTORADIOBUTTON + WS_TABSTOP + WS_GROUP
dialogitem 'BUTTON','requireAdmin', ID_Admin, 20,037,70,13,WS_VISIBLE + BS_AUTORADIOBUTTON
dialogitem 'BUTTON','highestAvailable',ID_High,20,051,70,13,WS_VISIBLE + BS_AUTORADIOBUTTON
dialogitem 'STATIC','Logo',ID_Logo, 115,013,00,00,WS_VISIBLE + SS_BITMAP
dialogitem 'BUTTON','Create', IDOK, 010,080,90,14,WS_VISIBLE + WS_TABSTOP + BS_DEFPUSHBUTTON
dialogitem 'BUTTON','Exit', IDCANCEL,115,080,52,14,WS_VISIBLE + WS_TABSTOP + BS_PUSHBUTTON
enddialog
versioninfo vInfo,\
VOS__WINDOWS32, VFT_APP, VFT2_UNKNOWN,\
LANG_ENGLISH + SUBLANG_DEFAULT, 1251,\
'LegalCopyright' , 'Copyright (c) 2020-2026. Core i7',\
'ProductName' , 'Manifest utility',\
'ProductVersion' , '6.1.7601',\
'FileDescription' , 'PE32/64 manifest creating',\
'FileVersion' , '1.0.0',\
'OriginalFilename', 'ManifestUtil.exe'
resdata manifest_data
file 'Manifest.xml'
endres
;//-----------------
section '.data' data readable writeable
hFile dd 0
hBitmap dd 0
hModule dd 0
xmlHdr 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 version="1.0.0.0" processorArchitecture="amd64" name="AppName" type="win32" />',13,10
db ' <dependency>',13,10
db ' <dependentAssembly>',13,10
db ' <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" />',13,10
db ' </dependentAssembly>',13,10
db ' </dependency>',13,10
db ' <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">',13,10
db ' <security>',13,10
db ' <requestedPrivileges>',13,10
db '<requestedExecutionLevel level="'
admin db 'requireAdministrator" uiAccess="false"/>',13,10
hight db 'highestAvailable" uiAccess="false"/>',13,10
user db 'asInvoker" uiAccess="false"/>',13,10
endHdr db ' </requestedPrivileges>',13,10
db ' </security>',13,10
db ' </trustInfo>',13,10
db '</assembly>',13,10
endBss:
bitmap logo,'logo.bmp'
| Description: |
|
| Filesize: |
10.21 KB |
| Viewed: |
167 Time(s) |

|
|
| Description: |
|
 Download |
| Filename: |
ManifestUtil.zip |
| Filesize: |
32.79 KB |
| Downloaded: |
31 Time(s) |
|
|