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