Merge pull request #1573 from unxed/fix-alt-keys
[far2l.git] / multiarc / README.TXT
blobfca7fe439fd51cd77d0ece8c40950ced7b7a1203
1 Archive support plugin considers all *.fmt DLL modules in Formats\r
2 directory as second level plugins.  Examples of such plugins\r
3 are supplied here. To reduce the size of the compiled DLLs,\r
4 the examples mainly use Win32 API functions and were compiled\r
5 without the standard C startup code.\r
6 \r
7 Second-level archive support plugins must export the following functions:\r
8 \r
9 ----------------------------------------------------------------------------\r
10 Called when second-level plugin module is loaded. This function\r
11 is optional and may be omitted.\r
13 DWORD WINAPI _export LoadFormatModule(\r
14   const char *ModuleName\r
15 );\r
17 Parameters:\r
18   ModuleName - name of the second-level plugin module\r
20 Return value:\r
21   Must be 0. In future it may be used to return second-level\r
22   plugin information.\r
23 ----------------------------------------------------------------------------\r
24 Checks if the given archive file is supported by the plugin or not.\r
26 BOOL WINAPI IsArchive(\r
27   const char *Name,\r
28   const unsigned char *Data,\r
29   int DataSize\r
30 );\r
32 Parameters:\r
33   Name     - archive name\r
34   Data     - archive data\r
35   DataSize - archive data size\r
37 Return value:\r
38   TRUE if this archive type is supported.\r
40 ----------------------------------------------------------------------------\r
41 Open archive and prepare to read it. Called after successful IsArchive.\r
43 BOOL WINAPI OpenArchive(\r
44   const char *Name,\r
45   int *Type\r
46 );\r
48 Parameters:\r
49   Name - archive name\r
50   Type - if the plugin supports several archive types, it must put the type\r
51          here, otherwise set *Type to 0\r
53 Return value:\r
54   TRUE if the archive was opened successfully.\r
56 ----------------------------------------------------------------------------\r
57 Get the next archive item. Called after OpenArchive.\r
59 int WINAPI GetArcItem(\r
60   struct PluginPanelItem *Item,\r
61   struct ArcItemInfo *Info\r
62 );\r
64 Parameters:\r
65   Item - this structure must be filled. Read its description in plugins.hlp.\r
66   Info - additional item info, which should be filled if possible.\r
68     struct ArcItemInfo\r
69     {\r
70       char HostOS[32];       - Host OS name or empty if unknown\r
71       char Description[256]; - Item description or empty string\r
72       int Solid;             - "Solid" flag\r
73       int Comment;           - Set if file comment is present\r
74       int Encrypted;         - Set if file is encrypted\r
75       int DictSize;          - Dictionary size or 0 if unknown\r
76       int UnpVer;            - Version to unpack (HighNumber*256+LowNumber)\r
77                                or 0 if unknown\r
78       int Chapter;           - chapter item\r
79     };\r
81   This structure is filled with zeros before it is passed to GetArcItem.\r
83 Return value:\r
84   GETARC_EOF         End of archive\r
85   GETARC_SUCCESS     Item successfully read\r
86   GETARC_BROKEN      Archive broken\r
87   GETARC_UNEXPEOF    Unexpected end of archive\r
88   GETARC_READERROR   Read error\r
90 ----------------------------------------------------------------------------\r
91 Close the archive. Called after the last GetArcItem call.\r
93 BOOL WINAPI CloseArchive(\r
94   struct ArcInfo *Info\r
95 );\r
97 Parameters:\r
98   Info - additional archive info, which should be filled if possible.\r
100     struct ArcInfo\r
101     {\r
102       int SFXSize;     - SFX module size\r
103       int Volume;      - Volume flag\r
104       int Comment;     - Archive comment present\r
105       int Recovery;    - Recovery record present\r
106       int Lock;        - Archive is locked\r
107       DWORD Flags;     - Additional archive information flags\r
108       DWORD Reserved;  - Reserved\r
109       int Chapters;    - count chapters in archive\r
110     };\r
112   'Flags' field can be combination of the following values:\r
114    AF_AVPRESENT     Authenticity information present\r
116    AF_IGNOREERRORS  Archiver commands exit code must be ignored\r
117                     for this archive\r
119   This structure is filled with zeros before it is passed to CloseArchive.\r
121 Return value:\r
122   TRUE if successful.\r
124 ----------------------------------------------------------------------------\r
125 Get the archive format name.\r
127 BOOL WINAPI GetFormatName(\r
128   int Type,\r
129   char *FormatName,\r
130   char *DefaultExt\r
131 );\r
133 Parameters:\r
134   Type       - archive type\r
135   FormatName - format name. It will be used to save parameters\r
136                in registry and select desired format\r
137   DefaultExt - default file extension for this format (without dot).\r
138                Used to increase format recognizing speed.\r
140 Return value:\r
141   TRUE if successful. If specified Type value is greater than\r
142   the maximum supported, FALSE must be returned.\r
144 ----------------------------------------------------------------------------\r
145 Get the default archiver command strings.\r
147 BOOL WINAPI GetDefaultCommands(\r
148   int Type,\r
149   int Command,\r
150   char *Dest\r
151 );\r
153 Parameters:\r
154   Type    - archive type\r
155   Command - command number\r
156     0 - extract\r
157     1 - extract without path\r
158     2 - test\r
159     3 - delete\r
160     4 - comment\r
161     5 - comment files\r
162     6 - convert to SFX\r
163     7 - lock\r
164     8 - add recovery record\r
165     9 - recover\r
166    10 - add files\r
167    11 - move files\r
168    12 - add files and folders\r
169    13 - move files and folders\r
170    14 - mask to select all files\r
172   Dest    - buffer to copy the command\r
174 Return value:\r
175   TRUE if successful. If specified Type value is greater than the maximum\r
176   supported, FALSE must be returned. If Type is supported, but the required\r
177   command is absent, return TRUE and set Dest to an empty string.\r
180 ----------------------------------------------------------------------------\r
181 Send a pointer to the PluginStartupInfo structure. Called when the\r
182 second-level plugin module is loaded (called after the LoadFormatModule\r
183 function). This function is optional and may be omitted.\r
185 void  WINAPI SetFarInfo(\r
186   const struct PluginStartupInfo *Info\r
187 );\r
189 Parameters:\r
190   Info    - plugin startup info:\r
192 Return value:\r
193   None.\r
195 ----------------------------------------------------------------------------\r
196 Returns the start position of the archive in the stream of data passed\r
197 to the IsArchive function. The function GetSFXPos is called\r
198 immediately after the archive has been recognized by the IsArchive\r
199 function. MultiArc selects the FMT module that has returned the lowest\r
200 offset (closer to the beginning of the file). This allows to handle\r
201 correctly the situation when, for example, an ARJ archive is stored\r
202 without compression in a ZIP archive called "N3gk8v1t.106". Previous\r
203 versions of MultiArc showed the ARJ archive, and not the ZIP archive,\r
204 when entering such file.\r
206 BOOL WINAPI GetSFXPos(void);\r
208 Parameters:\r
209   None.\r
211 Return value:\r
212   Offset of the archive beginning from the start of the file.\r
215 ----------------------------------------------------------------------------\r
216 ATTENTION! IF YOU WRITE ARCHIVE FORMAT PLUGINS, KEEP IN MIND THAT THE CURRENT\r
217 STRUCTURE ALIGNMENT MAY BE DIFFERENT FROM 1, AND IF YOU NEED TO DESCRIBE THE\r
218 STRUCTURE OF YOUR ARCHIVE FILE PRECISELY, THEN SWITCH ALIGNMENT BEFORE YOUR\r
219 STRUCTURE DEFINITION EXPLICITLY! OTHERWISE THE FIELDS IN YOUR STRUCTURE MAY\r
220 HAVE THE WRONG SIZE.\r
222 For explanations about alignment, consult your compiler manual.\r
223 ----------------------------------------------------------------------------\r