2 #define __stdcall __attribute__((ms_abi))
4 #define __stdcall __attribute__((stdcall))
7 #define INVALID_HANDLE_VALUE (void *)-1
9 #define FILE_SHARE_READ 0x00000001
10 #define FILE_SHARE_WRITE 0x00000002
11 #define FILE_SHARE_VALID_FLAGS 0x00000007
12 #define GENERIC_READ 0x80000000
13 #define GENERIC_WRITE 0x40000000
14 #define OPEN_EXISTING 3
17 #define FILE_ATTRIBUTE_READONLY 0x00000001
18 #define FILE_ATTRIBUTE_DEVICE 0x00000040
19 #define FILE_ATTRIBUTE_NORMAL 0x00000080
21 #define ERROR_INVALID_FUNCTION 1L
22 #define ERROR_FILE_NOT_FOUND 2L
23 #define ERROR_PATH_NOT_FOUND 3L
24 #define ERROR_ACCESS_DENIED 5L
25 #define ERROR_NOT_ENOUGH_MEMORY 8L
26 #define ERROR_NO_MORE_FILES 18L
27 #define ERROR_WRITE_PROTECT 19L
28 #define ERROR_SHARING_VIOLATION 32L
29 #define ERROR_LOCK_VIOLATION 33L
30 #define ERROR_HANDLE_EOF 38L
31 #define ERROR_FILE_EXISTS 80L
32 #define ERROR_INVALID_PARAMETER 87L
33 #define ERROR_INVALID_NAME 123L
34 #define ERROR_DIR_NOT_EMPTY 145L
35 #define ERROR_IO_PENDING 997L
37 #define CTL_CODE(t,f,m,a) (((t)<<16)|((a)<<14)|((f)<<2)|(m))
38 #define IOCTL_DISK_GET_DRIVE_GEOMETRY 0x00070000 //CTL_CODE(7, 0, 0, 0)
40 typedef enum _MEDIA_TYPE
53 RemovableMedia
= 0x0b,
70 typedef struct _DISK_GEOMETRY
74 ULONG TracksPerCylinder
;
75 ULONG SectorsPerTrack
;
83 void * __stdcall (*CreateFile
)(char *lpFileName
, ULONG dwDesiredAccess
, ULONG dwShareMode
, void *lpSecurityAttributes
,
84 ULONG dwCreationDisposition
, ULONG dwFlagsAndAttributes
, void *hTemplateFile
);
85 ULONG
__stdcall (*CloseHandle
)(void *hObject
);
86 ULONG
__stdcall (*ReadFile
)(void *hFile
, void *lpBuffer
, ULONG nNumberOfBytesToRead
, ULONG
*lpNumberOfBytesRead
, void *lpOverlapped
);
87 ULONG
__stdcall (*WriteFile
)(void *hFile
, void *lpBuffer
, ULONG nNumberOfBytesToWrite
, ULONG
*lpNumberOfBytesWritten
, void *lpOverlapped
);
88 ULONG
__stdcall (*SetFilePointer
)(void *hFile
, LONG lDistanceToMove
, LONG
*lpDistanceToMoveHigh
, ULONG dwMoveMethod
);
89 ULONG
__stdcall (*GetFileAttributes
)(STRPTR lpFileName
);
90 ULONG
__stdcall (*GetFileSize
)(void *hFile
, ULONG
*lpFileSizeHigh
);
91 ULONG
__stdcall (*DeviceIoControl
)(void *hDevice
, ULONG dwIoControlCode
, void *lpInBuffer
, ULONG nInBufferSize
,
92 void *lpOutBuffer
, ULONG nOutBufferSize
, ULONG
*lpBytesReturned
, void *lpOverlapped
);
93 ULONG
__stdcall (*GetLastError
)(void);