📄 windll.txt
字号:
The code set out below is not intended to be compiled, but is only intended asa very simplistic pointer to how to load and call the dll. You will have tolook in the files referenced below for actual, working code.This code, as I understand it, is not callable from Visual Basic. This is dueto a limitation on Visual Basic's part in that it cannot deal with pointers tofunctions, nor can it deal with pointers to structures very well. I know almostnothing about Visual Basic, and at this point, have little or no interest inlearning much about it.There are two entry points that use the structure shown below:BOOL WINAPI ZpSetOptions(ZPOPT) andZPOPT WINAPI ZpGetOptions(void)typedef struct {BOOL fSuffix = Currently not used by WiZBOOL fEncrypt; = encrypt fileBOOL fSystem; = include system and hidden filesBOOL fVolume; = Include volume labelBOOL fExtra; = Exclude extra attributesBOOL fNoDirEntries; = Do not add directory entriesBOOL fDate; = Exclude files earlier than specified dateBOOL fVerbose; = Mention oddities in zip file structureBOOL fQuiet; = Quiet operationBOOL fCRLF_LF; = Translate CR/LF to LFBOOL fLF_CRLF; = Translate LF to CR/LFBOOL fJunkDir; = Junk directory namesBOOL fRecurse; = Recurse into subdirectoriesBOOL fGrow; = Allow appending to a zip fileBOOL fForce; = Make entries using DOS names (k for Katz)BOOL fMove; = Delete files added or updated in zip fileBOOL fDeleteEntries; = Delete files from zip fileBOOL fUpdate; = Update zip file--overwrite only if newerBOOL fFreshen; = Freshen zip file--overwrite onlyBOOL fJunkSFX; = Junk SFX prefixBOOL fLatestTime; = Set zip file time to time of latest file in itBOOL fComment; = Put comment in zip fileBOOL fOffsets; = Update archive offsets for SFX filesBOOL fPrivilege; = Save privilegesBOOL fEncryption = read only option, true if encryption supported, false otherwise.int fRepair; = 1 => fix archive, 2 => try harder to fixchar fLevel; = Compression level (0 - 9)char Date[7]; = Date to include files afterchar szRootDir[256]; = Directory to use as base for zipping} ZPOPT, _far *LPZPOPTBOOL WINAPI ZpSetOptions(ZPOPT)This call will simply set the options in the zip dll until such time asanother call to this function is made. This must be made before the initialcall to make or update an archive.ZPOPT WINAPI ZpGetOptions(void)The call will return the above structure from the dll, with the fEncryptionflag set to the appropriate value based on whether encryption is supportedin this dll or not. It is currently used in WiZ only to determine ifencryption is actually supported.The main entry point is ZpArchive(ZCL C) where the structure shown belowis passed to the DLL when it is called.typedef struct {int argc; = Count of files to zipLPSTR lpszZipFN; = Archive file namechar **FNV; = file names to zip up. Think of this an argv} ZCL, _far *LPZCL;For examples of how the actual calls to the dll were set up in WiZ, look inthe file makezip.c in the WiZ source directory.For examples of how the actual loading and unloading of the dll's themselveswas done, look in wizmain.c in the WiZ source directory. Note that WiZ looksspecifically for a particular version number of the dll, and also expects tofind the company name to be Info-ZIP. This is to protect from getting differentversions of the dll loaded, with resulting unknown behavior.There is a very simplistic example of how to load and call into the dll inexample.c and example.h. Note that this example does not implement anycommand line switches at all, and is merely intended as a guide for thosebrave enough to enter a new world.There are four additional (at the moment) entry points:ZpInit, defined asint WINAPI ZpInit(ZIPUSERFUNCTIONS far * lpZipUserFunc);where ZIPUSERFUNCTIONS is defined as below.ZpInitVB, defined asint WINAPI ZpInitVB(ZIPUSERFUNCTIONS_VB)where ZIPUSERFUNCTIONS_VB is defined as:typedef struct {HINSTANCE hInstance;char print[80];char comment[80];char password[80];} ZIPUSERFUNCTIONS_VB, far *LPZIPUSERFUNCTIONS_VB;ZpInitVB is designed to be used only by Visual Basic users, as it is myunderstanding that VB doesn't talk pointers to functions. Hence what isrequired here is to pass in the exact name of the functions for printing,passwords and handling comments. These functions must also be exported bythe VB application. NOTE that this function has been tested under 'C', buthas not with VB. I have no idea if this will truly work.ZpVersion, defined asZpVer * ZpVersion(void);where ZpVer is defined as:typedef struct _ZpVer { ulg structlen; /* length of the struct being passed */ ulg flag; /* bit 0: is_beta bit 1: uses_zlib */ char *betalevel; /* e.g., "g BETA" or "" */ char *date; /* e.g., "4 Sep 95" (beta) or "4 September 1995" */ char *zlib_version; /* e.g., "0.95" or NULL */ _zip_version_type zip; _zip_version_type os2dll; _zip_version_type windll;} ZpVer;See api.c for exactly what ZpVersion does, but the short version ofwhat it does is return the unzip and dll versions in the ZpVer structure.The structure typedef's are in api.hThe typedef's for the function pointers in the structure ZIPUSERFUNCTIONSare shown immediately below.typedef int (far *DLLPRNT) (FILE *, unsigned int, char *);typedef int (WINAPI DLLPASSWORD) (char *, char *, int, char *);typedef char far * (far *DLLCOMMENT) (LPSTR);typedef struct {DLLPRNT *print; = pointer to application's print function.DLLPASSWORD *password; = pointer to application's function for processing passwords. Called from ttyio.cDLLCOMMENT *comment; = pointer to application's function for processing comments.} ZIPUSERFUNCTIONS, far * LPZIPUSERFUNCTIONS;Last revised June 3, 1997.Mike White
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -