source: rtems/cpukit/shttpd/compat_win32.h @ ba3e987e

4.104.115
Last change on this file since ba3e987e was 484cd8d, checked in by Ralf Corsepius <ralf.corsepius@…>, on 06/11/07 at 13:24:29

Import from shttpd-1.37.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 * Copyright (c) 2004-2007 Sergey Lyubka <valenok@gmail.com>
3 * All rights reserved
4 *
5 * "THE BEER-WARE LICENSE" (Revision 42):
6 * Sergey Lyubka wrote this file.  As long as you retain this notice you
7 * can do whatever you want with this stuff. If we meet some day, and you think
8 * this stuff is worth it, you can buy me a beer in return.
9 */
10
11/* Tip from Justin Maximilian, suppress errors from winsock2.h */
12#define _WINSOCKAPI_
13
14#include <windows.h>
15#include <winsock2.h>
16#include <commctrl.h>
17#include <winnls.h>
18#include <shlobj.h>
19#include <shellapi.h>
20
21#ifndef _WIN32_WCE
22
23#ifdef _MSC_VER /* pragmas not valid on MinGW */
24#pragma comment(lib,"ws2_32")
25#pragma comment(lib,"user32")
26#pragma comment(lib,"comctl32")
27#pragma comment(lib,"comdlg32")
28#pragma comment(lib,"shell32")
29#ifdef NO_GUI
30#pragma comment(linker,"/subsystem:console")
31#else
32#pragma comment(linker,"/subsystem:windows")
33#endif /* NO_GUI */
34#endif /* _MSC_VER */
35#include <process.h>
36#include <direct.h>
37#include <io.h>
38
39#else /* _WIN32_WCE */
40
41/* Windows CE-specific definitions */
42#define NO_CGI  /* WinCE has no pipes */
43#define NO_GUI  /* temporarily until it is fixed */
44#pragma comment(lib,"ws2")
45/* WinCE has both Unicode and ANSI versions of GetProcAddress */
46#undef GetProcAddress
47#define GetProcAddress GetProcAddressA
48#include "compat_wince.h"
49
50#endif /* _WIN32_WCE */
51
52#define ERRNO                   GetLastError()
53#define NO_SOCKLEN_T
54#define SSL_LIB                 L"libssl32.dll"
55#define DIRSEP                  '\\'
56#define IS_DIRSEP_CHAR(c)       ((c) == '/' || (c) == '\\')
57#define O_NONBLOCK              0
58#define EWOULDBLOCK             WSAEWOULDBLOCK
59#define snprintf                _snprintf
60#define vsnprintf               _vsnprintf
61#define mkdir(x,y)              _mkdir(x)
62#define dlopen(x,y)             LoadLibraryW(x)
63#define dlsym(x,y)              (void *) GetProcAddress(x,y)
64#define _POSIX_
65
66#ifdef __LCC__
67#include <stdint.h>
68#endif /* __LCC__ */
69
70#ifdef _MSC_VER /* MinGW already has these */
71typedef unsigned int            uint32_t;
72typedef unsigned short          uint16_t;
73typedef __int64                 uint64_t;
74#define S_ISDIR(x)              ((x) & _S_IFDIR)
75#endif /* _MSC_VER */
76
77/*
78 * POSIX dirent interface
79 */
80struct dirent {
81        char    d_name[FILENAME_MAX];
82};
83
84typedef struct DIR {
85        HANDLE                  handle;
86        WIN32_FIND_DATAW        info;
87        struct dirent           result;
88        char                    *name;
89} DIR;
90
91extern DIR *opendir(const char *name);
92extern int closedir(DIR *dir);
93extern struct dirent *readdir(DIR *dir);
Note: See TracBrowser for help on using the repository browser.