Expanding a compressed file using LZ32.dll

Chris Kelleher

Administrator
Staff member
<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>/*
// Test for expanding a packed input file
// Michael Rüsweg-Gilbert
//
// Last change: RG 25 Aug 1999 11:43 am
*/


def var input_file as char init "e:\save\xx.cs_" no-undo.
def var output_file as char init "e:\save\xx.cs" no-undo.

def var in___ofstru as memptr no-undo.
def var out__ofstru as memptr no-undo.
def var ret as integer no-undo.
def var in__hdl as int no-undo.
def var out_hdl as int no-undo.


set-size(in___ofstru) = 9 + 255. /* 8 + max. Length of filename + 1 */
set-size(out__ofstru) = 9 + 255. /* 8 + max. Length of filename + 1 */


run LZStart.

run LZOpenFileA ( input_file, INPUT-OUTPUT in___ofstru, 0, OUTPUT in__hdl).
message "in__Hdl=" in__hdl
view-as alert-box.

run LZOpenFileA ( output_file, INPUT-OUTPUT out__ofstru, 4096, OUTPUT
out_hdl).
message "out_Hdl=" out_hdl
view-as alert-box.

run LZCopy (in__hdl, out_hdl, OUTPUT ret).
message "Ret out_ LZCopy=" ret
view-as alert-box.

run LZClose(out_hdl).
run LZClose(in__hdl).

run LZDone.

/*
// DLL Interface Modules
*/

procedure LZCopy external "LZ32.dll":
def input parameter ip_in__fhdl as LONG no-undo.
def input parameter ip_out_fhdl as LONG no-undo.
def return parameter Ret as long no-undo. /* < 0: Error! */
end.


procedure LZOpenFileA external "LZ32.dll":
def input parameter fileName as char no-undo. /* String max 65 lang */
def input-output parameter io_fstru as memptr no-undo.
def input parameter ip_fflag as LONG no-undo. /* 0x0000 READ;
0x1000 CREATE */
def return parameter op_fhdl as LONG no-undo. /* -1:
Fehler;sonst FileHandle */
end.

procedure LZClose external "LZ32.dll":
def input parameter ip_fhdl as LONG no-undo. /* handle to close file
*/
end.

procedure LZStart external "LZ32.dll":
/* without parms */
end.

procedure LZDone external "LZ32.dll":
/* without parms */
end.


[/code]
 
Top