Home | History | Annotate | Download | only in include
      1 #ifndef _MINWINBASE_
      2 #define _MINWINBASE_
      3 
      4 #ifdef __cplusplus
      5 extern "C" {
      6 #endif
      7 
      8 #define MoveMemory RtlMoveMemory
      9 #define CopyMemory RtlCopyMemory
     10 #define FillMemory RtlFillMemory
     11 #define ZeroMemory RtlZeroMemory
     12 
     13   typedef struct _SECURITY_ATTRIBUTES {
     14     DWORD nLength;
     15     LPVOID lpSecurityDescriptor;
     16     WINBOOL bInheritHandle;
     17   } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
     18 
     19   typedef struct _OVERLAPPED {
     20     ULONG_PTR Internal;
     21     ULONG_PTR InternalHigh;
     22     __C89_NAMELESS union {
     23       struct {
     24 	DWORD Offset;
     25 	DWORD OffsetHigh;
     26       } DUMMYSTRUCTNAME;
     27       PVOID Pointer;
     28     } DUMMYUNIONNAME;
     29     HANDLE hEvent;
     30   } OVERLAPPED, *LPOVERLAPPED;
     31 
     32   typedef struct _OVERLAPPED_ENTRY {
     33     ULONG_PTR lpCompletionKey;
     34     LPOVERLAPPED lpOverlapped;
     35     ULONG_PTR Internal;
     36     DWORD dwNumberOfBytesTransferred;
     37   } OVERLAPPED_ENTRY, *LPOVERLAPPED_ENTRY;
     38 
     39 #ifndef _FILETIME_
     40 #define _FILETIME_
     41   typedef struct _FILETIME {
     42     DWORD dwLowDateTime;
     43     DWORD dwHighDateTime;
     44   } FILETIME,*PFILETIME,*LPFILETIME;
     45 #endif
     46 
     47 #ifndef _SYSTEMTIME_
     48 #define _SYSTEMTIME_
     49   typedef struct _SYSTEMTIME {
     50     WORD wYear;
     51     WORD wMonth;
     52     WORD wDayOfWeek;
     53     WORD wDay;
     54     WORD wHour;
     55     WORD wMinute;
     56     WORD wSecond;
     57     WORD wMilliseconds;
     58   } SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
     59 #endif
     60 
     61   typedef struct _WIN32_FIND_DATAA {
     62     DWORD dwFileAttributes;
     63     FILETIME ftCreationTime;
     64     FILETIME ftLastAccessTime;
     65     FILETIME ftLastWriteTime;
     66     DWORD nFileSizeHigh;
     67     DWORD nFileSizeLow;
     68     DWORD dwReserved0;
     69     DWORD dwReserved1;
     70     CHAR cFileName[MAX_PATH];
     71     CHAR cAlternateFileName[14];
     72   } WIN32_FIND_DATAA, *PWIN32_FIND_DATAA, *LPWIN32_FIND_DATAA;
     73 
     74   typedef struct _WIN32_FIND_DATAW {
     75     DWORD dwFileAttributes;
     76     FILETIME ftCreationTime;
     77     FILETIME ftLastAccessTime;
     78     FILETIME ftLastWriteTime;
     79     DWORD nFileSizeHigh;
     80     DWORD nFileSizeLow;
     81     DWORD dwReserved0;
     82     DWORD dwReserved1;
     83     WCHAR cFileName[MAX_PATH];
     84     WCHAR cAlternateFileName[14];
     85   } WIN32_FIND_DATAW, *PWIN32_FIND_DATAW, *LPWIN32_FIND_DATAW;
     86 
     87   __MINGW_TYPEDEF_AW(WIN32_FIND_DATA)
     88   __MINGW_TYPEDEF_AW(PWIN32_FIND_DATA)
     89   __MINGW_TYPEDEF_AW(LPWIN32_FIND_DATA)
     90 
     91   typedef enum _FINDEX_INFO_LEVELS {
     92     FindExInfoStandard,
     93     FindExInfoBasic,
     94     FindExInfoMaxInfoLevel
     95   } FINDEX_INFO_LEVELS;
     96 
     97 #define FIND_FIRST_EX_CASE_SENSITIVE 0x00000001
     98 #define FIND_FIRST_EX_LARGE_FETCH 0x00000002
     99 
    100   typedef enum _FINDEX_SEARCH_OPS {
    101     FindExSearchNameMatch,
    102     FindExSearchLimitToDirectories,
    103     FindExSearchLimitToDevices,
    104     FindExSearchMaxSearchOp
    105   } FINDEX_SEARCH_OPS;
    106 
    107   typedef enum _GET_FILEEX_INFO_LEVELS {
    108     GetFileExInfoStandard,
    109     GetFileExMaxInfoLevel
    110   } GET_FILEEX_INFO_LEVELS;
    111 
    112 #if _WIN32_WINNT >= 0x0600
    113   typedef enum _FILE_INFO_BY_HANDLE_CLASS {
    114     FileBasicInfo /* is zero? */,
    115     FileStandardInfo,
    116     FileNameInfo,
    117     FileRenameInfo,
    118     FileDispositionInfo,
    119     FileAllocationInfo,
    120     FileEndOfFileInfo,
    121     FileStreamInfo,
    122     FileCompressionInfo,
    123     FileAttributeTagInfo,
    124     FileIdBothDirectoryInfo,
    125     FileIdBothDirectoryRestartInfo,
    126     FileIoPriorityHintInfo,
    127     FileRemoteProtocolInfo,
    128     FileFullDirectoryInfo,
    129     FileFullDirectoryRestartInfo,
    130 #if _WIN32_WINNT >= 0x0602
    131     FileStorageInfo,
    132     FileAlignmentInfo,
    133     FileIdInfo,
    134     FileIdExtdDirectoryInfo,
    135     FileIdExtdDirectoryRestartInfo,
    136 #endif
    137     MaximumFileInfoByHandleClass
    138   } FILE_INFO_BY_HANDLE_CLASS, *PFILE_INFO_BY_HANDLE_CLASS;
    139 #endif
    140 
    141   typedef RTL_CRITICAL_SECTION CRITICAL_SECTION;
    142   typedef PRTL_CRITICAL_SECTION PCRITICAL_SECTION;
    143   typedef PRTL_CRITICAL_SECTION LPCRITICAL_SECTION;
    144   typedef RTL_CRITICAL_SECTION_DEBUG CRITICAL_SECTION_DEBUG;
    145   typedef PRTL_CRITICAL_SECTION_DEBUG PCRITICAL_SECTION_DEBUG;
    146   typedef PRTL_CRITICAL_SECTION_DEBUG LPCRITICAL_SECTION_DEBUG;
    147 
    148   typedef VOID (WINAPI *LPOVERLAPPED_COMPLETION_ROUTINE) (DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped);
    149 
    150 #define LOCKFILE_FAIL_IMMEDIATELY 0x1
    151 #define LOCKFILE_EXCLUSIVE_LOCK 0x2
    152 
    153   typedef struct _PROCESS_HEAP_ENTRY {
    154     PVOID lpData;
    155     DWORD cbData;
    156     BYTE cbOverhead;
    157     BYTE iRegionIndex;
    158     WORD wFlags;
    159     __C89_NAMELESS union {
    160       struct {
    161 	HANDLE hMem;
    162 	DWORD dwReserved[3];
    163       } Block;
    164       struct {
    165 	DWORD dwCommittedSize;
    166 	DWORD dwUnCommittedSize;
    167 	LPVOID lpFirstBlock;
    168 	LPVOID lpLastBlock;
    169       } Region;
    170     } DUMMYUNIONNAME;
    171   } PROCESS_HEAP_ENTRY,*LPPROCESS_HEAP_ENTRY,*PPROCESS_HEAP_ENTRY;
    172 
    173 #define PROCESS_HEAP_REGION 0x1
    174 #define PROCESS_HEAP_UNCOMMITTED_RANGE 0x2
    175 #define PROCESS_HEAP_ENTRY_BUSY 0x4
    176 #define PROCESS_HEAP_ENTRY_MOVEABLE 0x10
    177 #define PROCESS_HEAP_ENTRY_DDESHARE 0x20
    178 
    179   typedef struct _REASON_CONTEXT {
    180     ULONG Version;
    181     DWORD Flags;
    182     union {
    183       struct {
    184 	HMODULE LocalizedReasonModule;
    185 	ULONG LocalizedReasonId;
    186 	ULONG ReasonStringCount;
    187 	LPWSTR *ReasonStrings;
    188       } Detailed;
    189       LPWSTR SimpleReasonString;
    190     } Reason;
    191   } REASON_CONTEXT, *PREASON_CONTEXT;
    192 
    193 #define EXCEPTION_DEBUG_EVENT 1
    194 #define CREATE_THREAD_DEBUG_EVENT 2
    195 #define CREATE_PROCESS_DEBUG_EVENT 3
    196 #define EXIT_THREAD_DEBUG_EVENT 4
    197 #define EXIT_PROCESS_DEBUG_EVENT 5
    198 #define LOAD_DLL_DEBUG_EVENT 6
    199 #define UNLOAD_DLL_DEBUG_EVENT 7
    200 #define OUTPUT_DEBUG_STRING_EVENT 8
    201 #define RIP_EVENT 9
    202 
    203   typedef DWORD (WINAPI *PTHREAD_START_ROUTINE) (LPVOID lpThreadParameter);
    204   typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
    205 
    206   typedef struct _EXCEPTION_DEBUG_INFO {
    207     EXCEPTION_RECORD ExceptionRecord;
    208     DWORD dwFirstChance;
    209   } EXCEPTION_DEBUG_INFO, *LPEXCEPTION_DEBUG_INFO;
    210 
    211   typedef struct _CREATE_THREAD_DEBUG_INFO {
    212     HANDLE hThread;
    213     LPVOID lpThreadLocalBase;
    214     LPTHREAD_START_ROUTINE lpStartAddress;
    215   } CREATE_THREAD_DEBUG_INFO, *LPCREATE_THREAD_DEBUG_INFO;
    216 
    217   typedef struct _CREATE_PROCESS_DEBUG_INFO {
    218     HANDLE hFile;
    219     HANDLE hProcess;
    220     HANDLE hThread;
    221     LPVOID lpBaseOfImage;
    222     DWORD dwDebugInfoFileOffset;
    223     DWORD nDebugInfoSize;
    224     LPVOID lpThreadLocalBase;
    225     LPTHREAD_START_ROUTINE lpStartAddress;
    226     LPVOID lpImageName;
    227     WORD fUnicode;
    228   } CREATE_PROCESS_DEBUG_INFO, *LPCREATE_PROCESS_DEBUG_INFO;
    229 
    230   typedef struct _EXIT_THREAD_DEBUG_INFO {
    231     DWORD dwExitCode;
    232   } EXIT_THREAD_DEBUG_INFO, *LPEXIT_THREAD_DEBUG_INFO;
    233 
    234   typedef struct _EXIT_PROCESS_DEBUG_INFO {
    235     DWORD dwExitCode;
    236   } EXIT_PROCESS_DEBUG_INFO, *LPEXIT_PROCESS_DEBUG_INFO;
    237 
    238   typedef struct _LOAD_DLL_DEBUG_INFO {
    239     HANDLE hFile;
    240     LPVOID lpBaseOfDll;
    241     DWORD dwDebugInfoFileOffset;
    242     DWORD nDebugInfoSize;
    243     LPVOID lpImageName;
    244     WORD fUnicode;
    245   } LOAD_DLL_DEBUG_INFO, *LPLOAD_DLL_DEBUG_INFO;
    246 
    247   typedef struct _UNLOAD_DLL_DEBUG_INFO {
    248     LPVOID lpBaseOfDll;
    249   } UNLOAD_DLL_DEBUG_INFO, *LPUNLOAD_DLL_DEBUG_INFO;
    250 
    251   typedef struct _OUTPUT_DEBUG_STRING_INFO {
    252     LPSTR lpDebugStringData;
    253     WORD fUnicode;
    254     WORD nDebugStringLength;
    255   } OUTPUT_DEBUG_STRING_INFO, *LPOUTPUT_DEBUG_STRING_INFO;
    256 
    257   typedef struct _RIP_INFO {
    258     DWORD dwError;
    259     DWORD dwType;
    260   } RIP_INFO, *LPRIP_INFO;
    261 
    262   typedef struct _DEBUG_EVENT {
    263     DWORD dwDebugEventCode;
    264     DWORD dwProcessId;
    265     DWORD dwThreadId;
    266     union {
    267       EXCEPTION_DEBUG_INFO Exception;
    268       CREATE_THREAD_DEBUG_INFO CreateThread;
    269       CREATE_PROCESS_DEBUG_INFO CreateProcessInfo;
    270       EXIT_THREAD_DEBUG_INFO ExitThread;
    271       EXIT_PROCESS_DEBUG_INFO ExitProcess;
    272       LOAD_DLL_DEBUG_INFO LoadDll;
    273       UNLOAD_DLL_DEBUG_INFO UnloadDll;
    274       OUTPUT_DEBUG_STRING_INFO DebugString;
    275       RIP_INFO RipInfo;
    276     } u;
    277   } DEBUG_EVENT, *LPDEBUG_EVENT;
    278 
    279 #ifndef __WIDL__
    280   typedef PCONTEXT LPCONTEXT;
    281 #endif
    282 
    283 #define STILL_ACTIVE STATUS_PENDING
    284 #define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION
    285 #define EXCEPTION_DATATYPE_MISALIGNMENT STATUS_DATATYPE_MISALIGNMENT
    286 #define EXCEPTION_BREAKPOINT STATUS_BREAKPOINT
    287 #define EXCEPTION_SINGLE_STEP STATUS_SINGLE_STEP
    288 #define EXCEPTION_ARRAY_BOUNDS_EXCEEDED STATUS_ARRAY_BOUNDS_EXCEEDED
    289 #define EXCEPTION_FLT_DENORMAL_OPERAND STATUS_FLOAT_DENORMAL_OPERAND
    290 #define EXCEPTION_FLT_DIVIDE_BY_ZERO STATUS_FLOAT_DIVIDE_BY_ZERO
    291 #define EXCEPTION_FLT_INEXACT_RESULT STATUS_FLOAT_INEXACT_RESULT
    292 #define EXCEPTION_FLT_INVALID_OPERATION STATUS_FLOAT_INVALID_OPERATION
    293 #define EXCEPTION_FLT_OVERFLOW STATUS_FLOAT_OVERFLOW
    294 #define EXCEPTION_FLT_STACK_CHECK STATUS_FLOAT_STACK_CHECK
    295 #define EXCEPTION_FLT_UNDERFLOW STATUS_FLOAT_UNDERFLOW
    296 #define EXCEPTION_INT_DIVIDE_BY_ZERO STATUS_INTEGER_DIVIDE_BY_ZERO
    297 #define EXCEPTION_INT_OVERFLOW STATUS_INTEGER_OVERFLOW
    298 #define EXCEPTION_PRIV_INSTRUCTION STATUS_PRIVILEGED_INSTRUCTION
    299 #define EXCEPTION_IN_PAGE_ERROR STATUS_IN_PAGE_ERROR
    300 #define EXCEPTION_ILLEGAL_INSTRUCTION STATUS_ILLEGAL_INSTRUCTION
    301 #define EXCEPTION_NONCONTINUABLE_EXCEPTION STATUS_NONCONTINUABLE_EXCEPTION
    302 #define EXCEPTION_STACK_OVERFLOW STATUS_STACK_OVERFLOW
    303 #define EXCEPTION_INVALID_DISPOSITION STATUS_INVALID_DISPOSITION
    304 #define EXCEPTION_GUARD_PAGE STATUS_GUARD_PAGE_VIOLATION
    305 #define EXCEPTION_INVALID_HANDLE STATUS_INVALID_HANDLE
    306 #define EXCEPTION_POSSIBLE_DEADLOCK STATUS_POSSIBLE_DEADLOCK
    307 #define CONTROL_C_EXIT STATUS_CONTROL_C_EXIT
    308 
    309 #define LMEM_FIXED 0x0
    310 #define LMEM_MOVEABLE 0x2
    311 #define LMEM_NOCOMPACT 0x10
    312 #define LMEM_NODISCARD 0x20
    313 #define LMEM_ZEROINIT 0x40
    314 #define LMEM_MODIFY 0x80
    315 #define LMEM_DISCARDABLE 0xf00
    316 #define LMEM_VALID_FLAGS 0xf72
    317 #define LMEM_INVALID_HANDLE 0x8000
    318 
    319 #define LHND (LMEM_MOVEABLE | LMEM_ZEROINIT)
    320 #define LPTR (LMEM_FIXED | LMEM_ZEROINIT)
    321 
    322 #define NONZEROLHND (LMEM_MOVEABLE)
    323 #define NONZEROLPTR (LMEM_FIXED)
    324 
    325 #define LocalDiscard(h) LocalReAlloc ((h), 0, LMEM_MOVEABLE)
    326 
    327 #define LMEM_DISCARDED 0x4000
    328 #define LMEM_LOCKCOUNT 0xff
    329 
    330 #ifdef __cplusplus
    331 }
    332 #endif
    333 #endif
    334