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
31 /* For getaddrinfo. */
32 #define _WIN32_WCE 0x0401
38 /* shlobj.h declares these only for _WIN32_IE that we don't want to define.
39 In any case, with mingw32ce we only get a SHGetSpecialFolderPath. */
40 #define SHGetSpecialFolderPathW SHGetSpecialFolderPath
41 BOOL WINAPI SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
42 BOOL WINAPI SHGetSpecialFolderPathW(HWND,LPWSTR,int,BOOL);
44 #ifndef TLS_OUT_OF_INDEXES
45 #define TLS_OUT_OF_INDEXES 0xffffffff
49 /* Seriously. Windows CE does not have errno. Don't you hate it when
51 #define errno ((int)GetLastError ())
53 #define ENOENT ERROR_FILE_NOT_FOUND
54 #define EMFILE ERROR_TOO_MANY_OPEN_FILES
55 #define EACCES ERROR_ACCESS_DENIED
56 #define EBADF ERROR_INVALID_HANDLE
57 #define ENOMEM ERROR_NOT_ENOUGH_MEMORY
58 #define EXDEV ERROR_NOT_SAME_DEVICE
59 #define ENFILE ERROR_NO_MORE_FILES
60 #define EROFS ERROR_WRITE_PROTECT
61 #define ENOLCK ERROR_SHARING_BUFFER_EXCEEDED
62 #define ENOSYS ERROR_NOT_SUPPORTED
63 #define EEXIST ERROR_FILE_EXISTS
64 #define EPERM ERROR_CANNOT_MAKE
65 #define EINVAL ERROR_INVALID_PARAMETER
66 #define EINTR ERROR_INVALID_AT_INTERRUPT_TIME
67 #define EPIPE ERROR_BROKEN_PIPE
68 #define ENOSPC ERROR_DISK_FULL
69 #define ENOTEMPTY ERROR_DIR_NOT_EMPTY
70 #define EBUSY ERROR_BUSY
71 #define ENAMETOOLONG ERROR_FILENAME_EXCED_RANGE
72 #define EAGAIN ERROR_MORE_DATA
73 #define ENOTDIR ERROR_DIRECTORY
74 #define ERANGE ERROR_ARITHMETIC_OVERFLOW
75 #define ENXIO ERROR_FILE_INVALID
76 #define EFAULT ERROR_PROCESS_ABORTED
77 #define EIO ERROR_IO_DEVICE
78 #define EDEADLOCK ERROR_POSSIBLE_DEADLOCK
79 #define ENODEV ERROR_BAD_DEVICE
81 /* Windows CE is missing more stuff that is pretty standard. */
83 #define strdup _strdup
84 #define stricmp _stricmp
85 #define strnicmp _strnicmp
87 #define environ _dbus_wince_environ
88 extern char *environ[];
90 #define getenv _dbus_wince_getenv
91 char *getenv (const char *name);
93 #define putenv _dbus_wince_putenv
94 int putenv (char *str);
96 #define clock _dbus_wince_clock
99 #define abort _dbus_wince_abort
102 #define _S_IFMT 0170000 /* file type mask */
103 #define _S_IFDIR 0040000 /* directory */
104 #define _S_IFCHR 0020000 /* character special */
105 #define _S_IFIFO 0010000 /* pipe */
106 #define _S_IFREG 0100000 /* regular */
107 #define _S_IREAD 0000400 /* read permission, owner */
108 #define _S_IWRITE 0000200 /* write permission, owner */
109 #define _S_IEXEC 0000100 /* execute/search permission, owner */
110 #ifndef __OFF_T_DEFINED
112 #define __OFF_T_DEFINED
116 #define _MAX_FNAME 256
130 /* Windows CE is missing some Windows functions that we want. */
132 #define GetSystemTimeAsFileTime _dbus_wince_GetSystemTimeAsFileTime
133 void GetSystemTimeAsFileTime (LPFILETIME ftp);
135 #define _mbsrchr _dbus_wince_mbsrchr
136 unsigned char* _mbsrchr (const unsigned char*, unsigned int);
138 #define OpenFileMappingA _dbus_wince_OpenFileMappingA
139 HANDLE OpenFileMappingA(DWORD,BOOL,LPCSTR);
141 #define MoveFileExA _dbus_wince_MoveFileExA
142 BOOL MoveFileExA(LPCSTR,LPCSTR,DWORD);
143 #ifndef MOVEFILE_REPLACE_EXISTING
144 #define MOVEFILE_REPLACE_EXISTING 0x00000001
147 #define SetHandleInformation _dbus_wince_SetHandleInformation
148 BOOL SetHandleInformation(HANDLE,DWORD,DWORD);
149 #ifndef HANDLE_FLAG_INHERIT
150 #define HANDLE_FLAG_INHERIT 0x01
152 #ifndef HANDLE_FLAG_PROTECT
153 #define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x02
156 #define SearchPathA _dbus_wince_SearchPathA
157 DWORD SearchPathA(LPCSTR,LPCSTR,LPCSTR,DWORD,LPSTR,LPSTR*);
159 /* Instead of emulating all functions needed for this, we replace the
161 dbus_bool_t _dbus_getsid(char **sid);
164 #define LookupAccountNameW _dbus_wince_LookupAccountNameW
165 BOOL LookupAccountNameW(LPCWSTR,LPCWSTR,PSID,PDWORD,LPWSTR,PDWORD,PSID_NAME_USE);
167 #define IsValidSid _dbus_wince_IsValidSid
168 BOOL IsValidSid(PSID);
171 /* Windows CE does only have the UNICODE interfaces (FooW), but we
172 want to use the ASCII interfaces (FooA). We implement them
175 #define CreateFileA _dbus_wince_CreateFileA
176 HANDLE CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE);
178 #define DeleteFileA _dbus_wince_DeleteFileA
179 BOOL DeleteFileA(LPCSTR);
181 #define GetFileAttributesA _dbus_wince_GetFileAttributesA
182 DWORD GetFileAttributesA(LPCSTR);
184 #define GetFileAttributesExA _dbus_wince_GetFileAttributesExA
185 BOOL GetFileAttributesExA(LPCSTR,GET_FILEEX_INFO_LEVELS,PVOID);
187 #define CreateFileMappingA _dbus_wince_CreateFileMappingA
188 HANDLE CreateFileMappingA(HANDLE,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCSTR);
190 #define CreateDirectoryA _dbus_wince_CreateDirectoryA
191 BOOL CreateDirectoryA(LPCSTR,LPSECURITY_ATTRIBUTES);
193 #define RemoveDirectoryA _dbus_wince_RemoveDirectoryA
194 BOOL RemoveDirectoryA(LPCSTR);
196 #define FindFirstFileA _dbus_wince_FindFirstFileA
197 HANDLE FindFirstFileA(LPCSTR,LPWIN32_FIND_DATAA);
199 #define FindNextFileA _dbus_wince_FindNextFileA
200 BOOL FindNextFileA(HANDLE,LPWIN32_FIND_DATAA);
202 #define CreateMutexA _dbus_wince_CreateMutexA
203 HANDLE CreateMutexA(LPSECURITY_ATTRIBUTES,BOOL,LPCSTR);
205 #define CreateProcessA _dbus_wince_CreateProcessA
206 BOOL CreateProcessA(LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,PVOID,LPCSTR,LPSTARTUPINFOA,LPPROCESS_INFORMATION);
207 #ifndef CREATE_NO_WINDOW
208 #define CREATE_NO_WINDOW 0x08000000
212 #define RegOpenKeyExA _dbus_wince_RegOpenKeyExA
213 LONG RegOpenKeyExA(HKEY,LPCSTR,DWORD,REGSAM,PHKEY);
215 #define RegQueryValueExA _dbus_wince_RegQueryValueExA
216 LONG WINAPI RegQueryValueExA(HKEY,LPCSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
219 #define FormatMessageA _dbus_wince_FormatMessageA
220 DWORD FormatMessageA(DWORD,PCVOID,DWORD,DWORD,LPSTR,DWORD,va_list*);
222 #define GetModuleFileNameA _dbus_wince_GetModuleFileNameA
223 DWORD GetModuleFileNameA(HINSTANCE,LPSTR,DWORD);
225 #define GetTempPathA _dbus_wince_GetTempPathA
226 DWORD GetTempPathA(DWORD,LPSTR);
228 #define SHGetSpecialFolderPathA _dbus_wince_SHGetSpecialFolderPathA
229 BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
234 #endif /* DBUS_SYSDEPS_WINCE_GLUE_H */