2 * Windows APIs that are different for each system.
3 * We use pointers to the entry points so that a
4 * single binary will run on all Windows systems.
9 Copyright (C) 2000-2005 Kern Sibbald
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License as
13 published by the Free Software Foundation; either version 2 of
14 the License, or (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public
22 License along with this program; if not, write to the Free
23 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
31 #if defined(HAVE_WIN32)
33 * Commented out native.h include statement, which is not distributed with the
34 * free version of VC++, and which is not used in bacula.
36 * #if !defined(HAVE_MINGW) // native.h not present on mingw
43 #if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
49 // unicode enabling of win 32 needs some defines and functions
50 #define MAX_PATH_UTF8 MAX_PATH*3
52 int wchar_2_UTF8(char *pszUTF, const WCHAR *pszUCS, int cchChar = MAX_PATH_UTF8);
53 int UTF8_2_wchar(POOLMEM **pszUCS, const char *pszUTF);
58 typedef BOOL (WINAPI * t_OpenProcessToken)(HANDLE, DWORD, PHANDLE);
59 typedef BOOL (WINAPI * t_AdjustTokenPrivileges)(HANDLE, BOOL,
60 PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD);
61 typedef BOOL (WINAPI * t_LookupPrivilegeValue)(LPCTSTR, LPCTSTR, PLUID);
63 extern t_OpenProcessToken p_OpenProcessToken;
64 extern t_AdjustTokenPrivileges p_AdjustTokenPrivileges;
65 extern t_LookupPrivilegeValue p_LookupPrivilegeValue;
68 typedef int (__cdecl * t_wunlink) (const wchar_t *);
69 typedef int (__cdecl * t_wmkdir) (const wchar_t *);
70 typedef int (__cdecl * t_wopen) (const wchar_t *, int, ...);
72 extern t_wunlink p_wunlink;
73 extern t_wmkdir p_wmkdir;
74 extern t_wopen p_wopen;
77 typedef BOOL (WINAPI * t_GetFileAttributesExA)(LPCSTR, GET_FILEEX_INFO_LEVELS,
79 typedef BOOL (WINAPI * t_GetFileAttributesExW)(LPCWSTR, GET_FILEEX_INFO_LEVELS,
82 typedef DWORD (WINAPI * t_GetFileAttributesA)(LPCSTR);
83 typedef DWORD (WINAPI * t_GetFileAttributesW)(LPCWSTR);
84 typedef BOOL (WINAPI * t_SetFileAttributesA)(LPCSTR, DWORD);
85 typedef BOOL (WINAPI * t_SetFileAttributesW)(LPCWSTR, DWORD);
87 typedef HANDLE (WINAPI * t_CreateFileA) (LPCSTR, DWORD ,DWORD, LPSECURITY_ATTRIBUTES,
88 DWORD , DWORD, HANDLE);
89 typedef HANDLE (WINAPI * t_CreateFileW) (LPCWSTR, DWORD ,DWORD, LPSECURITY_ATTRIBUTES,
90 DWORD , DWORD, HANDLE);
92 typedef BOOL (WINAPI * t_SetProcessShutdownParameters)(DWORD, DWORD);
93 typedef BOOL (WINAPI * t_BackupRead)(HANDLE,LPBYTE,DWORD,LPDWORD,BOOL,BOOL,LPVOID*);
94 typedef BOOL (WINAPI * t_BackupWrite)(HANDLE,LPBYTE,DWORD,LPDWORD,BOOL,BOOL,LPVOID*);
96 typedef int (WINAPI * t_WideCharToMultiByte) (UINT CodePage, DWORD , LPCWSTR, int,
97 LPSTR, int, LPCSTR, LPBOOL);
99 typedef int (WINAPI * t_MultiByteToWideChar) (UINT, DWORD, LPCSTR, int, LPWSTR, int);
100 typedef HANDLE (WINAPI * t_FindFirstFileA) (LPCSTR, LPWIN32_FIND_DATAA);
101 typedef HANDLE (WINAPI * t_FindFirstFileW) (LPCWSTR, LPWIN32_FIND_DATAW);
103 typedef BOOL (WINAPI * t_FindNextFileA) (HANDLE, LPWIN32_FIND_DATAA);
104 typedef BOOL (WINAPI * t_FindNextFileW) (HANDLE, LPWIN32_FIND_DATAW);
106 typedef BOOL (WINAPI * t_SetCurrentDirectoryA) (LPCSTR);
107 typedef BOOL (WINAPI * t_SetCurrentDirectoryW) (LPCWSTR);
109 typedef DWORD (WINAPI * t_GetCurrentDirectoryA) (DWORD, LPSTR);
110 typedef DWORD (WINAPI * t_GetCurrentDirectoryW) (DWORD, LPWSTR);
112 extern t_GetFileAttributesA p_GetFileAttributesA;
113 extern t_GetFileAttributesW p_GetFileAttributesW;
115 extern t_GetFileAttributesExA p_GetFileAttributesExA;
116 extern t_GetFileAttributesExW p_GetFileAttributesExW;
118 extern t_SetFileAttributesA p_SetFileAttributesA;
119 extern t_SetFileAttributesW p_SetFileAttributesW;
121 extern t_CreateFileA p_CreateFileA;
122 extern t_CreateFileW p_CreateFileW;
123 extern t_SetProcessShutdownParameters p_SetProcessShutdownParameters;
124 extern t_BackupRead p_BackupRead;
125 extern t_BackupWrite p_BackupWrite;
127 extern t_WideCharToMultiByte p_WideCharToMultiByte;
128 extern t_MultiByteToWideChar p_MultiByteToWideChar;
130 extern t_FindFirstFileA p_FindFirstFileA;
131 extern t_FindFirstFileW p_FindFirstFileW;
133 extern t_FindNextFileA p_FindNextFileA;
134 extern t_FindNextFileW p_FindNextFileW;
136 extern t_SetCurrentDirectoryA p_SetCurrentDirectoryA;
137 extern t_SetCurrentDirectoryW p_SetCurrentDirectoryW;
139 extern t_GetCurrentDirectoryA p_GetCurrentDirectoryA;
140 extern t_GetCurrentDirectoryW p_GetCurrentDirectoryW;
144 extern VSSClient* g_pVSSClient;
147 void InitWinAPIWrapper();
150 #endif /* __WINAPI_H */