ReactOS  0.4.12-dev-409-g9f418243
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  ,
LPSTR   
)

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)
268  return (INT)(INT16)LZERROR_BADINHANDLE;
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 }
#define OF_READ
Definition: winbase.h:116
struct outqueuenode * head
Definition: adnsresfilter.c:66
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strpbrk(const char *String, const char *Delimiters)
Definition: utclib.c:302
#define WARN(fmt,...)
Definition: debug.h:111
GLdouble GLdouble t
Definition: gl.h:2047
#define isalpha(c)
Definition: acclib.h:74
static int fd
Definition: io.c:51
char * LPSTR
Definition: xmlstorage.h:182
static INT read_header(HFILE fd, struct lzfileheader *head)
Definition: lzexpand.c:149
int32_t INT
Definition: typedefs.h:56
int WINAPI _lclose(HFILE hFile)
Definition: lfile.c:138
#define HFILE_ERROR
Definition: winbase.h:111
smooth NULL
Definition: ftsmooth.c:416
HFILE WINAPI OpenFile(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle)
Definition: create.c:368
int toupper(int c)
Definition: utclib.c:881
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
int ret
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
#define islower(c)
Definition: acclib.h:72
GLuint in
Definition: glext.h:9616
char * strchr(const char *String, int ch)
Definition: utclib.c:501
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int tolower(int c)
Definition: utclib.c:902
int HFILE
Definition: windef.h:283
#define LZERROR_BADINHANDLE
Definition: lzexpand.h:7
signed short INT16

Referenced by GetExpandedNameW(), and main().

◆ GetExpandedNameW()

INT WINAPI GetExpandedNameW ( LPWSTR  ,
LPWSTR   
)

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 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
GLuint in
Definition: glext.h:9616
#define MultiByteToWideChar
Definition: compat.h:100
#define HeapFree(x, y, z)
Definition: compat.h:394
INT WINAPI GetExpandedNameA(LPSTR in, LPSTR out)
Definition: lzexpand.c:257

◆ 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 }
#define TRACE(s)
Definition: solgame.cpp:4

◆ LZInit()

INT WINAPI LZInit ( INT  )

◆ LZOpenFileA()

INT WINAPI LZOpenFileA ( LPSTR  ,
LPOFSTRUCT  ,
WORD   
)

Definition at line 556 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)
575  return HFILE_ERROR;
576  cfd=LZInit(fd);
577  if ((INT)cfd <= 0) return fd;
578  return cfd;
579 }
#define OF_READ
Definition: winbase.h:116
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
static int fd
Definition: io.c:51
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:56
#define HFILE_ERROR
Definition: winbase.h:111
HFILE WINAPI OpenFile(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle)
Definition: create.c:368
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
unsigned char BYTE
Definition: mem.h:68
HFILE WINAPI LZInit(HFILE hfSrc)
Definition: lzexpand.c:197
GLenum mode
Definition: glext.h:6217
static LPSTR LZEXPAND_MangleName(LPCSTR fn)
Definition: lzexpand.c:533
int HFILE
Definition: windef.h:283
#define HeapFree(x, y, z)
Definition: compat.h:394

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()

INT WINAPI LZOpenFileW ( LPWSTR  ,
LPOFSTRUCT  ,
WORD   
)

Definition at line 585 of file lzexpand.c.

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 }
#define WideCharToMultiByte
Definition: compat.h:101
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
#define CP_ACP
Definition: compat.h:99
char * LPSTR
Definition: xmlstorage.h:182
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HFILE WINAPI LZOpenFileA(LPSTR fn, LPOFSTRUCT ofs, WORD mode)
Definition: lzexpand.c:556
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
GLenum mode
Definition: glext.h:6217
int HFILE
Definition: windef.h:283
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by create_fileW(), decompress_file_lz(), delete_fileW(), do_file_copyW(), get_file_sizes_lz(), GetFileVersionInfoExW(), GetFileVersionInfoSizeExW(), test_LZOpenFileW(), test_LZOpenFileW_existing_compressed(), test_LZOpenFileW_nonexisting_compressed(), and TLB_NEFile_Open().

◆ 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 }
#define TRACE(s)
Definition: solgame.cpp:4