annotate Registry.cpp @ 2409:b29880e9ee79

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