xref: /trunk/main/sal/inc/systools/win32/advapi9x.h (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #pragma once
28 
29 #ifndef _WINDOWS_
30 #include <windows.h>
31 #endif
32 
33 #ifdef __cplusplus
34 extern "C"{
35 #endif
36 
37 //------------------------------------------------------------------------
38 // undefine the macros defined in the shlobj.h file in order to avoid
39 // warnings because of multiple defines
40 //------------------------------------------------------------------------
41 
42 // begin obsolete Win32 API functions -->
43 #ifdef RegOpenKey
44 #undef RegOpenKey
45 #endif
46 #ifdef RegEnumKey
47 #undef RegEnumKey
48 #endif
49 #ifdef RegCreateKey
50 #undef RegCreateKey
51 #endif
52 #ifdef RegQueryValue
53 #undef RegQueryValue
54 #endif
55 #ifdef RegSetValue
56 #undef RegSetValue
57 #endif
58 // <-- end obsolete Win32 functions
59 
60 #ifdef RegOpenKeyExW
61 #undef RegOpenKeyExW
62 #endif
63 #ifdef RegEnumKeyExW
64 #undef RegEnumKeyExW
65 #endif
66 #ifdef RegCreateKeyExW
67 #undef RegCreateKeyExW
68 #endif
69 #ifdef RegDeleteKeyW
70 #undef RegDeleteKeyW
71 #endif
72 #ifdef RegEnumValueW
73 #undef RegEnumValueW
74 #endif
75 #ifdef RegQueryValueExW
76 #undef RegQueryValueExW
77 #endif
78 #ifdef RegSetValueExW
79 #undef RegSetValueExW
80 #endif
81 #ifdef RegDeleteValueW
82 #undef RegDeleteValueW
83 #endif
84 #ifdef RegQueryInfoKeyW
85 #undef RegQueryInfoKeyW
86 #endif
87 
88 //------------------------------------------------------------------------
89 // set the compiler directives for the function pointer we declare below
90 // if we build sal or sal will be used as static library we define extern
91 // else sal exports the function pointers from a dll and we use __declspec
92 //------------------------------------------------------------------------
93 
94 #define ADVAPI9X_API extern
95 
96 	//------------------------------------------------------------------------
97 // declare function pointers to the appropriate shell functions
98 //------------------------------------------------------------------------
99 
100 ADVAPI9X_API LONG (WINAPI * lpfnRegOpenKeyExW) (
101   HKEY hKey,         // handle to open key
102   LPCWSTR lpSubKey,  // subkey name
103   DWORD ulOptions,   // reserved
104   REGSAM samDesired, // security access mask
105   PHKEY phkResult    // handle to open key
106 );
107 
108 ADVAPI9X_API LONG (WINAPI *lpfnRegEnumKeyExW) (
109   HKEY hKey,                  // handle to key to enumerate
110   DWORD dwIndex,              // subkey index
111   LPWSTR lpName,              // subkey name
112   LPDWORD lpcName,            // size of subkey buffer
113   LPDWORD lpReserved,         // reserved
114   LPWSTR lpClass,             // class string buffer
115   LPDWORD lpcClass,           // size of class string buffer
116   PFILETIME lpftLastWriteTime // last write time
117 );
118 
119 ADVAPI9X_API LONG (WINAPI *lpfnRegCreateKeyExW)(
120   HKEY hKey,                                  // handle to open key
121   LPCWSTR lpSubKey,                           // subkey name
122   DWORD Reserved,                             // reserved
123   LPWSTR lpClass,                             // class string
124   DWORD dwOptions,                            // special options
125   REGSAM samDesired,                          // desired security access
126   LPSECURITY_ATTRIBUTES lpSecurityAttributes, // inheritance
127   PHKEY phkResult,                            // key handle
128   LPDWORD lpdwDisposition                     // disposition value buffer
129 );
130 
131 ADVAPI9X_API LONG (WINAPI *lpfnRegDeleteKeyW) (
132   HKEY hKey,         // handle to open key
133   LPCWSTR lpSubKey   // subkey name
134 );
135 
136 ADVAPI9X_API LONG (WINAPI *lpfnRegEnumValueW) (
137   HKEY hKey,             // handle to key to query
138   DWORD dwIndex,         // index of value to query
139   LPWSTR lpValueName,    // value buffer
140   LPDWORD lpcValueName,  // size of value buffer
141   LPDWORD lpReserved,    // reserved
142   LPDWORD lpType,        // type buffer
143   LPBYTE lpData,         // data buffer
144   LPDWORD lpcbData       // size of data buffer
145 );
146 
147 ADVAPI9X_API LONG (WINAPI *lpfnRegQueryValueExW) (
148   HKEY hKey,            // handle to key
149   LPCWSTR lpValueName,  // value name
150   LPDWORD lpReserved,   // reserved
151   LPDWORD lpType,       // type buffer
152   LPBYTE lpData,        // data buffer
153   LPDWORD lpcbData      // size of data buffer
154 );
155 
156 ADVAPI9X_API LONG (WINAPI *lpfnRegSetValueExW)(
157   HKEY hKey,           // handle to key
158   LPCWSTR lpValueName, // value name
159   DWORD Reserved,      // reserved
160   DWORD dwType,        // value type
161   CONST BYTE *lpData,  // value data
162   DWORD cbData         // size of value data
163 );
164 
165 ADVAPI9X_API LONG (WINAPI *lpfnRegDeleteValueW) (
166   HKEY hKey,            // handle to key
167   LPCWSTR lpValueName   // value name
168 );
169 
170 ADVAPI9X_API LONG (WINAPI *lpfnRegQueryInfoKeyW) (
171 	HKEY hKey,						// handle to key to query
172 	LPWSTR lpClassW,				// address of buffer for class string
173 	LPDWORD lpcbClass,				// address of size of class string buffer
174 	LPDWORD lpReserved,				// reserved
175 	LPDWORD lpcSubKeys,				// address of buffer for number of
176 									// subkeys
177 	LPDWORD lpcbMaxSubKeyLen,		// address of buffer for longest subkey
178 									// name length
179 	LPDWORD lpcbMaxClassLen,		// address of buffer for longest class
180 									// string length
181 	LPDWORD lpcValues,				// address of buffer for number of value
182 									// entries
183 	LPDWORD lpcbMaxValueNameLen,	// address of buffer for longest
184 									// value name length
185 	LPDWORD lpcbMaxValueLen,		// address of buffer for longest value
186 									// data length
187 	LPDWORD lpcbSecurityDescriptor,	// address of buffer for security
188 									// descriptor length
189 	PFILETIME lpftLastWriteTime		// address of buffer for last write time
190 );
191 
192 //------------------------------------------------------------------------
193 // redefine the above undefined macros so that the preprocessor replaces
194 // all occurrences of this macros with our function pointer
195 //------------------------------------------------------------------------
196 
197 #define RegOpenKeyExW    lpfnRegOpenKeyExW
198 #define RegEnumKeyExW    lpfnRegEnumKeyExW
199 #define RegCreateKeyExW  lpfnRegCreateKeyExW
200 #define RegDeleteKeyW    lpfnRegDeleteKeyW
201 #define RegEnumValueW    lpfnRegEnumValueW
202 #define RegQueryValueExW lpfnRegQueryValueExW
203 #define RegSetValueExW   lpfnRegSetValueExW
204 #define RegDeleteValueW  lpfnRegDeleteValueW
205 #define RegQueryInfoKeyW lpfnRegQueryInfoKeyW
206 
207 #ifdef __cplusplus
208 }
209 #endif
210