Fixes for the MSC build
[gpgme.git] / src / w32-ce.h
index 2b761d652ca323cabf3a51f2be718b3f680e02be..a74c6e1716015e9db503d819343cd7d1b01ba96d 100644 (file)
 #include <time.h>
 #include <stdarg.h>
 
-/* For getaddrinfo.  */
-#define _MSV_VER 0x401
-#include <windows.h>
-
-
-/* shlobj.h declares these only for _WIN32_IE that we don't want to define.
-   In any case, with mingw32ce we only get a SHGetSpecialFolderPath.  */
-#define SHGetSpecialFolderPathW SHGetSpecialFolderPath
-BOOL WINAPI SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
-BOOL WINAPI SHGetSpecialFolderPathW(HWND,LPWSTR,int,BOOL);
+#ifdef _MSC_VER
+typedef int pid_t;
+#endif
 
+#include <winsock2.h>
+#include <ws2tcpip.h> /* For getaddrinfo.  */
+#include <windows.h>
 
 #define getenv _gpgme_wince_getenv
 char *getenv (const char *name);
@@ -51,6 +47,10 @@ void GetSystemTimeAsFileTime (LPFILETIME ftp);
 #define DeleteFileA _gpgme_wince_DeleteFileA
 BOOL DeleteFileA(LPCSTR);
 
+#define CreateFileA _gpgme_wince_CreateFileA
+HANDLE CreateFileA (LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES,
+                    DWORD, DWORD, HANDLE);
+
 #define CreateProcessA _gpgme_wince_CreateProcessA
 BOOL CreateProcessA(LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,PVOID,LPCSTR,LPSTARTUPINFOA,LPPROCESS_INFORMATION);
 
@@ -66,5 +66,24 @@ DWORD GetTempPathA(DWORD,LPSTR);
 #define SHGetSpecialFolderPathA _gpgme_wince_SHGetSpecialFolderPathA
 BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
 
+int _gpgme_wince_access (const char *fname, int mode);
+#define access(a,b) _gpgme_wince_access ((a), (b))
+
+void *_gpgme_wince_bsearch (const void *key, const void *base,
+                            size_t nmemb, size_t size,
+                            int (*compar) (const void *, const void *));
+#define bsearch(a,b,c,d,e) _gpgme_wince_bsearch ((a),(b),(c),(d),(e)) 
+
+#if defined(_MSC_VER)
+  /* Remove the redefined __leave keyword.  It is defined by MSC for
+     W32 in excpt.h and not in sehmap.h as for the plain windows
+     version.  */
+# undef leave
+# define HKEY_PERFORMANCE_DATA ((HKEY)0x80000004)
+# define HKEY_CURRENT_CONFIG  ((HKEY)0x80000005)
+  /* Replace the Mingw32CE provided abort function.  */
+# define abort() do { TerminateProcess (GetCurrentProcess(), 8); } while (0)
+# define _IOLBF 0x40
+#endif
 
 #endif /* GPGME_W32_CE_H */