D-Bus 1.6.12
|
00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ 00002 /* dbus-sysdeps-wince-glue.h Emulation of system/libc features for Windows CE (internal to D-Bus implementation) 00003 * 00004 * Copyright (C) 2002, 2003 Red Hat, Inc. 00005 * Copyright (C) 2003 CodeFactory AB 00006 * 00007 * Licensed under the Academic Free License version 2.1 00008 * 00009 * This program is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00022 * 00023 */ 00024 00025 #ifndef DBUS_SYSDEPS_WINCE_GLUE_H 00026 #define DBUS_SYSDEPS_WINCE_GLUE_H 00027 00028 #include <time.h> 00029 #include <stdarg.h> 00030 00031 /* For getaddrinfo, configure/cmake defined _WIN32_WCE to something >= 0x0401. */ 00032 #include <windows.h> 00033 #undef interface 00034 00035 DBUS_BEGIN_DECLS 00036 00037 /* shlobj.h declares these only for _WIN32_IE that we don't want to define. 00038 In any case, with mingw32ce we only get a SHGetSpecialFolderPath. */ 00039 #define SHGetSpecialFolderPathW SHGetSpecialFolderPath 00040 BOOL WINAPI SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL); 00041 BOOL WINAPI SHGetSpecialFolderPathW(HWND,LPWSTR,int,BOOL); 00042 00043 #ifndef TLS_OUT_OF_INDEXES 00044 #define TLS_OUT_OF_INDEXES 0xffffffff 00045 #endif 00046 00047 00048 /* Seriously. Windows CE does not have errno. Don't you hate it when 00049 that happens? */ 00050 #define errno ((int)GetLastError ()) 00051 00052 #define ENOENT ERROR_FILE_NOT_FOUND 00053 #define EMFILE ERROR_TOO_MANY_OPEN_FILES 00054 #define EACCES ERROR_ACCESS_DENIED 00055 #define EBADF ERROR_INVALID_HANDLE 00056 #define ENOMEM ERROR_NOT_ENOUGH_MEMORY 00057 #define EXDEV ERROR_NOT_SAME_DEVICE 00058 #define ENFILE ERROR_NO_MORE_FILES 00059 #define EROFS ERROR_WRITE_PROTECT 00060 #define ENOLCK ERROR_SHARING_BUFFER_EXCEEDED 00061 #define ENOSYS ERROR_NOT_SUPPORTED 00062 #define EEXIST ERROR_FILE_EXISTS 00063 #define EPERM ERROR_CANNOT_MAKE 00064 #define EINVAL ERROR_INVALID_PARAMETER 00065 #define EINTR ERROR_INVALID_AT_INTERRUPT_TIME 00066 #define EPIPE ERROR_BROKEN_PIPE 00067 #define ENOSPC ERROR_DISK_FULL 00068 #define ENOTEMPTY ERROR_DIR_NOT_EMPTY 00069 #define EBUSY ERROR_BUSY 00070 #define ENAMETOOLONG ERROR_FILENAME_EXCED_RANGE 00071 #define EAGAIN ERROR_MORE_DATA 00072 #define ENOTDIR ERROR_DIRECTORY 00073 #define ERANGE ERROR_ARITHMETIC_OVERFLOW 00074 #define ENXIO ERROR_FILE_INVALID 00075 #define EFAULT ERROR_PROCESS_ABORTED 00076 #define EIO ERROR_IO_DEVICE 00077 #define EDEADLOCK ERROR_POSSIBLE_DEADLOCK 00078 #define ENODEV ERROR_BAD_DEVICE 00079 00080 /* Windows CE is missing more stuff that is pretty standard. */ 00081 00082 #define strdup _strdup 00083 #define stricmp _stricmp 00084 #define strnicmp _strnicmp 00085 00086 #define environ _dbus_wince_environ 00087 extern char *environ[]; 00088 00089 #define getenv _dbus_wince_getenv 00090 char *getenv (const char *name); 00091 00092 #define putenv _dbus_wince_putenv 00093 int putenv (char *str); 00094 00095 #define clock _dbus_wince_clock 00096 clock_t clock (void); 00097 00098 #define abort _dbus_wince_abort 00099 void abort (void); 00100 00101 #define _S_IFMT 0170000 /* file type mask */ 00102 #define _S_IFDIR 0040000 /* directory */ 00103 #define _S_IFCHR 0020000 /* character special */ 00104 #define _S_IFIFO 0010000 /* pipe */ 00105 #define _S_IFREG 0100000 /* regular */ 00106 #define _S_IREAD 0000400 /* read permission, owner */ 00107 #define _S_IWRITE 0000200 /* write permission, owner */ 00108 #define _S_IEXEC 0000100 /* execute/search permission, owner */ 00109 00110 #ifndef __OFF_T_DEFINED 00111 typedef long off_t; 00112 #define __OFF_T_DEFINED 00113 #endif 00114 #ifndef _INTPTR_T_DEFINED 00115 typedef int intptr_t; 00116 #define _INTPTR_T_DEFINED 00117 #endif 00118 #ifndef _UINTPTR_T_DEFINED 00119 typedef unsigned int uintptr_t; 00120 #define _UINTPTR_T_DEFINED 00121 #endif 00122 00123 #ifndef _MAX_FNAME 00124 #define _MAX_FNAME 256 00125 #endif 00126 00127 #ifndef _IOFBF 00128 #define _IOFBF 0 00129 #endif 00130 #ifndef _IOLBF 00131 #define _IOLBF 1 00132 #endif 00133 #ifndef _IONBF 00134 #define _IONBF 2 00135 #endif 00136 00137 00138 /* Windows CE is missing some Windows functions that we want. */ 00139 00140 #define GetSystemTimeAsFileTime _dbus_wince_GetSystemTimeAsFileTime 00141 void GetSystemTimeAsFileTime (LPFILETIME ftp); 00142 00143 #define _mbsrchr _dbus_wince_mbsrchr 00144 unsigned char* _mbsrchr (const unsigned char*, unsigned int); 00145 00146 #define OpenFileMappingA _dbus_wince_OpenFileMappingA 00147 HANDLE OpenFileMappingA(DWORD,BOOL,LPCSTR); 00148 00149 #define MoveFileExA _dbus_wince_MoveFileExA 00150 BOOL MoveFileExA(LPCSTR,LPCSTR,DWORD); 00151 #ifndef MOVEFILE_REPLACE_EXISTING 00152 #define MOVEFILE_REPLACE_EXISTING 0x00000001 00153 #endif 00154 00155 #define SetHandleInformation _dbus_wince_SetHandleInformation 00156 BOOL SetHandleInformation(HANDLE,DWORD,DWORD); 00157 #ifndef HANDLE_FLAG_INHERIT 00158 #define HANDLE_FLAG_INHERIT 0x01 00159 #endif 00160 #ifndef HANDLE_FLAG_PROTECT 00161 #define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x02 00162 #endif 00163 00164 #define SearchPathA _dbus_wince_SearchPathA 00165 DWORD SearchPathA(LPCSTR,LPCSTR,LPCSTR,DWORD,LPSTR,LPSTR*); 00166 00167 /* Instead of emulating all functions needed for this, we replace the 00168 whole thing. */ 00169 dbus_bool_t _dbus_getsid(char **sid); 00170 00171 00172 #define LookupAccountNameW _dbus_wince_LookupAccountNameW 00173 BOOL LookupAccountNameW(LPCWSTR,LPCWSTR,PSID,PDWORD,LPWSTR,PDWORD,PSID_NAME_USE); 00174 00175 #define IsValidSid _dbus_wince_IsValidSid 00176 BOOL IsValidSid(PSID); 00177 00178 00179 /* Windows CE does only have the UNICODE interfaces (FooW), but we 00180 want to use the ASCII interfaces (FooA). We implement them 00181 here. */ 00182 00183 #define CreateFileA _dbus_wince_CreateFileA 00184 HANDLE CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE); 00185 00186 #define DeleteFileA _dbus_wince_DeleteFileA 00187 BOOL DeleteFileA(LPCSTR); 00188 00189 #define GetFileAttributesA _dbus_wince_GetFileAttributesA 00190 DWORD GetFileAttributesA(LPCSTR); 00191 00192 #define GetFileAttributesExA _dbus_wince_GetFileAttributesExA 00193 BOOL GetFileAttributesExA(LPCSTR,GET_FILEEX_INFO_LEVELS,PVOID); 00194 00195 #define CreateFileMappingA _dbus_wince_CreateFileMappingA 00196 HANDLE CreateFileMappingA(HANDLE,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCSTR); 00197 00198 #define CreateDirectoryA _dbus_wince_CreateDirectoryA 00199 BOOL CreateDirectoryA(LPCSTR,LPSECURITY_ATTRIBUTES); 00200 00201 #define RemoveDirectoryA _dbus_wince_RemoveDirectoryA 00202 BOOL RemoveDirectoryA(LPCSTR); 00203 00204 #define FindFirstFileA _dbus_wince_FindFirstFileA 00205 HANDLE FindFirstFileA(LPCSTR,LPWIN32_FIND_DATAA); 00206 00207 #define FindNextFileA _dbus_wince_FindNextFileA 00208 BOOL FindNextFileA(HANDLE,LPWIN32_FIND_DATAA); 00209 00210 #define CreateMutexA _dbus_wince_CreateMutexA 00211 HANDLE CreateMutexA(LPSECURITY_ATTRIBUTES,BOOL,LPCSTR); 00212 00213 #define CreateProcessA _dbus_wince_CreateProcessA 00214 BOOL CreateProcessA(LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,PVOID,LPCSTR,LPSTARTUPINFOA,LPPROCESS_INFORMATION); 00215 #ifndef CREATE_NO_WINDOW 00216 #define CREATE_NO_WINDOW 0x08000000 00217 #endif 00218 00219 00220 #define RegOpenKeyExA _dbus_wince_RegOpenKeyExA 00221 LONG RegOpenKeyExA(HKEY,LPCSTR,DWORD,REGSAM,PHKEY); 00222 00223 #define RegQueryValueExA _dbus_wince_RegQueryValueExA 00224 LONG WINAPI RegQueryValueExA(HKEY,LPCSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD); 00225 00226 00227 #define FormatMessageA _dbus_wince_FormatMessageA 00228 DWORD FormatMessageA(DWORD,PCVOID,DWORD,DWORD,LPSTR,DWORD,va_list*); 00229 00230 #define GetModuleFileNameA _dbus_wince_GetModuleFileNameA 00231 DWORD GetModuleFileNameA(HINSTANCE,LPSTR,DWORD); 00232 00233 #define GetTempPathA _dbus_wince_GetTempPathA 00234 DWORD GetTempPathA(DWORD,LPSTR); 00235 00236 #define SHGetSpecialFolderPathA _dbus_wince_SHGetSpecialFolderPathA 00237 BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL); 00238 00239 00240 #define OutputDebugStringA _dbus_wince_OutputDebugStringA 00241 void OutputDebugStringA(LPCSTR); 00242 00243 00244 DBUS_END_DECLS 00245 00246 #endif /* DBUS_SYSDEPS_WINCE_GLUE_H */