version 2.0, 2005/02/11 10:54:42
|
version 2.1, 2005/02/15 02:07:20
|
|
|
return 0; | return 0; |
} | } |
| |
|
FNWRITE(real_write) { |
|
int write_value = _write(hf, pv, cb); |
|
printf(" FNWRITE just called with %d, %d, %d - returning %d\n",hf, pv, cb, write_value); |
|
return write_value; |
|
} |
|
|
|
|
|
|
|
|
FNSEEK(dummy_seek) { | FNSEEK(dummy_seek) { |
printf(" FNSEEK just called with %d, %d, %d\n",hf, dist, seektype); | printf(" FNSEEK just called with %d, %d, %d\n",hf, dist, seektype); |
return 0; | return 0; |
} | } |
| |
|
FNSEEK(real_seek) { |
|
long lseek_value = _lseek(hf, dist, seektype); |
|
printf(" FNSEEK just called with %d, %d, %d - returning %d\n",hf, dist, seektype,lseek_value); |
|
return lseek_value; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
FNFDINOTIFY(dummy_notification){ |
|
printf(" FNFDINOTIFY just called with %d, %d \n",fdint,pfdin); |
|
return 0; |
|
} |
|
|
|
FNFDINOTIFY(notification_function) |
|
{ |
|
printf(" FNFDINOTIFY just called with %d, %d \n",fdint,pfdin); |
|
switch (fdint) |
|
{ |
|
case fdintCABINET_INFO: |
|
printf("fdintCABINET_INFO\n"); |
|
return 0; |
|
|
|
case fdintPARTIAL_FILE: |
|
printf("dintPARTIAL_FILE\n"); |
|
return 0; |
|
|
|
case fdintCOPY_FILE: |
|
printf("fdintCOPY_FILE\n"); |
|
return 0; |
|
|
|
case fdintCLOSE_FILE_INFO: |
|
printf("fdintCLOSE_FILE_INFO\n"); |
|
return 0; |
|
|
|
case fdintNEXT_CABINET: |
|
printf("fdintNEXT_CABINET\n"); |
|
return 0; |
|
} |
|
return 0; |
|
} |
|
|
|
|
|
|
|
|
|
static void printCabInfo(FDICABINETINFO cabinfo){ |
|
//printf("INSIDE PRINT CABINFO\n"); |
|
printf("Cabinet Data : cbC %d cF %d cFi %d si %d iC %d fr %b hp %d hn %d\n", |
|
cabinfo.cbCabinet, |
|
cabinfo.cFolders , |
|
cabinfo.cFiles , |
|
cabinfo.setID, |
|
cabinfo.iCabinet, |
|
cabinfo.fReserve , |
|
cabinfo.hasprev , |
|
cabinfo.hasnext ); |
|
} |
|
|
|
static void CheckCabInfo(FDICABINETINFO cabinfo, |
|
long TcbCabinet, |
|
USHORT TcFolders, |
|
USHORT TcFiles, |
|
USHORT TsetID, |
|
USHORT TiCabinet, |
|
BOOL TfReserve, |
|
BOOL Thasprev, |
|
BOOL Thasnext){ |
|
|
|
ok ( cabinfo.cbCabinet == TcbCabinet, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
ok ( cabinfo.cFolders == TcFolders, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
ok ( cabinfo.cFiles == TcFiles, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
ok ( cabinfo.setID == TsetID, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
ok ( cabinfo.iCabinet == TiCabinet, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
ok ( cabinfo.fReserve == TfReserve, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
ok ( cabinfo.hasprev == Thasprev, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
ok ( cabinfo.hasnext == Thasnext, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
} |
|
|
|
|
| |
| |
HFDI hfdi_unknown_dummy, hfdi_unknown_fake,hfdi_unknown_real; | HFDI hfdi_unknown_dummy, hfdi_unknown_fake,hfdi_unknown_real; |
|
|
final_free, | final_free, |
real_open, | real_open, |
real_read, | real_read, |
dummy_write, |
real_write, |
real_close, | real_close, |
dummy_seek, |
real_seek, |
cpuUNKNOWN, | cpuUNKNOWN, |
&error_structure | &error_structure |
); | ); |
|
|
printf("Ending TestCreate()\n"); | printf("Ending TestCreate()\n"); |
} | } |
| |
|
|
|
|
|
|
static void TestInfo(void) { | static void TestInfo(void) { |
/* Noticed Behavior : | /* Noticed Behavior : |
FDIIsCabinet does not open the file on its own, it requires a file open/close to be done externally. | FDIIsCabinet does not open the file on its own, it requires a file open/close to be done externally. |
|
|
ok ( FDIIsCabinet( hfdi_unknown_fake, fakeFD, &fdi_cabinfo_simple) == TRUE, | ok ( FDIIsCabinet( hfdi_unknown_fake, fakeFD, &fdi_cabinfo_simple) == TRUE, |
"FDIIsCabinet (FakeFile = Cabinet) failed!\n"); | "FDIIsCabinet (FakeFile = Cabinet) failed!\n"); |
| |
ok ( fdi_cabinfo_simple.cbCabinet == 117, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
CheckCabInfo(fdi_cabinfo_simple,117,1,1,12345,0,0,0,0); |
ok ( fdi_cabinfo_simple.cFolders == 1, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
ok ( fdi_cabinfo_simple.cFiles == 1, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
ok ( fdi_cabinfo_simple.setID == 12345, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
ok ( fdi_cabinfo_simple.iCabinet == 0, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
ok ( fdi_cabinfo_simple.fReserve == 0, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
ok ( fdi_cabinfo_simple.hasprev == 0, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
ok ( fdi_cabinfo_simple.hasnext == 0, "FDIIsCabinet,cabinfo (FakeFile = Cabinet) data did not match! Failed!\n"); |
|
|
|
| |
/* simply this with macros? | /* simply this with macros? |
yes, make one macro with inputs (cabname, testname, [expected values] ) --- using lambda notation | yes, make one macro with inputs (cabname, testname, [expected values] ) --- using lambda notation |
|
|
"FDIIsCabinet (File = Cabinet) complex_lzw.cab failed!\n"); | "FDIIsCabinet (File = Cabinet) complex_lzw.cab failed!\n"); |
real_close(realfd); | real_close(realfd); |
| |
printf("Cabinet Data : cbC %d cF %d cFi %d si %d iC %d fr %b hp %d hn %d\n", |
printCabInfo(fdi_cabinfo_complex); |
fdi_cabinfo_complex.cbCabinet, |
|
fdi_cabinfo_complex.cFolders , |
|
fdi_cabinfo_complex.cFiles , |
|
fdi_cabinfo_complex.setID, |
|
fdi_cabinfo_complex.iCabinet, |
|
fdi_cabinfo_complex.fReserve , |
|
fdi_cabinfo_complex.hasprev , |
|
fdi_cabinfo_complex.hasnext ); |
|
| |
realfd = real_open( "complex_lzw2.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0); | realfd = real_open( "complex_lzw2.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0); |
| |
|
|
"FDIIsCabinet (File = Cabinet) complex_lzw2.cab failed!\n"); | "FDIIsCabinet (File = Cabinet) complex_lzw2.cab failed!\n"); |
real_close(realfd); | real_close(realfd); |
| |
printf("Cabinet Data : cbC %d cF %d cFi %d si %d iC %d fr %b hp %d hn %d\n", |
printCabInfo(fdi_cabinfo_complex); |
fdi_cabinfo_complex.cbCabinet, |
|
fdi_cabinfo_complex.cFolders , |
|
fdi_cabinfo_complex.cFiles , |
|
fdi_cabinfo_complex.setID, |
|
fdi_cabinfo_complex.iCabinet, |
|
fdi_cabinfo_complex.fReserve , |
|
fdi_cabinfo_complex.hasprev , |
|
fdi_cabinfo_complex.hasnext ); |
|
| |
realfd = real_open( "complex_zip.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0); | realfd = real_open( "complex_zip.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0); |
| |
|
|
"FDIIsCabinet (File = Cabinet) complex_zip.cab failed!\n"); | "FDIIsCabinet (File = Cabinet) complex_zip.cab failed!\n"); |
real_close(realfd); | real_close(realfd); |
| |
printf("Cabinet Data : cbC %d cF %d cFi %d si %d iC %d fr %b hp %d hn %d\n", |
printCabInfo(fdi_cabinfo_complex); |
fdi_cabinfo_complex.cbCabinet, |
|
fdi_cabinfo_complex.cFolders , |
|
fdi_cabinfo_complex.cFiles , |
|
fdi_cabinfo_complex.setID, |
|
fdi_cabinfo_complex.iCabinet, |
|
fdi_cabinfo_complex.fReserve , |
|
fdi_cabinfo_complex.hasprev , |
|
fdi_cabinfo_complex.hasnext ); |
|
| |
realfd = real_open( "complex_zip2.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0); | realfd = real_open( "complex_zip2.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0); |
| |
|
|
"FDIIsCabinet (File = Cabinet) complex_zip2.cab failed!\n"); | "FDIIsCabinet (File = Cabinet) complex_zip2.cab failed!\n"); |
real_close(realfd); | real_close(realfd); |
| |
printf("Cabinet Data : cbC %d cF %d cFi %d si %d iC %d fr %b hp %d hn %d\n", |
|
fdi_cabinfo_complex.cbCabinet, |
printCabInfo(fdi_cabinfo_complex); |
fdi_cabinfo_complex.cFolders , |
|
fdi_cabinfo_complex.cFiles , |
|
fdi_cabinfo_complex.setID, |
|
fdi_cabinfo_complex.iCabinet, |
|
fdi_cabinfo_complex.fReserve , |
|
fdi_cabinfo_complex.hasprev , |
|
fdi_cabinfo_complex.hasnext ); |
|
| |
realfd = real_open( "complex_none.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0); | realfd = real_open( "complex_none.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0); |
| |
|
|
"FDIIsCabinet (File = Cabinet) complex_zip.cab failed!\n"); | "FDIIsCabinet (File = Cabinet) complex_zip.cab failed!\n"); |
real_close(realfd); | real_close(realfd); |
| |
printf("Cabinet Data : cbC %d cF %d cFi %d si %d iC %d fr %b hp %d hn %d\n", |
|
fdi_cabinfo_complex.cbCabinet, |
|
fdi_cabinfo_complex.cFolders , |
|
fdi_cabinfo_complex.cFiles , |
|
fdi_cabinfo_complex.setID, |
|
fdi_cabinfo_complex.iCabinet, |
|
fdi_cabinfo_complex.fReserve , |
|
fdi_cabinfo_complex.hasprev , |
|
fdi_cabinfo_complex.hasnext ); |
|
| |
|
printCabInfo(fdi_cabinfo_complex); |
|
|
|
|
|
} |
|
|
|
static void TestCopy(void){ |
|
printf("Starting TestCopy()\n"); |
|
printf("---simple.cab\n"); |
|
FDICopy(hfdi_unknown_real, |
|
"simple.cab", |
|
"C:\\cygwin\\home\\Administrator\\group3\\wine\\dlls\\cabinet\\tests\\", |
|
0, |
|
notification_function, |
|
NULL, |
|
NULL); |
|
printf("---complex_none.cab\n"); |
|
FDICopy(hfdi_unknown_real, |
|
"complex_none.cab", |
|
"C:\\cygwin\\home\\Administrator\\group3\\wine\\dlls\\cabinet\\tests\\", |
|
0, |
|
notification_function, |
|
NULL, |
|
NULL); |
|
printf("---complex_zip.cab\n"); |
|
FDICopy(hfdi_unknown_real, |
|
"complex_zip.cab", |
|
"C:\\cygwin\\home\\Administrator\\group3\\wine\\dlls\\cabinet\\tests\\", |
|
0, |
|
notification_function, |
|
NULL, |
|
NULL); |
|
printf("---complex_lzw.cab\n"); |
|
FDICopy(hfdi_unknown_real, |
|
"complex_lzw.cab", |
|
"C:\\cygwin\\home\\Administrator\\group3\\wine\\dlls\\cabinet\\tests\\", |
|
0, |
|
notification_function, |
|
NULL, |
|
NULL); |
| |
|
|
|
printf("Ending TestCopy()\n"); |
} | } |
| |
|
|
static void TestDestroy(void) { | static void TestDestroy(void) { |
printf("Starting TestDestroy()\n"); | printf("Starting TestDestroy()\n"); |
/* Should return TRUE if given a valid hfdi, else FALSE (only due to context errors?) */ | /* Should return TRUE if given a valid hfdi, else FALSE (only due to context errors?) */ |
|
|
{ | { |
TestCreate(); | TestCreate(); |
TestInfo(); | TestInfo(); |
/* |
|
TestCopy(); | TestCopy(); |
*/ |
|
TestDestroy(); | TestDestroy(); |
} | } |