| 2519 | } |
| 2520 | |
| 2521 | void |
| 2522 | mswin_write_reg(void) |
| 2523 | { |
| 2524 | HKEY key; |
| 2525 | DWORD disposition; |
| 2526 | int i; |
| 2527 | |
| 2528 | if (GetNHApp()->saveRegistrySettings) { |
| 2529 | char keystring[MAX_PATH]; |
| 2530 | DWORD safe_buf; |
| 2531 | |
| 2532 | sprintf(keystring, "%s\\%s\\%s\\%s", CATEGORYKEY, COMPANYKEY, |
| 2533 | PRODUCTKEY, SETTINGSKEY); |
| 2534 | |
| 2535 | if (RegOpenKeyEx(HKEY_CURRENT_USER, keystring, 0, KEY_WRITE, &key) |
| 2536 | != ERROR_SUCCESS) { |
| 2537 | RegCreateKeyEx(HKEY_CURRENT_USER, keystring, 0, NULL, |
| 2538 | REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, |
| 2539 | &key, &disposition); |
| 2540 | } |
| 2541 | |
| 2542 | #define NHSETREG_DWORD(name, val) \ |
| 2543 | RegSetValueEx(key, (name), 0, REG_DWORD, \ |
| 2544 | (unsigned char *)((safe_buf = (val)), &safe_buf), \ |
| 2545 | sizeof(DWORD)); |
| 2546 | |
| 2547 | /* Write the keys here */ |
| 2548 | NHSETREG_DWORD(INTFKEY, GetNHApp()->regNetHackMode); |
| 2549 | |
| 2550 | /* Main window placement */ |
| 2551 | NHSETREG_DWORD(MAINSHOWSTATEKEY, GetNHApp()->regMainShowState); |
| 2552 | NHSETREG_DWORD(MAINMINXKEY, GetNHApp()->regMainMinX); |
| 2553 | NHSETREG_DWORD(MAINMINYKEY, GetNHApp()->regMainMinY); |
| 2554 | NHSETREG_DWORD(MAINMAXXKEY, GetNHApp()->regMainMaxX); |
| 2555 | NHSETREG_DWORD(MAINMAXYKEY, GetNHApp()->regMainMaxY); |
| 2556 | NHSETREG_DWORD(MAINLEFTKEY, GetNHApp()->regMainLeft); |
| 2557 | NHSETREG_DWORD(MAINRIGHTKEY, GetNHApp()->regMainRight); |
| 2558 | NHSETREG_DWORD(MAINTOPKEY, GetNHApp()->regMainTop); |
| 2559 | NHSETREG_DWORD(MAINBOTTOMKEY, GetNHApp()->regMainBottom); |
| 2560 | |
| 2561 | NHSETREG_DWORD(MAINAUTOLAYOUT, GetNHApp()->bAutoLayout); |
| 2562 | NHSETREG_DWORD(MAPLEFT, GetNHApp()->rtMapWindow.left); |
| 2563 | NHSETREG_DWORD(MAPRIGHT, GetNHApp()->rtMapWindow.right); |
| 2564 | NHSETREG_DWORD(MAPTOP, GetNHApp()->rtMapWindow.top); |
| 2565 | NHSETREG_DWORD(MAPBOTTOM, GetNHApp()->rtMapWindow.bottom); |
| 2566 | NHSETREG_DWORD(MSGLEFT, GetNHApp()->rtMsgWindow.left); |
| 2567 | NHSETREG_DWORD(MSGRIGHT, GetNHApp()->rtMsgWindow.right); |
| 2568 | NHSETREG_DWORD(MSGTOP, GetNHApp()->rtMsgWindow.top); |
| 2569 | NHSETREG_DWORD(MSGBOTTOM, GetNHApp()->rtMsgWindow.bottom); |
| 2570 | NHSETREG_DWORD(STATUSLEFT, GetNHApp()->rtStatusWindow.left); |
| 2571 | NHSETREG_DWORD(STATUSRIGHT, GetNHApp()->rtStatusWindow.right); |
| 2572 | NHSETREG_DWORD(STATUSTOP, GetNHApp()->rtStatusWindow.top); |
| 2573 | NHSETREG_DWORD(STATUSBOTTOM, GetNHApp()->rtStatusWindow.bottom); |
| 2574 | NHSETREG_DWORD(MENULEFT, GetNHApp()->rtMenuWindow.left); |
| 2575 | NHSETREG_DWORD(MENURIGHT, GetNHApp()->rtMenuWindow.right); |
| 2576 | NHSETREG_DWORD(MENUTOP, GetNHApp()->rtMenuWindow.top); |
| 2577 | NHSETREG_DWORD(MENUBOTTOM, GetNHApp()->rtMenuWindow.bottom); |
| 2578 | NHSETREG_DWORD(TEXTLEFT, GetNHApp()->rtTextWindow.left); |
no test coverage detected