Skip to content

Instantly share code, notes, and snippets.

@AlexanderOMara
Last active December 2, 2019 05:30
Show Gist options
  • Save AlexanderOMara/bec719dbd4303edc770d85877ee36d08 to your computer and use it in GitHub Desktop.
Save AlexanderOMara/bec719dbd4303edc770d85877ee36d08 to your computer and use it in GitHub Desktop.
Node resedit replaceIconsForResource icon height issue
# OS files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
# Node files
node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*
report.*.json
*.tgz
yarn.lock

Node resedit replaceIconsForResource icon height issue

Currently NtExecutableResource.ts always resets the codepage to 0:

			// codepage
			view.setUint32(o + 8, 0, true);

Current output:

$ node main.js
original:
1252
1252
1252
1252
1252
1252
1252
1252
1252
1252
1252
updated:
0
0
0
0
0
0
0
0
0
0
0

Expected output:

$ node main.js
original:
1252
1252
1252
1252
1252
1252
1252
1252
1252
1252
1252
updated:
1252
1252
1252
1252
1252
1252
1252
1252
1252
1252
1252
'use strict';
const fs = require('fs');
const resedit = require('resedit');
async function main() {
const exe = resedit.NtExecutable.from(fs.readFileSync('HelloWorld.exe').buffer);
const res = resedit.NtExecutableResource.from(exe);
console.log('original:');
for (const entry of res.entries) {
console.log(entry.codepage);
}
res.outputResource(exe);
const res2 = resedit.NtExecutableResource.from(exe);
console.log('updated:');
for (const entry of res2.entries) {
console.log(entry.codepage);
}
}
main();
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"resedit": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/resedit/-/resedit-0.2.2.tgz",
"integrity": "sha512-d8M6X0M1n02T/F1sRFQXZm1gpAB8twOm9E/zbkbEb+8MLICPPQ+h5izwfJrezllDWEBu9k9gaHJocoWHO/j54A=="
}
}
}
{
"private": true,
"dependencies": {
"resedit": "^0.2.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment