ReactOS 0.4.15-dev-7953-g1f49173
iowin32.c File Reference
#include <stdlib.h>
#include "zlib.h"
#include "ioapi.h"
#include "iowin32.h"
Include dependency graph for iowin32.c:

Go to the source code of this file.

Classes

struct  WIN32FILE_IOWIN
 

Macros

#define INVALID_HANDLE_VALUE   (0xFFFFFFFF)
 
#define INVALID_SET_FILE_POINTER   ((DWORD)-1)
 

Functions

voidpf ZCALLBACK win32_open_file_func OF ((voidpf opaque, const char *filename, int mode))
 
uLong ZCALLBACK win32_read_file_func OF ((voidpf opaque, voidpf stream, void *buf, uLong size))
 
uLong ZCALLBACK win32_write_file_func OF ((voidpf opaque, voidpf stream, const void *buf, uLong size))
 
ZPOS64_T ZCALLBACK win32_tell64_file_func OF ((voidpf opaque, voidpf stream))
 
long ZCALLBACK win32_seek64_file_func OF ((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin))
 
static void win32_translate_open_mode (int mode, DWORD *lpdwDesiredAccess, DWORD *lpdwCreationDisposition, DWORD *lpdwShareMode, DWORD *lpdwFlagsAndAttributes)
 
static voidpf win32_build_iowin (HANDLE hFile)
 
voidpf ZCALLBACK win32_open64_file_func (voidpf opaque, const void *filename, int mode)
 
voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque, const void *filename, int mode)
 
voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque, const void *filename, int mode)
 
voidpf ZCALLBACK win32_open_file_func (voidpf opaque, const char *filename, int mode)
 
uLong ZCALLBACK win32_read_file_func (voidpf opaque, voidpf stream, void *buf, uLong size)
 
uLong ZCALLBACK win32_write_file_func (voidpf opaque, voidpf stream, const void *buf, uLong size)
 
static BOOL MySetFilePointerEx (HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod)
 
long ZCALLBACK win32_tell_file_func (voidpf opaque, voidpf stream)
 
ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream)
 
long ZCALLBACK win32_seek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
 
long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
 
int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream)
 
int ZCALLBACK win32_error_file_func (voidpf opaque, voidpf stream)
 
void fill_win32_filefunc (zlib_filefunc_def *pzlib_filefunc_def)
 
void fill_win32_filefunc64 (zlib_filefunc64_def *pzlib_filefunc_def)
 
void fill_win32_filefunc64A (zlib_filefunc64_def *pzlib_filefunc_def)
 
void fill_win32_filefunc64W (zlib_filefunc64_def *pzlib_filefunc_def)
 

Macro Definition Documentation

◆ INVALID_HANDLE_VALUE

#define INVALID_HANDLE_VALUE   (0xFFFFFFFF)

Definition at line 21 of file iowin32.c.

◆ INVALID_SET_FILE_POINTER

#define INVALID_SET_FILE_POINTER   ((DWORD)-1)

Definition at line 25 of file iowin32.c.

Function Documentation

◆ fill_win32_filefunc()

void fill_win32_filefunc ( zlib_filefunc_def pzlib_filefunc_def)

Definition at line 419 of file iowin32.c.

420{
421 pzlib_filefunc_def->zopen_file = win32_open_file_func;
422 pzlib_filefunc_def->zread_file = win32_read_file_func;
423 pzlib_filefunc_def->zwrite_file = win32_write_file_func;
424 pzlib_filefunc_def->ztell_file = win32_tell_file_func;
425 pzlib_filefunc_def->zseek_file = win32_seek_file_func;
426 pzlib_filefunc_def->zclose_file = win32_close_file_func;
427 pzlib_filefunc_def->zerror_file = win32_error_file_func;
428 pzlib_filefunc_def->opaque = NULL;
429}
#define NULL
Definition: types.h:112
long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin)
Definition: iowin32.c:314
int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream)
Definition: iowin32.c:391
uLong ZCALLBACK win32_write_file_func(voidpf opaque, voidpf stream, const void *buf, uLong size)
Definition: iowin32.c:225
long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream)
Definition: iowin32.c:266
int ZCALLBACK win32_error_file_func(voidpf opaque, voidpf stream)
Definition: iowin32.c:409
voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char *filename, int mode)
Definition: iowin32.c:174
uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void *buf, uLong size)
Definition: iowin32.c:203
seek_file_func zseek_file
Definition: ioapi.h:154
open_file_func zopen_file
Definition: ioapi.h:150
testerror_file_func zerror_file
Definition: ioapi.h:156
write_file_func zwrite_file
Definition: ioapi.h:152
read_file_func zread_file
Definition: ioapi.h:151
close_file_func zclose_file
Definition: ioapi.h:155
tell_file_func ztell_file
Definition: ioapi.h:153

