25

HOW I CAME ACROSS THIS

I wrote code for a simple stopwatch which can also double up as a Rubik's cube timer. The source code and the executable are here:

Cube timer

Anyway my doubt is not regarding this code(It works fine).

I downloaded the executable that I had uploaded to check if it worked fine and at that time I was greeted with this screen:

Open file - security warning

And under this dialogue box there was a field that said:

Publisher : Unknown Publisher

SCREEN SHOT:

screenshot

DOUBT

Is there some way programatically or otherwise by which I can change the publisher field?

SPECS

I have compiled the code with Microsoft Visual C++ 2010 Express.

IcyFlame
  • 5,059
  • 21
  • 50
  • 74

2 Answers2

21

You can easily change the publisher, either when linking/compiling by setting the appropriate resources for your project (e.g. CompanyName), or modifying the resources with a resource editor.

Your problem is really that there is no signature, so even if a publisher field is present it cannot be trusted.

You can find an example resource rc file near the end of http://msdn.microsoft.com/en-us/library/windows/desktop/aa381058%28v=vs.85%29.aspx.

To add resources to your VC project check:

The .rc file(s) will be compiled to binary (.res) and linked into your final executable.

To add or modify an existing executable, you should be able to use this tool (login required, this will cause the signature to be invalid in an already signed binary of course).

The Microsoft Authenticode documentation includes tutorials.

CAcert.org will sign a certificate you can use, and have instructions for getting started with Authenticode.

Sorry I can't be more helpful with VC, I don't use it, I usually using mingw and make, from some time ago targetting win32:

  1. given a VERSIONINFO in a text version.rc file use mingw32-windres to compile it to a .o file (I actually had a bunch of .rc files, they were each #include-d in a single resources.rc so I only needed to run windres on that single file, and link a single extra object file)
  2. include that version.o (or combined resources.o) in the final CC command, assuming compile and link to executable in one step
  3. I also included -lversion when linking, AFAIR this was just because I used GetFileVersionInfo() for the code to check and display its own version in the 'About' dialog.
mr.spuratic
  • 9,767
  • 3
  • 34
  • 24
  • 1
    Sir, can you give me complete steps. I am not able to understand the documentation given on the links you gave – IcyFlame Mar 13 '13 at 07:00
  • 1
    Added links to MS tutorials on Authenticode, and CAcert to for a certificate and their usage instructions. – mr.spuratic Mar 13 '13 at 14:17
  • @mr.spuratic, you wrote that you use mingw and make. I'm building a Win64 application using MinGW, and now I would like to set the publisher. My current exe has "Unknown publisher". Could you give me a hint how to create an exe with my publisher name using MinGW? – ywiyogo Aug 25 '22 at 07:23
  • @ywiyogo, I have added what I remember, I no longer have that build environment... – mr.spuratic Aug 25 '22 at 19:45
-1

Make your program in a batch file, then using Advanced BAT to EXE Converter, convert it to EXE & fill out all of the fields. This sure helped me! :)