Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Executable properties are needed for enterprise deploy #196

Closed
ffrappo opened this issue Feb 26, 2015 · 16 comments
Closed

Windows Executable properties are needed for enterprise deploy #196

ffrappo opened this issue Feb 26, 2015 · 16 comments

Comments

@ffrappo
Copy link

ffrappo commented Feb 26, 2015

When building for windows, the executable is missing some informations which are usually vital for enterprise deploy of the apps.

Those infos are the ones that can be accessed right-clicking the .exe, then choosing Properties > Details.

  • File Description;
  • Product Name;
  • Version;
  • Copyright;

There are workarounds using resource editors, but they are not very maintainable and they can very easily corrupt the executable.

@adam-lynch
Copy link
Contributor

We use Anolis Resourcer via winresourcer for the icon so maybe these properties could be edited with that too?

@adam-lynch
Copy link
Contributor

@felicienfrancois, any idea?

@felicienfrancois
Copy link

it should be possible to to it with Anolis resourcer / winresourcer but it is not documented enough to make it trivial.
Even with the UI, I can't get it working.
The resourceType to use is "Version".

Something like that should do the job:

require("winresourcer")({
    operation: "Add",
    exeFile: "path/to/the/file.exe",
    resourceType: "Version",
    resourceName: "1",
    lang: 1033,
    resourceFile: "path/to/a/file.bin" // ???
}, function(error) {
    // callback
});

But I can't figure out what should be the content of the resourceFile.
According to the documentation, anolis resourcer requires a file in input.
When extracting the data of an exe that already have version info, i get an empty file.
When trying to export the version info from the GUI, I get a raw binary file :S.

@felicienfrancois
Copy link

Well, I get it working with a file exported from the GUI.

What I made:

  • Open Anolis resourcer GUI
  • Open an exe which have Version info
  • Export version info in a raw binary file test.bin
  • Executed the following code:
require("winresourcer")({
    operation: "Add",
    exeFile: "target.exe",
    resourceType: "Version",
    resourceName: "1",
    lang: 1033,
    resourceFile: "test.bin"
}, function(error) {
    // callback
});

And the target exe get the infos from the source exe.

Then, we now need to be able to creates this binary file programmatically.
Opening with a text editor and searching on the web, it seems that it is not really a binary file but a null-terminated string table (Unicode string with NULL characters \u0000 between each characters and some special characters for key/pair and lines delimitation).

I'll search for a way to generate such a stringtable with nodejs

@adam-lynch
Copy link
Contributor

Thanks for looking into this!

Regards,
Adam Lynch

On 7 March 2015 at 20:05, Félicien FRANCOIS [email protected]
wrote:

Well, I get it working with a file exported from the GUI.

What I made:

  • Open Anolis resourcer GUI
  • Open an exe which have Version info
  • Export version info in a raw binary file test.bin
  • Executed the following code:

require("winresourcer")({
operation: "Add",
exeFile: "target.exe",
resourceType: "Version",
resourceName: "1",
lang: 1033,
resourceFile: "test.bin"
}, function(error) {
// callback
});

And the target exe get the infos from the source exe.

Then, we now need to be able to creates this binary file programmatically.
Opening with a text editor and searching on the web, it seems that it is
not really a binary file but a null-terminated string table (Unicode string
with NULL characters \u0000 between each characters and some special
characters for key/pair and lines delimitation).

I'll search for a way to generate such a stringtable with nodejs


Reply to this email directly or view it on GitHub
#196 (comment)
.

@karldd
Copy link

karldd commented Aug 5, 2015

@felicienfrancois Did you ever manage to get this working?

I did a little digging around and it looks we need to create a VERSIONINFO .rc file. For example like this one.

From there I believe it needs to be compiled into a binary .res file using RC with something like:

RC.Exe /v /fo outputFile.res inputFile.rc

Finally the .res file should be added using Anolis resourcer as you posted above. Unfortunately I haven't been able to get the properties to turn up. I'm guessing there is something amiss with the .res file I am generating.

