How to build exe with Administrator right?

Question : I want to add Administrator right and add sign to win64 exe,but i cant do it both,if some way i can add Administrator right when I build for win64 exe?

First try :
1:build a win64 exe by openfl build command
2: add Administrator right by using mt command
like this “mt.exe –manifest MyApp.exe.manifest -outputresource:MyApp.exe” ,it work,image
3:sign for it by DSignTool ,it tell me it is not a valid win32 application

Second try:
1:build a win64 exe by openfl build command
2:sign for it by DSignTool
3:add Administrator right by using mt command
when i check the win64 exe ,i find that i lose my sign ,and only have Administrator right uneder my icon

Above this ,it seems like step 2 and 3 can’t do both,is someway there that i can add Administrator right in build step?or any other suggestions or advices about add Administrator right and add sign to win64 exe?
If something helpful answer i would be really grateful ! Thanks for watching my question and sorry for my broken English.

Perhaps your first approach (using mt.exe) is correct but there’s a bug in DSignTool?

Perhaps signing happens in the same manifest file? Do you need to use mt.exe only and do something in the manifest to including signing data?

I have never thought of that !!
you give me a nice direction to try,thank you so much !
I will come back when I do it correctly

1 Like

I bring a good news.
To confirm whether there’s a bug in DSignToo or not ,I use C:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool\signtool.exe. it sign command sign fail too.what I do yesterday is to confirm which step is wrong. the answer is no one.
The win64 exe what I use to add Administrator and sign for it by DSignTool Fail is a signed exe !!!
Whent I use a not signed exe to test ,it work !

The answer of my question is:
When a signed exe sign again,it will show “SignTool Error: SignedCode::Sign returned error: 0x800700C1”
The way to solve my question is that remove sign if you get a signed exe first,and then add Administrator and sign.

For more infomation,I strongly suggest watching this: