| 2597 | } |
| 2598 | |
| 2599 | void |
| 2600 | mswin_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 | |
| 2630 | typedef struct ctv { |
| 2631 | const char *colorstring; |
no test coverage detected