Fixes for the MSC build
[gpgme.git] / src / w32-ce.h
1 /* w32-ce.h 
2    Copyright (C) 2010 g10 Code GmbH
3
4    This file is part of GPGME.
5  
6    GPGME is free software; you can redistribute it and/or modify it
7    under the terms of the GNU Lesser General Public License as
8    published by the Free Software Foundation; either version 2.1 of
9    the License, or (at your option) any later version.
10    
11    GPGME is distributed in the hope that it will be useful, but
12    WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15    
16    You should have received a copy of the GNU Lesser General Public
17    License along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19    02111-1307, USA.  */
20
21 #ifndef GPGME_W32_CE_H
22 #define GPGME_W32_CE_H
23
24 #include <time.h>
25 #include <stdarg.h>
26
27 #ifdef _MSC_VER
28 typedef int pid_t;
29 #endif
30
31 #include <winsock2.h>
32 #include <ws2tcpip.h> /* For getaddrinfo.  */
33 #include <windows.h>
34
35 #define getenv _gpgme_wince_getenv
36 char *getenv (const char *name);
37
38 #include <io.h>
39 #define isatty(fd) 0
40
41
42 /* Windows CE is missing some Windows functions that we want.  */
43
44 #define GetSystemTimeAsFileTime _gpgme_wince_GetSystemTimeAsFileTime
45 void GetSystemTimeAsFileTime (LPFILETIME ftp);
46
47 #define DeleteFileA _gpgme_wince_DeleteFileA
48 BOOL DeleteFileA(LPCSTR);
49
50 #define CreateFileA _gpgme_wince_CreateFileA
51 HANDLE CreateFileA (LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES,
52                     DWORD, DWORD, HANDLE);
53
54 #define CreateProcessA _gpgme_wince_CreateProcessA
55 BOOL CreateProcessA(LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,PVOID,LPCSTR,LPSTARTUPINFOA,LPPROCESS_INFORMATION);
56
57 #define RegOpenKeyExA _gpgme_wince_RegOpenKeyExA
58 LONG RegOpenKeyExA(HKEY,LPCSTR,DWORD,REGSAM,PHKEY);
59
60 #define RegQueryValueExA _gpgme_wince_RegQueryValueExA
61 LONG WINAPI RegQueryValueExA(HKEY,LPCSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
62
63 #define GetTempPathA _gpgme_wince_GetTempPathA
64 DWORD GetTempPathA(DWORD,LPSTR);
65
66 #define SHGetSpecialFolderPathA _gpgme_wince_SHGetSpecialFolderPathA
67 BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
68
69 int _gpgme_wince_access (const char *fname, int mode);
70 #define access(a,b) _gpgme_wince_access ((a), (b))
71
72 void *_gpgme_wince_bsearch (const void *key, const void *base,
73                             size_t nmemb, size_t size,
74                             int (*compar) (const void *, const void *));
75 #define bsearch(a,b,c,d,e) _gpgme_wince_bsearch ((a),(b),(c),(d),(e)) 
76
77 #if defined(_MSC_VER)
78   /* Remove the redefined __leave keyword.  It is defined by MSC for
79      W32 in excpt.h and not in sehmap.h as for the plain windows
80      version.  */
81 # undef leave
82 # define HKEY_PERFORMANCE_DATA ((HKEY)0x80000004)
83 # define HKEY_CURRENT_CONFIG  ((HKEY)0x80000005)
84   /* Replace the Mingw32CE provided abort function.  */
85 # define abort() do { TerminateProcess (GetCurrentProcess(), 8); } while (0)
86 # define _IOLBF 0x40
87 #endif
88
89 #endif /* GPGME_W32_CE_H */