Changing "Publisher" information for a ".exe" file - publisher

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:
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.

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:
How do I embed version information into a windows binary?
VC++ 2012: How to include version info from version.inc (maintained separately) into the .rc file
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:
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)
include that version.o (or combined resources.o) in the final CC command, assuming compile and link to executable in one step
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.

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! :)

Related

Delphi Linux64: how to retrieve the version information set by Project Options Version?

I gather there is no universal standard for putting version numbers into executables on Linux, in contrast to Windows which requires a certain structure for those details.
FreePascal has made its own standard and Delphi lets you define Version information for a Linux executable.
If we can put Version information in, we must be able to get it back out? How? Specifically on Linux64?
I have searched *.pas and *.inc in Studio\19.0\source\rtl\posix and I have not found anything on 'version' nor 'fileinfo' that could help.
Back with Kylix, I used to use argp_program_version from libc.
On a clean new DUnitX project, after adding {$ *.res} to the DPR so that the version information will stick, I can look at Project Options for Linux64 and I can see that they have a CFBundleVersion number defaulting to 1.0.0 for the project. How can I get the CFBundleVersion at runtime in my Linux64 executable?
Or, if that is not possible, could/should Delphi match the FreePascal standard and put the fileinfo into something which both Lazarus and Delphi could view at runtime??
This excerpt (metioned at both Windows and MacOS/iOS sections) from https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Version_Info may help:
Go to Tools > Options > IDE > Environment Variables and add a new User variable called SAVEVRC with Value=TRUE. This variable enables the generation of a .vrc file with an auto generated build number and other information.
another excerpt from there (not sure if related to the aforementioned SAVEVRC or not) is:
Note: If you define the VersionInfo resource and add it to the project via a $R directive in the project file, the compiler will ignore settings of Version Info at Project Options dialog box and use the custom resource data instead, given an application can have only one VersionInfo resource on Windows.

How to generate a .so file

I am writing an extension for the Scratch text editor application on Elementary OS Luna. But the documentation is practically non-existent for extension creation and I have no idea how to proceed after writing my main code for the extension.
I've already written the extension. I cannot use or test it yet as it needs to be "installed". I spent hours looking for docs but they do not exist. I did however, find a comment on the scratch launchpad page that says
Generally you have to generate a pluginname.so file and put it in
lib/scratch/plugins/pluginname with a pluginname.plugin file
Great. This seems like the last part of creating an extension for Scratch. What is a .so file, and how do I generate one? I've already created the other necessary files like the .plugin file and the .vala file.
Yes, I have searched for .so files but all I found were random things about it like using it with C, or C++ headers but obviously that won't work for me, since I'm using Vala?
How do I generate a .so file? What do I generate it from?
I think the The Vala tutorial could be helpful on creating the actual Shared library or Shared Object.
You can use the autotools, cmake or you can compile and link a shared library directly from the command line, quoted from the Vala tutorial:
Compilation and linking using Command Line
Vala is not yet capable of directly creating dynamic or static
libraries. To create a library, proceed with the -c (compile only)
switch and link the object files with your favourite linker, i.e.
libtool or ar.
$ valac -c ...(source files)
$ ar cx ...(object files)
or by compiling the intermediate C code with gcc
$ valac -C ...(source files)
$ gcc -o my-best-library.so --shared -fPIC ...(compiled C code files)...
From the Scratch Wiki
Due to browser security restrictions, Scratch 2.0 cannot interact with
hardware devices directly. Instead, hardware extensions come with a
helper app, a separate application that the user must install and run
on their computer. Scratch communicates with the helper app via HTTP
requests, and the helper app talks to the hardware. In the future,
some extensions may package their helper apps as browser plugins.
Here are the steps for creating and testing a Scratch extension:
Create an extension description file
Create your helper app and start it
Open the Scratch 2 Offline Editor
Import the extension description (shift-click on "File" and select "Import Experimental Extension" from the menu)
The new extension blocks will appear in the More Blocks palette
Test your extension and iterate!
Helper apps can be written in any language that supports server sockets, such as Python, Node.js, Java, C, etc.
Like you I've chased around the wiki but I cannot find an example with source. So all I can do is to address your question generally.
If you look at Build .so file from .c file using gcc command line you'll see how a simple .so can be created. However what code goes into a Scratch extension I don't know. Sorry.
Edit: More googling and I've found a sample from Nathan Dinsmore on GitHub that doesn't use C rather it uses JavaScript, and though it doesn't create a .so extension, it does have what appears to be a full description of creating an extension. He also provides a couple of tutorials.
Edit++ : And here is another sample written in Java.

fatal error LNK1106: invalid file or disk full: cannot seek to 0x5A57BEBC

I got this error using Visual Studio 2008 and I found a solution on the web here and here. But I can't find out how to configure link.exe.
How can I set the /expectedoutputsize:600000000 option for linker.exe in VS2008? I searched in the project properties in the Linker section, but I can't find the place...I searched in the solution and in Visual Studio options. I found the linker.exe.config but I don't know the schema.
My problem is not the disk space, I have plenty of disk space. Any help?
The option must be added in the Project Settings->Librarian->Command Line->Additional options: text box.
Sorry to resurrect this old thread, but I had a similar problem yesterday, and my solution had nothing to do with anything I found online. This is the first SO post that comes up, so I figured I would contribute in case anyone as the same problem.
Here is how I ran into the problem:
I originally had a project that created an exe:
MyProject.vcxproj -> MyProject.exe
I then turned the original project in to a .lib project by splitting main.cpp out to a separate .exe project. I set the target name for the exe project to be the same as the lib, so that we wouldn't change our executable name. I also added a different .exe project that uses the library but has a slightly different main.cpp
MyProject.vcxproj -> MyProject.lib
MyProjectVariant1.vcxproj -> MyProject.exe
MyProjectVariant2.vcxproj -> MyProjectVariant2.exe
The way our solution is currently laid out, all of the projects dump their targets into the same output directory.
The problem was that both the .lib and first .exe share the same target name, so any secondary files (pdb files, iobj, ipdb, etc.) would get overwritten. MyProject.exe would literally overwrite these ancillary files before it could link in the MyProject.lib.
Conclusion:
I "fixed" the problem by using a unique target name for the first variant. We will also review our build strategy to see if we should be using different output directories for each project instead of slamming them all together in the same location. Seems more logical to give them different target directories.