◆ fill_win32_filefunc64()

void fill_win32_filefunc64 ( zlib_filefunc64_def pzlib_filefunc_def)

Definition at line 431 of file iowin32.c.

432{
433 pzlib_filefunc_def->zopen64_file = win32_open64_file_func;
434 pzlib_filefunc_def->zread_file = win32_read_file_func;
435 pzlib_filefunc_def->zwrite_file = win32_write_file_func;
436 pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
437 pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
438 pzlib_filefunc_def->zclose_file = win32_close_file_func;
439 pzlib_filefunc_def->zerror_file = win32_error_file_func;
440 pzlib_filefunc_def->opaque = NULL;
441}
ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream)
Definition: iowin32.c:289
long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
Definition: iowin32.c:352
voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void *filename, int mode)
Definition: iowin32.c:101
write_file_func zwrite_file
Definition: ioapi.h:168
open64_file_func zopen64_file
Definition: ioapi.h:166
read_file_func zread_file
Definition: ioapi.h:167
tell64_file_func ztell64_file
Definition: ioapi.h:169
close_file_func zclose_file
Definition: ioapi.h:171
seek64_file_func zseek64_file
Definition: ioapi.h:170
testerror_file_func zerror_file
Definition: ioapi.h:172

◆ fill_win32_filefunc64A()

void fill_win32_filefunc64A ( zlib_filefunc64_def pzlib_filefunc_def)

Definition at line 444 of file iowin32.c.

445{
446 pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA;
447 pzlib_filefunc_def->zread_file = win32_read_file_func;
448 pzlib_filefunc_def->zwrite_file = win32_write_file_func;
449 pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
450 pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
451 pzlib_filefunc_def->zclose_file = win32_close_file_func;
452 pzlib_filefunc_def->zerror_file = win32_error_file_func;
453 pzlib_filefunc_def->opaque = NULL;
454}
voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void *filename, int mode)
Definition: iowin32.c:130

◆ fill_win32_filefunc64W()

void fill_win32_filefunc64W ( zlib_filefunc64_def pzlib_filefunc_def)

Definition at line 457 of file iowin32.c.

458{
459 pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW;
460 pzlib_filefunc_def->zread_file = win32_read_file_func;
461 pzlib_filefunc_def->zwrite_file = win32_write_file_func;
462 pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
463 pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
464 pzlib_filefunc_def->zclose_file = win32_close_file_func;
465 pzlib_filefunc_def->zerror_file = win32_error_file_func;
466 pzlib_filefunc_def->opaque = NULL;
467}
voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void *filename, int mode)
Definition: iowin32.c:154

Referenced by init_zlib(), and CZipCreatorImpl::JustDoIt().

◆ MySetFilePointerEx()

static BOOL MySetFilePointerEx ( HANDLE  hFile,
LARGE_INTEGER  pos,
LARGE_INTEGER newPos,
DWORD  dwMoveMethod 
)
static

Definition at line 246 of file iowin32.c.

247{
248#ifdef IOWIN32_USING_WINRT_API
249 return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod);
250#else
251 LONG lHigh = pos.HighPart;
252 DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, dwMoveMethod);
253 BOOL fOk = TRUE;
254 if (dwNewPos == 0xFFFFFFFF)
255 if (GetLastError() != NO_ERROR)
256 fOk = FALSE;
257 if ((newPos != NULL) && (fOk))
258 {
259 newPos->LowPart = dwNewPos;
260 newPos->HighPart = lHigh;
261 }
262 return fOk;
263#endif
264}
#define NO_ERROR
Definition: dderror.h:5
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define SetFilePointer
Definition: compat.h:743
BOOL WINAPI SetFilePointerEx(HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod)
Definition: fileinfo.c:177
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ HANDLE hFile
Definition: mswsock.h:90
long LONG
Definition: pedump.c:60
ULONG LowPart
Definition: typedefs.h:106
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by win32_seek64_file_func(), win32_seek_file_func(), win32_tell64_file_func(), and win32_tell_file_func().

◆ OF() [1/5]

◆ OF() [2/5]

◆ OF() [3/5]

◆ OF() [4/5]

◆ OF() [5/5]

◆ win32_build_iowin()

static voidpf win32_build_iowin ( HANDLE  hFile)
static

Definition at line 82 of file iowin32.c.

