annotate Registry.cpp @ 2494:de8c5c223e9c

for ACTOR_
author Ritor1
date Tue, 16 Sep 2014 17:48:58 +0600
parents 4f4eb812af28
children
rev   line source
2415
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2342
diff changeset
1 #define _CRTDBG_MAP_ALLOC
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2342
diff changeset
2 #include <stdlib.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2342
diff changeset
3 #include <crtdbg.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2342
diff changeset
4
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
6 #include <stdio.h>
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
7 #include <array>
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
8 #include <windows.h>
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
9
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
10 #include "Registry.h"
2427
94393b73d333 * Some initialization stuff
a.parshin
parents: 2415
diff changeset
11 #include "ErrorHandling.h"
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
12
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
13 //----- (004649EF) --------------------------------------------------------
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
14 int __fastcall ReadWindowsRegistryInt(const char *pKey, int uDefValue)
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
15 {
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
16 DWORD cbData; // [sp+8h] [bp-20h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
17 LPCSTR lpValueName; // [sp+Ch] [bp-1Ch]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
18 DWORD dwDisposition; // [sp+10h] [bp-18h]@2
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
19 BYTE Data[4]; // [sp+14h] [bp-14h]@5
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
20 HKEY hKey; // [sp+18h] [bp-10h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
21 HKEY phkResult; // [sp+1Ch] [bp-Ch]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
22 HKEY v10; // [sp+20h] [bp-8h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
23 HKEY v11; // [sp+24h] [bp-4h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
24
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
25 lpValueName = pKey;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
26 v11 = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
27 v10 = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
28 hKey = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
29 phkResult = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
30 cbData = 4;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
31 if ( !RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WOW64_32KEY, &hKey) )// for 64 bit
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
32 {
2481
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
33 if ( !RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition) )
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
34 {
2481
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
35 if ( !RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, KEY_ALL_ACCESS, 0, &v10, &dwDisposition) )
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
36 {
2481
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
37 if ( !RegCreateKeyExA(v10, "1.0", 0, "", 0, KEY_ALL_ACCESS, 0, &v11, &dwDisposition) )
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
38 {
2427
94393b73d333 * Some initialization stuff
a.parshin
parents: 2415
diff changeset
39 LSTATUS status;
94393b73d333 * Some initialization stuff
a.parshin
parents: 2415
diff changeset
40 if ( status = RegQueryValueExA(v11, lpValueName, 0, 0, Data, &cbData) )
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
41 {
2427
94393b73d333 * Some initialization stuff
a.parshin
parents: 2415
diff changeset
42 status;
94393b73d333 * Some initialization stuff
a.parshin
parents: 2415
diff changeset
43 GetLastError();
94393b73d333 * Some initialization stuff
a.parshin
parents: 2415
diff changeset
44
94393b73d333 * Some initialization stuff
a.parshin
parents: 2415
diff changeset
45 *(int *)Data = uDefValue;
2459
e5c88c2b02ab Audio_GetFirstHardwareDigitalDriver
Ritor1
parents: 2427
diff changeset
46 RegSetValueExA(v11, lpValueName, 0, 4, Data, 4);
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
47 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
48 RegCloseKey(v11);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
49 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
50 RegCloseKey(v10);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
51 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
52 RegCloseKey(phkResult);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
53 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
54 RegCloseKey(hKey);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
55 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
56 return *(int *)Data;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
57 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
58
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
59 //----- (00464B02) --------------------------------------------------------
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
60 void __fastcall WriteWindowsRegistryString(const char *pKey, const char *pString)
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
61 {
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
62 size_t v2; // eax@5
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
63 const char *lpValueName; // [sp+4h] [bp-1Ch]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
64 const char *Str; // [sp+8h] [bp-18h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
65 DWORD dwDisposition; // [sp+Ch] [bp-14h]@2
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
66 HKEY hKey; // [sp+10h] [bp-10h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
67 HKEY phkResult; // [sp+14h] [bp-Ch]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
68 HKEY v8; // [sp+18h] [bp-8h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
69 HKEY v9; // [sp+1Ch] [bp-4h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
70
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
71 Str = pString;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
72 lpValueName = pKey;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
73 v9 = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
74 v8 = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
75 hKey = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
76 phkResult = 0;
2481
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
77 if ( !RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WOW64_32KEY, &hKey) )
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
78 {
2481
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
79 if ( !RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition) )
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
80 {
2481
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
81 if ( !RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, KEY_ALL_ACCESS, 0, &v8, &dwDisposition) )
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
82 {
2481
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
83 if ( !RegCreateKeyExA(v8, "1.0", 0, "", 0, KEY_ALL_ACCESS, 0, &v9, &dwDisposition) )
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
84 {
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
85 v2 = strlen(Str);
2481
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
86 RegSetValueExA(v9, lpValueName, 0, 1, (const BYTE *)Str, v2 + 1);
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
87 RegCloseKey(v9);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
88 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
89 RegCloseKey(v8);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
90 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
91 RegCloseKey(phkResult);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
92 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
93 RegCloseKey(hKey);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
94 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
95 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
96
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
97 //----- (00464BEF) --------------------------------------------------------
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
98 void __fastcall ReadWindowsRegistryString(const char *pKeyName, char *pOutString, int uBufLen, const char *pDefaultValue)
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
99 {
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
100 LSTATUS (__stdcall *v4)(HKEY); // esi@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
101 LSTATUS result; // eax@7
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
102 DWORD Type; // [sp+Ch] [bp-24h]@5
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
103 LPCSTR lpValueName; // [sp+10h] [bp-20h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
104 DWORD cbData; // [sp+14h] [bp-1Ch]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
105 LPBYTE Dest; // [sp+18h] [bp-18h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
106 DWORD dwDisposition; // [sp+1Ch] [bp-14h]@2
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
107 HKEY phkResult; // [sp+20h] [bp-10h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
108 HKEY hKey; // [sp+24h] [bp-Ch]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
109 HKEY v13; // [sp+28h] [bp-8h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
110 HKEY v14; // [sp+2Ch] [bp-4h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
111
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
112 cbData = uBufLen;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
113 Dest = (LPBYTE)pOutString;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
114 lpValueName = pKeyName;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
115 v14 = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
116 v13 = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
117 hKey = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
118 phkResult = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
119 v4 = RegCloseKey;
2481
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
120 if ( RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WOW64_32KEY, &hKey)
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
121 || RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition)
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
122 || RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, KEY_ALL_ACCESS, 0, &v13, &dwDisposition)
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
123 || RegCreateKeyExA(v13, "1.0", 0, "", 0, KEY_ALL_ACCESS, 0, &v14, &dwDisposition) )
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
124 {
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
125 result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
126 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
127 else if ( RegQueryValueExA(v14, lpValueName, 0, &Type, Dest, &cbData) )
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
128 {
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
129 RegCloseKey(v14);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
130 v14 = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
131 result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
132 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
133 else
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
134 {
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
135 v4 = RegCloseKey;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
136 RegCloseKey(v14);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
137 v14 = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
138 RegCloseKey(v13);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
139 v13 = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
140 RegCloseKey(phkResult);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
141 phkResult = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
142 result = RegCloseKey(hKey);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
143 hKey = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
144 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
145 if ( v14 )
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
146 result = v4(v14);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
147 if ( v13 )
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
148 result = v4(v13);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
149 if ( hKey )
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
150 result = v4(hKey);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
151 if ( phkResult )
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
152 result = v4(phkResult);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
153 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
154
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
155 //----- (00464D32) --------------------------------------------------------
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
156 void __fastcall WriteWindowsRegistryInt(const char *pKey, int val)
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
157 {
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
158 const char *lpValueName; // [sp+4h] [bp-1Ch]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
159 BYTE Data[4]; // [sp+8h] [bp-18h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
160 DWORD dwDisposition; // [sp+Ch] [bp-14h]@2
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
161 HKEY hKey; // [sp+10h] [bp-10h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
162 HKEY phkResult; // [sp+14h] [bp-Ch]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
163 HKEY v7; // [sp+18h] [bp-8h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
164 HKEY v8; // [sp+1Ch] [bp-4h]@1
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
165
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
166 *(int *)Data = val;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
167 lpValueName = pKey;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
168 v8 = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
169 v7 = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
170 hKey = 0;
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
171 phkResult = 0;
2481
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
172 if ( !RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WOW64_32KEY, &hKey) )
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
173 {
2481
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
174 if ( !RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition) )
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
175 {
2481
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
176 if ( !RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, KEY_ALL_ACCESS, 0, &v7, &dwDisposition) )
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
177 {
2481
4f4eb812af28 KEY_ALL_ACCESS
Ritor1
parents: 2459
diff changeset
178 if ( !RegCreateKeyExA(v7, "1.0", 0, "", 0, KEY_ALL_ACCESS, 0, &v8, &dwDisposition) )
2342
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
179 {
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
180 RegSetValueExA(v8, lpValueName, 0, 4, Data, 4);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
181 RegCloseKey(v8);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
182 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
183 RegCloseKey(v7);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
184 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
185 RegCloseKey(phkResult);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
186 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
187 RegCloseKey(hKey);
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
188 }
d7f4dac06dc0 Adding Registry.h/.cpp to project
Grumpy7
parents:
diff changeset
189 }