1 |
#include <stdio.h> |
2 |
#include <windows.h> |
3 |
|
4 |
#include "../CDVDiso.h" |
5 |
|
6 |
#define GetKeyV(name, var, s, t) \ |
7 |
size = s; type = t; \ |
8 |
RegQueryValueEx(myKey, name, 0, &type, (LPBYTE) var, &size); |
9 |
|
10 |
#define GetKeyVdw(name, var) \ |
11 |
GetKeyV(name, var, 4, REG_DWORD); |
12 |
|
13 |
#define SetKeyV(name, var, s, t) \ |
14 |
RegSetValueEx(myKey, name, 0, t, (LPBYTE) var, s); |
15 |
|
16 |
#define SetKeyVdw(name, var) \ |
17 |
SetKeyV(name, var, 4, REG_DWORD); |
18 |
|
19 |
void SaveConf() |
20 |
{ |
21 |
HKEY myKey; |
22 |
DWORD myDisp; |
23 |
|
24 |
RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\PS2Eplugin\\CDVD\\CDVDiso", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &myKey, &myDisp); |
25 |
|
26 |
SetKeyV("IsoFile", IsoFile, sizeof(IsoFile), REG_BINARY); |
27 |
SetKeyV("CurrentWorkingFolder", IsoCWD, sizeof(IsoCWD), REG_BINARY); |
28 |
SetKeyVdw("BlockDump", &BlockDump); |
29 |
|
30 |
RegCloseKey(myKey); |
31 |
} |
32 |
|
33 |
void LoadConf() |
34 |
{ |
35 |
HKEY myKey; |
36 |
DWORD type, size; |
37 |
|
38 |
memset(IsoFile, 0, sizeof(IsoFile)); |
39 |
|
40 |
if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\PS2Eplugin\\CDVD\\CDVDiso", 0, KEY_ALL_ACCESS, &myKey) != ERROR_SUCCESS) |
41 |
{ |
42 |
SaveConf(); |
43 |
return; |
44 |
} |
45 |
|
46 |
GetKeyV("IsoFile", IsoFile, sizeof(IsoFile), REG_BINARY); |
47 |
GetKeyV("CurrentWorkingFolder", IsoCWD, sizeof(IsoCWD), REG_BINARY); |
48 |
GetKeyVdw("BlockDump", &BlockDump); |
49 |
|
50 |
RegCloseKey(myKey); |
51 |
} |