annotate Registry.cpp @ 2415:f4af3b203f65

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