You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
utils.elevate(...) seems to translate paths badly if it contains Unicode characters, this is an issue for Electron applications since they are commonly installed in %AppData% and the Windows user folder is named after the user.
(The error message says "Could not find file X. Check the name and try again")
Steps to reproduce
Create a folder containing Unicode characters
Add a .bat script to that folder
Try to elevate the bat script e.g. require("windows-registry").utils.elevate("C:\\שךקכ\\test.bat", "", function(res, err) { console.log(error);})
Expected outcome
The script should be executed elevated.
Actual outcome
The path becomes broken an error prompt is shown that the file could not be found.
Research
Created a console application in C++ that performs a shell execute of the bat script, similar to how windows-registry does it. The Unicode are encoded differently since there are issues with using Unicode characters in the source file, but it is the exactly same path.
require("fs").statSync("C:\\שךקכ\\test.bat") also works as intended, so there seems to be something that goes lost in translation when it comes to the path and elevate()
The text was updated successfully, but these errors were encountered:
Did some further research by creating my own native module, the wide string variants SHELLEXECUTEINFOW and ShellExecuteExW must be used. Node defaults to the ANSI variants.
utils.elevate(...) seems to translate paths badly if it contains Unicode characters, this is an issue for Electron applications since they are commonly installed in %AppData% and the Windows user folder is named after the user.
(The error message says "Could not find file X. Check the name and try again")
Steps to reproduce
require("windows-registry").utils.elevate("C:\\שךקכ\\test.bat", "", function(res, err) { console.log(error);})
Expected outcome
The script should be executed elevated.
Actual outcome
The path becomes broken an error prompt is shown that the file could not be found.
Research
Created a console application in C++ that performs a shell execute of the bat script, similar to how windows-registry does it. The Unicode are encoded differently since there are issues with using Unicode characters in the source file, but it is the exactly same path.
This works as intended.
require("fs").statSync("C:\\שךקכ\\test.bat")
also works as intended, so there seems to be something that goes lost in translation when it comes to the path andelevate()
The text was updated successfully, but these errors were encountered: