1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: kernel9x.h,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
41 //------------------------------------------------------------------------
42 // undefine the macros defined in the winbase.h file in order to avoid
43 // warnings because of multiple defines
44 //------------------------------------------------------------------------
54 #ifdef GetModuleFileNameW
55 #undef GetModuleFileNameW
58 #ifdef GetLogicalDriveStringsW
59 #undef GetLogicalDriveStringsW
82 #ifdef RemoveDirectoryW
83 #undef RemoveDirectoryW
86 #ifdef CreateDirectoryW
87 #undef CreateDirectoryW
90 #ifdef CreateDirectoryExW
91 #undef CreateDirectoryExW
98 #ifdef GetLongPathNameW
99 #undef GetLongPathNameW
102 #ifdef GetLocaleInfoW
103 #undef GetLocaleInfoW
106 #ifdef GetFullPathNameW
107 #undef GetFullPathNameW
110 #ifdef CreateProcessW
111 #undef CreateProcessW
114 #ifdef CreateProcessAsUserW
115 #undef CreateProcessAsUserW
118 #ifdef GetEnvironmentVariableW
119 #undef GetEnvironmentVariableW
126 #ifdef GetCurrentDirectoryW
127 #undef GetCurrentDirectoryW
130 #ifdef SetCurrentDirectoryW
131 #undef SetCurrentDirectoryW
134 #ifdef GetVolumeInformationW
135 #undef GetVolumeInformationW
139 #ifdef GetDiskFreeSpaceExA
140 #undef GetDiskFreeSpaceExA
143 #ifdef GetDiskFreeSpaceExW
144 #undef GetDiskFreeSpaceExW
147 //------------------------------------------------------------------------
148 // set the compiler directives for the function pointer we declare below
149 // if we build sal or sal will be used as static library we define extern
150 // else sal exports the function pointers from a dll and we use __declspec
151 //------------------------------------------------------------------------
153 #define KERNEL9X_API extern
155 //------------------------------------------------------------------------
156 // declare function pointers to the appropriate kernel functions
157 //------------------------------------------------------------------------
159 //BOOL WINAPI RegisterServiceProcess( DWORD dwProcessID, BOOL fRegister );
161 KERNEL9X_API
HMODULE (WINAPI
*lpfnLoadLibraryExW
) (
162 LPCWSTR lpLibFileName
, // file name of module
163 HANDLE hFile
, // reserved, must be NULL
164 DWORD dwFlags
// entry-point execution option
167 KERNEL9X_API
DWORD (WINAPI
*lpfnGetModuleFileNameW
) (
168 HMODULE hModule
, // handle to module
169 LPWSTR lpFilename
, // file name of module
170 DWORD nSize
// size of buffer
173 KERNEL9X_API
DWORD (WINAPI
*lpfnGetLogicalDriveStringsW
) (
174 DWORD nBufferLength
, // size of buffer
175 LPWSTR lpBuffer
// drive strings buffer
178 KERNEL9X_API
HANDLE ( WINAPI
*lpfnCreateFileW
)(
180 DWORD dwDesiredAccess
,
182 LPSECURITY_ATTRIBUTES lpSecurityAttributes
,
183 DWORD dwCreationDisposition
,
184 DWORD dwFlagsAndAttributes
,
188 KERNEL9X_API DWORD WINAPI
GetCanonicalPathNameA(
189 LPCSTR lpszPath
, // file name
190 LPSTR lpszCanonicalPath
, // path buffer
191 DWORD cchBuffer
// size of path buffer
194 KERNEL9X_API DWORD WINAPI
GetCanonicalPathNameW(
195 LPCWSTR lpszPath
, // file name
196 LPWSTR lpszCanonicalPath
, // path buffer
197 DWORD cchBuffer
// size of path buffer
200 KERNEL9X_API
HANDLE ( WINAPI
* lpfnCreateFileW
) (
202 DWORD dwDesiredAccess
,
204 LPSECURITY_ATTRIBUTES lpSecurityAttributes
,
205 DWORD dwCreationDisposition
,
206 DWORD dwFlagsAndAttributes
,
207 HANDLE hTemplateFile
);
209 KERNEL9X_API
BOOL (WINAPI
*lpfnDeleteFileW
) (
210 LPCWSTR lpFileName
// file name
213 KERNEL9X_API
BOOL (WINAPI
*lpfnCopyFileW
) (
214 LPCWSTR lpExistingFileName
, // file name
215 LPCWSTR lpNewFileName
, // new file name
216 BOOL bFailIfExist
// operation if file exists
219 KERNEL9X_API
BOOL (WINAPI
*lpfnMoveFileW
) (
220 LPCWSTR lpExistingFileName
, // file name
221 LPCWSTR lpNewFileName
// new file name
224 KERNEL9X_API
BOOL (WINAPI
*lpfnMoveFileExW
) (
225 LPCWSTR lpExistingFileName
, // file name
226 LPCWSTR lpNewFileName
, // new file name
227 DWORD dwFlags
// move options
230 KERNEL9X_API
BOOL (WINAPI
*lpfnRemoveDirectoryW
) (
231 LPCWSTR lpPathName
// directory name
234 KERNEL9X_API
BOOL ( WINAPI
* lpfnCreateDirectoryW
) (
235 LPCWSTR lpNewDirectory
, LPSECURITY_ATTRIBUTES lpSecurityAttributes
);
237 KERNEL9X_API
BOOL ( WINAPI
* lpfnCreateDirectoryExW
) (
238 LPCWSTR lpTemplateDirectory
,
239 LPCWSTR lpNewDirectory
,
240 LPSECURITY_ATTRIBUTES lpSecurityAttributes
);
242 KERNEL9X_API
DWORD ( WINAPI
* lpfnGetLongPathNameW
) (
243 LPCWSTR lpszShortPath
, // file name
244 LPWSTR lpszLongPath
, // path buffer
245 DWORD cchBuffer
// size of path buffer
248 // GetCanonicalPath is a tool function with no exact counterpart
249 // in the win32 api; we use nevertheless a function pointer
250 // because every variable etc. must root in the Kernel9x.lib else
251 // we loose our AutoSystoolInit object during linking
252 KERNEL9X_API
DWORD ( WINAPI
* lpfnGetCanonicalPathW
) (
253 LPCWSTR lpszPath
, // file name
254 LPWSTR lpszCanonicalPath
, // path buffer
255 DWORD cchBuffer
// size of path buffer
258 KERNEL9X_API
int ( WINAPI
* lpfnGetLocaleInfoW
) (
259 LCID Locale
, // locale identifier
260 LCTYPE LCType
, // information type
261 LPWSTR lpLCData
, // information buffer
262 int cchData
// size of buffer
265 KERNEL9X_API
DWORD ( WINAPI
* lpfnGetFullPathNameW
)(
266 LPCWSTR lpFileName
, // file name
267 DWORD nBufferLength
, // size of path buffer
268 LPWSTR lpBuffer
, // path buffer
269 LPWSTR
*lpFilePart
// address of file name in path
272 KERNEL9X_API
BOOL ( WINAPI
* lpfnCreateProcessW
)(
273 LPCWSTR lpApplicationName
, // name of executable module
274 LPWSTR lpCommandLine
, // command line string
275 LPSECURITY_ATTRIBUTES lpProcessAttributes
, // SD
276 LPSECURITY_ATTRIBUTES lpThreadAttributes
, // SD
277 BOOL bInheritHandles
, // handle inheritance option
278 DWORD dwCreationFlags
, // creation flags
279 LPVOID lpEnvironment
, // new environment block
280 LPCWSTR lpCurrentDirectory
, // current directory name
281 LPSTARTUPINFOW lpStartupInfo
, // startup information
282 LPPROCESS_INFORMATION lpProcessInformation
// process information
285 KERNEL9X_API
BOOL ( WINAPI
* lpfnCreateProcessAsUserW
)(
286 HANDLE hToken
, // handle to user token
287 LPCWSTR lpApplicationName
, // name of executable module
288 LPWSTR lpCommandLine
, // command-line string
289 LPSECURITY_ATTRIBUTES lpProcessAttributes
, // SD
290 LPSECURITY_ATTRIBUTES lpThreadAttributes
, // SD
291 BOOL bInheritHandles
, // inheritance option
292 DWORD dwCreationFlags
, // creation flags
293 LPVOID lpEnvironment
, // new environment block
294 LPCWSTR lpCurrentDirectory
, // current directory name
295 LPSTARTUPINFOW lpStartupInfo
, // startup information
296 LPPROCESS_INFORMATION lpProcessInformation
// process information
299 KERNEL9X_API
DWORD ( WINAPI
* lpfnGetEnvironmentVariableW
)(
300 LPCWSTR lpName
, // environment variable name
301 LPWSTR lpBuffer
, // buffer for variable value
302 DWORD nSize
// size of buffer
306 KERNEL9X_API
UINT ( WINAPI
* lpfnGetDriveTypeW
)(
307 LPCWSTR lpRootPathName
// root directory
310 KERNEL9X_API
DWORD ( WINAPI
* lpfnGetCurrentDirectoryW
)(
311 DWORD nBufferLength
, // size of directory buffer
312 LPWSTR lpBuffer
// directory buffer
315 KERNEL9X_API
BOOL ( WINAPI
* lpfnSetCurrentDirectoryW
)(
316 LPCWSTR lpPathName
// new directory name
319 // GetVolumeInformation
320 KERNEL9X_API
BOOL ( WINAPI
* lpfnGetVolumeInformationW
)(
321 LPCWSTR lpRootPathName
, // root directory
322 LPWSTR lpVolumeNameBuffer
, // volume name buffer
323 DWORD nVolumeNameSize
, // length of name buffer
324 LPDWORD lpVolumeSerialNumber
, // volume serial number
325 LPDWORD lpMaximumComponentLength
, // maximum file name length
326 LPDWORD lpFileSystemFlags
, // file system options
327 LPWSTR lpFileSystemName
, // file system name buffer
328 DWORD nFileSystemNameSize
// length of file system name buffer
331 // GetDiskFreeSpaceExA
332 KERNEL9X_API
BOOL (WINAPI
*lpfnGetDiskFreeSpaceExA
)(
333 LPCSTR lpDirectoryName
, // directory name
334 PULARGE_INTEGER lpFreeBytesAvailable
, // bytes available to caller
335 PULARGE_INTEGER lpTotalNumberOfBytes
, // bytes on disk
336 PULARGE_INTEGER lpTotalNumberOfFreeBytes
// free bytes on disk
339 // GetDiskFreeSpaceExW
340 KERNEL9X_API
BOOL (WINAPI
*lpfnGetDiskFreeSpaceExW
)(
341 LPCWSTR lpDirectoryName
, // directory name
342 PULARGE_INTEGER lpFreeBytesAvailable
, // bytes available to caller
343 PULARGE_INTEGER lpTotalNumberOfBytes
, // bytes on disk
344 PULARGE_INTEGER lpTotalNumberOfFreeBytes
// free bytes on disk
347 //------------------------------------------------------------------------
348 // redefine the above undefined macros so that the preprocessor replaces
349 // all occurrences of this macros with our function pointer
350 //------------------------------------------------------------------------
352 #define LoadLibraryExW lpfnLoadLibraryExW
353 #define LoadLibraryW(c) LoadLibraryExW(c, NULL, 0)
354 #define GetModuleFileNameW lpfnGetModuleFileNameW
355 #define GetLogicalDriveStringsW lpfnGetLogicalDriveStringsW
356 #define CreateFileW lpfnCreateFileW
357 #define DeleteFileW lpfnDeleteFileW
358 #define CopyFileW lpfnCopyFileW
359 #define MoveFileW lpfnMoveFileW
360 #define MoveFileExW lpfnMoveFileExW
361 #define RemoveDirectoryW lpfnRemoveDirectoryW
362 #define CreateDirectoryW lpfnCreateDirectoryW
363 #define CreateDirectoryExW lpfnCreateDirectoryExW
364 #define GetLongPathNameW lpfnGetLongPathNameW
365 #define GetFullPathNameW lpfnGetFullPathNameW
367 #define GetCanonicalPath lpfnGetCanonicalPathW
368 #define GetLocaleInfoW lpfnGetLocaleInfoW
370 #define CreateProcessW lpfnCreateProcessW
371 #define CreateProcessAsUserW lpfnCreateProcessAsUserW
372 #define GetEnvironmentVariableW lpfnGetEnvironmentVariableW
373 #define GetDriveTypeW lpfnGetDriveTypeW
375 #define GetCurrentDirectoryW lpfnGetCurrentDirectoryW
376 #define SetCurrentDirectoryW lpfnSetCurrentDirectoryW
378 #define GetVolumeInformationW lpfnGetVolumeInformationW
379 #define GetDiskFreeSpaceExA lpfnGetDiskFreeSpaceExA
380 #define GetDiskFreeSpaceExW lpfnGetDiskFreeSpaceExW