C++ Creating a standalone library in linux and using it in another program

I'm trying to create a shared library for Linux such that:
other programs can use its functions and its objects
the code is not visible to final user
What i did is create a shared library with Eclipse. This library uses pthreads.
I generated .so and .lib. The .lib is in LIBRARY/Lib while the .so is in LIBRARY/Release.
Then i created another project which should use this library and i gave the path of the .lib file and the path of the .h file which only contains the inclusions of all the necessary .h of the library.
All seems working but when i run the program it crashes. When debugging it I receive the following message:
Can't find a source file at "pthread_mutex_lock.c"
Locate the file or edit the source lookup path to include its location.
What's wrong? Can someone help me please?
EDIT: I changed nothing and now I have a different error, some lines before the previous:
Can't find a source file at "random.c"
Locate the file or edit the source lookup path to include its location.
other programs can use its functions and its objects
the code is not visible to final user
These two goals directly contradict each other, and achieving both at the same time is impossible on Linux.
If some program can use your library, then I can write a new program that can do so as well.

fatal error C1084: Cannot read type library file: 'Smegui.tlb': Error loading type library/DLL

I am trying to build an old version of an application which consists of VC++ projects that were written in Visual Studio 2003.
My OS is Windows 7 Enterprise (64-bit).
When I try and build the solution I get the following errors:
error C4772: #import referenced a type from a missing type library; '__missing_type__' used as a placeholder
fatal error C1084: Cannot read type library file: 'Smegui.tlb': Error loading type library/DLL.
They both complain about the following import statement:
#import "Smegui.tlb" no_implementation
This is not a case of the file path being incorrect as renaming the Smegui.tlb file causes the compiler to throw another error saying it cannot find the library.
Smegui is from another application that this one depends on. I thought perhaps I was missing a dll but there is no such thing as Smegui.dll.
All I know about .tlb files is that they are a type library and you can create them from an assembly using tlbexp.exe or regasm.exe (the later also registers the assembly with COM)
There is also an Apache Ant build script which uses a custom task to invoke devenv.com to build the projects. This is the same script that the build server originally used to build the application. It gives me the same errors when I try and run it.
The strangest thing about this is that I knew it ought to work seeing as it is all freshly checked out from subversion. I tried many different combinations of admin vs user elevation, VS vs Ant build, cleaning, release.
I have got it to build successfully about 5 times but the build seems to be non-deterministic.
If anyone can shed some light on how this tlb stuff even works or what this error might mean I would greatly appreciate it.
I found a far more reliable solution: open the tlb with oleview.exe and then close it.
Not sure what this actually does but it works every time.
I think oleview is actually one of the samples included with Visual Studio but I haven't had the time to debug it and see what it is doing.
I ran into this error because one type library was trying to load a dependent type library, which it could not find. Even though the dependent type library was in the same directory, and even though that directory was in the searchable path, the compiler would error loading the first type library, but not mention the dependent type library in the error.
To find the pseudo-missing type library, I ran Process Monitor (procman64.exe) during the compile. This showed that after the reported type library had successfully loaded, a dependent type library could not be found. It even showed all of the places that it was looking for the dependent type library, none of which were where it should have been looking (e.g.: ).
The fix was to add a <PreBuildEvent> to the project to copy the dependent .tlb file to one of the directories that was actually being searched.
<PreBuildEvent>
<Command>copy /Y ..\Lib\Interop\CWSpeechRecLib.tlb .\</Command>
</PreBuildEvent>
http://msdn.microsoft.com/en-us/library/sce74ah7%28VS.71%29.aspx
smegui.tlb is referencing some other tlb that the compiler can't find. If you have the .idl for smegui you might be able to figure out what the other is. I suspect the missing tlb is something that original build machine had registered but that your machine doesn't have registered.
A type library is a binary description of a set of interfaces, coclasses and enums. They're usually generated for COM components, in the case of tlbexp and regasm the tlb is created from the assembly metadata. For native COM components they are usually generated from an idl (Interface Description Language) file by the midl tool.
Edit:
I just noticed you're on x64 Windows. Are you building the project with a new version of Visual Studio? If so, are you targeting x86 or x64? If the latter, it may simply be a 32bit component that the compiler can't find (or less likely, a x64 component the x86 compiler can't find if you are targeting x86), for WOW64 the registry is virtualized for x86 vs. x64 applications.
Well I finally found out why I managed to get it to build sometimes and not others... sort of.
So long as I ran the build script with elevated administrator permissions and let that get as far as it could until that error occurred, then run the build script again as a protected administrator succeeded. Those steps must be done in that exact order with no other steps in between. If I try build in Visual Studio it does not work (although I did get it to succeed once). Probably some kind of virtualisation issue although it still doesn't quite make sense.
Well I don't need help on this any more and I know it's probably impossible to fully answer this question without knowing exactly what the build is doing. However if anyone does have any more thoughts I would happily receive them.
Cheers,
Steiny

Resources