' ########################################################################################
' Microsoft Windows
' File: LZExpand.inc
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_LZExpand_PBI)
#DEFINE PBX_LZExpand_PBI
%EQUATE `LZEXPAND_INC = 1
#INCLUDE ONCE "Core/Windows.inc"
'/*
'** Error Return Codes
'*/
%EQUATE `LZERROR_BADINHANDLE = -1 ' /* invalid input handle */
%EQUATE `LZERROR_BADOUTHANDLE = -2 ' /* invalid output handle */
%EQUATE `LZERROR_READ = -3 ' /* corrupt compressed file format */
%EQUATE `LZERROR_WRITE = -4 ' /* out of space for output file */
%EQUATE `LZERROR_GLOBALLOC = -5 ' /* insufficient memory for LZFile struct */
%EQUATE `LZERROR_PUBLICLOC = -5 ' /* insufficient memory for LZFile struct */
%EQUATE `LZERROR_GLOBLOCK = -6 ' /* bad Global handle */
%EQUATE `LZERROR_BADVALUE = -7 ' /* input parameter out of range */
%EQUATE `LZERROR_UNKNOWNALG = -8 ' /* compression algorithm not recognized */
'/*
'** Prototypes
'*/
DECLARE FUNCTION LZStart LIB "lz32.dll" ALIAS "LZStart" ( ) AS LONG ' INT
DECLARE SUB LZDone LIB "lz32.dll" ALIAS "LZDone" ( )
DECLARE FUNCTION CopyLZFile LIB "lz32.dll" ALIAS "CopyLZFile" ( BYVAL hfSource AS LONG , BYVAL hfDest AS LONG ) AS LONG
DECLARE FUNCTION LZCopy LIB "lz32.dll" ALIAS "LZCopy" ( BYVAL hfSource AS LONG
 , BYVAL hfDest AS LONG
 ) AS LONG
DECLARE FUNCTION LZInit LIB "lz32.dll" ALIAS "LZInit" ( BYVAL hfSource AS LONG
 ) AS LONG ' INT
DECLARE FUNCTION GetExpandedNameA LIB "lz32.dll" ALIAS "GetExpandedNameA" ( BYREF lpszSource AS ASCIIZ , BYREF lpszBuffer AS ASCIIZ ) AS LONG ' INT
DECLARE FUNCTION GetExpandedNameW LIB "lz32.dll" ALIAS "GetExpandedNameW" ( BYREF lpszSource AS WSTRINGZ , BYREF lpszBuffer AS WSTRINGZ ) AS LONG ' INT
#IF %DEF(%UNICODE)
 MACRO GetExpandedName = GetExpandedNameW
#ELSE
 MACRO GetExpandedName = GetExpandedNameA
#ENDIF
DECLARE FUNCTION LZOpenFileA LIB "lz32.dll" ALIAS "LZOpenFileA" ( BYREF lpFileName AS ASCIIZ , BYREF lpReOpenBuf AS OFSTRUCT , BYVAL wStyle AS WORD ) AS LONG ' INT
DECLARE FUNCTION LZOpenFileW LIB "lz32.dll" ALIAS "LZOpenFileW" ( BYREF lpFileName AS WSTRINGZ , BYREF lpReOpenBuf AS OFSTRUCT , BYVAL wStyle AS WORD ) AS LONG ' INT
#IF %DEF(%UNICODE)
 MACRO LZOpenFile = LZOpenFileW
#ELSE
 MACRO LZOpenFile = LZOpenFileA
#ENDIF
DECLARE FUNCTION LZSeek LIB "lz32.dll" ALIAS "LZSeek" ( BYVAL hFile AS LONG , BYVAL lOffset AS LONG , BYVAL iOrigin AS LONG ) AS LONG
DECLARE FUNCTION LZRead LIB "lz32.dll" ALIAS "LZRead" ( BYVAL hFile AS LONG
 , BYREF lpBuffer AS ASCIIZ
 , BYVAL cbRead AS LONG
 ) AS LONG ' INT
DECLARE SUB LZClose LIB "lz32.dll" ALIAS "LZClose" ( BYVAL hFile AS LONG )
#ENDIF
