Diff

Not logged in

Differences From Artifact [e5d43e62c628c0b0]:

To Artifact [3495de98d7c1ed4e]:


5 5 * * 6 6 * Translated from MinGW Windows headers * 7 7 * by Stewart Gordon * 8 8 * * 9 9 * Placed into public domain * 10 10 \***********************************************************************/ 11 11 module win32.winreg; 12 -pragma(lib, "advapi32.lib"); 12 +pragma(lib, "advapi32"); 13 13 14 14 private import win32.w32api, win32.winbase, win32.windef; 15 15 16 -const HKEY 16 +enum : HKEY { // for some reason, DMD errors if I don't give all the values explicitly 17 17 HKEY_CLASSES_ROOT = cast(HKEY) 0x80000000, 18 18 HKEY_CURRENT_USER = cast(HKEY) 0x80000001, 19 19 HKEY_LOCAL_MACHINE = cast(HKEY) 0x80000002, 20 20 HKEY_USERS = cast(HKEY) 0x80000003, 21 21 HKEY_PERFORMANCE_DATA = cast(HKEY) 0x80000004, 22 22 HKEY_CURRENT_CONFIG = cast(HKEY) 0x80000005, 23 - HKEY_DYN_DATA = cast(HKEY) 0x80000006; 23 + HKEY_DYN_DATA = cast(HKEY) 0x80000006 24 +} 24 25 25 26 enum : DWORD { 26 27 REG_OPTION_NON_VOLATILE, 27 28 REG_OPTION_VOLATILE 28 29 } 29 30 30 31 enum : DWORD { ................................................................................ 70 71 DWORD ve_valuelen; 71 72 DWORD ve_valueptr; 72 73 DWORD ve_type; 73 74 } 74 75 alias VALENTW* PVALENTW; 75 76 76 77 // RRF - Registry Routine Flags (for RegGetValue) 77 -static if (WINVER >= 0x600) { 78 +static if (_WIN32_WINNT >= 0x600) { 78 79 enum : DWORD { 79 80 RRF_RT_REG_NONE = 0x00000001, 80 81 RRF_RT_REG_SZ = 0x00000002, 81 82 RRF_RT_REG_EXPAND_SZ = 0x00000004, 82 83 RRF_RT_REG_BINARY = 0x00000008, 83 84 RRF_RT_REG_DWORD = 0x00000010, 84 85 RRF_RT_REG_MULTI_SZ = 0x00000020, ................................................................................ 125 126 LONG RegQueryValueExA(HKEY, LPCSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD); 126 127 LONG RegQueryValueExW(HKEY, LPCWSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD); 127 128 LONG RegReplaceKeyA(HKEY, LPCSTR, LPCSTR, LPCSTR); 128 129 LONG RegReplaceKeyW(HKEY, LPCWSTR, LPCWSTR, LPCWSTR); 129 130 LONG RegSaveKeyA(HKEY, LPCSTR, LPSECURITY_ATTRIBUTES); 130 131 LONG RegSaveKeyW(HKEY, LPCWSTR, LPSECURITY_ATTRIBUTES); 131 132 LONG RegSetKeySecurity(HKEY, SECURITY_INFORMATION, PSECURITY_DESCRIPTOR); 132 - LONG RegSetValueExA(HKEY, LPCSTR, DWORD, DWORD, CPtr!(BYTE), DWORD); 133 - LONG RegSetValueExW(HKEY, LPCWSTR, DWORD, DWORD, CPtr!(BYTE), DWORD); 133 + LONG RegSetValueExA(HKEY, LPCSTR, DWORD, DWORD, const(BYTE)*, DWORD); 134 + LONG RegSetValueExW(HKEY, LPCWSTR, DWORD, DWORD, const(BYTE)*, DWORD); 134 135 LONG RegUnLoadKeyA(HKEY, LPCSTR); 135 136 LONG RegUnLoadKeyW(HKEY, LPCWSTR); 136 - static if (_WIN32_WINDOWS >= 0x410) { 137 - LONG RegNotifyChangeKeyValue(HKEY, BOOL, DWORD, HANDLE, BOOL); 137 + LONG RegNotifyChangeKeyValue(HKEY, BOOL, DWORD, HANDLE, BOOL); 138 + 139 + BOOL AbortSystemShutdownA(LPCSTR); 140 + BOOL AbortSystemShutdownW(LPCWSTR); 141 + BOOL InitiateSystemShutdownA(LPSTR, LPSTR, DWORD, BOOL, BOOL); 142 + BOOL InitiateSystemShutdownW(LPWSTR, LPWSTR, DWORD, BOOL, BOOL); 143 + LONG RegGetKeySecurity(HKEY, SECURITY_INFORMATION, 144 + PSECURITY_DESCRIPTOR, PDWORD); 145 + LONG RegRestoreKeyA(HKEY, LPCSTR, DWORD); 146 + LONG RegRestoreKeyW(HKEY, LPCWSTR, DWORD); 147 + LONG RegSetKeySecurity(HKEY, SECURITY_INFORMATION, 148 + PSECURITY_DESCRIPTOR); 149 + 150 + static if (_WIN32_WINNT >= 0x500) { 151 + LONG RegDisablePredefinedCache(); 152 + LONG RegOpenCurrentUser(REGSAM, PHKEY); 153 + LONG RegOpenUserClassesRoot(HANDLE, DWORD, REGSAM, PHKEY); 138 154 } 139 155 140 - static if (_WIN32_WINNT_ONLY) { 141 - BOOL AbortSystemShutdownA(LPCSTR); 142 - BOOL AbortSystemShutdownW(LPCWSTR); 143 - BOOL InitiateSystemShutdownA(LPSTR, LPSTR, DWORD, BOOL, BOOL); 144 - BOOL InitiateSystemShutdownW(LPWSTR, LPWSTR, DWORD, BOOL, BOOL); 145 - LONG RegGetKeySecurity(HKEY, SECURITY_INFORMATION, 146 - PSECURITY_DESCRIPTOR, PDWORD); 147 - LONG RegRestoreKeyA(HKEY, LPCSTR, DWORD); 148 - LONG RegRestoreKeyW(HKEY, LPCWSTR, DWORD); 149 - LONG RegSetKeySecurity(HKEY, SECURITY_INFORMATION, 150 - PSECURITY_DESCRIPTOR); 151 - 152 - static if (_WIN32_WINNT >= 0x500) { 153 - LONG RegDisablePredefinedCache(); 154 - LONG RegOpenCurrentUser(REGSAM, PHKEY); 155 - LONG RegOpenUserClassesRoot(HANDLE, DWORD, REGSAM, PHKEY); 156 - } 156 + static if (_WIN32_WINNT >= 0x501) { 157 + LONG RegSaveKeyExA(HKEY, LPCSTR, LPSECURITY_ATTRIBUTES, DWORD); 158 + LONG RegSaveKeyExW(HKEY, LPCWSTR, LPSECURITY_ATTRIBUTES, DWORD); 159 + } 157 160 158 - static if (_WIN32_WINNT >= 0x501) { 159 - LONG RegSaveKeyExA(HKEY, LPCSTR, LPSECURITY_ATTRIBUTES, DWORD); 160 - LONG RegSaveKeyExW(HKEY, LPCWSTR, LPSECURITY_ATTRIBUTES, DWORD); 161 - } 162 - 163 - static if (_WIN32_WINNT >= 0x600) { 164 - LONG RegGetValueA(HKEY hkey, LPCSTR lpSubKey, LPCSTR lpValue, 165 - DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData); 166 - LONG RegGetValueW(HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpValue, 167 - DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData); 168 - } 161 + static if (_WIN32_WINNT >= 0x600) { 162 + LONG RegGetValueA(HKEY hkey, LPCSTR lpSubKey, LPCSTR lpValue, 163 + DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData); 164 + LONG RegGetValueW(HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpValue, 165 + DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData); 169 166 } 170 167 171 168 deprecated { 172 169 LONG RegCreateKeyA(HKEY, LPCSTR, PHKEY); 173 170 LONG RegCreateKeyW(HKEY, LPCWSTR, PHKEY); 174 171 LONG RegEnumKeyA(HKEY, DWORD, LPSTR, DWORD); 175 172 LONG RegEnumKeyW(HKEY, DWORD, LPWSTR, DWORD); ................................................................................ 196 193 alias RegQueryMultipleValuesW RegQueryMultipleValues; 197 194 alias RegQueryValueExW RegQueryValueEx; 198 195 alias RegReplaceKeyW RegReplaceKey; 199 196 alias RegSaveKeyW RegSaveKey; 200 197 alias RegSetValueExW RegSetValueEx; 201 198 alias RegUnLoadKeyW RegUnLoadKey; 202 199 203 - static if (_WIN32_WINNT_ONLY) { 204 - alias AbortSystemShutdownW AbortSystemShutdown; 205 - alias InitiateSystemShutdownW InitiateSystemShutdown; 206 - alias RegRestoreKeyW RegRestoreKey; 207 - static if (_WIN32_WINNT >= 0x501) { 208 - alias RegSaveKeyExA RegSaveKeyEx; 209 - } 210 - static if (_WIN32_WINNT >= 0x600) { 211 - alias RegGetValueW RegGetValue; 212 - } 200 + alias AbortSystemShutdownW AbortSystemShutdown; 201 + alias InitiateSystemShutdownW InitiateSystemShutdown; 202 + alias RegRestoreKeyW RegRestoreKey; 203 + static if (_WIN32_WINNT >= 0x501) { 204 + alias RegSaveKeyExA RegSaveKeyEx; 205 + } 206 + static if (_WIN32_WINNT >= 0x600) { 207 + alias RegGetValueW RegGetValue; 213 208 } 214 209 deprecated { 215 210 alias RegCreateKeyW RegCreateKey; 216 211 alias RegEnumKeyW RegEnumKey; 217 212 alias RegOpenKeyW RegOpenKey; 218 213 alias RegQueryValueW RegQueryValue; 219 214 alias RegSetValueW RegSetValue; ................................................................................ 231 226 alias RegQueryInfoKeyA RegQueryInfoKey; 232 227 alias RegQueryMultipleValuesA RegQueryMultipleValues; 233 228 alias RegQueryValueExA RegQueryValueEx; 234 229 alias RegReplaceKeyA RegReplaceKey; 235 230 alias RegSaveKeyA RegSaveKey; 236 231 alias RegSetValueExA RegSetValueEx; 237 232 alias RegUnLoadKeyA RegUnLoadKey; 238 - static if (_WIN32_WINNT_ONLY) { 239 - alias AbortSystemShutdownA AbortSystemShutdown; 240 - alias InitiateSystemShutdownA InitiateSystemShutdown; 241 - alias RegRestoreKeyW RegRestoreKey; 242 - static if (_WIN32_WINNT >= 0x501) { 243 - alias RegSaveKeyExA RegSaveKeyEx; 244 - } 245 - static if (_WIN32_WINNT >= 0x600) { 246 - alias RegGetValueA RegGetValue; 247 - } 233 + alias AbortSystemShutdownA AbortSystemShutdown; 234 + alias InitiateSystemShutdownA InitiateSystemShutdown; 235 + alias RegRestoreKeyW RegRestoreKey; 236 + static if (_WIN32_WINNT >= 0x501) { 237 + alias RegSaveKeyExA RegSaveKeyEx; 238 + } 239 + static if (_WIN32_WINNT >= 0x600) { 240 + alias RegGetValueA RegGetValue; 248 241 } 249 242 deprecated { 250 243 alias RegCreateKeyA RegCreateKey; 251 244 alias RegEnumKeyA RegEnumKey; 252 245 alias RegOpenKeyA RegOpenKey; 253 246 alias RegQueryValueA RegQueryValue; 254 247 alias RegSetValueA RegSetValue; 255 248 } 256 249 } 257 250 258 251 alias VALENT* PVALENT;