ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/win32.h
Revision: 1.4
Committed: Sat Sep 16 22:06:17 2006 UTC (17 years, 7 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +0 -0 lines
State: FILE REMOVED
Log Message:
indent

File Contents

# Content
1 /*
2 * Structures and types used to implement opendir/readdir/closedir
3 * on Windows 95/NT and set the loe level defines
4 */
5
6 #if !defined(AFX_STDAFX_H__31666CA1_2474_11D5_AE6C_F07569C10000__INCLUDED_)
7 #define AFX_STDAFX_H__31666CA1_2474_11D5_AE6C_F07569C10000__INCLUDED_
8
9 /* Define the version here. In Unixland, it's defined on the command line now. */
10 #define VERSION "1.9.1"
11
12 #pragma warning(disable: 4761) /* integral size mismatch in argument; conversion supplied */
13
14 #if _MSC_VER > 1000
15 #pragma once
16 #endif /* _MSC_VER > 1000 */
17
18 #endif /* !defined(AFX_STDAFX_H__31666CA1_2474_11D5_AE6C_F07569C10000__INCLUDED_) */
19
20 #define WIN32_LEAN_AND_MEAN
21 #include <windows.h>
22 #include <windowsx.h>
23 #include <mmsystem.h>
24 #include <winsock2.h>
25 #include <time.h>
26 #include <direct.h>
27 #include <math.h>
28
29 #include <sys/stat.h> /* somewhat odd, but you don't get stat here with __STDC__ */
30
31 #include <io.h>
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <sys/types.h>
35 #include <process.h>
36
37 #define __STDC__ 1 /* something odd, CF want this, but don'T include it */
38 /* before the standard includes */
39
40 #ifndef HAVE_SNPRINTF
41 #define HAVE_SNPRINTF 1
42 #endif
43 #define snprintf _snprintf
44
45 #include "version.h"
46
47 /* include all needed autoconfig.h defines */
48 #define CS_LOGSTATS
49 #define HAVE_SRAND
50 #ifndef HAVE_FCNTL_H
51 #define HAVE_FCNTL_H
52 #endif
53 #ifndef HAVE_STDDEF_H
54 #define HAVE_STDDEF_H
55 #endif
56 #define GETTIMEOFDAY_TWO_ARGS
57 #define MAXPATHLEN 256
58
59 /* Many defines to redirect unix functions or fake standard unix values */
60 #define inline __inline
61 #define unlink(__a) _unlink(__a)
62 #define mkdir(__a, __b) mkdir(__a)
63 #define getpid() _getpid()
64 #define popen(__a, __b) _popen(__a, __b)
65 #define pclose(__a) _pclose(__a)
66 #define vsnprintf _vsnprintf
67
68 #define R_OK 6 /* for __access() */
69 #define F_OK 6
70
71 #define PREFIXDIR ""
72
73 #define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)
74 #define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
75
76 #ifndef S_ISGID
77 #define S_ISGID 0002000
78 #endif
79 #ifndef S_IWOTH
80 #define S_IWOTH 0000200
81 #endif
82 #ifndef S_IWGRP
83 #define S_IWGRP 0000020
84 #endif
85 #ifndef S_IWUSR
86 #define S_IWUSR 0000002
87 #endif
88 #ifndef S_IROTH
89 #define S_IROTH 0000400
90 #endif
91 #ifndef S_IRGRP
92 #define S_IRGRP 0000040
93 #endif
94 #ifndef S_IRUSR
95 #define S_IRUSR 0000004
96 #endif
97
98 #define WIFEXITED(x) 1
99 #define WEXITSTATUS(x) x
100
101 /* Location of read-only machine independent data */
102 #define DATADIR "share"
103 #define LIBDIR "share"
104 #define CONFDIR "share"
105
106 /* Location of changeable single system data (temp maps, hiscore, etc) */
107 #define LOCALDIR "var"
108
109 #define COMPRESS "/usr/bin/compress"
110 #define UNCOMPRESS "/usr/bin/uncompress"
111 #define GZIP "/bin/gzip"
112 #define GUNZIP "/bin/gunzip"
113 #define BZIP "/usr/bin/bzip2"
114 #define BUNZIP "/usr/bin/bunzip2"
115
116 /* Suffix for libraries */
117 #define PLUGIN_SUFFIX ".dll"
118
119 /* struct dirent - same as Unix */
120
121 typedef struct dirent {
122 long d_ino; /* inode (always 1 in WIN32) */
123 off_t d_off; /* offset to this dirent */
124 unsigned short d_reclen; /* length of d_name */
125 char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */
126 }dirent;
127
128 #define NAMLEN(dirent) strlen((dirent)->d_name)
129
130 /* typedef DIR - not the same as Unix */
131 typedef struct {
132 long handle; /* _findfirst/_findnext handle */
133 short offset; /* offset into directory */
134 short finished; /* 1 if there are not more files */
135 struct _finddata_t fileinfo; /* from _findfirst/_findnext */
136 char *dir; /* the dir we are reading */
137 struct dirent dent; /* the dirent to return */
138 } DIR;
139
140 #ifndef socklen_t
141 #define socklen_t int /* Doesn't exist, just a plain int */
142 #endif
143
144 /* Function prototypes */
145 extern int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info);
146 extern DIR *opendir(const char *);
147 extern struct dirent *readdir(DIR *);
148 extern int closedir(DIR *);
149 extern void rewinddir(DIR *);
150 extern int strncasecmp(const char *s1, const char *s2, int n);
151 extern int strcasecmp(const char *s1, const char*s2);
152 extern void service_register( );
153 extern void service_unregister( );
154 extern void service_handle( );
155
156 /* For Win32 service */
157 extern int bRunning;