D-Bus: dbus-sysdeps-wince-glue.h Source File

D-Bus 1.14.10

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, configure/cmake defined _WIN32_WCE to something >= 0x0401. */
32#include <windows.h>
33#undef interface
34
35 DBUS_BEGIN_DECLS
36
37/* shlobj.h declares these only for _WIN32_IE that we don't want to define.
38 In any case, with mingw32ce we only get a SHGetSpecialFolderPath. */
39#define SHGetSpecialFolderPathW SHGetSpecialFolderPath
40BOOL WINAPI SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
41BOOL WINAPI SHGetSpecialFolderPathW(HWND,LPWSTR,int,BOOL);
42
43#ifndef TLS_OUT_OF_INDEXES
44#define TLS_OUT_OF_INDEXES 0xffffffff
45#endif
46
47
48/* Seriously. Windows CE does not have errno. Don't you hate it when
49 that happens? */
50#define errno ((int)GetLastError ())
51
52#define ENOENT ERROR_FILE_NOT_FOUND
53#define EMFILE ERROR_TOO_MANY_OPEN_FILES
54#define EACCES ERROR_ACCESS_DENIED
55#define EBADF ERROR_INVALID_HANDLE
56#define ENOMEM ERROR_NOT_ENOUGH_MEMORY
57#define EXDEV ERROR_NOT_SAME_DEVICE
58#define ENFILE ERROR_NO_MORE_FILES
59#define EROFS ERROR_WRITE_PROTECT
60#define ENOLCK ERROR_SHARING_BUFFER_EXCEEDED
61#define ENOSYS ERROR_NOT_SUPPORTED
62#define EEXIST ERROR_FILE_EXISTS
63#define EPERM ERROR_CANNOT_MAKE
64#define EINVAL ERROR_INVALID_PARAMETER
65#define EINTR ERROR_INVALID_AT_INTERRUPT_TIME
66#define EPIPE ERROR_BROKEN_PIPE
67#define ENOSPC ERROR_DISK_FULL
68#define ENOTEMPTY ERROR_DIR_NOT_EMPTY
69#define EBUSY ERROR_BUSY
70#define ENAMETOOLONG ERROR_FILENAME_EXCED_RANGE
71#define EAGAIN ERROR_MORE_DATA
72#define ENOTDIR ERROR_DIRECTORY
73#define ERANGE ERROR_ARITHMETIC_OVERFLOW
74#define ENXIO ERROR_FILE_INVALID
75#define EFAULT ERROR_PROCESS_ABORTED
76#define EIO ERROR_IO_DEVICE
77#define EDEADLOCK ERROR_POSSIBLE_DEADLOCK
78#define ENODEV ERROR_BAD_DEVICE
79
80/* Windows CE is missing more stuff that is pretty standard. */
81
82#define strdup _strdup
83#define stricmp _stricmp
84#define strnicmp _strnicmp
85
86#define environ _dbus_wince_environ
87extern char *environ[];
88
89#define getenv _dbus_wince_getenv
90char *getenv (const char *name);
91
92#define putenv _dbus_wince_putenv
93int putenv (char *str);
94
95#define clock _dbus_wince_clock
96clock_t clock (void);
97
98#define abort _dbus_wince_abort
99void abort (void);
100
101#define _S_IFMT 0170000 /* file type mask */
102#define _S_IFDIR 0040000 /* directory */
103#define _S_IFCHR 0020000 /* character special */
104#define _S_IFIFO 0010000 /* pipe */
105#define _S_IFREG 0100000 /* regular */
106#define _S_IREAD 0000400 /* read permission, owner */
107#define _S_IWRITE 0000200 /* write permission, owner */
108#define _S_IEXEC 0000100 /* execute/search permission, owner */
109
110#ifndef __OFF_T_DEFINED
111typedef long off_t;
112#define __OFF_T_DEFINED
113#endif
114#ifndef _INTPTR_T_DEFINED
115typedef int intptr_t;
116#define _INTPTR_T_DEFINED
117#endif
118#ifndef _UINTPTR_T_DEFINED
119typedef unsigned int uintptr_t;
120#define _UINTPTR_T_DEFINED
121#endif
122
123#ifndef _MAX_FNAME
124#define _MAX_FNAME 256
125#endif
126
127#ifndef _IOFBF
128#define _IOFBF 0
129#endif
130#ifndef _IOLBF
131#define _IOLBF 1
132#endif
133#ifndef _IONBF
134#define _IONBF 2
135#endif
136
137
138/* Windows CE is missing some Windows functions that we want. */
139
140#define GetSystemTimeAsFileTime _dbus_wince_GetSystemTimeAsFileTime
141void GetSystemTimeAsFileTime (LPFILETIME ftp);
142
143#define _mbsrchr _dbus_wince_mbsrchr
144unsigned char* _mbsrchr (const unsigned char*, unsigned int);
145
146#define OpenFileMappingA _dbus_wince_OpenFileMappingA
147HANDLE OpenFileMappingA(DWORD,BOOL,LPCSTR);
148
149#define MoveFileExA _dbus_wince_MoveFileExA
150BOOL MoveFileExA(LPCSTR,LPCSTR,DWORD);
151#ifndef MOVEFILE_REPLACE_EXISTING
152#define MOVEFILE_REPLACE_EXISTING 0x00000001
153#endif
154
155#define SetHandleInformation _dbus_wince_SetHandleInformation
156BOOL SetHandleInformation(HANDLE,DWORD,DWORD);
157#ifndef HANDLE_FLAG_INHERIT
158#define HANDLE_FLAG_INHERIT 0x01
159#endif
160#ifndef HANDLE_FLAG_PROTECT
161#define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x02
162#endif
163
164#define SearchPathA _dbus_wince_SearchPathA
165DWORD SearchPathA(LPCSTR,LPCSTR,LPCSTR,DWORD,LPSTR,LPSTR*);
166
167/* Instead of emulating all functions needed for this, we replace the
168 whole thing. */
169dbus_bool_t _dbus_getsid(char **sid);
170
171
172#define LookupAccountNameW _dbus_wince_LookupAccountNameW
173BOOL LookupAccountNameW(LPCWSTR,LPCWSTR,PSID,PDWORD,LPWSTR,PDWORD,PSID_NAME_USE);
174
175#define IsValidSid _dbus_wince_IsValidSid
176BOOL IsValidSid(PSID);
177
178
179/* Windows CE does only have the UNICODE interfaces (FooW), but we
180 want to use the ASCII interfaces (FooA). We implement them
181 here. */
182
183#define CreateFileA _dbus_wince_CreateFileA
184HANDLE CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE);
185
186#define DeleteFileA _dbus_wince_DeleteFileA
187BOOL DeleteFileA(LPCSTR);
188
189#define GetFileAttributesA _dbus_wince_GetFileAttributesA
190DWORD GetFileAttributesA(LPCSTR);
191
192#define GetFileAttributesExA _dbus_wince_GetFileAttributesExA
193BOOL GetFileAttributesExA(LPCSTR,GET_FILEEX_INFO_LEVELS,PVOID);
194
195#define CreateFileMappingA _dbus_wince_CreateFileMappingA
196HANDLE CreateFileMappingA(HANDLE,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCSTR);
197
198#define CreateDirectoryA _dbus_wince_CreateDirectoryA
199BOOL CreateDirectoryA(LPCSTR,LPSECURITY_ATTRIBUTES);
200
201#define RemoveDirectoryA _dbus_wince_RemoveDirectoryA
202BOOL RemoveDirectoryA(LPCSTR);
203
204#define FindFirstFileA _dbus_wince_FindFirstFileA
205HANDLE FindFirstFileA(LPCSTR,LPWIN32_FIND_DATAA);
206
207#define FindNextFileA _dbus_wince_FindNextFileA
208BOOL FindNextFileA(HANDLE,LPWIN32_FIND_DATAA);
209
210#define CreateMutexA _dbus_wince_CreateMutexA
211HANDLE CreateMutexA(LPSECURITY_ATTRIBUTES,BOOL,LPCSTR);
212
213#define CreateProcessA _dbus_wince_CreateProcessA
214BOOL CreateProcessA(LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,PVOID,LPCSTR,LPSTARTUPINFOA,LPPROCESS_INFORMATION);
215#ifndef CREATE_NO_WINDOW
216#define CREATE_NO_WINDOW 0x08000000
217#endif
218
219
220#define RegOpenKeyExA _dbus_wince_RegOpenKeyExA
221LONG RegOpenKeyExA(HKEY,LPCSTR,DWORD,REGSAM,PHKEY);
222
223#define RegQueryValueExA _dbus_wince_RegQueryValueExA
224LONG WINAPI RegQueryValueExA(HKEY,LPCSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
225
226
227#define FormatMessageA _dbus_wince_FormatMessageA
228DWORD FormatMessageA(DWORD,PCVOID,DWORD,DWORD,LPSTR,DWORD,va_list*);
229
230#define GetModuleFileNameA _dbus_wince_GetModuleFileNameA
231DWORD GetModuleFileNameA(HINSTANCE,LPSTR,DWORD);
232
233#define GetTempPathA _dbus_wince_GetTempPathA
234DWORD GetTempPathA(DWORD,LPSTR);
235
236#define SHGetSpecialFolderPathA _dbus_wince_SHGetSpecialFolderPathA
237BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
238
239
240#define OutputDebugStringA _dbus_wince_OutputDebugStringA
241void OutputDebugStringA(LPCSTR);
242
243
244 DBUS_END_DECLS
245
246#endif /* DBUS_SYSDEPS_WINCE_GLUE_H */
DBUS_BEGIN_DECLS
#define DBUS_BEGIN_DECLS
Macro used prior to declaring functions in the D-Bus header files.
Definition dbus-macros.h:34
DBUS_END_DECLS
#define DBUS_END_DECLS
Macro used after declaring functions in the D-Bus header files.
Definition dbus-macros.h:35