83{
85
86 if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE))
87 {
88 WIN32FILE_IOWIN w32fiow;
89 w32fiow.hf = hFile;
90 w32fiow.error = 0;
91 ret = malloc(sizeof(WIN32FILE_IOWIN));
92
93 if (ret==NULL)
95 else
96 *((WIN32FILE_IOWIN*)ret) = w32fiow;
97 }
98 return ret;
99}
#define malloc
Definition: debug_ros.c:4
#define CloseHandle
Definition: compat.h:739
void FAR * voidpf
Definition: zlib.h:42
#define INVALID_HANDLE_VALUE
Definition: iowin32.c:21
HANDLE hf
Definition: iowin32.c:51
int ret

Referenced by win32_open64_file_func(), win32_open64_file_funcA(), win32_open64_file_funcW(), and win32_open_file_func().

◆ win32_close_file_func()

int ZCALLBACK win32_close_file_func ( voidpf  opaque,
voidpf  stream 
)

Definition at line 391 of file iowin32.c.

392{
393 int ret=-1;
394
395 if (stream!=NULL)
396 {
398 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
399 if (hFile != NULL)
400 {
402 ret=0;
403 }
404 free(stream);
405 }
406 return ret;
407}
#define free
Definition: debug_ros.c:5
Definition: parse.h:23

Referenced by fill_win32_filefunc(), fill_win32_filefunc64(), fill_win32_filefunc64A(), and fill_win32_filefunc64W().

◆ win32_error_file_func()

int ZCALLBACK win32_error_file_func ( voidpf  opaque,
voidpf  stream 
)

Definition at line 409 of file iowin32.c.

410{
411 int ret=-1;
412 if (stream!=NULL)
413 {
415 }
416 return ret;
417}
#define error(str)
Definition: mkdosfs.c:1605

Referenced by fill_win32_filefunc(), fill_win32_filefunc64(), fill_win32_filefunc64A(), and fill_win32_filefunc64W().

◆ win32_open64_file_func()

voidpf ZCALLBACK win32_open64_file_func ( voidpf  opaque,
const void filename,
int  mode 
)

Definition at line 101 of file iowin32.c.

102{
103 //const char* mode_fopen = NULL;
104 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
105 HANDLE hFile = NULL;
106
107 win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
108
109#ifdef IOWIN32_USING_WINRT_API
110#ifdef UNICODE
111 if ((filename!=NULL) && (dwDesiredAccess != 0))
112 hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
113#else
114 if ((filename!=NULL) && (dwDesiredAccess != 0))
115 {
116 WCHAR filenameW[FILENAME_MAX + 0x200 + 1];
117 MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200);
118 hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
119 }
120#endif
121#else
122 if ((filename!=NULL) && (dwDesiredAccess != 0))
123 hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
124#endif
125
126 return win32_build_iowin(hFile);
127}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
WINBASEAPI HANDLE WINAPI CreateFile2(LPCWSTR, DWORD, DWORD, DWORD, LPCREATEFILE2_EXTENDED_PARAMETERS)
GLenum mode
Definition: glext.h:6217
#define FILENAME_MAX
Definition: stdio.h:64
const char * filename
Definition: ioapi.h:137
static voidpf win32_build_iowin(HANDLE hFile)
Definition: iowin32.c:82
static void win32_translate_open_mode(int mode, DWORD *lpdwDesiredAccess, DWORD *lpdwCreationDisposition, DWORD *lpdwShareMode, DWORD *lpdwFlagsAndAttributes)
Definition: iowin32.c:56
static const WCHAR filenameW[]
Definition: amstream.c:41
#define CreateFile
Definition: winbase.h:3749
__wchar_t WCHAR
Definition: xmlstorage.h:180
const CHAR * LPCTSTR
Definition: xmlstorage.h:193

Referenced by fill_win32_filefunc64().

◆ win32_open64_file_funcA()

voidpf ZCALLBACK win32_open64_file_funcA ( voidpf  opaque,
const void filename,
int  mode 
)

Definition at line 130 of file iowin32.c.