@felicienfrancois
Copy link

@karldd I switched to electron (known as atom shell) so I no longer have thoose issues
To set versioninfo on electron binaries, I use rcedit, which is also provided as a node module or a grunt module.

When I tried rcedit on NW.JS binaries, quite a long time ago, there was several issues (especially with the icon) but it may have changes as both NW.JS and rcedit have been updated.

In the case there are still issues with rcedit setting icon of nw.js, you may use winresourcer for the icon and rcedit for version info

@gpetrov
Copy link

gpetrov commented Jun 4, 2016

this will be really handy feature to be able to change the version info automatically.

the icon can be changed now - but still not the file info

any progress?

@evshiron
Copy link

evshiron commented Jun 4, 2016

@gpetrov What about using nwjs-builder instead?

@gpetrov
Copy link

gpetrov commented Jun 5, 2016

thanks @evshiron - wasn't aware of it - will check it out!
Is there a grunt module for it as well?

@evshiron
Copy link

evshiron commented Jun 5, 2016

@gpetrov I am afraid not. I have never used things like grunt or gulp. But I do make nwjs-builder callable from other node.js scripts (see "Use As Module" and "Manifest Options" sections of the README), maybe that helps if you want to compose a simple grunt task by yourself :)

@ffrappo ffrappo changed the title Windows Executable properties is needed for enterprise deploy Windows Executable properties are needed for enterprise deploy Jun 5, 2016
@adam-lynch adam-lynch added the feature Priority: 2 label Jun 7, 2016
@DblK
Copy link
Contributor

DblK commented Jul 4, 2016

I successfully added a way to edit windows executable information.
I wil make some tests and make a pull request soon.

Everything has been done with rcedit instead of winresourcer and work like a charm including icons (see below).
image

@cdobbyn
Copy link

cdobbyn commented Feb 12, 2017

Not sure why someone hasn't posted this yet. Here's how to do it (from a gulp pleb) using rcedit. This would be really nice to be able to do in nw-builder.

gulp.task('edit-nwjs', function(done) {
    version = '1.0.0';
    year = '2017';
    rcedit(
        './path/to/file.exe', 
        {
            'version-string': {
                'CompanyName': 'Your-Company-Here',
                'FileDescription': 'Description-About-Things',
                'LegalCopyright': 'Copyright ' + year + ' Your-Company-Here',
                'ProductName': 'Your-Product',
        },
        'file-version': version,
        'product-version': version,
    }, 
    done
    );
});

MadLittleMods added a commit to gitterHQ/nw-builder that referenced this issue Jul 17, 2017
Fix nwutils#196
Fix nwutils#315

See

 - nwjs/nw.js#5809
 - nwjs/nw.js#5807
 - nwjs/nw.js#4293
 - nwjs/nw.js#2160
 - nwjs/nw.js#5829

Allows you to edit the version string of the resultant Windows executable.
These can be easily viewed in Properties -> Details, http://i.imgur.com/oqyRwaa.png

Fix issue where the process showed up as `nwjs` in Windows.
Now defaults to the `options.appName`
@MadLittleMods
Copy link
Contributor

MadLittleMods commented Jul 17, 2017

@cdobbyn When trying to change FileDescription via rcedit as a post-process to the nw-builder build, I would always get a blank/default-shimmer NW.js page when starting up the app instead of the specified main file. I suppose it is getting corrupted somehow 😕

I made a PR to add it directly into the nw-builder package and do the rcedit before winresourcer, #459 which is working great for me so far 🚀

@evshiron
Copy link

Cool, when I did this I discovered that the appended bundle was stripped by rcedit, so call rcedit before appending should work.

@mscreenie
Copy link

Thanks @evshiron . I decided to use nw-builder as it works pretty well with my automated building process. I'll look to see if I can fit nwjs-builder instead. I simply need to ship quickly, if not I may rcedit myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants