1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-sysdeps-wince-glue.h Emulation of system/libc features for Windows CE (internal to D-Bus implementation)
4 * Copyright (C) 2002, 2003 Red Hat, Inc.
5 * Copyright (C) 2003 CodeFactory AB
7 * Licensed under the Academic Free License version 2.1
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 #ifndef DBUS_SYSDEPS_WINCE_GLUE_H
26 #define DBUS_SYSDEPS_WINCE_GLUE_H
36 /* shlobj.h declares these only for _WIN32_IE that we don't want to define.
37 In any case, with mingw32ce we only get a SHGetSpecialFolderPath. */
38 #define SHGetSpecialFolderPathW SHGetSpecialFolderPath
39 BOOL WINAPI SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
40 BOOL WINAPI SHGetSpecialFolderPathW(HWND,LPWSTR,int,BOOL);
42 #ifndef TLS_OUT_OF_INDEXES
43 #define TLS_OUT_OF_INDEXES 0xffffffff
47 /* Seriously. Windows CE does not have errno. Don't you hate it when
49 #define errno (GetLastError ())
51 #define ENOENT ERROR_FILE_NOT_FOUND
52 #define EMFILE ERROR_TOO_MANY_OPEN_FILES
53 #define EACCES ERROR_ACCESS_DENIED
54 #define EBADF ERROR_INVALID_HANDLE
55 #define ENOMEM ERROR_NOT_ENOUGH_MEMORY
56 #define EXDEV ERROR_NOT_SAME_DEVICE
57 #define ENFILE ERROR_NO_MORE_FILES
58 #define EROFS ERROR_WRITE_PROTECT
59 #define ENOLCK ERROR_SHARING_BUFFER_EXCEEDED
60 #define ENOSYS ERROR_NOT_SUPPORTED
61 #define EEXIST ERROR_FILE_EXISTS
62 #define EPERM ERROR_CANNOT_MAKE
63 #define EINVAL ERROR_INVALID_PARAMETER
64 #define EINTR ERROR_INVALID_AT_INTERRUPT_TIME
65 #define EPIPE ERROR_BROKEN_PIPE
66 #define ENOSPC ERROR_DISK_FULL
67 #define ENOTEMPTY ERROR_DIR_NOT_EMPTY
68 #define EBUSY ERROR_BUSY
69 #define ENAMETOOLONG ERROR_FILENAME_EXCED_RANGE
70 #define EAGAIN ERROR_MORE_DATA
71 #define ENOTDIR ERROR_DIRECTORY
72 #define ERANGE ERROR_ARITHMETIC_OVERFLOW
73 #define ENXIO ERROR_FILE_INVALID
74 #define EFAULT ERROR_PROCESS_ABORTED
75 #define EIO ERROR_IO_DEVICE
76 #define EDEADLOCK ERROR_POSSIBLE_DEADLOCK
77 #define ENODEV ERROR_BAD_DEVICE
79 /* Windows CE is missing more stuff that is pretty standard. */
81 #define strdup _strdup
82 #define stricmp _stricmp
83 #define strnicmp _strnicmp
85 #define environ _dbus_wince_environ
86 extern char *environ[];
88 #define getenv _dbus_wince_getenv
89 char *getenv (const char *name);
91 #define putenv _dbus_wince_putenv
92 int putenv (char *str);
94 #define clock _dbus_wince_clock
97 #define abort _dbus_wince_abort
100 #define _S_IFMT 0170000 /* file type mask */
101 #define _S_IFDIR 0040000 /* directory */
102 #define _S_IFCHR 0020000 /* character special */
103 #define _S_IFIFO 0010000 /* pipe */
104 #define _S_IFREG 0100000 /* regular */
105 #define _S_IREAD 0000400 /* read permission, owner */
106 #define _S_IWRITE 0000200 /* write permission, owner */
107 #define _S_IEXEC 0000100 /* execute/search permission, owner */
108 #ifndef __OFF_T_DEFINED
110 #define __OFF_T_DEFINED
114 #define _MAX_FNAME 256
128 /* Windows CE is missing some Windows functions that we want. */
130 #define GetSystemTimeAsFileTime _dbus_wince_GetSystemTimeAsFileTime
131 void GetSystemTimeAsFileTime (LPFILETIME ftp);
133 #define _mbsrchr _dbus_wince_mbsrchr
134 unsigned char* _mbsrchr (const unsigned char*, unsigned int);
136 #define OpenFileMappingA _dbus_wince_OpenFileMappingA
137 HANDLE OpenFileMappingA(DWORD,BOOL,LPCSTR);
139 #define MoveFileExA _dbus_wince_MoveFileExA
140 BOOL MoveFileExA(LPCSTR,LPCSTR,DWORD);
141 #ifndef MOVEFILE_REPLACE_EXISTING
142 #define MOVEFILE_REPLACE_EXISTING 0x00000001
145 #define SetHandleInformation _dbus_wince_SetHandleInformation
146 BOOL SetHandleInformation(HANDLE,DWORD,DWORD);
147 #ifndef HANDLE_FLAG_INHERIT
148 #define HANDLE_FLAG_INHERIT 0x01
150 #ifndef HANDLE_FLAG_PROTECT
151 #define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x02
154 #define SearchPathA _dbus_wince_SearchPathA
155 DWORD SearchPathA(LPCSTR,LPCSTR,LPCSTR,DWORD,LPSTR,LPSTR*);
157 /* Instead of emulating all functions needed for this, we replace the
159 dbus_bool_t _dbus_getsid(char **sid);
162 #define LookupAccountNameW _dbus_wince_LookupAccountNameW
163 BOOL LookupAccountNameW(LPCWSTR,LPCWSTR,PSID,PDWORD,LPWSTR,PDWORD,PSID_NAME_USE);
165 #define IsValidSid _dbus_wince_IsValidSid
166 BOOL IsValidSid(PSID);
169 /* Windows CE does only have the UNICODE interfaces (FooW), but we
170 want to use the ASCII interfaces (FooA). We implement them
173 #define CreateFileA _dbus_wince_CreateFileA
174 HANDLE CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE);
176 #define DeleteFileA _dbus_wince_DeleteFileA
177 BOOL DeleteFileA(LPCSTR);
179 #define GetFileAttributesA _dbus_wince_GetFileAttributesA
180 DWORD GetFileAttributesA(LPCSTR);
182 #define GetFileAttributesExA _dbus_wince_GetFileAttributesExA
183 BOOL GetFileAttributesExA(LPCSTR,GET_FILEEX_INFO_LEVELS,PVOID);
185 #define CreateFileMappingA _dbus_wince_CreateFileMappingA
186 HANDLE CreateFileMappingA(HANDLE,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCSTR);
188 #define CreateDirectoryA _dbus_wince_CreateDirectoryA
189 BOOL CreateDirectoryA(LPCSTR,LPSECURITY_ATTRIBUTES);
191 #define RemoveDirectoryA _dbus_wince_RemoveDirectoryA
192 BOOL RemoveDirectoryA(LPCSTR);
194 #define FindFirstFileA _dbus_wince_FindFirstFileA
195 HANDLE FindFirstFileA(LPCSTR,LPWIN32_FIND_DATAA);
197 #define FindNextFileA _dbus_wince_FindNextFileA
198 BOOL FindNextFileA(HANDLE,LPWIN32_FIND_DATAA);
200 #define CreateMutexA _dbus_wince_CreateMutexA
201 HANDLE CreateMutexA(LPSECURITY_ATTRIBUTES,BOOL,LPCSTR);
203 #define CreateProcessA _dbus_wince_CreateProcessA
204 BOOL CreateProcessA(LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,PVOID,LPCSTR,LPSTARTUPINFOA,LPPROCESS_INFORMATION);
205 #ifndef CREATE_NO_WINDOW
206 #define CREATE_NO_WINDOW 0x08000000
210 #define RegOpenKeyExA _dbus_wince_RegOpenKeyExA
211 LONG RegOpenKeyExA(HKEY,LPCSTR,DWORD,REGSAM,PHKEY);
213 #define RegQueryValueExA _dbus_wince_RegQueryValueExA
214 LONG WINAPI RegQueryValueExA(HKEY,LPCSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
217 #define FormatMessageA _dbus_wince_FormatMessageA
218 DWORD FormatMessageA(DWORD,PCVOID,DWORD,DWORD,LPSTR,DWORD,va_list*);
220 #define GetModuleFileNameA _dbus_wince_GetModuleFileNameA
221 DWORD GetModuleFileNameA(HINSTANCE,LPSTR,DWORD);
223 #define GetTempPathA _dbus_wince_GetTempPathA
224 DWORD GetTempPathA(DWORD,LPSTR);
226 #define SHGetSpecialFolderPathA _dbus_wince_SHGetSpecialFolderPathA
227 BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
232 #endif /* DBUS_SYSDEPS_WINCE_GLUE_H */