1 rizwank 1.1 /*
2 * Unit test suite for cabinet.dll - FDI functions
3 *
4 * Copyright 2004 Rizwan Kassim, Dan Kegel
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
|
21 rizwank 2.3 #include <stdlib.h>
22 #include <string.h>
|
23 cs130_alex 2.2 #include <sys/stat.h>
|
24 rizwank 1.1
25 #ifndef STANDALONE
26 #include <wine/test.h>
27 #define ok2 ok
28 #else
29 /* To build outside Wine tree, compile with cl -DSTANDALONE -D_X86_ cabinet_fdi.c FDI.lib
30 These are only called if standalone are used, defining ok and START_TEST, which would normally be declared in winetree */
31 #include <assert.h>
32 #include <stdio.h>
33 #define START_TEST(name) main(int argc, char **argv)
34 #define ok(condition, msg) \
35 do { if(!(condition)) { \
36 fprintf(stderr,"failed at %d, msg:" msg "\n",__LINE__); \
37 exit(1); \
38 } } while(0)
39 #define ok2(condition, msg, arg) \
40 do { if(!(condition)) { \
41 fprintf(stderr,"failed at %d, msg:" msg "\n",__LINE__, arg); \
42 exit(1); \
43 } } while(0)
44 #define todo_wine
45 rizwank 1.1 #endif
46
47 #include <winerror.h>
48 #include <fdi.h>
|
49 rizwank 1.7 #include <fcntl.h>
|
50 rizwank 2.4 #include "cabinet_files.h"
|
51 rizwank 1.7
|
52 rizwank 1.8 /* Do malloc and free output debug messages?
53 #define DEBUG_ALLOC
54 */
|
55 rizwank 1.7
|
56 rizwank 2.4 /* What is our "Fake" Filedescriptors? */
57 static int fakeFD_simple = 22881;
58 static int fakeFD_complexzip2 = 22882;
59 static int fakeFD_complexlzw2 = 22883;
60 static int fakeFD_broken = 22884;
|
61 rizwank 1.7
|
62 rizwank 1.8 /*
|
63 rizwank 2.0 This hex data is the output of makecab.exe (Windows Cabinet SDK/bin)
64 ****** IS USING THE OUTPUT OF A NON LGPL program okay ******
|
65 rizwank 1.8
66 The cab file is mirrored in the file system as simple.cab
67
68 The 'test.txt' in the cab file contains the string 'So long, and thanks for all the fish.'
|
69 rizwank 2.4
70 The files in the "cabinet_files.h" were created with hexify.sh
|
71 rizwank 1.8 */
|
72 rizwank 2.0 /*
73 Multiple File Cabs are included, as cabinet.dll supports multiple file archive types.
74 The compressed file size had to be greater than 50k, cabarc restricts 'diskette spanning' to
75 archives above 50k.
76 The peculiar options were selected specifically to test cabinet.dll more throughly.
77
78 complex_lzw.cab cabarc -m LZX:16 -pr -i 32356 N complex_lzw.cab amontillado.txt lgpl.txt gpl.txt midsummer\*
79 complex_lzw2.cab cabarc -m LZX:17 -d 50000 -pr -i 32356 N complex_lzw*.cab amontillado.txt + lgpl.txt gpl.txt midsummer\*
|
80 rizwank 1.8
|
81 rizwank 2.0 complex_zip.cab cabarc -m MSZIP -pr -i 32356 N complex_lzw.cab amontillado.txt lgpl.txt gpl.txt midsummer\*
82 complex_zip2.cab cabarc -m MSZIP -d 50000 -pr -i 32356 N complex_zip*.cab amontillado.txt + lgpl.txt gpl.txt midsummer\*
|
83 rizwank 1.7
|
84 rizwank 2.0 complex_none.cab cabarc -m NONE -pr -i 32356 N complex_none.cab amontillado.txt midsummer\act1*
|
85 rizwank 1.1
|
86 rizwank 1.8 /*
87 To do in FDI: -from wine/include/fdi.h
|
88 rizwank 1.1 FDICreate
89 File Write -FNWRITE(hf, pv, cb)
90 File Seek -FNSEEK(hf,dist,seektype)
91 Error Structure
92 FDICopy
93 Notification function
94 Decryption function
95 FDIDestroy
96 */
97
|
98 rizwank 1.8 #ifndef DEBUG_ALLOC
99 FNALLOC(final_alloc) {
100 return malloc(cb);
101 }
102 FNFREE(final_free) {
103 free(pv);
104 return;
105 }
106 #else
107 FNALLOC(final_alloc) {
|
108 rizwank 1.5 printf(" FNALLOC just called with %d\n",cb);
109 return malloc(cb);
|
110 rizwank 1.3 }
|
111 rizwank 1.8 FNFREE(final_free) {
|
112 rizwank 1.5 printf(" FNFREE just called with %d\n",pv);
113 free(pv);
|
114 rizwank 1.3 return;
115 }
|
116 rizwank 1.8 #endif
117
|
118 rizwank 1.3
|
119 rizwank 1.5 /*
|
120 rizwank 1.7 Match i/o specs of _open, _read, _write, _close, and _lseek.
121 */
122
123 /*
|
124 rizwank 1.8 http://msdn.microsoft.com/library/en-us/vclib/html/_crt__open.2c_._wopen.asp
|
125 rizwank 1.7 _open I: const char *filename, int oflag, int pmode O: int (handler), -1 for err.
|
126 rizwank 1.8 DUMMY : FUNCTIONAL FAKE : FUNCTIONAL REAL : FUNCTIONAL
|
127 rizwank 1.5 */
128
|
129 rizwank 1.3 FNOPEN(dummy_open) {
|
130 rizwank 1.8 printf(" FNOPEN (dummy) just called with %d, %d, %d\n",pszFile, oflag, pmode);
|
131 rizwank 1.3 return 0;
132 }
133
|
134 rizwank 1.7 FNOPEN(fake_open) {
|
135 rizwank 2.4 printf(" FNOPEN (virtual) just called with %d, %d, %d\n",pszFile, oflag, pmode);
136 printf(" Returning %d as file descriptor\n",12);
|
137 rizwank 1.7 return 12;
138 }
139
140 FNOPEN(real_open) {
141 int handler = _open(pszFile,oflag,pmode);
142 printf(" FNOPEN (real) just called with %s, %d, %d\n",pszFile, oflag, pmode);
143 printf(" FNOPEN (real) returning handler (%d)\n",handler);
144 return handler;
145 }
146
147 /*
|
148 rizwank 1.8 http://msdn.microsoft.com/library/en-us/vclib/html/_CRT__read.asp
|
149 rizwank 1.7 _read I: int fd, void *buffer, unsigned int count O: int (szBuffer)
|
150 rizwank 1.8 DUMMY : FUNCTIONAL FAKE : FUNCTIONAL, INCOMPLETE REAL : FUNCTIONAL
|
151 rizwank 1.7 */
152
|
153 rizwank 1.3 FNREAD(dummy_read) {
|
154 rizwank 1.8 printf(" FNREAD (dummy) just called with %d, %d, %d\n",hf, pv, cb);
|
155 rizwank 1.5 return 0;
|
156 rizwank 1.3 }
|
157 rizwank 1.7
|
158 rizwank 1.8 /* Doesn't keep virtual file location pointer */
|
159 rizwank 1.7 FNREAD(fake_read) {
|
160 rizwank 2.4 printf(" FNREAD (virtual) just called with %d, %d, %d\n",hf, pv, cb);
161 switch (hf)
162 {
163 /* Const int doesnt count as constant for cases --- why? */
164 case 22881:
165 {
166 printf (" Called fake file descriptor %d (file_simple_cab),\n\tpopulating buffer and size (%d)\n",hf,cb);
167 memcpy (pv, file_simple_cab ,cb);
168 break;
169 }
170 case 22882:
171 {
172 printf (" Called fake file descriptor %d (file_complex_zip2_cab),\n\tpopulating buffer and size (%d)\n",hf,cb);
173 memcpy (pv, file_complex_zip2_cab ,cb);
174 break;
175 }
176 case 22883:
177 {
178 printf (" Called fake file descriptor %d (file_complex_lzw2_cab),\n\tpopulating buffer and size (%d)\n",hf,cb);
179 memcpy (pv, file_complex_lzw2_cab ,cb);
180 break;
181 rizwank 2.4 }
182 case 22884:
183 {
184 printf (" Called fake file descriptor %d (file_broken_cab),\n\tpopulating buffer and size (%d)\n",hf,cb);
185 memcpy (pv, file_broken_cab ,cb);
186 break;
187 }
188 default:
189 {
190 printf (" FNREAD (virtual) was called with the unknown file handler. Failed!\n",hf);
191 return -1;
192 }
|
193 rizwank 1.8 }
|
194 rizwank 2.4 printf(" Returning %d\n",cb);
|
195 rizwank 1.8 return cb;
|
196 rizwank 1.7 }
197
|
198 rizwank 2.4
|
199 rizwank 1.7 FNREAD(real_read) {
200 int szBuffer = _read(hf,pv,cb);
201 printf(" FNREAD (read) just called with %d, %d, %d\n",hf, pv, cb);
202 printf(" FNREAD (read) returning size (%d)\n",szBuffer);
203 return szBuffer;
204 }
205
|
206 rizwank 1.8 /*
207 http://msdn.microsoft.com/library/en-us/vclib/html/_CRT__close.asp
208 _close I: int fd O: int (0=success 1=failure)
209 DUMMY : FUNCTIONAL FAKE : FUNCTIONAL REAL : FUNCTIONAL
210 */
|
211 rizwank 1.7
|
212 rizwank 1.8 FNCLOSE(dummy_close) {
213 printf(" FNCLOSE (dummy) just called with %d - returning %d\n",hf,0);
|
214 rizwank 1.5 return 0;
|
215 rizwank 1.3 }
216
|
217 rizwank 1.8 FNCLOSE(fake_close) {
|
218 rizwank 2.4 printf(" FNCLOSE (virtual) just called with %d - returning %d\n",hf,0);
|
219 rizwank 1.8 return 0;
220 }
|
221 rizwank 1.3
|
222 rizwank 1.8 FNCLOSE(real_close) {
223 int closevalue = _close(hf);
224 printf(" FNCLOSE (real) just called with %d - returning %d\n",hf,closevalue);
225 return closevalue;
226 }
227
228
|
229 rizwank 2.0
230
231
|
232 rizwank 1.8 FNWRITE(dummy_write) {
233 printf(" FNWRITE just called with %d, %d, %d\n",hf, pv, cb);
|
234 rizwank 1.5 return 0;
|
235 rizwank 1.3 }
|
236 rizwank 1.1
|
237 cs130_alex 2.1 FNWRITE(real_write) {
238 int write_value = _write(hf, pv, cb);
239 printf(" FNWRITE just called with %d, %d, %d - returning %d\n",hf, pv, cb, write_value);
240 return write_value;
241 }
242
243
244
245
|
246 rizwank 1.3 FNSEEK(dummy_seek) {
|
247 rizwank 1.8 printf(" FNSEEK just called with %d, %d, %d\n",hf, dist, seektype);
|
248 rizwank 1.5 return 0;
|
249 rizwank 1.3 }
250
|
251 cs130_alex 2.1 FNSEEK(real_seek) {
252 long lseek_value = _lseek(hf, dist, seektype);
253 printf(" FNSEEK just called with %d, %d, %d - returning %d\n",hf, dist, seektype,lseek_value);
254 return lseek_value;
255 }
256
257
258
259
260
261 FNFDINOTIFY(dummy_notification){
262 printf(" FNFDINOTIFY just called with %d, %d \n",fdint,pfdin);
263 return 0;
264 }
265
|
266 rizwank 2.3 FNFDINOTIFY(notification_function)
267 {
268 printf(" FNFDINOTIFY real just called with %d, %d \n",fdint,pfdin);
269 switch (fdint)
270 {
271 case fdintCABINET_INFO:
272 {
273 printf("fdintCABINET_INFO\n");
274 return 0;
275 }
276 case fdintPARTIAL_FILE:
277 {
278 printf("dintPARTIAL_FILE\n");
279 return 0;
280 }
281 case fdintCOPY_FILE:
282 {
283 int fih = 0;
284 char target[256];
285
286 printf("fdintCOPY_FILE\n");
287 rizwank 2.3 printf(" file name: %s\n", pfdin->psz1);
288 sprintf(target, "./%s",pfdin->psz1);
289 printf("%s\n",target);
290
291 fih = real_open(
292 target,
293 _O_BINARY | _O_CREAT | _O_WRONLY | _O_SEQUENTIAL,
294 _S_IREAD | _S_IWRITE
295 );
296
297 return fih;
298 }
299
300
301 case fdintCLOSE_FILE_INFO:
302 {
303
304 printf("fdintCLOSE_FILE_INFO\n");
305 return 0;
306 }
307 case fdintNEXT_CABINET:
308 rizwank 2.3 {
309
310 printf("fdintNEXT_CABINET\n");
311 return 0;
312 }
313 case fdintENUMERATE:
314 {
315 printf("fdintENUMERATE\n");
316 return 0;
317 }
318 }
319 return 0;
320 }
|
321 cs130_alex 2.1
322
323
|
324 rizwank 2.3
325 static void printCabInfo(FDICABINETINFO cabinfo){
326 //printf("INSIDE PRINT CABINFO\n");
|
327 rizwank 2.4 printf(" Cabinet Data : cbC %d cF %d cFi %d si %d iC %d fr %d hp %d hn %d\n",
|
328 cs130_alex 2.1 cabinfo.cbCabinet,
329 cabinfo.cFolders ,
330 cabinfo.cFiles ,
331 cabinfo.setID,
332 cabinfo.iCabinet,
333 cabinfo.fReserve ,
334 cabinfo.hasprev ,
|
335 rizwank 2.3 cabinfo.hasnext );
|
336 cs130_alex 2.1 }
337
|
338 rizwank 2.4
|
339 cs130_alex 2.2 static void CheckCabInfo(char * cabname,
340 FDICABINETINFO cabinfo,
|
341 rizwank 2.3 long TcbCabinet,
342 USHORT TcFolders,
343 USHORT TcFiles,
344 USHORT TsetID,
345 USHORT TiCabinet,
346 BOOL TfReserve,
347 BOOL Thasprev,
348 BOOL Thasnext){
|
349 cs130_alex 2.2 ok2 ( cabinfo.cbCabinet == TcbCabinet, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
350 ok2 ( cabinfo.cFolders == TcFolders, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
351 ok2 ( cabinfo.cFiles == TcFiles, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
352 ok2 ( cabinfo.setID == TsetID, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
353 ok2 ( cabinfo.iCabinet == TiCabinet, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
354 ok2 ( cabinfo.fReserve == TfReserve, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
355 ok2 ( cabinfo.hasprev == Thasprev, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
|
356 rizwank 2.3 ok2 ( cabinfo.hasnext == Thasnext, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
|
357 cs130_alex 2.1 }
358
|
359 rizwank 2.4
360 /* Tried to enhance functionality with :
361
362
363 ok4 ( cabinfo.cbCabinet == TcbCabinet, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n\tExpected %d, got %d for cbCabinet\n", cabname, TcbCabinet, cabinfo.cbCabinet );
364 ok4 ( cabinfo.cFolders == TcFolders, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n\tExpected %d, got %d for cFolders\n", cabname,TcFolders,cabinfo.cFolders);
365 ok4 ( cabinfo.cFiles == TcFiles, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n\tExpected %d, got %d for cFiles\n", cabname,TcFiles,cabinfo.cFiles);
366 ok4 ( cabinfo.setID == TsetID, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n\tExpected %d, got %d for setID\n", cabname,TsetID.cabinfo.setID);
367 ok4 ( cabinfo.iCabinet == TiCabinet, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n\tExpected %d, got %d for iCabinet\n", cabname,TiCabinet,cabinfo.iCabinet);
368 ok4 ( cabinfo.fReserve == TfReserve, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n\tExpected %d, got %d for fReserve\n", cabname,TfReserve,cabinfo.fReserve);
369 ok4 ( cabinfo.hasprev == Thasprev, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n\tExpected %d, got %d for hasprev\n", cabname,Thasprev,cabinfo.hasprev );
370 ok4 ( cabinfo.hasnext == Thasnext, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n\tExpected %d, got %d for Thasnext\n", cabname,Thasnext,cabinfo.hasnext);
371 #define ok4(condition, msg, arg, arb, arc) \
372 do { if(!(condition)) { \
373 fprintf(stderr,"failed at %d, msg:" msg "\n",__LINE__, arg, arb, arc); \
374 exit(1); \
375 } } while(0)
376
377
378 But it didn't really work, and its too late to fix it for now */
|
379 cs130_alex 2.1
|
380 rizwank 2.0
381
|
382 rizwank 1.7 HFDI hfdi_unknown_dummy, hfdi_unknown_fake,hfdi_unknown_real;
|
383 rizwank 1.4 /* yes its global and ugly */
384
|
385 rizwank 2.0 /* Is CPU386 or Unknown more commonly used? */
|
386 rizwank 1.1
|
387 rizwank 1.4 static void TestCreate(void) {
388
389 ERF error_structure;
390
391 printf("Starting TestCreate()\n");
392
|
393 rizwank 1.7 hfdi_unknown_dummy = FDICreate(
|
394 rizwank 1.8 final_alloc,
395 final_free,
|
396 rizwank 1.5 dummy_open,
397 dummy_read,
398 dummy_write,
399 dummy_close,
400 dummy_seek,
401 cpuUNKNOWN,
402 &error_structure
403 );
|
404 rizwank 1.7 ok(hfdi_unknown_dummy != NULL,"FDICreate (CPU = unknown) (functions=dummy) failed!\n");
405
406 hfdi_unknown_fake = FDICreate(
|
407 rizwank 1.8 final_alloc,
408 final_free,
|
409 rizwank 1.7 fake_open,
410 fake_read,
411 dummy_write,
412 dummy_close,
413 dummy_seek,
414 cpuUNKNOWN,
415 &error_structure
416 );
417 ok(hfdi_unknown_fake != NULL,"FDICreate (CPU = unknown) (functions=fake) failed!\n");
418
419 hfdi_unknown_real = FDICreate(
|
420 rizwank 1.8 final_alloc,
421 final_free,
|
422 rizwank 1.7 real_open,
423 real_read,
|
424 cs130_alex 2.1 real_write,
|
425 rizwank 1.8 real_close,
|
426 cs130_alex 2.1 real_seek,
|
427 rizwank 1.7 cpuUNKNOWN,
428 &error_structure
429 );
430 ok(hfdi_unknown_real != NULL,"FDICreate (CPU = unknown) (functions=real) failed!\n");
431
432 printf("Ending TestCreate()\n");
433 }
434
|
435 cs130_alex 2.1
436
437
|
438 rizwank 1.7 static void TestInfo(void) {
|
439 rizwank 1.8 /* Noticed Behavior :
440 FDIIsCabinet does not open the file on its own, it requires a file open/close to be done externally.
441 WHY?
442 The only functions in HFDI that FDIIsCabinet directly accesses is FNREAD
443 Important cases to check :
444 If the filedescriptor == ERR, does it FAIL? (dummy_read)
445 If the filedescriptor == NOTCABINET, does it FAIL? (fake_read, real_read)
446 If the filedescriptor == CABINET, does it SUCCEED? (fake_read, real_read)
447 If the filedescriptor == CABINET, does it populate FDICABINETINFO? (fake_read, real_read)
448 */
449
|
450 rizwank 1.7 int realfd;
451 int sizer;
|
452 rizwank 1.8 FDICABINETINFO fdi_cabinfo_dummy, fdi_cabinfo_simple, fdi_cabinfo_complex;
|
453 rizwank 1.7
454 printf("Starting TestInfo()\n");
|
455 rizwank 1.8
456 /* TEST : ERR filehandle associated, dummy functions should return FALSE */
457 ok ( FDIIsCabinet( hfdi_unknown_dummy, -1, &fdi_cabinfo_dummy) == FALSE,
|
458 rizwank 1.7 "FDIIsCabinet (File = Error) failed!\n");
|
459 rizwank 1.8
460 /* TEST : Fake filehandle associated, memory manually copied, should return TRUE */
|
461 rizwank 2.4 ok ( FDIIsCabinet( hfdi_unknown_fake, fakeFD_simple, &fdi_cabinfo_simple) == TRUE,
462 "FDIIsCabinet (Virtual File = Cabinet) failed!\n");
|
463 rizwank 1.8
|
464 cs130_alex 2.2 CheckCabInfo("simple.cab",fdi_cabinfo_simple,117,1,1,12345,0,0,0,0);
|
465 rizwank 1.8
|
466 rizwank 2.4 /*
|
467 rizwank 2.0 Is it ok to reuse the same hfdi_unknown_real ? */
468
469 /* TEST : Opened filehandle associated, corrupted cab loaded, should return FALSE */
470 /* We can see that the Windows implementation only reads the first 36 bytes - what if we corrupted a CAB after 36 bytes?*/
471
|
472 rizwank 2.4
473 /* Testing broken cab - using virtual file reads */
474 ok ( FDIIsCabinet( hfdi_unknown_fake, fakeFD_broken, &fdi_cabinfo_simple) == FALSE,
475 "FDIIsCabinet (Virtual File = Bad-Cabinet) failed!\n");
476
|
477 rizwank 2.0 realfd = real_open( "cabinet_fdi.c" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0);
478
479 ok ( FDIIsCabinet( hfdi_unknown_real, realfd, &fdi_cabinfo_complex) == FALSE,
480 "FDIIsCabinet (File = Non-Cabinet) cabinet_fdi.c failed!\n");
481 real_close(realfd);
|
482 rizwank 2.4
|
483 rizwank 2.0
|
484 rizwank 2.4 CheckCabInfo("simple.cab",fdi_cabinfo_simple,117,1,1,12345,0,0,0,0);
485
|
486 rizwank 2.0
487 /* TEST : Opened filehandle associated, valid cab loaded, should return TRUE */
488 realfd = real_open( "complex_lzw.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0);
489
490 ok ( FDIIsCabinet( hfdi_unknown_real, realfd, &fdi_cabinfo_complex) == TRUE,
491 "FDIIsCabinet (File = Cabinet) complex_lzw.cab failed!\n");
492 real_close(realfd);
493
|
494 cs130_alex 2.1 printCabInfo(fdi_cabinfo_complex);
|
495 rizwank 2.0
496
|
497 rizwank 2.4 ok ( FDIIsCabinet( hfdi_unknown_fake, fakeFD_complexlzw2, &fdi_cabinfo_complex) == TRUE,
498 "FDIIsCabinet (Virtual File = Cabinet) complex_lzw2.cab failed!\n");
499
500 printCabInfo(fdi_cabinfo_complex);
501
502 CheckCabInfo("complex_lzw2",fdi_cabinfo_complex,3513,1,1,32356,1,0,1,0);
|
503 rizwank 2.0
504
|
505 rizwank 2.4
|
506 rizwank 2.0 realfd = real_open( "complex_zip.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0);
507
|
508 rizwank 1.8 ok ( FDIIsCabinet( hfdi_unknown_real, realfd, &fdi_cabinfo_complex) == TRUE,
|
509 rizwank 2.0 "FDIIsCabinet (File = Cabinet) complex_zip.cab failed!\n");
|
510 rizwank 1.8 real_close(realfd);
|
511 rizwank 1.7
|
512 cs130_alex 2.1 printCabInfo(fdi_cabinfo_complex);
|
513 rizwank 2.0
|
514 rizwank 2.4
515 ok ( FDIIsCabinet( hfdi_unknown_fake, fakeFD_complexzip2, &fdi_cabinfo_complex) == TRUE,
516 "FDIIsCabinet (Virtual File = Cabinet) complex_zip2.cab failed!\n");
517
518 printCabInfo(fdi_cabinfo_complex);
519
520 CheckCabInfo("complex_zip2",fdi_cabinfo_complex,6995,1,4,32356,1,0,1,0);
|
521 rizwank 2.0
522
523 realfd = real_open( "complex_none.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0);
524
525 ok ( FDIIsCabinet( hfdi_unknown_real, realfd, &fdi_cabinfo_complex) == TRUE,
526 "FDIIsCabinet (File = Cabinet) complex_zip.cab failed!\n");
527 real_close(realfd);
528
|
529 cs130_alex 2.1
530 printCabInfo(fdi_cabinfo_complex);
|
531 rizwank 2.0
|
532 rizwank 1.7
533 }
|
534 cs130_alex 2.1
|
535 rizwank 2.4 /* Peer cooment : really_shouldn't use relative paths in FDICopy call --- doing // doesn't work as a comment in C fyi
536 */
537
|
538 rizwank 2.3 static void TestCopy(void){
539 printf("Starting TestCopy()\n");
540 printf("---simple.cab\n");
541 FDICopy(hfdi_unknown_real,
542 "simple.cab",
543 "./",
544 //"C:\\cygwin\\home\\Administrator\\group3\\wine\\dlls\\cabinet\\tests\\",
545 0,
546 notification_function,
547 NULL,
548 NULL);
549 /*printf("---complex_none.cab\n");
550 FDICopy(hfdi_unknown_real,
551 "complex_none.cab",
552 "C:\\cygwin\\home\\Administrator\\group3\\wine\\dlls\\cabinet\\tests\\",
553 0,
554 notification_function,
555 NULL,
556 NULL);
557 printf("---complex_zip.cab\n");
558 FDICopy(hfdi_unknown_real,
559 rizwank 2.3 "complex_zip.cab",
560 "C:\\cygwin\\home\\Administrator\\group3\\wine\\dlls\\cabinet\\tests\\",
561 0,
562 notification_function,
563 NULL,
564 NULL);
565 printf("---complex_lzw.cab\n");
566 FDICopy(hfdi_unknown_real,
567 "complex_lzw.cab",
568 "C:\\cygwin\\home\\Administrator\\group3\\wine\\dlls\\cabinet\\tests\\",
569 0,
570 notification_function,
571 NULL,
572 NULL);
573 */
574
575 printf("Ending TestCopy()\n");
|
576 cs130_alex 2.1 }
577
|
578 rizwank 1.7
579 static void TestDestroy(void) {
580 printf("Starting TestDestroy()\n");
|
581 rizwank 2.0 /* Should return TRUE if given a valid hfdi, else FALSE (only due to context errors?) */
582
|
583 rizwank 1.7 ok(FDIDestroy(hfdi_unknown_dummy), "FDIDestroy (CPU = unknown) (functions=fake) failed!\n");
584 ok(FDIDestroy(hfdi_unknown_fake), "FDIDestroy (CPU = unknown) (functions=fake) failed!\n");
|
585 rizwank 2.0 ok(FDIDestroy(hfdi_unknown_real), "FDIDestroy (CPU = unknown) (functions=real) failed!\n");
|
586 rizwank 1.7 printf("Ending TestDestroy()\n");
|
587 rizwank 1.5
|
588 rizwank 1.4 }
|
589 rizwank 1.1
590 START_TEST(paths)
591 {
|
592 rizwank 1.4 TestCreate();
|
593 rizwank 1.7 TestInfo();
|
594 rizwank 1.2 TestCopy();
595 TestDestroy();
|
596 rizwank 1.1 }
|