ReactOS 0.4.15-dev-7704-gc07eb9f
lzexpand.c
Go to the documentation of this file.
1/*
2 * LZ Decompression functions
3 *
4 * Copyright 1996 Marcus Meissner
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 *
20 * NOTES
21 *
22 * The LZ (Lempel Ziv) decompression was used in win16 installation programs.
23 * It is a simple tabledriven decompression engine, the algorithm is not
24 * documented as far as I know. WINE does not contain a compressor for
25 * this format.
26 *
27 * The implementation is complete and there have been no reports of failures
28 * for some time.
29 *
30 * TODO:
31 *
32 * o Check whether the return values are correct
33 *
34 */
35
36#ifdef __REACTOS__
37
38#include <k32.h>
39
40#define NDEBUG
41#include <debug.h>
43
44#define HFILE_ERROR ((HFILE)-1)
45
46#include "lzexpand.h"
47
48#define _lwrite(a, b, c) (long)(_hwrite(a, b, (long)c))
49
50#else /* __REACTOS__ */
51
52#include "config.h"
53
54#include <string.h>
55#include <ctype.h>
56#include <sys/types.h>
57#include <stdarg.h>
58#include <stdio.h>
59#ifdef HAVE_UNISTD_H
60# include <unistd.h>
61#endif
62
63#include "windef.h"
64#include "winbase.h"
65#include "lzexpand.h"
66
67#include "wine/unicode.h"
68#include "wine/debug.h"
69
71
72#endif /* __REACTOS__ */
73
74/* The readahead length of the decompressor. Reading single bytes
75 * using _lread() would be SLOW.
76 */
77#define GETLEN 2048
78
79#define LZ_MAGIC_LEN 8
80#define LZ_HEADER_LEN 14
81
82/* Format of first 14 byte of LZ compressed file */
88};
89static const BYTE LZMagic[LZ_MAGIC_LEN]={'S','Z','D','D',0x88,0xf0,0x27,0x33};
90
91#define LZ_TABLE_SIZE 0x1000
92
93struct lzstate {
94 HFILE realfd; /* the real filedescriptor */
95 CHAR lastchar; /* the last char of the filename */
96
97 DWORD reallength; /* the decompressed length of the file */
98 DWORD realcurrent; /* the position the decompressor currently is */
99 DWORD realwanted; /* the position the user wants to read from */
100
101 BYTE table[LZ_TABLE_SIZE]; /* the rotating LZ table */
102 UINT curtabent; /* CURrent TABle ENTry */
103
104 BYTE stringlen; /* length and position of current string */
105 DWORD stringpos; /* from stringtable */
106
107
108 WORD bytetype; /* bitmask within blocks */
109
110 BYTE *get; /* GETLEN bytes */
111 DWORD getcur; /* current read */
112 DWORD getlen; /* length last got */
113};
114
115#define MAX_LZSTATES 16
117
118#define LZ_MIN_HANDLE 0x400
119#define IS_LZ_HANDLE(h) (((h) >= LZ_MIN_HANDLE) && ((h) < LZ_MIN_HANDLE+MAX_LZSTATES))
120#define GET_LZ_STATE(h) (IS_LZ_HANDLE(h) ? lzstates[(h)-LZ_MIN_HANDLE] : NULL)
121
122/* reads one compressed byte, including buffering */
123#define GET(lzs,b) _lzget(lzs,&b)
124#define GET_FLUSH(lzs) lzs->getcur=lzs->getlen;
125
126static int
127_lzget(struct lzstate *lzs,BYTE *b) {
128 if (lzs->getcur<lzs->getlen) {
129 *b = lzs->get[lzs->getcur++];
130 return 1;
131 } else {
132 int ret = _lread(lzs->realfd,lzs->get,GETLEN);
133 if (ret==HFILE_ERROR)
134 return HFILE_ERROR;
135 if (ret==0)
136 return 0;
137 lzs->getlen = ret;
138 lzs->getcur = 1;
139 *b = *(lzs->get);
140 return 1;
141 }
142}
143/* internal function, reads lzheader
144 * returns BADINHANDLE for non filedescriptors
145 * return 0 for file not compressed using LZ
146 * return UNKNOWNALG for unknown algorithm
147 * returns lzfileheader in *head
148 */
150{
152
153 if (_llseek(fd,0,SEEK_SET)==-1)
154 return LZERROR_BADINHANDLE;
155
156 /* We can't directly read the lzfileheader struct due to
157 * structure element alignment
158 */
160 return 0;
161 memcpy(head->magic,buf,LZ_MAGIC_LEN);
162 memcpy(&(head->compressiontype),buf+LZ_MAGIC_LEN,1);
163 memcpy(&(head->lastchar),buf+LZ_MAGIC_LEN+1,1);
164
165 /* FIXME: consider endianness on non-intel architectures */
166 memcpy(&(head->reallength),buf+LZ_MAGIC_LEN+2,4);
167
168 if (memcmp(head->magic,LZMagic,LZ_MAGIC_LEN))
169 return 0;
170 if (head->compressiontype!='A')
171 return LZERROR_UNKNOWNALG;
172 return 1;
173}
174
175
176/***********************************************************************
177 * LZStart (KERNEL32.@)
178 */
180{
181 TRACE("(void)\n");
182 return 1;
183}
184
185
186/***********************************************************************
187 * LZInit (KERNEL32.@)
188 *
189 * initializes internal decompression buffers, returns lzfiledescriptor.
190 * (return value the same as hfSrc, if hfSrc is not compressed)
191 * on failure, returns error code <0
192 * lzfiledescriptors range from 0x400 to 0x410 (only 16 open files per process)
193 *
194 * since _llseek uses the same types as libc.lseek, we just use the macros of
195 * libc
196 */
198{
199
200 struct lzfileheader head;
201 struct lzstate *lzs;
202 int i, ret;
203
204 TRACE("(%d)\n",hfSrc);
205 ret=read_header(hfSrc,&head);
206 if (ret<=0) {
207 _llseek(hfSrc,0,SEEK_SET);
208 return ret?ret:hfSrc;
209 }
210 for (i = 0; i < MAX_LZSTATES; i++) if (!lzstates[i]) break;
211 if (i == MAX_LZSTATES) return LZERROR_GLOBALLOC;
212 lzstates[i] = lzs = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*lzs) );
213 if(lzs == NULL) return LZERROR_GLOBALLOC;
214
215 lzs->realfd = hfSrc;
216 lzs->lastchar = head.lastchar;
217 lzs->reallength = head.reallength;
218
219 lzs->get = HeapAlloc( GetProcessHeap(), 0, GETLEN );
220 lzs->getlen = 0;
221 lzs->getcur = 0;
222
223 if(lzs->get == NULL) {
224 HeapFree(GetProcessHeap(), 0, lzs);
225 lzstates[i] = NULL;
226 return LZERROR_GLOBALLOC;
227 }
228
229 /* Yes, preinitialize with spaces */
230 memset(lzs->table,' ',LZ_TABLE_SIZE);
231 /* Yes, start 16 byte from the END of the table */
232 lzs->curtabent = 0xff0;
233 return LZ_MIN_HANDLE + i;
234}
235
236
237/***********************************************************************
238 * LZDone (KERNEL32.@)
239 */
240void WINAPI LZDone(void)
241{
242 TRACE("(void)\n");
243}
244
245
246/***********************************************************************
247 * GetExpandedNameA (KERNEL32.@)
248 *
249 * gets the full filename of the compressed file 'in' by opening it
250 * and reading the header
251 *
252 * "file." is being translated to "file"
253 * "file.bl_" (with lastchar 'a') is being translated to "file.bla"
254 * "FILE.BL_" (with lastchar 'a') is being translated to "FILE.BLA"
255 */
256
258{
259 struct lzfileheader head;
260 HFILE fd;
261 OFSTRUCT ofs;
262 INT fnislowercased,ret,len;
263 LPSTR s,t;
264
265 TRACE("(%s)\n",in);
266 fd=OpenFile(in,&ofs,OF_READ);
267 if (fd==HFILE_ERROR)
269 strcpy(out,in);
271 if (ret<=0) {
272 /* not a LZ compressed file, so the expanded name is the same
273 * as the input name */
274 _lclose(fd);
275 return 1;
276 }
277
278
279 /* look for directory prefix and skip it. */
280 s=out;
281 while (NULL!=(t=strpbrk(s,"/\\:")))
282 s=t+1;
283
284 /* now mangle the basename */
285 if (!*s) {
286 /* FIXME: hmm. shouldn't happen? */
287 WARN("Specified a directory or what? (%s)\n",in);
288 _lclose(fd);
289 return 1;
290 }
291 /* see if we should use lowercase or uppercase on the last char */
292 fnislowercased=1;
293 t=s+strlen(s)-1;
294 while (t>=out) {
295 if (!isalpha(*t)) {
296 t--;
297 continue;
298 }
299 fnislowercased=islower(*t);
300 break;
301 }
302 if (isalpha(head.lastchar)) {
303 if (fnislowercased)
304 head.lastchar=tolower(head.lastchar);
305 else
306 head.lastchar=toupper(head.lastchar);
307 }
308
309 /* now look where to replace the last character */
310 if (NULL!=(t=strchr(s,'.'))) {
311 if (t[1]=='\0') {
312 t[0]='\0';
313 } else {
314 len=strlen(t)-1;
315 if (t[len]=='_')
316 t[len]=head.lastchar;
317 }
318 } /* else no modification necessary */
319 _lclose(fd);
320 return 1;
321}
322
323
324/***********************************************************************
325 * GetExpandedNameW (KERNEL32.@)
326 */
328{
329 INT ret;
330 DWORD len = WideCharToMultiByte( CP_ACP, 0, in, -1, NULL, 0, NULL, NULL );
331 char *xin = HeapAlloc( GetProcessHeap(), 0, len );
332 char *xout = HeapAlloc( GetProcessHeap(), 0, len+3 );
333 WideCharToMultiByte( CP_ACP, 0, in, -1, xin, len, NULL, NULL );
334 if ((ret = GetExpandedNameA( xin, xout )) > 0)
335 MultiByteToWideChar( CP_ACP, 0, xout, -1, out, strlenW(in)+4 );
336 HeapFree( GetProcessHeap(), 0, xin );
337 HeapFree( GetProcessHeap(), 0, xout );
338 return ret;
339}
340
341
342/***********************************************************************
343 * LZRead (KERNEL32.@)
344 */
346{
347 int howmuch;
348 BYTE b,*buf;
349 struct lzstate *lzs;
350
351 buf=(LPBYTE)vbuf;
352 TRACE("(%d,%p,%d)\n",fd,buf,toread);
353 howmuch=toread;
354 if (!(lzs = GET_LZ_STATE(fd))) return _lread(fd,buf,toread);
355
356/* The decompressor itself is in a define, cause we need it twice
357 * in this function. (the decompressed byte will be in b)
358 */
359#define DECOMPRESS_ONE_BYTE \
360 if (lzs->stringlen) { \
361 b = lzs->table[lzs->stringpos]; \
362 lzs->stringpos = (lzs->stringpos+1)&0xFFF; \
363 lzs->stringlen--; \
364 } else { \
365 if (!(lzs->bytetype&0x100)) { \
366 if (1!=GET(lzs,b)) \
367 return toread-howmuch; \
368 lzs->bytetype = b|0xFF00; \
369 } \
370 if (lzs->bytetype & 1) { \
371 if (1!=GET(lzs,b)) \
372 return toread-howmuch; \
373 } else { \
374 BYTE b1,b2; \
375 \
376 if (1!=GET(lzs,b1)) \
377 return toread-howmuch; \
378 if (1!=GET(lzs,b2)) \
379 return toread-howmuch; \
380 /* Format: \
381 * b1 b2 \
382 * AB CD \
383 * where CAB is the stringoffset in the table\
384 * and D+3 is the len of the string \
385 */ \
386 lzs->stringpos = b1|((b2&0xf0)<<4); \
387 lzs->stringlen = (b2&0xf)+2; \
388 /* 3, but we use a byte already below ... */\
389 b = lzs->table[lzs->stringpos];\
390 lzs->stringpos = (lzs->stringpos+1)&0xFFF;\
391 } \
392 lzs->bytetype>>=1; \
393 } \
394 /* store b in table */ \
395 lzs->table[lzs->curtabent++]= b; \
396 lzs->curtabent &= 0xFFF; \
397 lzs->realcurrent++;
398
399 /* if someone has seeked, we have to bring the decompressor
400 * to that position
401 */
402 if (lzs->realcurrent!=lzs->realwanted) {
403 /* if the wanted position is before the current position
404 * I see no easy way to unroll ... We have to restart at
405 * the beginning. *sigh*
406 */
407 if (lzs->realcurrent>lzs->realwanted) {
408 /* flush decompressor state */
410 GET_FLUSH(lzs);
411 lzs->realcurrent= 0;
412 lzs->bytetype = 0;
413 lzs->stringlen = 0;
414 memset(lzs->table,' ',LZ_TABLE_SIZE);
415 lzs->curtabent = 0xFF0;
416 }
417 while (lzs->realcurrent<lzs->realwanted) {
419 }
420 }
421
422 while (howmuch) {
424 lzs->realwanted++;
425 *buf++ = b;
426 howmuch--;
427 }
428 return toread;
429#undef DECOMPRESS_ONE_BYTE
430}
432
433/***********************************************************************
434 * LZSeek (KERNEL32.@)
435 */
437{
438 struct lzstate *lzs;
439 LONG newwanted;
440
441 TRACE("(%d,%d,%d)\n",fd,off,type);
442 /* not compressed? just use normal _llseek() */
443 if (!(lzs = GET_LZ_STATE(fd))) return _llseek(fd,off,type);
444 newwanted = lzs->realwanted;
445 switch (type) {
446 case 1: /* SEEK_CUR */
447 newwanted += off;
448 break;
449 case 2: /* SEEK_END */
450 newwanted = lzs->reallength-off;
451 break;
452 default:/* SEEK_SET */
453 newwanted = off;
454 break;
455 }
456 if (newwanted>lzs->reallength)
457 return LZERROR_BADVALUE;
458 if (newwanted<0)
459 return LZERROR_BADVALUE;
460 lzs->realwanted = newwanted;
461 return newwanted;
462}
463
464
465/***********************************************************************
466 * LZCopy (KERNEL32.@)
468 * Copies everything from src to dest
469 * if src is a LZ compressed file, it will be uncompressed.
470 * will return the number of bytes written to dest or errors.
471 */
473{
474 int usedlzinit = 0, ret, wret;
475 LONG len;
476 HFILE oldsrc = src, srcfd;
478 struct lzstate *lzs;
479#define BUFLEN 1000
480 CHAR buf[BUFLEN];
481 /* we need that weird typedef, for i can't seem to get function pointer
482 * casts right. (Or they probably just do not like WINAPI in general)
483 */
484 typedef UINT (WINAPI *_readfun)(HFILE,LPVOID,UINT);
485
486 _readfun xread;
487
488 TRACE("(%d,%d)\n",src,dest);
489 if (!IS_LZ_HANDLE(src)) {
490 src = LZInit(src);
491 if ((INT)src <= 0) return 0;
492 if (src != oldsrc) usedlzinit=1;
493 }
494
495 /* not compressed? just copy */
496 if (!IS_LZ_HANDLE(src))
497#ifdef __REACTOS__
498 xread=(_readfun)_hread; // ROSHACK
499#else
500 xread=_lread;
501#endif
502 else
503 xread=(_readfun)LZRead;
504 len=0;
505 while (1) {
506 ret=xread(src,buf,BUFLEN);
507 if (ret<=0) {
508 if (ret==0)
509 break;
510 if (ret==-1)
511 return LZERROR_READ;
512 return ret;
513 }
514 len += ret;
515 wret = _lwrite(dest,buf,ret);
516 if (wret!=ret)
517 return LZERROR_WRITE;
518 }
519
520 /* Maintain the timestamp of source file to destination file */
521 srcfd = (!(lzs = GET_LZ_STATE(src))) ? src : lzs->realfd;
524
525 /* close handle */
526 if (usedlzinit)
527 LZClose(src);
528 return len;
529#undef BUFLEN
530}
531
532/* reverses GetExpandedPathname */
534{
535 char *p;
536 char *mfn = HeapAlloc( GetProcessHeap(), 0, strlen(fn) + 3 ); /* "._" and \0 */
537 if(mfn == NULL) return NULL;
538 strcpy( mfn, fn );
539 if (!(p = strrchr( mfn, '\\' ))) p = mfn;
540 if ((p = strchr( p, '.' )))
541 {
542 p++;
543 if (strlen(p) < 3) strcat( p, "_" ); /* append '_' */
544 else p[strlen(p)-1] = '_'; /* replace last character */
545 }
546 else strcat( mfn, "._" ); /* append "._" */
547 return mfn;
548}
549
550
551/***********************************************************************
552 * LZOpenFileA (KERNEL32.@)
553 *
554 * Opens a file. If not compressed, open it as a normal file.
555 */
557{
558 HFILE fd,cfd;
559 BYTE ofs_cBytes = ofs->cBytes;
560
561 TRACE("(%s,%p,%d)\n",fn,ofs,mode);
562 /* 0x70 represents all OF_SHARE_* flags, ignore them for the check */
563 fd=OpenFile(fn,ofs,mode);
564 if (fd==HFILE_ERROR)
565 {
567 fd = OpenFile(mfn,ofs,mode);
568 HeapFree( GetProcessHeap(), 0, mfn );
569 }
570 if (fd==HFILE_ERROR)
571 ofs->cBytes = ofs_cBytes;
572 if ((mode&~0x70)!=OF_READ)
573 return fd;
574 if (fd==HFILE_ERROR)
575 return HFILE_ERROR;
576 cfd=LZInit(fd);
577 if ((INT)cfd <= 0) return fd;
578 return cfd;
579}
581
582/***********************************************************************
583 * LZOpenFileW (KERNEL32.@)
584 */
586{
587 HFILE ret;
588 DWORD len = WideCharToMultiByte( CP_ACP, 0, fn, -1, NULL, 0, NULL, NULL );
589 LPSTR xfn = HeapAlloc( GetProcessHeap(), 0, len );
590 WideCharToMultiByte( CP_ACP, 0, fn, -1, xfn, len, NULL, NULL );
591 ret = LZOpenFileA(xfn,ofs,mode);
592 HeapFree( GetProcessHeap(), 0, xfn );
593 return ret;
594}
596
597/***********************************************************************
598 * LZClose (KERNEL32.@)
599 */
600void WINAPI LZClose( HFILE fd )
601{
602 struct lzstate *lzs;
603
604 TRACE("(%d)\n",fd);
605 if (!(lzs = GET_LZ_STATE(fd))) _lclose(fd);
606 else
607 {
608 HeapFree( GetProcessHeap(), 0, lzs->get );
611 HeapFree( GetProcessHeap(), 0, lzs );
612 }
613}
614
615#ifdef __REACTOS__
616
617/*
618 * @implemented
619 */
620VOID
621WINAPI
622LZCloseFile(IN HFILE FileHandle)
623{
624 /* One function uses _lclose, the other CloseHandle -- same thing */
626}
627
628/*
629 * @unimplemented
630 */
631ULONG
632WINAPI
633LZCreateFileW(IN LPCWSTR FileName,
634 IN DWORD dwDesiredAccess,
635 IN DWORD dwShareMode,
636 IN DWORD dwCreationDisposition,
637 IN LPWSTR lpString1)
638{
639 WARN(" LZCreateFileW Not implemented!\n");
642}
643
644#endif /* __REACTOS__ */
signed short INT16
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define islower(c)
Definition: acclib.h:72
#define isalpha(c)
Definition: acclib.h:74
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int toupper(int c)
Definition: utclib.c:881
int tolower(int c)
Definition: utclib.c:902
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
char * strchr(const char *String, int ch)
Definition: utclib.c:501
char * strpbrk(const char *String, const char *Delimiters)
Definition: utclib.c:302
struct outqueuenode * head
Definition: adnsresfilter.c:66
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define DEBUG_CHANNEL(args)
Definition: rdesktop.h:159
#define LongToHandle(h)
Definition: basetsd.h:82
#define WARN(fmt,...)
Definition: debug.h:112
#define NULL
Definition: types.h:112
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define CP_ACP
Definition: compat.h:109
#define SetLastError(x)
Definition: compat.h:752
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
HFILE WINAPI OpenFile(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle)
Definition: create.c:368
BOOL WINAPI SetFileTime(IN HANDLE hFile, CONST FILETIME *lpCreationTime OPTIONAL, CONST FILETIME *lpLastAccessTime OPTIONAL, CONST FILETIME *lpLastWriteTime OPTIONAL)
Definition: fileinfo.c:948
BOOL WINAPI GetFileTime(IN HANDLE hFile, OUT LPFILETIME lpCreationTime OPTIONAL, OUT LPFILETIME lpLastAccessTime OPTIONAL, OUT LPFILETIME lpLastWriteTime OPTIONAL)
Definition: fileinfo.c:896
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLdouble GLdouble t
Definition: gl.h:2047
GLenum src
Definition: glext.h:6340
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum mode
Definition: glext.h:6217
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint in
Definition: glext.h:9616
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SEEK_SET
Definition: jmemansi.c:26
#define b
Definition: ke_i.h:79
#define _lread(a, b, c)
Definition: kernel32.h:171
#define kernel32file
Definition: kernel32.h:6
int WINAPI _lclose(HFILE hFile)
Definition: lfile.c:138
LONG WINAPI _llseek(HFILE hFile, LONG lOffset, int iOrigin)
Definition: lfile.c:149
long WINAPI _hread(HFILE hFile, LPVOID lpBuffer, long lBytes)
Definition: lfile.c:20
#define LZ_MIN_HANDLE
Definition: lzexpand.c:118
static LPSTR LZEXPAND_MangleName(LPCSTR fn)
Definition: lzexpand.c:528
INT WINAPI LZStart(void)
Definition: lzexpand.c:179
#define MAX_LZSTATES
Definition: lzexpand.c:115
static int _lzget(struct lzstate *lzs, BYTE *b)
Definition: lzexpand.c:127
#define DECOMPRESS_ONE_BYTE
LONG WINAPI LZSeek(HFILE fd, LONG off, INT type)
Definition: lzexpand.c:431
#define LZ_TABLE_SIZE
Definition: lzexpand.c:91
INT WINAPI LZRead(HFILE fd, LPSTR vbuf, INT toread)
Definition: lzexpand.c:345
#define GETLEN
Definition: lzexpand.c:77
HFILE WINAPI LZOpenFileW(LPWSTR fn, LPOFSTRUCT ofs, WORD mode)
Definition: lzexpand.c:580
static const BYTE LZMagic[LZ_MAGIC_LEN]
Definition: lzexpand.c:89
LONG WINAPI LZCopy(HFILE src, HFILE dest)
Definition: lzexpand.c:467
static struct lzstate * lzstates[MAX_LZSTATES]
Definition: lzexpand.c:116
INT WINAPI GetExpandedNameW(LPWSTR in, LPWSTR out)
Definition: lzexpand.c:327
void WINAPI LZClose(HFILE fd)
Definition: lzexpand.c:595
static INT read_header(HFILE fd, struct lzfileheader *head)
Definition: lzexpand.c:149
HFILE WINAPI LZInit(HFILE hfSrc)
Definition: lzexpand.c:197
#define LZ_MAGIC_LEN
Definition: lzexpand.c:79
HFILE WINAPI LZOpenFileA(LPSTR fn, LPOFSTRUCT ofs, WORD mode)
Definition: lzexpand.c:551
#define LZ_HEADER_LEN
Definition: lzexpand.c:80
#define BUFLEN
#define GET_LZ_STATE(h)
Definition: lzexpand.c:120
void WINAPI LZDone(void)
Definition: lzexpand.c:240
INT WINAPI GetExpandedNameA(LPSTR in, LPSTR out)
Definition: lzexpand.c:257
#define GET_FLUSH(lzs)
Definition: lzexpand.c:124
#define IS_LZ_HANDLE(h)
Definition: lzexpand.c:119
#define LZERROR_BADVALUE
Definition: lzexpand.h:13
#define LZERROR_GLOBALLOC
Definition: lzexpand.h:11
#define LZERROR_UNKNOWNALG
Definition: lzexpand.h:14
#define LZERROR_WRITE
Definition: lzexpand.h:10
#define LZERROR_READ
Definition: lzexpand.h:9
#define LZERROR_BADINHANDLE
Definition: lzexpand.h:7
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static char * dest
Definition: rtl.c:135
unsigned int UINT
Definition: ndis.h:50
#define LPVOID
Definition: nt_native.h:45
long LONG
Definition: pedump.c:60
#define strlenW(s)
Definition: unicode.h:28
static FILE * out
Definition: regtests2xml.c:44
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
static int fd
Definition: io.c:51
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
BYTE cBytes
Definition: winbase.h:1289
Definition: fci.c:127
BYTE compressiontype
Definition: lzexpand.c:85
DWORD reallength
Definition: lzexpand.c:87
BYTE magic[LZ_MAGIC_LEN]
Definition: lzexpand.c:84
CHAR lastchar
Definition: lzexpand.c:86
BYTE table[LZ_TABLE_SIZE]
Definition: lzexpand.c:101
BYTE stringlen
Definition: lzexpand.c:104
BYTE * get
Definition: lzexpand.c:110
DWORD realcurrent
Definition: lzexpand.c:98
CHAR lastchar
Definition: lzexpand.c:95
WORD bytetype
Definition: lzexpand.c:108
DWORD reallength
Definition: lzexpand.c:97
DWORD getcur
Definition: lzexpand.c:111
DWORD stringpos
Definition: lzexpand.c:105
UINT curtabent
Definition: lzexpand.c:102
DWORD realwanted
Definition: lzexpand.c:99
HFILE realfd
Definition: lzexpand.c:94
DWORD getlen
Definition: lzexpand.c:112
Definition: internal.h:110
unsigned char * LPBYTE
Definition: typedefs.h:53
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
int ret
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
#define HFILE_ERROR
Definition: winbase.h:111
UINT WINAPI _lwrite(_In_ HFILE hFile, _In_reads_bytes_(uBytes) LPCCH lpBuffer, _In_ UINT uBytes)
#define OF_READ
Definition: winbase.h:116
int HFILE
Definition: windef.h:298
#define WINAPI
Definition: msvc.h:6
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193