Replace the metadata modification from trusted file to our executable binary file.
-
Choose your Target file. For example i have choosen
OneDrive.exe
-
I have attacted the file into ResourceHacker.exe file. Open it and choose the Target Binary file. In our case
OneDrive.exe
- On Version Info. You can see the the content of resource.rc file. Either you can right click and download the .rc file. or you can just copy the BLOCK that contains data.
-
Next create an Directory res/ and create
resource.rc
file. and paste the following data to the file.Modify the file from the
BLOCK "040904B0"
1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEFLAGSMASK 0x3F
FILEFLAGS 0x0
FILEOS 0x40004
FILETYPE 0x1
FILESUBTYPE 0x0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "Microsoft Corporation"
VALUE "FileDescription", "Microsoft OneDrive (64 bit) Setup"
VALUE "InternalName", "OneDriveSetup.exe"
VALUE "LegalCopyright", "Microsoft Corporation. All rights reserved."
VALUE "OriginalFilename", "OneDriveSetup.exe"
VALUE "ProductName", "Microsoft OneDrive"
VALUE "FileVersion", "24.226.1110.0004"
VALUE "ProductVersion", "24.226.1110.0004"
VALUE "SpecialBuild", "b/build/10555381-65ec-136d-7d57-ecec00fce7a0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
1 ICON "res/icon.ico"
-
After that Download an suitable .icon and place it in the
res/icon.ico
path. -
Now Add the following crates in
[build-dependencies]
category under the [dependencies] category.
- Create an build.rs file from the directory. The tree structure directory will be like.
Simple_Program\
|__src\
| |___main.rs
|
|__res\
| |__resource.rc
| |__icon.ico
|
|__build.rs
|__Cargo.lock
|__Cargo.toml
-
Follow the code in the build.rs and compile the program.
-
After compiling. Look at the Results : )
By @5mukx