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

Embed manifest resource using MSVC toolchain, to avoid installer heuristics. #16

Merged
merged 1 commit into from
Nov 23, 2016

Conversation

liigo
Copy link
Contributor

@liigo liigo commented Nov 23, 2016

I tested it on Windows 10 + MSVC 2015. The manifest resource was linked into .exe, which don't requires administrator privilege to be run anymore. (I didn't touch existing code for gnu toolchain, it will continue works, if it did works.)

See comments on #11 for more information.
Fixes #11
Fixes #14

@nabijaczleweli r?

if cfg!(target_env = "msvc") {
// We'll create a `.res` file here, but name it as `.lib`,
// so that it can be found and linked correctly.
// Yes, `.res` may be linked directly, like `.lib` and `.o`.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh god why

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why, but I know it works:)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

msvc.txt

@nabijaczleweli
Copy link
Owner

Works on GNU too, nice work

@nabijaczleweli nabijaczleweli merged commit f57e9c3 into nabijaczleweli:master Nov 23, 2016
@mzji
Copy link

mzji commented Nov 23, 2016

By the document, the msvc linker will recognize the binary resource file, convert it to a COFF object file and link it to the final binary automatically.

@nabijaczleweli
Copy link
Owner

Another case of counter-intuitive specialcasing by M$, :goodjob:

@mzji
Copy link

mzji commented Nov 23, 2016

Well, on Windows, it is a common practice that include the compiled resources inside the final PE binary, so I think what MSVC's link.exe did here makes sense. Yeah, it's a bit anti-intuitive for Unix people since the PE file could include icons (which is binary resource, IMO), but the ELF/Mach-O can't.

Reference: Comparison of executable file formats on Wikipedia, note the "Icon" part.

@liigo
Copy link
Contributor Author

liigo commented Nov 23, 2016

An useful feature, not counter-intuitive, IMHO.

@nabijaczleweli
Copy link
Owner

Useful: yes, counter-intuitive: slightly, since you get an object file you can link to/

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

Successfully merging this pull request may close these issues.

3 participants