Pre-sign self-extracting EXE files - code-signing

I need to generate many self-extracting EXE files, which all differ quite slightly (containing one static EXE file to be run, and a user-provided config file).
I want to avoid having a signing infrastructure on the server that generates these self-extracting EXE files. Is it possible to sign a container EXE in such a way that I can add the configuration file later?
I tried appending the configuration file to the signed EXE, but that caused the file to appear as unsigned; the signature clearly must be at the end of the file.

Related

ClickOnce: Dependent Executable in manifest not installed

I have a ClickOnce deployed application A that requires a third-Party executable B.exe. B.exe is referenced inside the Project A.
The application manifest contains A.exe as startup application. A.exe.manifest contains a dependency to B.exe.
All binaries and manifests and other required files are correctly deployed to IIS.
Upon executing the Application network-deployed for the first time, the Application is completely downloaded by ClickOnce. All required files appear in the ClickOnce Log File in this way:
[09:05:53] : Method Call : DownloadSingleFile called
[09:05:53] : DownloadQueueItem : _sourceUri = http://localhost/A/1.0.0.0/B.exe, _targetPath = C:\Users\Me\AppData\Local\Temp\Deployment\PT44L145.G7Y\6OXRRZ4O.RG4\B.exe
[09:05:53] : HttpWebRequest= Proxy.IsByPassed=True, ProxyUri=http://localhost/A/1.0.0.0/B.exe
[09:05:53] : HttpWebResponse=ResponseUri=http://localhost/A/1.0.0.0/B.exe
I don't know whether the file is correctly copied to _targetPath because the folder is deleted too fast.
The file is copied correctly to _targetPath.
After deploying A.exe is executed by ClickOnce from the Installation directory (something like C:\Users\Me\AppData\Local\Apps\2.0\RZPET3XL.MDD\DP0VG7XH.MDZ\A.exe_f5309fcb4f74cdd0_0004.0003_07a7ad3d606fa838\)
The directory C:\Users\Me\AppData\Local\Apps\2.0\RZPET3XL.MDD\DP0VG7XH.MDZ\A.exe_f5309fcb4f74cdd0_0004.0003_07a7ad3d606fa838\ does not contain B.exe so the Third party process cannot be started. But it contains B.exe.manifest, B.exe.config, B.cdf-ms and all other files required by the application and contained in A.exe.manifest.
Why is B.exe not copied to the installation directory and how can i let it appear there?
// edit: I used Process Monitor and checked whether there was maybe a problem with opening the file or something other weird. There was none. There is not even an attempt to read B.exe from the deployment directory.

run command after application was compiled

I'm looking for a way to have an encrypted version of the app.config file in the ouput folder. Below I'll describe what I've done so far for accomplish this.
put those commands in the post-build event:
copy "$(ProjectDir)App.config" "$(ProjectDir)App_copy.config"
rename "$(ProjectDir)App.config" web.config
aspnet_regiis -pef connectionStrings "$(ProjectDir.TrimEnd('\\'))" -prov DataProtectionConfigurationProvider
rename "$(ProjectDir)web.config" App.config
This encrypt the file app.config properly. But it make the app.config no longer human redable. I'd like somehow to after the application compile and the app.config from $(ProjectDir) is in the output folder, run this command (to have the app.config file human readable again):
rename "$(ProjectDir)App_copy.config" app.config
How can I do that using VS build system?

Include all files from a folder in MSI

How can I to include all files from source folder and deploy them into a target folder during installation. I have multiple images in a folder and i want all of them to be included in msi automatically rather than including all of them separately using <File> element.
You need to Read about HEAT in the wix installer tutorial,
http://wix.tramontana.co.hu/
"%WIX%\bin\heat.exe" dir "$(SolutionDir)bin\Release -out Release.wxs"
this is the type of pre-build event you will need to define in order to harvest a directory.

how to get executable application from .bin files

whene I extract a win32 application file.exe with (ressourcextract) I got .bin + .bmp and .txt files.
after some changes in one .bin file how to get my .exe application again , what must i do ? compile or assembly and how ?
thanks in advance
possible dupe of: Replacing Bitmap Resource in exe
You can undoubtedly find a tool to do so, but since this is a programming forum, these are the main APIs you would use:
BeginUpdateResource, UpdateResource, and EndUpdateResource.
Sample
For additional reference/information, here is the spec for the PE file format:
http://msdn.microsoft.com/en-us/library/windows/hardware/gg463119.aspx

Non-ASCII filenames mangled in deployment package

I deploy my VS2010 MVC3 project using "Build Deployment Package". The problem is that a couple of files have national (Swedish) characters ÅÄÖ in their filenames, and the deployment package gets these filenames wrong.
For example "Köpvillkor.pdf" becomes "K+Âpvillkor.pdf". The file has the right name in the unzipped "PackageTmp" folder, but inside the "<projname>-<version>.zip" file the filename is mangled, so it seems the problem lies in the way the package is zipped, i.e. it gets an UTF-8 encoded filename from the file system but stores it without conversion as ASCII or WIN1252 or some such inside the zip.
Is there any way to fix this?
If you use IIS to import the deployment package zip file, the filenames will be converted back to the proper encoding.
Unfortunately Winzip, 7-zip and even Windows Explorer Zip extension don't understand the filenames encoding, manual deployment is not possible.
I found today that you can uncheck "Create deployment package as a zip file" and then zip it manually. I use WinZip to zip it manually, and the non-ASCII characters are correctly preserved.

Resources