7 char *out_string,
int out_string_size) {
11 const char *delimiter = strstr(
path,
"/");
13 strncpy(current_key,
path, delimiter -
path);
14 current_key[delimiter -
path] =
'\0';
16 strcpy(path_tail, delimiter + 1);
19 if (!strcmpi(current_key,
"HKEY_CLASSES_ROOT"))
20 parent_key = HKEY_CLASSES_ROOT;
21 else if (!strcmpi(current_key,
"HKEY_CURRENT_CONFIG"))
22 parent_key = HKEY_CURRENT_CONFIG;
23 else if (!strcmpi(current_key,
"HKEY_CURRENT_USER"))
24 parent_key = HKEY_CURRENT_USER;
25 else if (!strcmpi(current_key,
"HKEY_LOCAL_MACHINE"))
26 parent_key = HKEY_LOCAL_MACHINE;
27 else if (!strcmpi(current_key,
"HKEY_USERS"))
28 parent_key = HKEY_USERS;
32 delimiter = strstr(path_tail,
"/");
34 strncpy(current_key, path_tail, delimiter - path_tail);
35 current_key[delimiter - path_tail] =
'\0';
37 strcpy(path_tail, delimiter + 1);
45 if (!RegOpenKeyExA(parent_key, current_key, 0,
46 KEY_READ | KEY_WOW64_32KEY, &key)) {
54 DWORD data_size = out_string_size;
55 if (RegQueryValueExA(parent_key,
path,
nullptr,
nullptr,
56 (LPBYTE)out_string, &data_size))
69 if (
const char *path_override = std::getenv(
"WOMM_PATH_OVERRIDE")) {
70 config.mm7_install_type =
"Custom Folder (ENV path override)";
71 config.mm7_install_path = path_override;
76 "HKEY_LOCAL_MACHINE/SOFTWARE/GOG.com/GOGMM7/PATH",
77 mm7_path,
sizeof(mm7_path));
79 config.mm7_install_type =
"GoG MM7 installation";
80 config.mm7_install_path = mm7_path;
85 "HKEY_LOCAL_MACHINE/SOFTWARE/New World Computing/Might and Magic VII/1.0/AppPath",
86 mm7_path,
sizeof(mm7_path));
88 config.mm7_install_type =
"Standard MM7 1.0 installation";
89 config.mm7_install_path = mm7_path;
94 int __stdcall
WinMain(HINSTANCE, HINSTANCE,
char *,
int) {