MCPcopy Create free account
hub / github.com/NetHack/NetHack / mswin_destroy_reg

Function mswin_destroy_reg

win/win32/mswproc.c:2599–2628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2597}
2598
2599void
2600mswin_destroy_reg(void)
2601{
2602 char keystring[MAX_PATH];
2603 HKEY key;
2604 DWORD nrsubkeys;
2605
2606 /* Delete keys one by one, as NT does not delete trees */
2607 sprintf(keystring, "%s\\%s\\%s\\%s", CATEGORYKEY, COMPANYKEY, PRODUCTKEY,
2608 SETTINGSKEY);
2609 RegDeleteKey(HKEY_CURRENT_USER, keystring);
2610 sprintf(keystring, "%s\\%s\\%s", CATEGORYKEY, COMPANYKEY, PRODUCTKEY);
2611 RegDeleteKey(HKEY_CURRENT_USER, keystring);
2612 /* The company key will also contain information about newer versions
2613 of nethack (e.g. a subkey called NetHack 4.0), so only delete that
2614 if it's empty now. */
2615 sprintf(keystring, "%s\\%s", CATEGORYKEY, COMPANYKEY);
2616 /* If we cannot open it, we probably cannot delete it either... Just
2617 go on and see what happens. */
2618 RegOpenKeyEx(HKEY_CURRENT_USER, keystring, 0, KEY_READ, &key);
2619 nrsubkeys = 0;
2620 RegQueryInfoKey(key, NULL, NULL, NULL, &nrsubkeys, NULL, NULL, NULL, NULL,
2621 NULL, NULL, NULL);
2622 RegCloseKey(key);
2623 if (nrsubkeys == 0)
2624 RegDeleteKey(HKEY_CURRENT_USER, keystring);
2625
2626 /* Prevent saving on exit */
2627 GetNHApp()->saveRegistrySettings = 0;
2628}
2629
2630typedef struct ctv {
2631 const char *colorstring;

Callers 2

onWMCommandFunction · 0.70
early_optionsFunction · 0.50

Calls 1

GetNHAppFunction · 0.70

Tested by

no test coverage detected