Switch to UTF-16 helper function for xul.dll binary patching

This commit is contained in:
Dan Stillman 2023-05-26 06:43:46 -04:00
parent 889a812fdc
commit fd50a5b65e

View file

@ -410,7 +410,9 @@ if [ $BUILD_WIN == 1 ]; then
# recreate the folder with correct permissions for security reasons, but we never had a folder in
# ProgramData, so we can just create it as "Zotero". Instead of using a custom xul.dll, just
# replace the hard-coded string with "Zotero" and add a bunch of NULs.
perl -pe 's/\x{4D}\x{00}\x{6F}\x{00}\x{7A}\x{00}\x{69}\x{00}\x{6C}\x{00}\x{6C}\x{00}\x{61}\x{00}\x{2D}\x{00}\x{31}\x{00}\x{64}\x{00}\x{65}\x{00}\x{34}\x{00}\x{65}\x{00}\x{65}\x{00}\x{63}\x{00}\x{38}\x{00}\x{2D}\x{00}\x{31}\x{00}\x{32}\x{00}\x{34}\x{00}\x{31}\x{00}\x{2D}\x{00}\x{34}\x{00}\x{31}\x{00}\x{37}\x{00}\x{37}\x{00}\x{2D}\x{00}\x{61}\x{00}\x{38}\x{00}\x{36}\x{00}\x{34}\x{00}\x{2D}\x{00}\x{65}\x{00}\x{35}\x{00}\x{39}\x{00}\x{34}\x{00}\x{65}\x{00}\x{38}\x{00}\x{64}\x{00}\x{31}\x{00}\x{66}\x{00}\x{62}\x{00}\x{33}\x{00}\x{38}\x{00}/\x{5A}\x{00}\x{6F}\x{00}\x{74}\x{00}\x{65}\x{00}\x{72}\x{00}\x{6F}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}/' < xul.dll > xul.dll.new
from=$(get_utf16_chars "Mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38")
to=$(get_utf16_chars "Zotero" 38)
perl -pe "s/$from/$to/" < xul.dll > xul.dll.new
mv xul.dll.new xul.dll
# Check for UTF-16 "Zotero" in DLL