Where does signtool.exe store the application name when signing an .MSI file? - uac

We're having the following situation.
An .MSI file, after being signed using signtool.exe, will show the following UAC prompt:
The same .MSI file, after being signed with a custom tool that uses the CryptUIWizDigitalSign API, shows the following UAC prompt:
We want to make sure the .MSI file displays the "Our awesome application" text in the UAC prompt, not some id generated by the MSI engine.
We've tried filling the field pwszDescription in the CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO structure:
A pointer to a null-terminated Unicode string that contains the description of the subject of the signature.
but this did not work.
Is there another field we can use for that?

In the end filling the pwszDescription field worked fine, I can only assume we were making some other error.

Related

Windows environment variable %USERPROFILE% in File URI Scheme (three slashes)

In Notepad++ I have a link to a batch file using a "File URI Scheme with three slashes" convention as follows:
file:///C:/Users/john.doe/some_folder/test%20file.bat
When I double-click on it, the link works (i.e. the double-click runs the batch file).
I want to modify the File URI to incorporate %USERPROFILE% like so:
file:///%USERPROFILE%/some_folder/test%20file.bat
This doesn't work. Is there some character I can add or remove or escape to make it work?
UPDATE: since making this post, I've learned that Notepad++ doesn't expand Windows environment variables.

.net core console app not runing when called from .bat file

I have created a .net core 2.0 app and can run it by using Powershell and navigating to the project folder and calling dotnet run.
If I add a .bat file containing the above command and call myFile.bat I get the error
'´╗┐dotnet' is not recognized as an internal or external command,
So I tried adding dotnet myProject.dll in the batch file and get the same error.
I have read the the two ╗┐ characters are an encoding issue, so I changed my .bat file to UTF8, but that had not effect.
What have I done wrong?
Those strange characters are indeed an encoding issue, they are called Byte order marks. These are useful to programs which consume text streams, informs them of some meta information about the text that follows.
Not particularly useful for you however because the windows command prompt does not understand them. To fix this open the file up in notepad and save the file with an ANSI encoding, cmd should understand how to handle it.

Open file with my application

How can I handle automatically opening a file with my Windows Forms application? As in, I double-click the file and my application pops up and knows to open the file.
I'm assuming I somehow have to add an entry in the registry or something like this, and handle command line parameters, but I can't quite figure out the way to go about this.
Attached an image for clarity, it's pretty much what I want to achieve. (I'll be using my own file extension so I don't mess up other programs as well)
There's an answer in MSDN about how to associate your application with an extension. The information about shell file extension associations is stored in the registry.
Or, to set it interactively, make use of the "Open With" > "Choose default program..." feature.

Overwrting multiple file using NSIS Script (how Win Zip extractor does)

I am writing a script using Null Script which install around 6000 files in INSTALLDIR i.e. C:\ABC folder.
I have done this using
File /r "ABC"
in install section.
It is just a simple extractor (no registry entries and no uninstall.exe created during install).
Now, if I run the same exe again then I want my exe to display a message box to the user while overwriting the files containing the options
Yes,
Yes too all, or
exit the installer
i.e. How WinZip software does while extracting the same zip file in the same location multiple times.
If I set the SetOverwrite value to off then during install (2nd time) my EXE just skips the file installation without notifying the user. Also using IFFILEEXIST I can check a single file or *.* files but cannot do one to one mapping.
Please suggest how can I implement this. If this question is already posted then please send me the link.
Thanks in advance.
It is not possible to get this behavior in NSIS when using File /r. You might be able to pull off something similar by generating the file list at compile time by executing a batch file with !system and then check if each file exists and maybe delete the old one at run-time but you are not going to get the dialog without a custom plugin. NSIS itself only supports basic Abort/Retry/Cancel and Yes/No dialogs.
If you only want to use free tools, why not just use 7-Zip to create a self extracting archive?

Using a second signing card with the same sponsor cert

I have 2 file signing cards with the same "sponsor" (obviously, the actual "signer" is different between the 2). Until quite recently, I've only been using the one but today I tried using the other. I built my application and signed it using the same process I always use and I downloaded both the .out and the .p7s files the same way I always do, but when the download finishes, I get an error message about the signature not matching.
I was pretty sure that you could use 2 different signing cards as long as the sponsor was the same between them. Am I wrong? What am I missing?
For the record:
This is for a Vx520
My terminal is on the latest OS
I have verified that the sponsor certificate name on the terminal's boot up screen matches the sponsor cert name in the signing tool's diagnostics menu
My terminal also has VMAC and CommServer, but no other programs on it (besides the one I built and am trying to download and run)
When the file signing tool runs, it generates the .p7s file, which is always required, but it also generates a file Certif.crt. This file is not necessary to download to the terminal if you are only using a single signing card, but if you use a second card, you MUST download it along with the .p7s. From what I can tell, this .crt file is what the terminal uses to determine that the sponsors are the same. Once I downloaded the .crt file along with everything else, it worked.
Side note: The tool also generates a SponsorCertif.crt file. I'm not using that nor do I know what scenarios would require it... If you know, please comment below.

Resources