31#define MEDIA_SIZE 999999999
32#define FOLDER_THRESHOLD 900000
109 { {
'M',
'S',
'C',
'F'}, 0, 0x59, 0,
sizeof(
struct CFHEADER) +
sizeof(
struct CFFOLDER), 0, 3,1, 1, 1, 0, 0x1225, 0x2013 },
111 {
sizeof(
"Hello World!")-1, 0, 0x1234, 0x1225, 0x2013, 0xa114 },
112 {
'f',
'i',
'l',
'e',
'.',
'd',
'a',
't',0 },
113 { 0,
sizeof(
"Hello World!")-1,
sizeof(
"Hello World!")-1 },
114 {
'H',
'e',
'l',
'l',
'o',
' ',
'W',
'o',
'r',
'l',
'd',
'!' }
187 ok(0,
"FDIIsCabinet shouldn't call pfnopen\n");
193 ok(hf == 0,
"unexpected hf %Ix\n", hf);
199 ok(0,
"FDIIsCabinet shouldn't call pfnwrite\n");
205 ok(0,
"FDIIsCabinet shouldn't call pfnclose\n");
211 ok(hf == 0,
"unexpected hf %Ix\n", hf);
228 erf.erfOper = 0x1abe11ed;
229 erf.erfType = 0x5eed1e55;
230 erf.fError = 0x1ead1e55;
234 ok(hfdi !=
NULL,
"Expected non-NULL context\n");
237 ok(
erf.erfOper == 0x1abe11ed,
"Expected 0x1abe11ed, got %d\n",
erf.erfOper);
238 ok(
erf.erfType == 0x5eed1e55,
"Expected 0x5eed1e55, got %d\n",
erf.erfType);
239 ok(
erf.fError == 0x1ead1e55,
"Expected 0x1ead1e55, got %d\n",
erf.fError);
245 erf.erfOper = 0x1abe11ed;
246 erf.erfType = 0x5eed1e55;
247 erf.fError = 0x1ead1e55;
251 ok(hfdi !=
NULL,
"Expected non-NULL context\n");
254 ok((
erf.erfOper == 0x1abe11ed ||
erf.erfOper == 0 ),
"Expected 0x1abe11ed or 0, got %d\n",
erf.erfOper);
255 ok((
erf.erfType == 0x5eed1e55 ||
erf.erfType == 0 ),
"Expected 0x5eed1e55 or 0, got %d\n",
erf.erfType);
256 ok((
erf.fError == 0x1ead1e55 ||
erf.fError == 0 ),
"Expected 0x1ead1e55 or 0, got %d\n",
erf.fError);
261 erf.erfOper = 0x1abe11ed;
262 erf.erfType = 0x5eed1e55;
263 erf.fError = 0x1ead1e55;
267 ok(hfdi !=
NULL,
"Expected non-NULL context\n");
270 ok((
erf.erfOper == 0x1abe11ed ||
erf.erfOper == 0 ),
"Expected 0x1abe11ed or 0, got %d\n",
erf.erfOper);
271 ok((
erf.erfType == 0x5eed1e55 ||
erf.erfType == 0 ),
"Expected 0x5eed1e55 or 0, got %d\n",
erf.erfType);
272 ok((
erf.fError == 0x1ead1e55 ||
erf.fError == 0 ),
"Expected 0x1ead1e55 or 0, got %d\n",
erf.fError);
277 erf.erfOper = 0x1abe11ed;
278 erf.erfType = 0x5eed1e55;
279 erf.fError = 0x1ead1e55;
283 ok(hfdi !=
NULL,
"Expected non-NULL context\n");
286 ok((
erf.erfOper == 0x1abe11ed ||
erf.erfOper == 0 ),
"Expected 0x1abe11ed or 0, got %d\n",
erf.erfOper);
287 ok((
erf.erfType == 0x5eed1e55 ||
erf.erfType == 0 ),
"Expected 0x5eed1e55 or 0, got %d\n",
erf.erfType);
288 ok((
erf.fError == 0x1ead1e55 ||
erf.fError == 0 ),
"Expected 0x1ead1e55 or 0, got %d\n",
erf.fError);
293 erf.erfOper = 0x1abe11ed;
294 erf.erfType = 0x5eed1e55;
295 erf.fError = 0x1ead1e55;
299 ok(hfdi !=
NULL,
"Expected non-NULL context\n");
302 ok((
erf.erfOper == 0x1abe11ed ||
erf.erfOper == 0 ),
"Expected 0x1abe11ed or 0, got %d\n",
erf.erfOper);
303 ok((
erf.erfType == 0x5eed1e55 ||
erf.erfType == 0 ),
"Expected 0x5eed1e55 or 0, got %d\n",
erf.erfType);
304 ok((
erf.fError == 0x1ead1e55 ||
erf.fError == 0 ),
"Expected 0x1ead1e55 or 0, got %d\n",
erf.fError);
309 erf.erfOper = 0x1abe11ed;
310 erf.erfType = 0x5eed1e55;
311 erf.fError = 0x1ead1e55;
315 ok(hfdi !=
NULL,
"Expected non-NULL context\n");
318 ok((
erf.erfOper == 0x1abe11ed ||
erf.erfOper == 0 ),
"Expected 0x1abe11ed or 0, got %d\n",
erf.erfOper);
319 ok((
erf.erfType == 0x5eed1e55 ||
erf.erfType == 0 ),
"Expected 0x5eed1e55 or 0, got %d\n",
erf.erfType);
320 ok((
erf.fError == 0x1ead1e55 ||
erf.fError == 0 ),
"Expected 0x1ead1e55 or 0, got %d\n",
erf.fError);
325 erf.erfOper = 0x1abe11ed;
326 erf.erfType = 0x5eed1e55;
327 erf.fError = 0x1ead1e55;
340 erf.erfOper = 0x1abe11ed;
341 erf.erfType = 0x5eed1e55;
342 erf.fError = 0x1ead1e55;
346 ok(hfdi !=
NULL,
"Expected non-NULL context\n");
349 ok((
erf.erfOper == 0x1abe11ed ||
erf.erfOper == 0 ),
"Expected 0x1abe11ed or 0, got %d\n",
erf.erfOper);
350 ok((
erf.erfType == 0x5eed1e55 ||
erf.erfType == 0 ),
"Expected 0x5eed1e55 or 0, got %d\n",
erf.erfType);
351 ok((
erf.fError == 0x1ead1e55 ||
erf.fError == 0 ),
"Expected 0x1ead1e55 or 0, got %d\n",
erf.fError);
357 erf.erfOper = 0x1abe11ed;
358 erf.erfType = 0x5eed1e55;
359 erf.fError = 0x1ead1e55;
363 ok(hfdi ==
NULL,
"Expected NULL context, got %p\n", hfdi);
365 "Expected FDIERROR_ALLOC_FAIL, got %d\n",
erf.erfOper);
366 ok(
erf.fError ==
TRUE,
"Expected TRUE, got %d\n",
erf.fError);
369 ok(
erf.erfType == 0,
"Expected 0, got %d\n",
erf.erfType);
383 ok(hfdi !=
NULL,
"Expected non-NULL context\n");
453 BOOL fContinuation,
void *pv)
462 DWORD dwShareMode = 0;
475 dwCreateDisposition, 0,
NULL);
489 ok(
res,
"Failed to ReadFile\n");
501 ok(
res,
"Failed to WriteFile\n");
528 ok(
ret,
"Failed to DeleteFile %s\n", pszFile);
540 if (tempname && (
strlen(tempname) < (
unsigned)cbTempName))
567 ok(
res,
"Expected GetFileInformationByHandle to succeed\n");
592 ok(
res,
"Expected FCIAddFile to succeed\n");
601 pCabParams->
setID = 0xbeef;
612 static CHAR a_txt[] =
"a.txt",
614 testdir_c_txt[] =
"testdir\\c.txt",
615 testdir_d_txt[] =
"testdir\\d.txt";
624 ok(hfci !=
NULL,
"Failed to create an FCI context\n");
632 ok(
res,
"Failed to flush the cabinet\n");
635 ok(
res,
"Failed to destroy the cabinet\n");
645 char temp[] =
"temp.txt";
646 char extract[] =
"extract.cab";
654 ok(hfdi !=
NULL,
"Expected non-NULL context\n");
664 "Expected ERROR_INVALID_HANDLE, got %ld\n",
GetLastError());
669 ok(cabinfo.
setID == 0,
"Expected 0, got %d\n", cabinfo.
setID);
684 ok(cabinfo.
setID == 0,
"Expected 0, got %d\n", cabinfo.
setID);
698 ok(cabinfo.
setID == 0xbeef,
"Expected 0xbeef, got %d\n", cabinfo.
setID);
708 ok(hfdi !=
NULL,
"Expected non-NULL context\n");
719 ok(cabinfo.
setID == 0xbeef,
"Expected 0xbeef, got %d\n", cabinfo.
setID);
737 static const char expected[] =
"memory\\block";
741 ok(oflag ==
_O_BINARY,
"expected _O_BINARY, got %x\n", oflag);
745 if (!
data)
return -1;
751 trace(
"mem_open(%s,%x,%x) => %p\n",
name, oflag, pmode,
data);
764 data->pos += cb_read;
772 static const char expected[] =
"Hello World!";
774 trace(
"mem_write(%#Ix,%p,%u)\n", hf, pv,
cb);
776 ok(hf == 0x12345678,
"expected 0x12345678, got %#Ix\n", hf);
777 ok(
cb == 12,
"expected 12, got %u\n",
cb);
805 ok(0,
"seek: not expected type %d\n", seektype);
818 static const char expected[9] =
"file.dat\0";
823 trace(
"mem_notify: CLOSE_FILE_INFO %s, handle %#Ix\n",
info->psz1,
info->hf);
826 ok(
info->date == 0x1225,
"expected 0x1225, got %#x\n",
info->date);
827 ok(
info->time == 0x2013,
"expected 0x2013, got %#x\n",
info->time);
828 ok(
info->attribs == 0xa114,
"expected 0xa114, got %#x\n",
info->attribs);
829 ok(
info->iFolder == 0x1234,
"expected 0x1234, got %#x\n",
info->iFolder);
834 trace(
"mem_notify: COPY_FILE %s, %ld bytes\n",
info->psz1,
info->cb);
836 ok(
info->cb == 12,
"expected 12, got %lu\n",
info->cb);
838 ok(
info->iFolder == 0x1234,
"expected 0x1234, got %#x\n",
info->iFolder);
843 trace(
"mem_notify(%d,%p)\n", fdint,
info);
857 char name[] =
"extract.cab";
859 char memory_block[] =
"memory\\block";
860 char memory[] =
"memory\\";
861 char block[] =
"block";
872 ok(
ret,
"Failed to flush the cabinet\n");
889 "Expected ERROR_INVALID_HANDLE, got %ld\n",
GetLastError());
894 skip(
"Running on a root drive directory.\n");
915 ok(hfdi !=
NULL,
"FDICreate error %d\n",
erf.erfOper);
918 ok(
fd != -1,
"fdi_open failed\n");
922 ok(
ret,
"FDIIsCabinet error %d\n",
erf.erfOper);
923 ok(
info.cbCabinet == 0x59,
"expected 0x59, got %#lx\n",
info.cbCabinet);
924 ok(
info.cFiles == 1,
"expected 1, got %d\n",
info.cFiles);
925 ok(
info.cFolders == 1,
"expected 1, got %d\n",
info.cFolders);
926 ok(
info.setID == 0x1225,
"expected 0x1225, got %#x\n",
info.setID);
927 ok(
info.iCabinet == 0x2013,
"expected 0x2013, got %#x\n",
info.iCabinet);
932 ok(
ret,
"FDICopy error %d\n",
erf.erfOper);
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
#define mem_free(ptr, bsize)
HFDI __cdecl FDICreate(PFNALLOC pfnalloc, PFNFREE pfnfree, PFNOPEN pfnopen, PFNREAD pfnread, PFNWRITE pfnwrite, PFNCLOSE pfnclose, PFNSEEK pfnseek, int cpuType, PERF perf)
BOOL __cdecl FDIIsCabinet(HFDI hfdi, INT_PTR hf, PFDICABINETINFO pfdici)
BOOL __cdecl FDICopy(HFDI hfdi, char *pszCabinet, char *pszCabPath, int flags, PFNFDINOTIFY pfnfdin, PFNFDIDECRYPT pfnfdid, void *pvUser)
BOOL __cdecl FDIDestroy(HFDI hfdi)
static WCHAR available[MAX_STRING_RESOURCE_LEN]
#define INVALID_SET_FILE_POINTER
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define HeapFree(x, y, z)
#define ERROR_INVALID_HANDLE
#define FILE_ATTRIBUTE_NORMAL
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
BOOL WINAPI FileTimeToDosDateTime(IN CONST FILETIME *lpFileTime, OUT LPWORD lpFatDate, OUT LPWORD lpFatTime)
BOOL __cdecl FCIAddFile(HFCI hfci, char *pszSourceFile, char *pszFileName, BOOL fExecute, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis, PFNFCIGETOPENINFO pfnfcigoi, TCOMP typeCompress)
BOOL __cdecl FCIDestroy(HFCI hfci)
HFCI __cdecl FCICreate(PERF perf, PFNFCIFILEPLACED pfnfiledest, PFNFCIALLOC pfnalloc, PFNFCIFREE pfnfree, PFNFCIOPEN pfnopen, PFNFCIREAD pfnread, PFNFCIWRITE pfnwrite, PFNFCICLOSE pfnclose, PFNFCISEEK pfnseek, PFNFCIDELETE pfndelete, PFNFCIGETTEMPFILE pfnfcigtf, PCCAB pccab, void *pv)
BOOL __cdecl FCIFlushCabinet(HFCI hfci, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
int WINAPI lstrlenA(LPCSTR lpString)
double __cdecl erf(double)
#define memcpy(s1, s2, n)
#define FILE_FLAG_SEQUENTIAL_SCAN
static CHAR CURR_DIR[MAX_PATH]
static const struct @1778 cab_data
static UINT CDECL fdi_mem_read(INT_PTR hf, void *pv, UINT cb)
static int CDECL fdi_close_static(INT_PTR hf)
static INT_PTR CDECL fdi_open_static(char *pszFile, int oflag, int pmode)
static void test_FDIDestroy(void)
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
static void createTestFile(const CHAR *name)
static void delete_test_files(void)
static LONG CDECL fdi_seek_static(INT_PTR hf, LONG dist, int seektype)
static INT_PTR CDECL fdi_mem_notify(FDINOTIFICATIONTYPE fdint, FDINOTIFICATION *info)
static void test_FDICopy(void)
static INT_PTR CDECL fdi_mem_open(char *name, int oflag, int pmode)
UCHAR szName[sizeof("file.dat")]
static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
static void add_file(HFCI hfci, char *file)
static INT_PTR static_fdi_handle
static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
static void set_cab_parameters(PCCAB pCabParams)
static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
static UINT CDECL fdi_read(INT_PTR hf, void *pv, UINT cb)
static void create_test_files(void)
static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int *err, void *pv)
static LONG CDECL fdi_seek(INT_PTR hf, LONG dist, int seektype)
static int CDECL fdi_close(INT_PTR hf)
static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
static void *CDECL fdi_alloc_bad(ULONG cb)
static int CDECL fdi_mem_close(INT_PTR hf)
static void create_cab_file(void)
static void CDECL fdi_free(void *pv)
static int CDECL fci_delete(char *pszFile, int *err, void *pv)
static void test_FDIIsCabinet(void)
static UINT CDECL fdi_write(INT_PTR hf, void *pv, UINT cb)
static UINT CDECL fdi_mem_write(INT_PTR hf, void *pv, UINT cb)
static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
static void *CDECL fdi_alloc(ULONG cb)
static UINT CDECL fdi_read_static(INT_PTR hf, void *pv, UINT cb)
static void test_FDICreate(void)
static INT_PTR CDECL fdi_open(char *pszFile, int oflag, int pmode)
static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
static INT_PTR __cdecl CopyProgress(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
UCHAR ab[sizeof("Hello World!") -1]
static LONG CDECL fdi_mem_seek(INT_PTR hf, LONG dist, int seektype)
static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
static UINT CDECL fdi_write_static(INT_PTR hf, void *pv, UINT cb)
static HMODULE MODULEINFO DWORD cb
static char memory[1024 *256]
char szCabPath[CB_MAX_CAB_PATH]
char szCab[CB_MAX_CABINET_NAME]
#define INVALID_FILE_ATTRIBUTES
DWORD WINAPI GetLastError(void)
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
static unsigned int block