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, configure/cmake defined _WIN32_WCE to something >= 0x0401. */
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
40
BOOL WINAPI SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
41
BOOL WINAPI SHGetSpecialFolderPathW(HWND,LPWSTR,int,BOOL);
43
#ifndef TLS_OUT_OF_INDEXES
44
#define TLS_OUT_OF_INDEXES 0xffffffff
48
/* Seriously. Windows CE does not have errno. Don't you hate it when
50
#define errno ((int)GetLastError ())
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
80
/* Windows CE is missing more stuff that is pretty standard. */
82
#define strdup _strdup
83
#define stricmp _stricmp
84
#define strnicmp _strnicmp
86
#define environ _dbus_wince_environ
87
extern char *environ[];
89
#define getenv _dbus_wince_getenv
90
char *getenv (const char *name);
92
#define putenv _dbus_wince_putenv
93
int putenv (char *str);
95
#define clock _dbus_wince_clock
98
#define abort _dbus_wince_abort
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 */
110
#ifndef __OFF_T_DEFINED
112
#define __OFF_T_DEFINED
114
#ifndef _INTPTR_T_DEFINED
115
typedef int intptr_t;
116
#define _INTPTR_T_DEFINED
118
#ifndef _UINTPTR_T_DEFINED
119
typedef unsigned int uintptr_t;
120
#define _UINTPTR_T_DEFINED
124
#define _MAX_FNAME 256
138
/* Windows CE is missing some Windows functions that we want. */
140
#define GetSystemTimeAsFileTime _dbus_wince_GetSystemTimeAsFileTime
141
void GetSystemTimeAsFileTime (LPFILETIME ftp);
143
#define _mbsrchr _dbus_wince_mbsrchr
144
unsigned char* _mbsrchr (const unsigned char*, unsigned int);
146
#define OpenFileMappingA _dbus_wince_OpenFileMappingA
147
HANDLE OpenFileMappingA(DWORD,BOOL,LPCSTR);
149
#define MoveFileExA _dbus_wince_MoveFileExA
150
BOOL MoveFileExA(LPCSTR,LPCSTR,DWORD);
151
#ifndef MOVEFILE_REPLACE_EXISTING
152
#define MOVEFILE_REPLACE_EXISTING 0x00000001
155
#define SetHandleInformation _dbus_wince_SetHandleInformation
156
BOOL SetHandleInformation(HANDLE,DWORD,DWORD);
157
#ifndef HANDLE_FLAG_INHERIT
158
#define HANDLE_FLAG_INHERIT 0x01
160
#ifndef HANDLE_FLAG_PROTECT
161
#define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x02
164
#define SearchPathA _dbus_wince_SearchPathA
165
DWORD SearchPathA(LPCSTR,LPCSTR,LPCSTR,DWORD,LPSTR,LPSTR*);
167
/* Instead of emulating all functions needed for this, we replace the
169
dbus_bool_t _dbus_getsid(char **sid);
172
#define LookupAccountNameW _dbus_wince_LookupAccountNameW
173
BOOL LookupAccountNameW(LPCWSTR,LPCWSTR,PSID,PDWORD,LPWSTR,PDWORD,PSID_NAME_USE);
175
#define IsValidSid _dbus_wince_IsValidSid
176
BOOL IsValidSid(PSID);
179
/* Windows CE does only have the UNICODE interfaces (FooW), but we
180
want to use the ASCII interfaces (FooA). We implement them
183
#define CreateFileA _dbus_wince_CreateFileA
184
HANDLE CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE);
186
#define DeleteFileA _dbus_wince_DeleteFileA
187
BOOL DeleteFileA(LPCSTR);
189
#define GetFileAttributesA _dbus_wince_GetFileAttributesA
190
DWORD GetFileAttributesA(LPCSTR);
192
#define GetFileAttributesExA _dbus_wince_GetFileAttributesExA
193
BOOL GetFileAttributesExA(LPCSTR,GET_FILEEX_INFO_LEVELS,PVOID);
195
#define CreateFileMappingA _dbus_wince_CreateFileMappingA
196
HANDLE CreateFileMappingA(HANDLE,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCSTR);
198
#define CreateDirectoryA _dbus_wince_CreateDirectoryA
199
BOOL CreateDirectoryA(LPCSTR,LPSECURITY_ATTRIBUTES);
201
#define RemoveDirectoryA _dbus_wince_RemoveDirectoryA
202
BOOL RemoveDirectoryA(LPCSTR);
204
#define FindFirstFileA _dbus_wince_FindFirstFileA
205
HANDLE FindFirstFileA(LPCSTR,LPWIN32_FIND_DATAA);
207
#define FindNextFileA _dbus_wince_FindNextFileA
208
BOOL FindNextFileA(HANDLE,LPWIN32_FIND_DATAA);
210
#define CreateMutexA _dbus_wince_CreateMutexA
211
HANDLE CreateMutexA(LPSECURITY_ATTRIBUTES,BOOL,LPCSTR);
213
#define CreateProcessA _dbus_wince_CreateProcessA
214
BOOL 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
220
#define RegOpenKeyExA _dbus_wince_RegOpenKeyExA
221
LONG RegOpenKeyExA(HKEY,LPCSTR,DWORD,REGSAM,PHKEY);
223
#define RegQueryValueExA _dbus_wince_RegQueryValueExA
224
LONG WINAPI RegQueryValueExA(HKEY,LPCSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
227
#define FormatMessageA _dbus_wince_FormatMessageA
228
DWORD FormatMessageA(DWORD,PCVOID,DWORD,DWORD,LPSTR,DWORD,va_list*);
230
#define GetModuleFileNameA _dbus_wince_GetModuleFileNameA
231
DWORD GetModuleFileNameA(HINSTANCE,LPSTR,DWORD);
233
#define GetTempPathA _dbus_wince_GetTempPathA
234
DWORD GetTempPathA(DWORD,LPSTR);
236
#define SHGetSpecialFolderPathA _dbus_wince_SHGetSpecialFolderPathA
237
BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
240
#define OutputDebugStringA _dbus_wince_OutputDebugStringA
241
void OutputDebugStringA(LPCSTR);
246
#endif /* DBUS_SYSDEPS_WINCE_GLUE_H */