131{
132 //const char* mode_fopen = NULL;
133 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
134 HANDLE hFile = NULL;
135
136 win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
137
138#ifdef IOWIN32_USING_WINRT_API
139 if ((filename!=NULL) && (dwDesiredAccess != 0))
140 {
141 WCHAR filenameW[FILENAME_MAX + 0x200 + 1];
142 MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200);
143 hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
144 }
145#else
146 if ((filename!=NULL) && (dwDesiredAccess != 0))
147 hFile = CreateFileA((LPCSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
148#endif
149
150 return win32_build_iowin(hFile);
151}
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by fill_win32_filefunc64A().

◆ win32_open64_file_funcW()

voidpf ZCALLBACK win32_open64_file_funcW ( voidpf  opaque,
const void filename,
int  mode 
)

Definition at line 154 of file iowin32.c.

155{
156 //const char* mode_fopen = NULL;
157 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
158 HANDLE hFile = NULL;
159
160 win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
161
162#ifdef IOWIN32_USING_WINRT_API
163 if ((filename!=NULL) && (dwDesiredAccess != 0))
164 hFile = CreateFile2((LPCWSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition,NULL);
165#else
166 if ((filename!=NULL) && (dwDesiredAccess != 0))
167 hFile = CreateFileW((LPCWSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
168#endif
169
170 return win32_build_iowin(hFile);
171}
#define CreateFileW
Definition: compat.h:741
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by fill_win32_filefunc64W().

◆ win32_open_file_func()

voidpf ZCALLBACK win32_open_file_func ( voidpf  opaque,
const char filename,
int  mode 
)

Definition at line 174 of file iowin32.c.

175{
176 //const char* mode_fopen = NULL;
177 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
178 HANDLE hFile = NULL;
179
180 win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
181
182#ifdef IOWIN32_USING_WINRT_API
183#ifdef UNICODE
184 if ((filename!=NULL) && (dwDesiredAccess != 0))
185 hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
186#else
187 if ((filename!=NULL) && (dwDesiredAccess != 0))
188 {
189 WCHAR filenameW[FILENAME_MAX + 0x200 + 1];
190 MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200);
191 hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
192 }
193#endif
194#else
195 if ((filename!=NULL) && (dwDesiredAccess != 0))
196 hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
197#endif
198
199 return win32_build_iowin(hFile);
200}

Referenced by fill_win32_filefunc().

◆ win32_read_file_func()

uLong ZCALLBACK win32_read_file_func ( voidpf  opaque,
voidpf  stream,
void buf,
uLong  size 
)

Definition at line 203 of file iowin32.c.

204{
205 uLong ret=0;
206 HANDLE hFile = NULL;
207 if (stream!=NULL)
208 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
209
210 if (hFile != NULL)
211 {
212 if (!ReadFile(hFile, buf, size, &ret, NULL))
213 {
215 if (dwErr == ERROR_HANDLE_EOF)
216 dwErr = 0;
218 }
219 }
220
221 return ret;
222}
DWORD dwErr
Definition: service.c:36
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
unsigned long uLong
Definition: zlib.h:39
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define ERROR_HANDLE_EOF
Definition: winerror.h:140

Referenced by fill_win32_filefunc(), fill_win32_filefunc64(), fill_win32_filefunc64A(), and fill_win32_filefunc64W().

◆ win32_seek64_file_func()

long ZCALLBACK win32_seek64_file_func ( voidpf  opaque,
voidpf  stream,
ZPOS64_T  offset,
int  origin 
)

Definition at line 352 of file iowin32.c.

353{
354 DWORD dwMoveMethod=0xFFFFFFFF;
355 HANDLE hFile = NULL;
356 long ret=-1;
357
358 if (stream!=NULL)
359 hFile = ((WIN32FILE_IOWIN*)stream)->hf;
360
361 switch (origin)
362 {
364 dwMoveMethod = FILE_CURRENT;
365 break;
367 dwMoveMethod = FILE_END;
368 break;
370 dwMoveMethod = FILE_BEGIN;
371 break;
372 default: return -1;
373 }
374
375 if (hFile)
376 {
378 pos.QuadPart = offset;
379 if (!MySetFilePointerEx(hFile, pos, NULL, dwMoveMethod))
380 {
383 ret = -1;
384 }
385 else
386 ret=0;
387 }
388 return ret;
389}
#define FILE_BEGIN
Definition: compat.h:761
GLintptr offset
Definition: glext.h:5920
voidpf uLong int origin
Definition: ioapi.h:144
#define ZLIB_FILEFUNC_SEEK_CUR
Definition: ioapi.h:114
#define ZLIB_FILEFUNC_SEEK_SET
Definition: ioapi.h:116
#define ZLIB_FILEFUNC_SEEK_END
Definition: ioapi.h:115
static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod)
Definition: iowin32.c:246
#define FILE_END
Definition: winbase.h:114
#define FILE_CURRENT
Definition: winbase.h:113

Referenced by fill_win32_filefunc64(), fill_win32_filefunc64A(), and fill_win32_filefunc64W().

◆ win32_seek_file_func()

long ZCALLBACK win32_seek_file_func ( voidpf  opaque,
voidpf  stream,
uLong  offset,
int  origin 
)

Definition at line 314 of file iowin32.c.

315{
316 DWORD dwMoveMethod=0xFFFFFFFF;
317 HANDLE hFile = NULL;
318
319 long ret=-1;
320 if (stream!=NULL)
321 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
322 switch (origin)
323 {
325 dwMoveMethod = FILE_CURRENT;
326 break;
328 dwMoveMethod = FILE_END;
329 break;
331 dwMoveMethod = FILE_BEGIN;
332 break;
333 default: return -1;
334 }
335
336 if (hFile != NULL)
337 {
339 pos.QuadPart = offset;
340 if (!MySetFilePointerEx(hFile, pos, NULL, dwMoveMethod))
341 {
344 ret = -1;
345 }
346 else
347 ret=0;
348 }
349 return ret;
350}

Referenced by fill_win32_filefunc().

◆ win32_tell64_file_func()

ZPOS64_T ZCALLBACK win32_tell64_file_func ( voidpf  opaque,
voidpf  stream 
)

Definition at line 289 of file iowin32.c.

290{
291 ZPOS64_T ret= (ZPOS64_T)-1;
292 HANDLE hFile = NULL;
293 if (stream!=NULL)
294 hFile = ((WIN32FILE_IOWIN*)stream)->hf;
295
296 if (hFile)
297 {
299 pos.QuadPart = 0;
300
302 {
305 ret = (ZPOS64_T)-1;
306 }
307 else
308 ret=pos.QuadPart;
309 }
310 return ret;
311}
unsigned long long int ZPOS64_T
Definition: ioapi.h:99

Referenced by fill_win32_filefunc64(), fill_win32_filefunc64A(), and fill_win32_filefunc64W().

◆ win32_tell_file_func()

long ZCALLBACK win32_tell_file_func ( voidpf  opaque,
voidpf  stream 
)

Definition at line 266 of file iowin32.c.

267{
268 long ret=-1;
269 HANDLE hFile = NULL;
270 if (stream!=NULL)
271 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
272 if (hFile != NULL)
273 {
275 pos.QuadPart = 0;
276
278 {
281 ret = -1;
282 }
283 else
284 ret=(long)pos.LowPart;
285 }
286 return ret;
287}
#define long
Definition: qsort.c:33

Referenced by fill_win32_filefunc().

◆ win32_translate_open_mode()

static void win32_translate_open_mode ( int  mode,
DWORD lpdwDesiredAccess,
DWORD lpdwCreationDisposition,
DWORD lpdwShareMode,
DWORD lpdwFlagsAndAttributes 
)
static

Definition at line 56 of file iowin32.c.

61{
62 *lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0;
63
65 {
66 *lpdwDesiredAccess = GENERIC_READ;
67 *lpdwCreationDisposition = OPEN_EXISTING;
68 *lpdwShareMode = FILE_SHARE_READ;
69 }
71 {
72 *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
73 *lpdwCreationDisposition = OPEN_EXISTING;
74 }
76 {
77 *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
78 *lpdwCreationDisposition = CREATE_ALWAYS;
79 }
80}
#define OPEN_EXISTING
Definition: compat.h:775
#define GENERIC_READ
Definition: compat.h:135
#define FILE_SHARE_READ
Definition: compat.h:136
#define ZLIB_FILEFUNC_MODE_READWRITEFILTER
Definition: ioapi.h:120
#define ZLIB_FILEFUNC_MODE_EXISTING
Definition: ioapi.h:122
#define ZLIB_FILEFUNC_MODE_CREATE
Definition: ioapi.h:123
#define ZLIB_FILEFUNC_MODE_READ
Definition: ioapi.h:118
#define CREATE_ALWAYS
Definition: disk.h:72
#define GENERIC_WRITE
Definition: nt_native.h:90

Referenced by win32_open64_file_func(), win32_open64_file_funcA(), win32_open64_file_funcW(), and win32_open_file_func().

◆ win32_write_file_func()

uLong ZCALLBACK win32_write_file_func ( voidpf  opaque,
voidpf  stream,
const void buf,
uLong  size 
)

Definition at line 225 of file iowin32.c.

226{
227 uLong ret=0;
228 HANDLE hFile = NULL;
229 if (stream!=NULL)
230 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
231
232 if (hFile != NULL)
233 {
234 if (!WriteFile(hFile, buf, size, &ret, NULL))
235 {
237 if (dwErr == ERROR_HANDLE_EOF)
238 dwErr = 0;
240 }
241 }
242
243 return ret;
244}
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24

Referenced by fill_win32_filefunc(), fill_win32_filefunc64(), fill_win32_filefunc64A(), and fill_win32_filefunc64W().