Skip to content

Instantly share code, notes, and snippets.

@illikainen
Created July 13, 2020 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save illikainen/6f228c42b77c21c1e2954966b54179fc to your computer and use it in GitHub Desktop.
Save illikainen/6f228c42b77c21c1e2954966b54179fc to your computer and use it in GitHub Desktop.
NOTE: from https://www.madobe.net/archiver/lib/yz1d032.exe (translated to English with Google Translate)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
YZ1.DLL Ver 0.32 API description file
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
==index==
(☆ Introduction ===> sdk.txt)
(☆ About command ===> sdk.txt)
(☆ about wildcard ===> sdk.txt)
☆ About API
☆ About structures, messages, and callbacks
☆ About error code
=========
★ About API
Since it is in C format, when using it from C++, it is declared and used with extern "C"
Please do so. For structures, all are aligned to byte alignment.
It is necessary to define it (defined in YZ1.H).
=================================================== =====================
LHA.DLL compatible API
================================================== =====================
-------------------------------------------------- ---------------------
int WINAPI Yz1( const HWND wnd, LPCSTR cmd, LPSTR buf, const DWORD siz );
-------------------------------------------------- ---------------------
Ordinal number 1
function
Specify with a command character string to perform compression/decompression.
argument
Please specify the window of the wnd application.
On the DLL side, execute EnableWindow(wnd,FALSE) at runtime,
Suppress window movement.
Specify NULL for applications without windows.
cmd Command string. (See sdk.txt)
buf A buffer that receives the result report from the DLL. if size is greater than 0
The terminating'\0' is always added.
The number of bytes reserved in siz buf. If you don't need the result output,
Please specify 0.
Return value
0=Normal end, Other=Error (*Refer to error code)
-------------------------------------------------- ---------------------
WORD WINAPI Yz1GetVersion();
-------------------------------------------------- ---------------------
Ordinal number 2
function
Returns the version number of the DLL.
Return value
Version number x 100. For example, Ver 0.04 returns 4.
-------------------------------------------------- ---------------------
WORD WINAPI Yz1GetCursorInterval();
-------------------------------------------------- ---------------------
Ordinal number 3
function
Gets the rotation speed of the cursor.
YZ1.DLL saves the value, but does not affect the operation.
Return value
Rotation speed of cursor (msec)
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1SetCursorInterval( const WORD wInterval );
-------------------------------------------------- ---------------------
Ordinal number 4
function
Set the rotation speed of the cursor.
YZ1.DLL saves the value, but does not affect the operation.
argument
wInterval cursor rotation speed (msec)
Return value
TRUE=normal end (set up), FALSE=abnormal end
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1GetBackGroundMode();
-------------------------------------------------- ---------------------
Ordinal number 5
function
Gets whether the DLL is in background mode.
YZ1.DLL saves the value, but does not affect the operation.
Return value
TRUE=background mode, FALSE=non-background mode
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1SetBackGroundMode( const BOOL bBG );
-------------------------------------------------- ---------------------
Ordinal number 6
function
Sets the background mode of the DLL.
YZ1.DLL saves the value, but does not affect the operation.
argument
bBG Background mode to set.
Return value
TRUE=normal end (set up), FALSE=abnormal end
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1GetCursorMode();
-------------------------------------------------- ---------------------
Ordinal number 7
function
Gets whether the mode is to display the cursor while the DLL is running.
YZ1.DLL saves the value, but does not affect the operation.
Return value
TRUE=display mode, FALSE=non-display mode
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1SetCursorMode( const BOOL bCur );
-------------------------------------------------- ---------------------
Ordinal number 8
function
Set whether to display the cursor while the DLL is operating.
YZ1.DLL saves the value, but does not affect the operation.
argument
bCur Cursor mode to set.
Return value
TRUE=normal end (set up), FALSE=abnormal end
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1GetRunning();
-------------------------------------------------- ---------------------
Ordinal number 10
function
Gets whether or not the DLL is currently running.
Return value
TRUE=running, FALSE=not running
=================================================== =====================
LHA.DLL incompatible API
=================================================== =====================
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1CheckArchive( LPCSTR filename, const int mode );
-------------------------------------------------- ---------------------
Ordinal number 12
function
As an archive file supported by the specified file
Returns whether it is correct.
argument
filename The filename you want to check.
mode Check mode. You can specify the following values.
CHECKARCHIVE_ALL(16): Separate archive with password.
Return value
TRUE=Normal archive, FALSE=Not archive
However, if you specify the CHECKARCHIVE_ALL flag,
2=Library with PassWord ,1=Normal library with non-PassWord ,0=Not archive
Will be.
-------------------------------------------------- ---------------------
int WINAPI Yz1GetFileCount( LPCSTR filename );
-------------------------------------------------- ---------------------
Ordinal number 17
function
Gets the number of files stored in the specified archive file.
argument
filename The archive file name for which you want to obtain the number of stored files.
Return value
Number of stored files. -1 on error.
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1QueryFunctionList( const int iAPI );
-------------------------------------------------- ---------------------
Ordinal number 18
function
Gets whether the specified API is available.
argument
A unique number that indicates the iAPI API. See YZ1.H for specific values.
Return value
TRUE=enabled, FALSE=disabled
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1ConfigDialog( const HWND wnd, LPSTR opt, const int mode );
-------------------------------------------------- ---------------------
Ordinal number 11
function
Originally it is an API for setting options interactively,
Currently it just prints version information.
================================================== =====================
OpenArchive API
=================================================== =====================
1. In the explanation below
"The archive file" is the yz1 archive itself that is being operated.
"Stored file" is a file in the archive that matches the previous search.
The argument HARC arc is the handle returned by Yz1OpenArchive().
Refers to.
2. Precautions when operating the archive with password in OpenArchive system
If a password is applied to the yz1 library, you will have to enter it
Information on the stored file cannot be acquired. (Information on the archive file can be obtained.)
Refer to the explanation below and the explanation of the original API "Yz1Set/GetDefaultPassword",
Please implement in an appropriate form for the application.
*Operation inside Yz1OpenArchive*
If M_ERROR_MESSAGE_ON is set, Yz1SetDefaultPassword(arc,NULL);
If not, Yz1SetDefaultPassword(arc,""); is automatically executed.
*Operation when first Yz1FindFirst after OpenArchive of archive with path*
-The standard password is not set (==NULL).
Displays a password input dialog and prompts the user for input.
-A standard password is set.
Attempt to acquire information with the standard password.
as a result,
The password was correct.
The correct password is automatically saved with Yz1SetDefaultPassword(),
After that, it works the same as a normal archive.
The password was incorrect.
Search error returns ERROR_PASSWORD_FILE.
*Example*
1. Give up the information display of the archive with password easily.
OpenArchive() with M_ERROR_MESSAGE_OFF and the rest is normal.
.2. Give up, but please display the error message.
OpenArchive() with M_ERROR_MESSAGE_ON, then
Execute SetDefaultPassword(arc,"some dummy string"). The rest is normal.
3. If there is a password, have the user enter it at Find First.
OpenArchive() with M_ERROR_MESSAGE_ON and the rest is normal.
4. Please do not display the error message.
OpenArchive() with M_ERROR_MESSAGE_OFF, then
Execute SetDefaultPassword(arc,NULL). The rest is normal.
⑤ Since I call both FindFirst() and Yz1(),
I want to do it once without displaying the dialog.
First, check the return value of CheckArchive to see if it has a password.
<Properly if there is no password...>
If there is an I password, the application will display its own dialog and
Ask the user to enter a password.
Open with> Open Archive. (M_ERROR_MESSAGE_ON/OFF can be either)
Pass the previous password to SetDefaultPassword.
For example, FindFirst,
For example, pass the previous password to Yz1() with the -p option.
Another hand (only possible in the order of Yz1FindFirst -> Yz1)
First, open with OpenArchive and do FindFirst etc.
Get the password with GetDefaultPassword before CloseArchive,
Pass it to Yz1() with -p option.
-------------------------------------------------- ---------------------
int WINAPI Yz1SetDefaultPassword( HARC arc, LPCSTR pwd );
-------------------------------------------------- ---------------------
Ordinal number 178 ([YZ1.DLL] This is a unique API!!)
function
Set a standard password for the archive.
argument
pwd The password you want to set as standard. If you specify NULL,
The DLL will ask the user in a dialog.
Return value
0=Normal end, Other=Error
-------------------------------------------------- ---------------------
DWORD WINAPI Yz1GetDefaultPassword( HARC arc, LPSTR pwd, DWORD siz );
-------------------------------------------------- ---------------------
Ordinal number 179 ([YZ1.DLL] This is a unique API!!)
function
Acquires the standard password set in the archive.
argument
pwd A buffer containing the standard password.
The number of bytes reserved in the siz buffer.
Return value
0 = Normal end, -1 = Error or standard path is not set yet
Other = Insufficient buffer capacity. Returns the number of bytes required.
-------------------------------------------------- ---------------------
int WINAPI Yz1PasswordDialog( HWND parent, LPSTR buf, DWORD siz );
-------------------------------------------------- ---------------------
Ordinal number 180 ([YZ1.DLL] This is a unique API!!)
function
YZ1.DLL Displays the standard password input dialog.
argument
parent The parent window of the dialog.
buf A buffer to receive the password.
The number of bytes reserved in the siz buffer.
Return value
0=Normal end, -1=Cancel
-------------------------------------------------- ---------------------
HARC WINAPI Yz1OpenArchive( const HWND wnd, LPCSTR filename, const DWORD mode );
-------------------------------------------------- ---------------------
Ordinal number 21
function
If the specified file is a valid archive file, it will be opened and its handle will be opened.
return. Subsequent access to the archive file is performed with this handle.
argument
wnd App window handle.
filename Archive file name.
mode A flag that specifies the processing mode. Combine the following values ​​with |.
M_CHECK_ALL_PATH: Search all paths when searching for file names.
M_CHECK_FILENAME_ONLY Only file name is searched when searching.
M_ERROR_MESSAGE_ON * Issue an error message when an error occurs.
M_ERROR_MESSAGE_OFF *No error message is displayed when an error occurs.
*Proprietary specifications: The display of the password input request also conforms to the setting by this flag.
Return value
A handle that corresponds to the specified archive file. NULL on error.
-------------------------------------------------- ---------------------
int WINAPI Yz1CloseArchive( HARC arc );
-------------------------------------------------- ---------------------
Ordinal number 22
function
Release the handle allocated by the above API.
*Please do not try to release it with GlobalFree() yourself.
Please be sure to use this API.
Return value
0=Normal end, Other=Error
-------------------------------------------------- ---------------------
int WINAPI Yz1FindFirst( HARC arc,LPCSTR WildName,LPINDIVIDUALINFO lpInfo );
-------------------------------------------------- ---------------------
Ordinal number 23
function
Get information about the first storage file.
argument
WildName Specify the file name to search. Wild cards can be specified.
You can specify multiple items by separating them with spaces. It may be enclosed in "".
If you specify an empty string, all files in the archive will be matched.
lpInfo A pointer to a structure of type INDIVIDUALINFO to return the results.
Specify NULL if the result is not required.
Return value
0=Normal end, -1=Search end, Other=Error
-------------------------------------------------- ---------------------
int WINAPI Yz1FindNext( HARC arc,LPINDIVIDUALINFO lpInfo );
-------------------------------------------------- ---------------------
Ordinal number 24
function
Acquires the information of the second and subsequent storage files.
argument
lpInfo A pointer to a structure of type INDIVIDUALINFO to return the results.
Specify NULL if the result is not required.
Return value
0=Normal end, -1=Search end, Other=Error
-------------------------------------------------- ---------------------
int WINAPI Yz1GetArcFileName( HARC arc,LPCSTR buf,const int siz );
-------------------------------------------------- ---------------------
Ordinal number 31
function
Get the archive file name.
argument
buf A buffer to store the file name.
The size of the siz buffer.
Return value
0=Normal end, Other=Error
-------------------------------------------------- ---------------------
DWORD WINAPI Yz1GetArcFileSize( HARC arc );
-------------------------------------------------- ---------------------
Ordinal number 32
function
Gets the size of the archive file.
Return value
The size of the archive file. -1 on error.
-------------------------------------------------- ---------------------
WORD WINAPI Yz1GetArcDate( HARC arc );
-------------------------------------------------- ---------------------
Ordinal number 36
function
Get the update date of the archive file in DOS format.
Return value
The update date of the archive file. -1 on error. The format is as follows:
Bit content
0-4 Day of month (1-31)
5-8 Month of year (1-12)
9-15 Year of year (number of years since 1980)
*Theoretically, it can be expressed until the end of 2107.
-------------------------------------------------- ---------------------
WORD WINAPI Yz1GetArcTime( HARC arc );
-------------------------------------------------- ---------------------
Ordinal number 37
function
Get the update time of the archive file in DOS format.
Return value
The update time of the archive file. -1 on error. The format is as follows:
Bit content
0-4 Hours, minutes, seconds (divided by 2)
5-10 Hours, minutes, seconds (0-59)
11-15 Hours, minutes and seconds (0-23)
*Since it is implemented using Win32 API, seconds may be set depending on the environment.
▼ It depends on whether it is rounded up or rounded down.
-------------------------------------------------- ---------------------
int WINAPI Yz1IsSFXFile( HARC arc );
-------------------------------------------------- ---------------------
Ordinal number 39
function
Gets whether the archive file is a self-extracting file.
Return value
0=normal archive, -1=error, other=self-extracting archive
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1GetArcCreateTimeEx( HARC arc,FILETIME* pCreatFT );
-------------------------------------------------- ---------------------
Ordinal number 68
function
Get the creation date and time of the archive in FILETIME format.
argument
pCreatFT A FILETIME structure that contains date and time information.
Return value
TRUE=normal end, FALSE=abnormal end
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1GetArcAccessTimeEx( HARC arc,FILETIME* pAccsFT );
-------------------------------------------------- ---------------------
Ordinal number 69
function
Get the reference date and time of the archive in FILETIME format.
argument
pAccsFT A FILETIME structure that contains date and time information.
Return value
TRUE=normal end, FALSE=abnormal end
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1GetArcWriteTimeEx( HARC arc,FILETIME* pWriteFT );
-------------------------------------------------- ---------------------
Ordinal number 70
function
Get the last modified date of the archive in FILETIME format.
argument
pWriteFT A FILETIME structure that contains the date and time information.
Return value
TRUE=normal end, FALSE=abnormal end
-------------------------------------------------- ---------------------
DWORD WINAPI Yz1GetArcOriginalSize( HARC arc );
-------------------------------------------------- ---------------------
Ordinal number 33
function
Get the total size (after decompression) of the files that matched the search up to this point.
Return value
Total size. -1 on error.
-------------------------------------------------- ---------------------
int WINAPI Yz1GetFileName( HARC arc,LPCSTR buf,const int siz );
-------------------------------------------------- ---------------------
Ordinal number 40
function
Get the filename of the stored file.
argument
buf A buffer to store the file name.
The size of the siz buffer.
Return value
0=normal end, other=error
-------------------------------------------------- ---------------------
DWORD WINAPI Yz1GetOriginalSize( HARC arc );
-------------------------------------------------- ---------------------
Ordinal number 41
function
Get the size of the stored file (after decompression).
Return value
Storage file size. -1 on error.
-------------------------------------------------- ---------------------
int WINAPI Yz1GetAttribute( HARC arc );
-------------------------------------------------- ---------------------
Ordinal number 47
function
Get the attributes of the stored file.
Return value
Stored file attributes. A combination of the following bits with |. -1 on error.
FA_RDONLY Read-only file.
FA_HIDDEN Invisible attribute file.
FA_SYSTEM system file.
FA_LABEL Volume label.
FA_DIREC directory.
FA_ARCH save bit.
-------------------------------------------------- ---------------------
int WINAPI Yz1GetMethod( HARC arc,LPSTR buf,const int siz );
-------------------------------------------------- ---------------------
Ordinal number 61
function
Get the compression method of the stored file.
argument
buf A buffer that contains the name of the compression method.
The size of the siz buffer.
Return value
0=Normal end, Other=Error
-------------------------------------------------- ---------------------
WORD WINAPI Yz1GetDate( HARC arc );
-------------------------------------------------- ---------------------
Ordinal number 44
function
Get the date of the stored file.
Return value
Stored file date. -1 on error.
The format follows MSDOS time stamp. (Refer to the description of Yz1GetArcDate)
-------------------------------------------------- ---------------------
WORD WINAPI Yz1GetTime( HARC arc );
-------------------------------------------------- ---------------------
Ordinal number 45
function
Get the time of the stored file.
Return value
Store file time. -1 on error.
The format conforms to the MSDOS time stamp. (Refer to the description of Yz1GetArcTime)
-------------------------------------------------- ---------------------
DWORD WINAPI Yz1GetWriteTime( HARC arc );
-------------------------------------------------- ---------------------
Ordinal number 62
function
Get the last modified date of the stored file.
Return value
The date and time the file was stored in UNIX format in UTC. -1 on error.
The UNIX format is the number of seconds since Jan.1, 1970 00:00:00.
=================================================== =====================
Windows message API
=================================================== =====================
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1SetOwnerWindow( const HWND wnd );
-------------------------------------------------- ---------------------
Ordinal number 90
function
Sets the message destination window for YZ1.DLL. YZ1.DLL is
Sends a wm_arcextract message to the window specified here.
Return value
TRUE=normal end, FALSE=error
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1ClearOwnerWindow();
-------------------------------------------------- ---------------------
Ordinal number 91
function
Cancel the window settings set with the above API.
Return value
TRUE=Normal end, FALSE=Error
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1SetOwnerWindowEx( HWND wnd, LPARCHIVERPROC lpArcProc );
-------------------------------------------------- ---------------------
Ordinal number 92
function
Specify the callback function to receive the processing status.
If NULL is specified for pArcProc, the same operation as SetOwnerWindow is performed.
Return value
TRUE=normal end, FALSE=error
-------------------------------------------------- ---------------------
BOOL WINAPI Yz1KillOwnerWindowEx( HWND wnd );
-------------------------------------------------- ---------------------
Ordinal number 93
function
Cancel the window settings set with the above API.
Return value
TRUE=Normal end, FALSE=Error
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
★ About structures, messages, and callbacks
<INDIVIDUALINFO structure>
typedef struct {
DWORD dwOriginalSize;
DWORD dwCompressedSize;
DWORD dwCRC;
UINT uFlag;
UINT uOSType;
WORD wRatio;
WORD wDate;
WORD wTime;
char szFileName[FNAME_MAX32 + 1];
char dummy1[3];
char szAttribute[8];
char szMode[8];
} INDIVIDUALINFO;
dwOriginalSize Size of stored file before compression.
-SzFileName Storage file name.
-SzAttribute Storage file attribute.
・In szMode YZ1.DLL, enter "-yz1-".
-WDate Update date of the stored file (DOS format).
-Update time of wTime storage file (DOS format).
・All other members are cleared to 0.
<Windows Message>
If the progress display of YZ1.DLL is suppressed by the -i option, etc.
-Sends a message informing the processing status to the calling window.
However, it is necessary to set the notification destination window with the Yz1SetOwnerWindow() API.
The message sent is
Wm_arcextract
WPARAM: nMode = (int)wParam
0: Indicates that processing of the corresponding file is started.
1: Indicates that the corresponding file is being processed.
2: The process is about to end. lpEis is NULL.
3: Indicates that the processing of the corresponding archive is started.
The archive name is stored in szSourceFileName.
LPARAM: lpEis = (EXTRACTINGINFO FAR *)lParam
typedef struct {
DWORD dwFileSize;
DWORD dwWriteSize;
char szSourceFileName[FNAME32_MAX + 1];
char dummy1[3];
char szDestFileName[FNAME32_MAX + 1];
char dummy[3];
} EXTRACTINGINFO;
-DwFileSize The size of the stored file before compression.
-DwWriteSize ↑ Of these, the size that was expanded/compressed.
-SzSourceFileName Storage file name for processing.
-SzDestFileName Path name of the file to be processed.
・All other members are cleared to 0.
Return value :
If the application returns 0, processing continues,
If a value other than 0 is returned, the processing will be stopped.
The wm_arcextract message is sent to the system with RegisterWindowMessage().
Can be used by registering.
<Callback>
If you use Yz1SetOwnerWindowEx() instead of Yz1SetOwnerWindow(),
Notify the following callback function of the processing status.
typedef BOOL CALLBACK ARCHIVERPROC( HWND wnd, UINT msg, UINT uState,
LPEXTRACTINGINFOEX pEis)
The window handle specified in wnd Yz1SetOwnerWindowEx is passed.
Msg Currently it is wm_arcextract.
UState wm_arcextract Synonymous with the message parameter wParam.
A structure that contains information about the pEis storage file.
typedef struct {
EXTRACTINGINFO exinfo;
DWORD dwCompressedSize;
DWORD dwCRC;
UINT uOSType;
WORD wRatio;
WORD wDate;
WORD wTime;
char szAttribute[8];
char szMode[8];
} EXTRACTINGINFOEX;
-Exinfo EXTRACTINGINFO structure is stored.
-SzAttribute Storage file attribute.
・SzMode "-yz1-"
-WDate Update date of the stored file (DOS format).
-Update time of the wTime storage file (DOS format).
・All other members are cleared to 0.
Return value Return TRUE to continue processing, FALSE to stop processing.
※Note! The return value is the opposite of the window message! !!
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
★ About error code
The error value returned by YZ1.DLL.
ERROR_NOT_ARC_FILE The archive file name is not specified.
ERROR_COMMAND_NAME Command specification is incorrect.
ERROR_LONG_FILE_NAME File/directory name is too long.
ERROR_NOT_FILENAME File name must be specified.
ERROR_TMP_OPEN Work file cannot be created.
ERROR_USER_CANCEL The processing was interrupted by the user.
ERROR_MAKEDIRECTORY Directory cannot be created.
ERROR_HARC_ISNOT_OPENED The file is not opened by Open Archive.
ERROR_NOT_SEARCH_MODE Not searched by FindFirst.
ERROR_PASSWORD_FILE Password is required.
ERROR_CANNOT_READ Reading failed.
0xFFFFFFFF Other error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment