Current News
Archived News
Search News
Discussion Forum


Old Forum
Install Programs More Downloads...
Troubleshooting
Source Code
Format Specs.
Misc. Information
Non-SF Stuff
Links




24f53ca27e88edc03ee653fe95f8a49fdfa8aaa6
1 /* License information for this code is in license.txt */
3 #ifndef WINDOWS_H_INCLUDED
4 #define WINDOWS_H_INCLUDED
6 #include <malloc.h>
7 #include <string.h>
8 #include <ctype.h>
9 #include <fcntl.h>
10 #include <unistd.h>
11 #include <sys/stat.h>
13 #define LINUX_PORT
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
19 // Function related defines
20 #define __cdecl
21 #define __stdcall
22 #define WINAPI __stdcall
23 #define APIENTRY __stdcall
24 #define __declspec(dllimport)
25 #define __declspec(dllexport)
26 #define __inline inline
27 #define __forceinline inline
29 #define CONST const
31 // Type defines
32 typedef unsigned char BYTE;
33 typedef unsigned short int WORD;
34 typedef unsigned long int DWORD;
35 typedef short int SHORT;
36 typedef unsigned short int USHORT;
37 typedef DWORD LCID;
38 typedef long int LONG;
39 typedef LONG * PLONG;
40 typedef int BOOL;
41 typedef void * LPVOID;
42 typedef CONST void *LPCVOID;
43 typedef char CHAR;
44 typedef char * LPSTR;
45 typedef const char * LPCSTR;
46 typedef DWORD * LPDWORD;
47 typedef BYTE * LPBYTE;
48 typedef LPVOID HANDLE;
49 typedef HANDLE HINSTANCE;
51 // Structs
52 typedef struct _OVERLAPPED {
53         DWORD  Internal;
54         DWORD  InternalHigh;
55         DWORD  Offset;
56         DWORD  OffsetHigh;
57         HANDLE hEvent;
58 } OVERLAPPED, *LPOVERLAPPED;
59 typedef struct _SECURITY_ATTRIBUTES {
60         DWORD nLength;
61         LPVOID lpSecurityDescriptor;
62         BOOL bInheritHandle;
63 } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
65 // Constants
66 #define FALSE 0
67 #define TRUE 1
68 #define MAX_PATH 260
69 #define INVALID_HANDLE_VALUE ((HANDLE)-1)
70 #define DLL_PROCESS_ATTACH 1
71 #define DLL_THREAD_ATTACH  2
72 #define DLL_THREAD_DETACH  3
73 #define DLL_PROCESS_DETACH 0
74 #define PAGE_NOACCESS          0x01
75 #define PAGE_READONLY          0x02
76 #define PAGE_READWRITE         0x04
77 #define PAGE_WRITECOPY         0x08
78 #define PAGE_EXECUTE           0x10
79 #define PAGE_EXECUTE_READ      0x20
80 #define PAGE_EXECUTE_READWRITE 0x40
81 #define PAGE_EXECUTE_WRITECOPY 0x80
82 #define PAGE_GUARD            0x100
83 #define PAGE_NOCACHE          0x200
84 #define PAGE_WRITECOMBINE     0x400
85 #define MEM_COMMIT           0x1000
86 #define MEM_RESERVE          0x2000
87 #define MEM_DECOMMIT         0x4000
88 #define MEM_RELEASE          0x8000
89 #define MEM_FREE            0x10000
90 #define MEM_PRIVATE         0x20000
91 #define MEM_MAPPED          0x40000
92 #define MEM_RESET           0x80000
93 #define MEM_TOP_DOWN       0x100000
94 #define MEM_4MB_PAGES    0x80000000
95 #define DRIVE_UNKNOWN     0
96 #define DRIVE_NO_ROOT_DIR 1
97 #define DRIVE_REMOVABLE   2
98 #define DRIVE_FIXED       3
99 #define DRIVE_REMOTE      4
100 #define DRIVE_CDROM       5
101 #define DRIVE_RAMDISK     6
102 #define GENERIC_READ                     (0x80000000L)
103 #define GENERIC_WRITE                    (0x40000000L)
104 #define GENERIC_EXECUTE                  (0x20000000L)
105 #define GENERIC_ALL                      (0x10000000L)
106 #define FILE_SHARE_READ                 0x00000001
107 #define FILE_SHARE_WRITE                0x00000002
108 #define FILE_SHARE_DELETE               0x00000004
109 #define CREATE_NEW          1
110 #define CREATE_ALWAYS       2
111 #define OPEN_EXISTING       3
112 #define OPEN_ALWAYS         4
113 #define TRUNCATE_EXISTING   5
114 #define FILE_BEGIN           0
115 #define FILE_CURRENT         1
116 #define FILE_END             2
117 #define ERROR_FILE_NOT_FOUND             2L
118 #define ERROR_ACCESS_DENIED              5L
119 #define ERROR_INVALID_PARAMETER          87L    // dderror
120 #define ERROR_ALREADY_EXISTS             183L
121 #define ERROR_FILE_INVALID               1006L
122 #define ERROR_UNKNOWN_PROPERTY           1608L
124 // Declarations for Windows API functions
125 void WINAPI SetLastError(DWORD dwLastError);
126 DWORD WINAPI GetLastError();
127 DWORD WINAPI GetCurrentDirectory(DWORD dwBufferLength, LPSTR lpBuffer);
128 DWORD WINAPI GetDriveType(LPCSTR lpRootPath);
129 HANDLE WINAPI CreateFile(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
130 BOOL WINAPI CloseHandle(HANDLE hObject);
131 DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh);
132 DWORD WINAPI SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod);
133 BOOL WINAPI SetEndOfFile(HANDLE hFile);
134 BOOL WINAPI ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);
135 BOOL WINAPI WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
136 BOOL WINAPI DeleteFile(LPCSTR lpFileName);
138 // Declarations for C runtime functions
139 char * strlwr(char *lpString);
140 char * strupr(char *lpString);
141 char * strdup(const char *lpString);
142 #define stricmp strcasecmp
143 #define strnicmp strncasecmp
144 int memicmp(const char *lpString1, const char *lpString2, size_t dwSize);
146 // Other functions
147 void SlashToBackslash(char *lpPath);
148 void BackslashToSlash(char *lpPath);
150 #ifdef __cplusplus
151 };  // extern "C"
152 #endif
154 #endif