2 * File Compression Interface
4 * Copyright 2002 Patrik Stridvall
5 * Copyright 2005 Gerold Jens Wucherpfennig
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(cabinet);
36 /***********************************************************************
37 * FCICreate (CABINET.10)
39 * Provided with several callbacks,
40 * returns a handle which can be used to perform operations
44 * perf [IO] A pointer to an ERF structure. When FCICreate
45 * returns an error condition, error information may
46 * be found here as well as from GetLastError.
47 * pfnfiledest [I] A pointer to a function which is called when a file
48 * is placed. Only useful for subsequent cabinet files.
49 * pfnalloc [I] A pointer to a function which allocates ram. Uses
50 * the same interface as malloc.
51 * pfnfree [I] A pointer to a function which frees ram. Uses the
52 * same interface as free.
53 * pfnopen [I] A pointer to a function which opens a file. Uses
54 * the same interface as _open.
55 * pfnread [I] A pointer to a function which reads from a file into
56 * a caller-provided buffer. Uses the same interface
58 * pfnwrite [I] A pointer to a function which writes to a file from
59 * a caller-provided buffer. Uses the same interface
61 * pfnclose [I] A pointer to a function which closes a file handle.
62 * Uses the same interface as _close.
63 * pfnseek [I] A pointer to a function which seeks in a file.
64 * Uses the same interface as _lseek.
65 * pfndelete [I] A pointer to a function which deletes a file.
66 * pfnfcigtf [I] A pointer to a function which gets the name of a
67 * temporary file; ignored in wine
68 * pccab [I] A pointer to an initialized CCAB structure
69 * pv [I] A pointer to an application-defined notification
70 * function which will be passed to other FCI functions
74 * On success, returns an FCI handle of type HFCI.
75 * On failure, the NULL file handle is returned. Error
76 * info can be retrieved from perf.
82 HFCI __cdecl FCICreate(
84 PFNFCIFILEPLACED pfnfiledest,
92 PFNFCIDELETE pfndelete,
93 PFNFCIGETTEMPFILE pfnfcigtf,
99 if ((!pfnalloc) || (!pfnfree)) {
100 perf->erfOper = FCIERR_NONE;
101 perf->erfType = ERROR_BAD_ARGUMENTS;
104 SetLastError(ERROR_BAD_ARGUMENTS);
108 if (!(rv = (HFCI) (*pfnalloc)(sizeof(FCI_Int)))) {
109 perf->erfOper = FCIERR_ALLOC_FAIL;
110 perf->erfType = ERROR_NOT_ENOUGH_MEMORY;
113 SetLastError(ERROR_NOT_ENOUGH_MEMORY);
117 PFCI_INT(rv)->FCI_Intmagic = FCI_INT_MAGIC;
118 PFCI_INT(rv)->perf = perf;
119 PFCI_INT(rv)->pfnfiledest = pfnfiledest;
120 PFCI_INT(rv)->pfnalloc = pfnalloc;
121 PFCI_INT(rv)->pfnfree = pfnfree;
122 PFCI_INT(rv)->pfnopen = pfnopen;
123 PFCI_INT(rv)->pfnread = pfnread;
124 PFCI_INT(rv)->pfnwrite = pfnwrite;
125 PFCI_INT(rv)->pfnclose = pfnclose;
126 PFCI_INT(rv)->pfnseek = pfnseek;
127 PFCI_INT(rv)->pfndelete = pfndelete;
128 PFCI_INT(rv)->pfnfcigtf = pfnfcigtf;
129 PFCI_INT(rv)->pccab = pccab;
130 PFCI_INT(rv)->pv = pv;
132 /* Still mark as incomplete, because of other missing FCI* APIs */
134 PFCI_INT(rv)->FCI_Intmagic = 0;
136 FIXME("(%p, %p, %p, %p, %p, %p, %p, %p, %p, %p, %p, %p, %p): stub\n",
137 perf, pfnfiledest, pfnalloc, pfnfree, pfnopen, pfnread, pfnwrite, pfnclose,
138 pfnseek, pfndelete, pfnfcigtf, pccab, pv);
140 perf->erfOper = FCIERR_NONE;
144 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
150 /***********************************************************************
151 * FCIAddFile (CABINET.11)
153 BOOL __cdecl FCIAddFile(
158 PFNFCIGETNEXTCABINET pfnfcignc,
159 PFNFCISTATUS pfnfcis,
160 PFNFCIGETOPENINFO pfnfcigoi,
163 FIXME("(%p, %p, %p, %d, %p, %p, %p, %hu): stub\n", hfci, pszSourceFile,
164 pszFileName, fExecute, pfnfcignc, pfnfcis, pfnfcigoi, typeCompress);
166 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
171 /***********************************************************************
172 * FCIFlushCabinet (CABINET.13)
174 BOOL __cdecl FCIFlushCabinet(
177 PFNFCIGETNEXTCABINET pfnfcignc,
178 PFNFCISTATUS pfnfcis)
180 FIXME("(%p, %d, %p, %p): stub\n", hfci, fGetNextCab, pfnfcignc, pfnfcis);
182 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
187 /***********************************************************************
188 * FCIFlushFolder (CABINET.12)
190 BOOL __cdecl FCIFlushFolder(
192 PFNFCIGETNEXTCABINET pfnfcignc,
193 PFNFCISTATUS pfnfcis)
195 FIXME("(%p, %p, %p): stub\n", hfci, pfnfcignc, pfnfcis);
197 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
202 /***********************************************************************
203 * FCIDestroy (CABINET.14)
205 * Frees a handle created by FCICreate.
206 * Only reason for failure would be an invalid handle.
209 * hfci [I] The HFCI to free
215 BOOL __cdecl FCIDestroy(HFCI hfci)
217 if (REALLY_IS_FCI(hfci)) {
218 PFCI_INT(hfci)->FCI_Intmagic = 0;
219 PFDI_FREE(hfci, hfci);
222 SetLastError(ERROR_INVALID_HANDLE);
226 /* Still mark as incomplete, because of other missing FCI* APIs */
227 FIXME("(%p): stub\n", hfci);
228 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);