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 %lx\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 %lx\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");
460 BOOL fContinuation,
void *pv)
469 DWORD dwShareMode = 0;
482 dwCreateDisposition, 0,
NULL);
496 ok(
res,
"Failed to ReadFile\n");
508 ok(
res,
"Failed to WriteFile\n");
535 ok(
ret,
"Failed to DeleteFile %s\n", pszFile);
547 if (tempname && (
strlen(tempname) < (
unsigned)cbTempName))
574 ok(
res,
"Expected GetFileInformationByHandle to succeed\n");
599 ok(
res,
"Expected FCIAddFile to succeed\n");
608 pCabParams->
setID = 0xbeef;
619 static CHAR a_txt[] =
"a.txt",
621 testdir_c_txt[] =
"testdir\\c.txt",
622 testdir_d_txt[] =
"testdir\\d.txt";
631 ok(hfci !=
NULL,
"Failed to create an FCI context\n");
639 ok(
res,
"Failed to flush the cabinet\n");
642 ok(
res,
"Failed to destroy the cabinet\n");
652 char temp[] =
"temp.txt";
653 char extract[] =
"extract.cab";
661 ok(hfdi !=
NULL,
"Expected non-NULL context\n");
671 "Expected ERROR_INVALID_HANDLE, got %d\n",
GetLastError());
676 ok(cabinfo.
setID == 0,
"Expected 0, got %d\n", cabinfo.
setID);
691 ok(cabinfo.
setID == 0,
"Expected 0, got %d\n", cabinfo.
setID);
705 ok(cabinfo.
setID == 0xbeef,
"Expected 0xbeef, got %d\n", cabinfo.
setID);
715 ok(hfdi !=
NULL,
"Expected non-NULL context\n");
726 ok(cabinfo.
setID == 0xbeef,
"Expected 0xbeef, got %d\n", cabinfo.
setID);
744 static const char expected[] =
"memory\\block";
748 ok(oflag ==
_O_BINARY,
"expected _O_BINARY, got %x\n", oflag);
752 if (!
data)
return -1;
758 trace(
"mem_open(%s,%x,%x) => %p\n",
name, oflag, pmode,
data);
771 data->pos += cb_read;
779 static const char expected[] =
"Hello World!";
781 trace(
"mem_write(%#lx,%p,%u)\n", hf, pv,
cb);
783 ok(hf == 0x12345678,
"expected 0x12345678, got %#lx\n", hf);
784 ok(
cb == 12,
"expected 12, got %u\n",
cb);
812 ok(0,
"seek: not expected type %d\n", seektype);
825 static const char expected[9] =
"file.dat\0";
830 trace(
"mem_notify: CLOSE_FILE_INFO %s, handle %#lx\n",
info->psz1,
info->hf);
833 ok(
info->date == 0x1225,
"expected 0x1225, got %#x\n",
info->date);
834 ok(
info->time == 0x2013,
"expected 0x2013, got %#x\n",
info->time);
835 ok(
info->attribs == 0xa114,
"expected 0xa114, got %#x\n",
info->attribs);
836 ok(
info->iFolder == 0x1234,
"expected 0x1234, got %#x\n",
info->iFolder);
841 trace(
"mem_notify: COPY_FILE %s, %d bytes\n",
info->psz1,
info->cb);
843 ok(
info->cb == 12,
"expected 12, got %u\n",
info->cb);
845 ok(
info->iFolder == 0x1234,
"expected 0x1234, got %#x\n",
info->iFolder);
850 trace(
"mem_notify(%d,%p)\n", fdint,
info);
864 char name[] =
"extract.cab";
866 char memory_block[] =
"memory\\block";
867 char memory[] =
"memory\\";
868 char block[] =
"block";
879 ok(
ret,
"Failed to flush the cabinet\n");
896 "Expected ERROR_INVALID_HANDLE, got %d\n",
GetLastError());
901 skip(
"Running on a root drive directory.\n");
922 ok(hfdi !=
NULL,
"FDICreate error %d\n",
erf.erfOper);
925 ok(
fd != -1,
"fdi_open failed\n");
929 ok(
ret,
"FDIIsCabinet error %d\n",
erf.erfOper);
930 ok(
info.cbCabinet == 0x59,
"expected 0x59, got %#x\n",
info.cbCabinet);
931 ok(
info.cFiles == 1,
"expected 1, got %d\n",
info.cFiles);
932 ok(
info.cFolders == 1,
"expected 1, got %d\n",
info.cFolders);
933 ok(
info.setID == 0x1225,
"expected 0x1225, got %#x\n",
info.setID);
934 ok(
info.iCabinet == 0x2013,
"expected 0x2013, got %#x\n",
info.iCabinet);
939 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 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 const struct @1645 cab_data
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