ReactOS 0.4.16-dev-297-gc569aee
lzexpand.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LZERROR_BADINHANDLE   (-1)
 
#define LZERROR_BADOUTHANDLE   (-2)
 
#define LZERROR_READ   (-3)
 
#define LZERROR_WRITE   (-4)
 
#define LZERROR_GLOBALLOC   (-5)
 
#define LZERROR_GLOBLOCK   (-6)
 
#define LZERROR_BADVALUE   (-7)
 
#define LZERROR_UNKNOWNALG   (-8)
 
#define GetExpandedName   GetExpandedNameA
 
#define LZOpenFile   LZOpenFileA
 

Functions

LONG WINAPI CopyLZFile (INT, INT)
 
INT WINAPI GetExpandedNameA (LPSTR, LPSTR)
 
INT WINAPI GetExpandedNameW (LPWSTR, LPWSTR)
 
VOID APIENTRY LZClose (INT)
 
LONG APIENTRY LZCopy (INT, INT)
 
VOID WINAPI LZDone (VOID)
 
INT WINAPI LZInit (INT)
 
INT WINAPI LZOpenFileA (LPSTR, LPOFSTRUCT, WORD)
 
INT WINAPI LZOpenFileW (LPWSTR, LPOFSTRUCT, WORD)
 
INT WINAPI LZRead (INT, LPSTR, INT)
 
LONG WINAPI LZSeek (INT, LONG, INT)
 
INT WINAPI LZStart (VOID)
 

Macro Definition Documentation

◆ GetExpandedName

#define GetExpandedName   GetExpandedNameA

Definition at line 31 of file lzexpand.h.

◆ LZERROR_BADINHANDLE

#define LZERROR_BADINHANDLE   (-1)

Definition at line 7 of file lzexpand.h.

◆ LZERROR_BADOUTHANDLE

#define LZERROR_BADOUTHANDLE   (-2)

Definition at line 8 of file lzexpand.h.

◆ LZERROR_BADVALUE

#define LZERROR_BADVALUE   (-7)

Definition at line 13 of file lzexpand.h.

◆ LZERROR_GLOBALLOC

#define LZERROR_GLOBALLOC   (-5)

Definition at line 11 of file lzexpand.h.

◆ LZERROR_GLOBLOCK

#define LZERROR_GLOBLOCK   (-6)

Definition at line 12 of file lzexpand.h.

◆ LZERROR_READ

#define LZERROR_READ   (-3)

Definition at line 9 of file lzexpand.h.

◆ LZERROR_UNKNOWNALG

#define LZERROR_UNKNOWNALG   (-8)

Definition at line 14 of file lzexpand.h.

◆ LZERROR_WRITE

#define LZERROR_WRITE   (-4)

Definition at line 10 of file lzexpand.h.

◆ LZOpenFile

#define LZOpenFile   LZOpenFileA

Definition at line 32 of file lzexpand.h.

Function Documentation

◆ CopyLZFile()

LONG WINAPI CopyLZFile ( INT  ,
INT   
)

◆ GetExpandedNameA()

INT WINAPI GetExpandedNameA ( LPSTR  in,
LPSTR  out 
)

Definition at line 257 of file lzexpand.c.

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}
signed short INT16
#define islower(c)
Definition: acclib.h:72
#define isalpha(c)
Definition: acclib.h:74
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 WARN(fmt,...)
Definition: precomp.h:61
#define NULL
Definition: types.h:112
HFILE WINAPI OpenFile(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle)
Definition: create.c:368
GLdouble s
Definition: gl.h:2039
GLdouble GLdouble t
Definition: gl.h:2047
GLuint in
Definition: glext.h:9616
GLenum GLsizei len
Definition: glext.h:6722
int WINAPI _lclose(HFILE hFile)
Definition: lfile.c:138
static INT read_header(HFILE fd, struct lzfileheader *head)
Definition: lzexpand.c:149
#define LZERROR_BADINHANDLE
Definition: lzexpand.h:7
static FILE * out
Definition: regtests2xml.c:44
static int fd
Definition: io.c:51
#define TRACE(s)
Definition: solgame.cpp:4
int32_t INT
Definition: typedefs.h:58
int ret
#define HFILE_ERROR
Definition: winbase.h:112
#define OF_READ
Definition: winbase.h:117
int HFILE
Definition: windef.h:298
char * LPSTR
Definition: xmlstorage.h:182

Referenced by GetExpandedNameW(), and main().

◆ GetExpandedNameW()

INT WINAPI GetExpandedNameW ( LPWSTR  in,
LPWSTR  out 
)

Definition at line 327 of file lzexpand.c.

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}
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#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
unsigned long DWORD
Definition: ntddk_ex.h:95
INT WINAPI GetExpandedNameA(LPSTR in, LPSTR out)
Definition: lzexpand.c:257
#define strlenW(s)
Definition: unicode.h:34

◆ LZClose()

VOID APIENTRY LZClose ( INT  )

◆ LZCopy()

LONG APIENTRY LZCopy ( INT  ,
INT   
)

◆ LZDone()

VOID WINAPI LZDone ( VOID  )

Definition at line 240 of file lzexpand.c.

241{
242 TRACE("(void)\n");
243}

◆ LZInit()

INT WINAPI LZInit ( INT  )

◆ LZOpenFileA()

INT WINAPI LZOpenFileA ( LPSTR  fn,
LPOFSTRUCT  ofs,
WORD  mode 
)

Definition at line 551 of file lzexpand.c.

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)
GLenum mode
Definition: glext.h:6217
static LPSTR LZEXPAND_MangleName(LPCSTR fn)
Definition: lzexpand.c:528
BYTE cBytes
Definition: winbase.h:1314
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
unsigned char BYTE
Definition: xxhash.c:193

Referenced by create_file(), delete_file(), LZOpenFileW(), main(), test_LZCopy(), test_LZOpenFileA(), test_LZOpenFileA_existing_compressed(), test_LZOpenFileA_nonexisting_compressed(), test_LZRead(), and VerInstallFileA().

◆ LZOpenFileW()

◆ LZRead()

INT WINAPI LZRead ( INT  ,
LPSTR  ,
INT   
)

◆ LZSeek()

LONG WINAPI LZSeek ( INT  ,
LONG  ,
INT   
)

◆ LZStart()

INT WINAPI LZStart ( VOID  )

Definition at line 179 of file lzexpand.c.

180{
181 TRACE("(void)\n");
182 return 1;
183}