Fix Windows registry values broken by d155b0f

Also remove unused resource IDs from the resource script.
This commit is contained in:
Tamás Bálint Misius 2021-03-24 22:01:58 +01:00
parent 36e9fdc39d
commit ee22c3e631
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
4 changed files with 5 additions and 9 deletions

View File

@ -6,6 +6,6 @@ resources_files += files(
if copt_platform == 'win'
powder_files += windows_mod.compile_resources(
'powder-res.rc',
depend_files: resources_files,
depend_files: [ resources_files, 'resource.h' ],
)
endif

View File

@ -2,4 +2,3 @@
IDI_ICON ICON DISCARDABLE "icon.ico"
IDI_DOC_ICON ICON DISCARDABLE "document.ico"
IDI_EVENTCOMPAT LUASCRIPT "../src/lua/luascripts/eventcompat.lua"

View File

@ -1,8 +1,5 @@
#define LUASCRIPT 256
#define IDI_ICON 101
#define IDI_DOC_ICON 110
#define IDI_TPTMP 120
#define IDI_SCRIPTMANAGER 121
#define IDI_EVENTCOMPAT 122
#define IDI_DOC_ICON 102

View File

@ -171,15 +171,15 @@ bool Client::DoInstallation()
ByteString currentfilename = Platform::ExecutableName();
ByteString iconname = currentfilename + ",-102";
ByteString AppDataPath = Platform::WinNarrow(_wgetcwd(NULL, 0));
ByteString opencommand = "\"" + currentfilename + "\" open \"%%1\" ddir \"" + AppDataPath + "\"";
ByteString protocolcommand = "\"" + currentfilename + "\" ddir \"" + AppDataPath + "\" ptsave \"%%1\"";
ByteString opencommand = "\"" + currentfilename + "\" open \"%1\" ddir \"" + AppDataPath + "\"";
ByteString protocolcommand = "\"" + currentfilename + "\" ddir \"" + AppDataPath + "\" ptsave \"%1\"";
auto createKey = [](ByteString s, HKEY &k) {
return RegCreateKeyExW(HKEY_CURRENT_USER, Platform::WinWiden(s).c_str(), 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &k, NULL);
};
auto setValue = [](HKEY k, ByteString s) {
auto w = Platform::WinWiden(s);
return RegSetValueExW(k, NULL, 0, REG_SZ, (LPBYTE)&w[0], w.size() + 1);
return RegSetValueExW(k, NULL, 0, REG_SZ, (LPBYTE)&w[0], (w.size() + 1) * 2);
};
//Create protocol entry