00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _EDT_OS_NT_H
00012 #define _EDT_OS_NT_H
00013
00014 #include <stdio.h>
00015 #include <io.h>
00016
00017 #ifndef _KERNEL
00018
00019
00020 #include <winsock2.h>
00021 #include <winioctl.h>
00022
00023 #include <process.h>
00024 #include <time.h>
00025
00026
00027 #endif
00028
00029
00030
00031 #ifndef _MSC_VER
00032
00033 #include <winnt.h>
00034
00035 #endif
00036
00037 #ifdef _MSC_VER
00038 typedef unsigned __int64 uint64_t ;
00039 typedef __int64 int64_t ;
00040 typedef unsigned int uint32_t ;
00041 typedef int int32_t ;
00042 typedef unsigned short uint16_t;
00043 typedef short int16_t;
00044
00045 #endif
00046
00047 typedef unsigned char *caddr_t ;
00048 typedef unsigned char uchar_t ;
00049 typedef unsigned short ushort_t ;
00050 typedef unsigned int uint_t ;
00051
00052 typedef unsigned long u_long;
00053
00054 #define NULL_HANDLE INVALID_HANDLE_VALUE
00055 #define thread_t HANDLE
00056
00057 #define DIRHANDLE HANDLE
00058
00059 #define EDTAPI __declspec(dllexport)
00060
00061 #ifdef LIBDLL
00062
00063 #define EDTIMPORT __declspec(dllimport)
00064
00065 #else
00066
00067 #define EDTIMPORT
00068
00069 #endif
00070
00071 #define strncasecmp strnicmp
00072 #define strcasecmp stricmp
00073
00074 #define strtoull _strtoui64
00075
00076
00077 #define PAGESIZE 4096
00078
00079 #define SECTOR_SIZE 512
00080
00081
00082
00083
00084 #if _MSC_VER >= 1300
00085
00086 #pragma warning(disable : 4996)
00087
00088
00089 #endif
00090
00091
00092
00093 #ifndef _KERNEL
00094
00095 #define DLLEXPORT __declspec(dllexport)
00096
00097
00098
00099 #ifdef __cplusplus
00100
00101 #if defined( __AFXWIN_H__) || defined(_AFXDLL) || defined(_AFXEXT)
00102
00103
00104 #include <afxwin.h>
00105
00106 #define edt_get_dc(wnd) GetDC(wnd)
00107 #define edt_release_dc(wnd, pdc) ReleaseDC(wnd, pdc)
00108
00109
00110 #define EdtBox CRect
00111
00112 #define EdtWindow HWND
00113 #define EdtDC HDC
00114 #define EdtPoint CPoint
00115
00116
00117 #endif
00118
00119 #endif
00120 #ifndef ASSERT
00121
00122 #include <assert.h>
00123
00124 #ifdef _DEBUG
00125
00126 #define ASSERT(f) assert(f)
00127
00128 #else
00129
00130 #define ASSERT(f)
00131
00132
00133 #endif
00134
00135
00136 #endif
00137
00138
00139
00140 #ifdef TRACE
00141 #undef TRACE
00142
00143 #endif
00144
00145 #ifdef _DEBUG
00146
00147 #define TRACE SysLog.Message
00148
00149 #else
00150
00151 #define TRACE
00152
00153
00154 #endif
00155
00156 typedef __int64 EdtFileOffset;
00157
00158
00159 typedef unsigned char byte;
00160
00161 typedef unsigned int uint;
00162
00163 typedef unsigned long ulong;
00164 typedef HANDLE thread_t;
00165
00166 #ifndef LaunchThread
00167
00168 #define LaunchThread(pThread,func,pointer) { \
00169 unsigned int thrdaddr; \
00170 pThread = (thread_t) _beginthreadex(NULL, 0, func, pointer, CREATE_SUSPENDED, &thrdaddr);\
00171 ResumeThread(pThread); }
00172
00173 #endif
00174
00175 #define WaitForThread(pThread,timeout) \
00176 WaitForSingleObject(pThread,timeout)
00177
00178
00179 typedef unsigned int (__stdcall *edt_thread_function)(void *);
00180
00181 typedef thread_t thread_type;
00182
00183 #define THREAD_RETURN UINT
00184 #define THREAD_FUNC_DECLARE UINT __stdcall
00185
00186 #ifdef _MSC_VER
00187
00188 typedef CRITICAL_SECTION critical_section_t;
00189
00190 #define init_critical(cp) InitializeCriticalSection(&cp);
00191 #define enter_critical(cp) EnterCriticalSection(&cp);
00192 #define leave_critical(cp) LeaveCriticalSection(&cp);
00193 #define delete_critical(cp) DeleteCriticalSection(&cp);
00194
00195 #endif
00196
00197 typedef HANDLE mutex_t;
00198
00199 #define create_mutex_named(m,nm) m = CreateMutex(NULL,FALSE, nm)
00200 #define create_mutex(m) m = CreateMutex(NULL,FALSE,NULL)
00201
00202 #define wait_mutex_timeout(m,timeout) WaitForSingleObject(m,timeout)
00203 #define wait_mutex(m) WaitForSingleObject(m,INFINITE)
00204 #define release_mutex(m) ReleaseMutex(m)
00205 #define delete_mutex(m) CloseHandle(m)
00206
00207
00208 typedef HANDLE event_t;
00209
00210 #define create_event_named(m, manual, init_state, nm) \
00211 m = CreateEvent(NULL,manual,init_state,nm)
00212
00213 #define create_event(m, manual, init_state) \
00214 m = CreateEvent(NULL,manual,init_state,NULL)
00215
00216 #define wait_event_timeout(m,timeout) WaitForSingleObject(m,timeout)
00217 #define wait_event(m) WaitForSingleObject(m,INFINITE)
00218
00219 #define signal_event(e) SetEvent(e)
00220 #define clear_event(e) ResetEvent(e)
00221
00222 #endif
00223
00224
00225 #endif
00226
00227
00228
00229
00230