Send system log messages to debug port for now.
[platform/upstream/dbus.git] / dbus / dbus-sysdeps-wince-glue.h
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)
3  * 
4  * Copyright (C) 2002, 2003  Red Hat, Inc.
5  * Copyright (C) 2003 CodeFactory AB
6  *
7  * Licensed under the Academic Free License version 2.1
8  * 
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.
13  *
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.
18  * 
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
22  *
23  */
24
25 #ifndef DBUS_SYSDEPS_WINCE_GLUE_H
26 #define DBUS_SYSDEPS_WINCE_GLUE_H
27
28 #include <time.h>
29 #include <stdarg.h>
30
31 /* For getaddrinfo.  */
32 #define _WIN32_WCE 0x0401 
33 #include <windows.h>
34 #undef interface
35
36 DBUS_BEGIN_DECLS
37
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);
43
44 #ifndef TLS_OUT_OF_INDEXES
45 #define TLS_OUT_OF_INDEXES 0xffffffff
46 #endif
47
48
49 /* Seriously.  Windows CE does not have errno.  Don't you hate it when
50    that happens?  */
51 #define errno ((int)GetLastError ())
52
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
80
81 /* Windows CE is missing more stuff that is pretty standard.  */
82
83 #define strdup _strdup
84 #define stricmp _stricmp
85 #define strnicmp _strnicmp
86
87 #define environ _dbus_wince_environ
88 extern char *environ[];
89
90 #define getenv _dbus_wince_getenv
91 char *getenv (const char *name);
92
93 #define putenv _dbus_wince_putenv
94 int putenv (char *str);
95
96 #define clock _dbus_wince_clock
97 clock_t clock (void);
98
99 #define abort _dbus_wince_abort
100 void abort (void);
101
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
111 typedef long off_t;
112 #define __OFF_T_DEFINED
113 #endif
114
115 #ifndef _MAX_FNAME
116 #define _MAX_FNAME 256
117 #endif
118
119 #ifndef _IOFBF
120 #define _IOFBF  0
121 #endif
122 #ifndef _IOLBF
123 #define _IOLBF  1
124 #endif
125 #ifndef _IONBF
126 #define _IONBF  2
127 #endif
128
129
130 /* Windows CE is missing some Windows functions that we want.  */
131
132 #define GetSystemTimeAsFileTime _dbus_wince_GetSystemTimeAsFileTime
133 void GetSystemTimeAsFileTime (LPFILETIME ftp);
134
135 #define _mbsrchr _dbus_wince_mbsrchr
136 unsigned char* _mbsrchr (const unsigned char*, unsigned int);
137
138 #define OpenFileMappingA _dbus_wince_OpenFileMappingA
139 HANDLE OpenFileMappingA(DWORD,BOOL,LPCSTR);
140
141 #define MoveFileExA _dbus_wince_MoveFileExA
142 BOOL MoveFileExA(LPCSTR,LPCSTR,DWORD);
143 #ifndef MOVEFILE_REPLACE_EXISTING
144 #define MOVEFILE_REPLACE_EXISTING 0x00000001
145 #endif
146
147 #define SetHandleInformation _dbus_wince_SetHandleInformation
148 BOOL SetHandleInformation(HANDLE,DWORD,DWORD);
149 #ifndef HANDLE_FLAG_INHERIT
150 #define HANDLE_FLAG_INHERIT 0x01
151 #endif
152 #ifndef HANDLE_FLAG_PROTECT
153 #define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x02
154 #endif
155
156 #define SearchPathA _dbus_wince_SearchPathA
157 DWORD SearchPathA(LPCSTR,LPCSTR,LPCSTR,DWORD,LPSTR,LPSTR*);
158
159 /* Instead of emulating all functions needed for this, we replace the
160    whole thing.  */
161 dbus_bool_t _dbus_getsid(char **sid);
162
163
164 #define LookupAccountNameW _dbus_wince_LookupAccountNameW
165 BOOL LookupAccountNameW(LPCWSTR,LPCWSTR,PSID,PDWORD,LPWSTR,PDWORD,PSID_NAME_USE);
166
167 #define IsValidSid _dbus_wince_IsValidSid
168 BOOL IsValidSid(PSID);
169
170
171 /* Windows CE does only have the UNICODE interfaces (FooW), but we
172    want to use the ASCII interfaces (FooA).  We implement them
173    here.  */
174
175 #define CreateFileA _dbus_wince_CreateFileA
176 HANDLE CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE);
177
178 #define DeleteFileA _dbus_wince_DeleteFileA
179 BOOL DeleteFileA(LPCSTR);
180
181 #define GetFileAttributesA _dbus_wince_GetFileAttributesA
182 DWORD GetFileAttributesA(LPCSTR);
183
184 #define GetFileAttributesExA _dbus_wince_GetFileAttributesExA
185 BOOL GetFileAttributesExA(LPCSTR,GET_FILEEX_INFO_LEVELS,PVOID);
186
187 #define CreateFileMappingA _dbus_wince_CreateFileMappingA
188 HANDLE CreateFileMappingA(HANDLE,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCSTR);
189
190 #define CreateDirectoryA _dbus_wince_CreateDirectoryA
191 BOOL CreateDirectoryA(LPCSTR,LPSECURITY_ATTRIBUTES);
192
193 #define RemoveDirectoryA _dbus_wince_RemoveDirectoryA
194 BOOL RemoveDirectoryA(LPCSTR);
195
196 #define FindFirstFileA _dbus_wince_FindFirstFileA
197 HANDLE FindFirstFileA(LPCSTR,LPWIN32_FIND_DATAA);
198
199 #define FindNextFileA _dbus_wince_FindNextFileA
200 BOOL FindNextFileA(HANDLE,LPWIN32_FIND_DATAA);
201
202 #define CreateMutexA _dbus_wince_CreateMutexA
203 HANDLE CreateMutexA(LPSECURITY_ATTRIBUTES,BOOL,LPCSTR);
204
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
209 #endif
210
211
212 #define RegOpenKeyExA _dbus_wince_RegOpenKeyExA
213 LONG RegOpenKeyExA(HKEY,LPCSTR,DWORD,REGSAM,PHKEY);
214
215 #define RegQueryValueExA _dbus_wince_RegQueryValueExA
216 LONG WINAPI RegQueryValueExA(HKEY,LPCSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
217
218
219 #define FormatMessageA _dbus_wince_FormatMessageA
220 DWORD FormatMessageA(DWORD,PCVOID,DWORD,DWORD,LPSTR,DWORD,va_list*);
221
222 #define GetModuleFileNameA _dbus_wince_GetModuleFileNameA
223 DWORD GetModuleFileNameA(HINSTANCE,LPSTR,DWORD);
224
225 #define GetTempPathA _dbus_wince_GetTempPathA
226 DWORD GetTempPathA(DWORD,LPSTR);
227
228 #define SHGetSpecialFolderPathA _dbus_wince_SHGetSpecialFolderPathA
229 BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
230
231
232 DBUS_END_DECLS
233
234 #endif /* DBUS_SYSDEPS_WINCE_GLUE_H */