xref: /trunk/main/sal/inc/systools/win32/advapi9x.h (revision 9eab2a37)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #pragma once
24 
25 #ifndef _WINDOWS_
26 #include <windows.h>
27 #endif
28 
29 #ifdef __cplusplus
30 extern "C"{
31 #endif
32 
33 //------------------------------------------------------------------------
34 // undefine the macros defined in the shlobj.h file in order to avoid
35 // warnings because of multiple defines
36 //------------------------------------------------------------------------
37 
38 // begin obsolete Win32 API functions -->
39 #ifdef RegOpenKey
40 #undef RegOpenKey
41 #endif
42 #ifdef RegEnumKey
43 #undef RegEnumKey
44 #endif
45 #ifdef RegCreateKey
46 #undef RegCreateKey
47 #endif
48 #ifdef RegQueryValue
49 #undef RegQueryValue
50 #endif
51 #ifdef RegSetValue
52 #undef RegSetValue
53 #endif
54 // <-- end obsolete Win32 functions
55 
56 #ifdef RegOpenKeyExW
57 #undef RegOpenKeyExW
58 #endif
59 #ifdef RegEnumKeyExW
60 #undef RegEnumKeyExW
61 #endif
62 #ifdef RegCreateKeyExW
63 #undef RegCreateKeyExW
64 #endif
65 #ifdef RegDeleteKeyW
66 #undef RegDeleteKeyW
67 #endif
68 #ifdef RegEnumValueW
69 #undef RegEnumValueW
70 #endif
71 #ifdef RegQueryValueExW
72 #undef RegQueryValueExW
73 #endif
74 #ifdef RegSetValueExW
75 #undef RegSetValueExW
76 #endif
77 #ifdef RegDeleteValueW
78 #undef RegDeleteValueW
79 #endif
80 #ifdef RegQueryInfoKeyW
81 #undef RegQueryInfoKeyW
82 #endif
83 
84 //------------------------------------------------------------------------
85 // set the compiler directives for the function pointer we declare below
86 // if we build sal or sal will be used as static library we define extern
87 // else sal exports the function pointers from a dll and we use __declspec
88 //------------------------------------------------------------------------
89 
90 #define ADVAPI9X_API extern
91 
92 	//------------------------------------------------------------------------
93 // declare function pointers to the appropriate shell functions
94 //------------------------------------------------------------------------
95 
96 ADVAPI9X_API LONG (WINAPI * lpfnRegOpenKeyExW) (
97   HKEY hKey,         // handle to open key
98   LPCWSTR lpSubKey,  // subkey name
99   DWORD ulOptions,   // reserved
100   REGSAM samDesired, // security access mask
101   PHKEY phkResult    // handle to open key
102 );
103 
104 ADVAPI9X_API LONG (WINAPI *lpfnRegEnumKeyExW) (
105   HKEY hKey,                  // handle to key to enumerate
106   DWORD dwIndex,              // subkey index
107   LPWSTR lpName,              // subkey name
108   LPDWORD lpcName,            // size of subkey buffer
109   LPDWORD lpReserved,         // reserved
110   LPWSTR lpClass,             // class string buffer
111   LPDWORD lpcClass,           // size of class string buffer
112   PFILETIME lpftLastWriteTime // last write time
113 );
114 
115 ADVAPI9X_API LONG (WINAPI *lpfnRegCreateKeyExW)(
116   HKEY hKey,                                  // handle to open key
117   LPCWSTR lpSubKey,                           // subkey name
118   DWORD Reserved,                             // reserved
119   LPWSTR lpClass,                             // class string
120   DWORD dwOptions,                            // special options
121   REGSAM samDesired,                          // desired security access
122   LPSECURITY_ATTRIBUTES lpSecurityAttributes, // inheritance
123   PHKEY phkResult,                            // key handle
124   LPDWORD lpdwDisposition                     // disposition value buffer
125 );
126 
127 ADVAPI9X_API LONG (WINAPI *lpfnRegDeleteKeyW) (
128   HKEY hKey,         // handle to open key
129   LPCWSTR lpSubKey   // subkey name
130 );
131 
132 ADVAPI9X_API LONG (WINAPI *lpfnRegEnumValueW) (
133   HKEY hKey,             // handle to key to query
134   DWORD dwIndex,         // index of value to query
135   LPWSTR lpValueName,    // value buffer
136   LPDWORD lpcValueName,  // size of value buffer
137   LPDWORD lpReserved,    // reserved
138   LPDWORD lpType,        // type buffer
139   LPBYTE lpData,         // data buffer
140   LPDWORD lpcbData       // size of data buffer
141 );
142 
143 ADVAPI9X_API LONG (WINAPI *lpfnRegQueryValueExW) (
144   HKEY hKey,            // handle to key
145   LPCWSTR lpValueName,  // value name
146   LPDWORD lpReserved,   // reserved
147   LPDWORD lpType,       // type buffer
148   LPBYTE lpData,        // data buffer
149   LPDWORD lpcbData      // size of data buffer
150 );
151 
152 ADVAPI9X_API LONG (WINAPI *lpfnRegSetValueExW)(
153   HKEY hKey,           // handle to key
154   LPCWSTR lpValueName, // value name
155   DWORD Reserved,      // reserved
156   DWORD dwType,        // value type
157   CONST BYTE *lpData,  // value data
158   DWORD cbData         // size of value data
159 );
160 
161 ADVAPI9X_API LONG (WINAPI *lpfnRegDeleteValueW) (
162   HKEY hKey,            // handle to key
163   LPCWSTR lpValueName   // value name
164 );
165 
166 ADVAPI9X_API LONG (WINAPI *lpfnRegQueryInfoKeyW) (
167 	HKEY hKey,						// handle to key to query
168 	LPWSTR lpClassW,				// address of buffer for class string
169 	LPDWORD lpcbClass,				// address of size of class string buffer
170 	LPDWORD lpReserved,				// reserved
171 	LPDWORD lpcSubKeys,				// address of buffer for number of
172 									// subkeys
173 	LPDWORD lpcbMaxSubKeyLen,		// address of buffer for longest subkey
174 									// name length
175 	LPDWORD lpcbMaxClassLen,		// address of buffer for longest class
176 									// string length
177 	LPDWORD lpcValues,				// address of buffer for number of value
178 									// entries
179 	LPDWORD lpcbMaxValueNameLen,	// address of buffer for longest
180 									// value name length
181 	LPDWORD lpcbMaxValueLen,		// address of buffer for longest value
182 									// data length
183 	LPDWORD lpcbSecurityDescriptor,	// address of buffer for security
184 									// descriptor length
185 	PFILETIME lpftLastWriteTime		// address of buffer for last write time
186 );
187 
188 //------------------------------------------------------------------------
189 // redefine the above undefined macros so that the preprocessor replaces
190 // all occurrences of this macros with our function pointer
191 //------------------------------------------------------------------------
192 
193 #define RegOpenKeyExW    lpfnRegOpenKeyExW
194 #define RegEnumKeyExW    lpfnRegEnumKeyExW
195 #define RegCreateKeyExW  lpfnRegCreateKeyExW
196 #define RegDeleteKeyW    lpfnRegDeleteKeyW
197 #define RegEnumValueW    lpfnRegEnumValueW
198 #define RegQueryValueExW lpfnRegQueryValueExW
199 #define RegSetValueExW   lpfnRegSetValueExW
200 #define RegDeleteValueW  lpfnRegDeleteValueW
201 #define RegQueryInfoKeyW lpfnRegQueryInfoKeyW
202 
203 #ifdef __cplusplus
204 }
205 #endif
206