20 #ifndef INVALID_HANDLE_VALUE
21 #define INVALID_HANDLE_VALUE (0xFFFFFFFF)
24 #ifndef INVALID_SET_FILE_POINTER
25 #define INVALID_SET_FILE_POINTER ((DWORD)-1)
30 #if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API)))
31 #if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY, WINAPI_PARTITION_APP)
32 #define IOWIN32_USING_WINRT_API 1
52 DWORD* lpdwDesiredAccess,
53 DWORD* lpdwCreationDisposition,
55 DWORD* lpdwFlagsAndAttributes)
57 *lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0;
61 *lpdwDesiredAccess = GENERIC_READ;
62 *lpdwCreationDisposition = OPEN_EXISTING;
63 *lpdwShareMode = FILE_SHARE_READ;
67 *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
68 *lpdwCreationDisposition = OPEN_EXISTING;
72 *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
73 *lpdwCreationDisposition = CREATE_ALWAYS;
98 const char* mode_fopen =
NULL;
99 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
104 #ifdef IOWIN32_USING_WINRT_API
107 hFile = CreateFile2((LPCTSTR)
filename, dwDesiredAccess, dwShareMode, dwCreationDisposition,
NULL);
111 WCHAR filenameW[FILENAME_MAX + 0x200 + 1];
112 MultiByteToWideChar(CP_ACP,0,(
const char*)
filename,-1,filenameW,FILENAME_MAX + 0x200);
113 hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition,
NULL);
118 hFile = CreateFile((LPCTSTR)
filename, dwDesiredAccess, dwShareMode,
NULL, dwCreationDisposition, dwFlagsAndAttributes,
NULL);
127 const char* mode_fopen =
NULL;
128 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
133 #ifdef IOWIN32_USING_WINRT_API
136 WCHAR filenameW[FILENAME_MAX + 0x200 + 1];
137 MultiByteToWideChar(CP_ACP,0,(
const char*)
filename,-1,filenameW,FILENAME_MAX + 0x200);
138 hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition,
NULL);
142 hFile = CreateFileA((LPCSTR)
filename, dwDesiredAccess, dwShareMode,
NULL, dwCreationDisposition, dwFlagsAndAttributes,
NULL);
151 const char* mode_fopen =
NULL;
152 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
157 #ifdef IOWIN32_USING_WINRT_API
159 hFile = CreateFile2((LPCWSTR)
filename, dwDesiredAccess, dwShareMode, dwCreationDisposition,
NULL);
162 hFile = CreateFileW((LPCWSTR)
filename, dwDesiredAccess, dwShareMode,
NULL, dwCreationDisposition, dwFlagsAndAttributes,
NULL);
171 const char* mode_fopen =
NULL;
172 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
177 #ifdef IOWIN32_USING_WINRT_API
180 hFile = CreateFile2((LPCTSTR)
filename, dwDesiredAccess, dwShareMode, dwCreationDisposition,
NULL);
184 WCHAR filenameW[FILENAME_MAX + 0x200 + 1];
185 MultiByteToWideChar(CP_ACP,0,(
const char*)
filename,-1,filenameW,FILENAME_MAX + 0x200);
186 hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition,
NULL);
191 hFile = CreateFile((LPCTSTR)
filename, dwDesiredAccess, dwShareMode,
NULL, dwCreationDisposition, dwFlagsAndAttributes,
NULL);
209 DWORD dwErr = GetLastError();
210 if (dwErr == ERROR_HANDLE_EOF)
231 DWORD dwErr = GetLastError();
232 if (dwErr == ERROR_HANDLE_EOF)
243 #ifdef IOWIN32_USING_WINRT_API
244 return SetFilePointerEx(hFile,
pos, newPos, dwMoveMethod);
247 DWORD dwNewPos = SetFilePointer(hFile,
pos.LowPart, &lHigh, dwMoveMethod);
249 if (dwNewPos == 0xFFFFFFFF)
250 if (GetLastError() != NO_ERROR)
252 if ((newPos !=
NULL) && (fOk))
254 newPos->LowPart = dwNewPos;
255 newPos->HighPart = lHigh;
274 DWORD dwErr = GetLastError();
298 DWORD dwErr = GetLastError();
311 DWORD dwMoveMethod=0xFFFFFFFF;
320 dwMoveMethod = FILE_CURRENT;
323 dwMoveMethod = FILE_END;
326 dwMoveMethod = FILE_BEGIN;
337 DWORD dwErr = GetLastError();
349 DWORD dwMoveMethod=0xFFFFFFFF;
359 dwMoveMethod = FILE_CURRENT;
362 dwMoveMethod = FILE_END;
365 dwMoveMethod = FILE_BEGIN;
376 DWORD dwErr = GetLastError();
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags long
RZ_API void Ht_() free(HtName_(Ht) *ht)
#define ZLIB_FILEFUNC_MODE_READWRITEFILTER
#define ZLIB_FILEFUNC_MODE_EXISTING
#define ZLIB_FILEFUNC_SEEK_CUR
#define ZLIB_FILEFUNC_SEEK_SET
#define ZLIB_FILEFUNC_MODE_CREATE
#define ZLIB_FILEFUNC_SEEK_END
#define ZLIB_FILEFUNC_MODE_READ
unsigned long long int ZPOS64_T
void fill_win32_filefunc64(zlib_filefunc64_def *pzlib_filefunc_def)
long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin)
voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void *filename, int mode)
void fill_win32_filefunc64W(zlib_filefunc64_def *pzlib_filefunc_def)
int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream)
#define INVALID_HANDLE_VALUE
uLong ZCALLBACK win32_write_file_func(voidpf opaque, voidpf stream, const void *buf, uLong size)
void fill_win32_filefunc(zlib_filefunc_def *pzlib_filefunc_def)
ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream)
long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream)
int ZCALLBACK win32_error_file_func(voidpf opaque, voidpf stream)
voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void *filename, int mode)
static voidpf win32_build_iowin(HANDLE hFile)
voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char *filename, int mode)
static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod)
voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char *filename, int mode))
void fill_win32_filefunc64A(zlib_filefunc64_def *pzlib_filefunc_def)
static void win32_translate_open_mode(int mode, DWORD *lpdwDesiredAccess, DWORD *lpdwCreationDisposition, DWORD *lpdwShareMode, DWORD *lpdwFlagsAndAttributes)
uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void *buf, uLong size)
voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void *filename, int mode)
void * malloc(size_t size)
write_file_func zwrite_file
open64_file_func zopen64_file
read_file_func zread_file
tell64_file_func ztell64_file
close_file_func zclose_file
seek64_file_func zseek64_file
testerror_file_func zerror_file
seek_file_func zseek_file
open_file_func zopen_file
testerror_file_func zerror_file
write_file_func zwrite_file
read_file_func zread_file
close_file_func zclose_file
tell_file_func ztell_file
void error(const char *msg)