(file) Return to cabinet_fdi.c CVS log (file) (dir) Up to [RizwankCVS] / group3 / wine / dlls / cabinet / tests

  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 cs130_alex 2.2 //#include <windows.h>
 22                #include <stdlib.h>
 23                #include <string.h>
 24                //#include <io.h>
 25                //#include <fcntl.h>
 26                //#include <dos.h>
 27                #include <sys/stat.h>
 28 rizwank    1.1 
 29                #ifndef STANDALONE
 30                #include <wine/test.h>
 31                #define ok2 ok
 32                #else
 33                /* To build outside Wine tree, compile with cl -DSTANDALONE -D_X86_ cabinet_fdi.c FDI.lib 
 34                  These are only called if standalone are used, defining ok and START_TEST, which would normally be declared in winetree */
 35                #include <assert.h> 
 36                #include <stdio.h>
 37                #define START_TEST(name) main(int argc, char **argv)
 38                #define ok(condition, msg)       \
 39                	do { if(!(condition)) {  \
 40                		fprintf(stderr,"failed at %d, msg:" msg "\n",__LINE__); \
 41                		exit(1);         \
 42                	} } while(0)
 43                #define ok2(condition, msg, arg) \
 44                        do { if(!(condition)) {  \
 45                		fprintf(stderr,"failed at %d, msg:" msg "\n",__LINE__, arg); \
 46                		exit(1);         \
 47                	} } while(0)
 48                #define todo_wine
 49 rizwank    1.1 #endif 
 50                
 51                #include <winerror.h>
 52                #include <fdi.h>
 53 rizwank    1.7 #include <fcntl.h>
 54                
 55 rizwank    1.8 /* Do malloc and free output debug messages? 
 56                #define DEBUG_ALLOC
 57                */
 58 rizwank    1.7 
 59 rizwank    1.8 /* What is our "Fake" Filedescriptor? */
 60                static int fakeFD = 22881;
 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                */
 70 rizwank    1.7 static unsigned char compressed_file[] = 
 71                   {0x4D,0x53,0x43,0x46,0x00,0x00,0x00,0x00,0x75,0x00,
 72                	0x00,0x00,0x00,0x00,0x00,0x00,0x2C,0x00,0x00,0x00,
 73                	0x00,0x00,0x00,0x00,0x03,0x01,0x01,0x00,0x01,0x00,
 74                	0x00,0x00,0x39,0x30,0x00,0x00,0x45,0x00,0x00,0x00,
 75                	0x01,0x00,0x01,0x00,0x26,0x00,0x00,0x00,0x00,0x00,
 76                	0x00,0x00,0x00,0x00,0x4A,0x32,0xB2,0xBE,0x20,0x00,
 77                	0x74,0x65,0x73,0x74,0x2E,0x74,0x78,0x74,0x00,0x9C,
 78                	0x74,0xD0,0x75,0x28,0x00,0x26,0x00,0x43,0x4B,0x0B,
 79                	0xCE,0x57,0xC8,0xC9,0xCF,0x4B,0xD7,0x51,0x48,0xCC,
 80                	0x4B,0x51,0x28,0xC9,0x48,0xCC,0xCB,0x2E,0x56,0x48,
 81                	0xCB,0x2F,0x52,0x48,0xCC,0xC9,0x01,0x72,0x53,0x15,
 82                	0xD2,0x32,0x8B,0x33,0xF4,0xB8,0x00};
 83                static int szcompressed_file = sizeof(compressed_file);
 84                
 85 rizwank    2.0 /*
 86                	Multiple File Cabs are included, as cabinet.dll supports multiple file archive types.
 87                	The compressed file size had to be greater than 50k, cabarc restricts 'diskette spanning' to 
 88                	  archives above 50k.
 89                	The peculiar options were selected specifically to test cabinet.dll more throughly.
 90                	
 91                	complex_lzw.cab  	cabarc -m LZX:16 -pr -i 32356 N complex_lzw.cab amontillado.txt lgpl.txt gpl.txt midsummer\*
 92                	complex_lzw2.cab 	cabarc -m LZX:17 -d 50000 -pr -i 32356 N complex_lzw*.cab amontillado.txt + lgpl.txt gpl.txt midsummer\*
 93 rizwank    1.8 
 94 rizwank    2.0 	complex_zip.cab  	cabarc -m MSZIP -pr -i 32356 N complex_lzw.cab amontillado.txt lgpl.txt gpl.txt midsummer\*
 95                	complex_zip2.cab 	cabarc -m MSZIP -d 50000 -pr -i 32356 N complex_zip*.cab amontillado.txt + lgpl.txt gpl.txt midsummer\*
 96 rizwank    1.7 
 97 rizwank    2.0 	complex_none.cab	cabarc -m NONE -pr -i 32356 N complex_none.cab amontillado.txt midsummer\act1*
 98 rizwank    1.1 
 99 rizwank    1.8 /*	
100                	To do in FDI:				-from wine/include/fdi.h
101 rizwank    1.1 	FDICreate
102                		File Write				-FNWRITE(hf, pv, cb)
103                		File Seek				-FNSEEK(hf,dist,seektype)
104                		Error Structure
105                	FDICopy
106                		Notification function
107                		Decryption function
108                	FDIDestroy
109                */
110                
111 rizwank    1.8 #ifndef DEBUG_ALLOC
112                FNALLOC(final_alloc) {
113                	return malloc(cb);
114                }
115                FNFREE(final_free) {
116                	free(pv);
117                	return;
118                }
119                #else
120                FNALLOC(final_alloc) {
121 rizwank    1.5  	printf("   FNALLOC just called with %d\n",cb);
122                	return malloc(cb);
123 rizwank    1.3 }
124 rizwank    1.8 FNFREE(final_free) {
125 rizwank    1.5 	printf("   FNFREE just called with %d\n",pv);
126                	free(pv);
127 rizwank    1.3 	return;
128                }
129 rizwank    1.8 #endif
130                
131 rizwank    1.3 
132 rizwank    1.5 /*
133 rizwank    1.7 	Match i/o specs of _open, _read, _write, _close, and _lseek.
134                */
135                
136                /*	
137 rizwank    1.8 	http://msdn.microsoft.com/library/en-us/vclib/html/_crt__open.2c_._wopen.asp
138 rizwank    1.7 	_open 		I: const char *filename, int oflag, int pmode	O: int (handler), -1 for err.
139 rizwank    1.8 	DUMMY  : FUNCTIONAL		FAKE : FUNCTIONAL 		REAL : FUNCTIONAL
140 rizwank    1.5 */
141                
142 rizwank    1.3 FNOPEN(dummy_open) {
143 rizwank    1.8 	printf("  FNOPEN (dummy) just called with %d, %d, %d\n",pszFile, oflag, pmode);
144 rizwank    1.3 	return 0;
145                }
146                
147 rizwank    1.7 FNOPEN(fake_open) {
148 rizwank    1.8 	printf("  FNOPEN (fake) just called with %d, %d, %d\n",pszFile, oflag, pmode);
149                	printf("  Returning %d as file descriptor\n",fakeFD);
150 rizwank    1.7 	return 12;
151                }
152                
153                FNOPEN(real_open) {
154                	int handler = _open(pszFile,oflag,pmode);
155                	printf("   FNOPEN (real) just called with %s, %d, %d\n",pszFile, oflag, pmode);
156                	printf("   FNOPEN (real) returning handler (%d)\n",handler);
157                	return handler;
158                }
159                
160                /*
161 rizwank    1.8 	http://msdn.microsoft.com/library/en-us/vclib/html/_CRT__read.asp	
162 rizwank    1.7 	_read		I: int fd, void *buffer, unsigned int count		O:	int (szBuffer)
163 rizwank    1.8 	DUMMY  : FUNCTIONAL		FAKE : FUNCTIONAL, INCOMPLETE		REAL : FUNCTIONAL
164 rizwank    1.7 */
165                
166 rizwank    1.3 FNREAD(dummy_read) {
167 rizwank    1.8 	printf("   FNREAD (dummy) just called with %d, %d, %d\n",hf, pv, cb);
168 rizwank    1.5 	return 0;
169 rizwank    1.3 }
170 rizwank    1.7 
171 rizwank    1.8 /* Doesn't keep virtual file location pointer */
172 rizwank    1.7 FNREAD(fake_read) {
173 rizwank    1.8 	printf("   FNREAD (fake) just called with %d, %d, %d\n",hf, pv, cb);
174                	if (hf == fakeFD) {
175                		printf ("   Called with fake file descriptor, populating buffer and size (%d)\n",cb);
176                		memcpy (pv, compressed_file ,cb);
177                		}
178                	else {
179                		printf ("   FNREAD (fake) was called with the unknown file handler. Failed!\n",hf);
180                	}
181                	return cb;
182 rizwank    1.7 }
183                
184                FNREAD(real_read) {
185                	int szBuffer = _read(hf,pv,cb);
186                	printf("   FNREAD (read) just called with %d, %d, %d\n",hf, pv, cb);
187                	printf("   FNREAD (read) returning size (%d)\n",szBuffer);
188                	return szBuffer;
189                }
190                
191 rizwank    1.8 /*
192                	http://msdn.microsoft.com/library/en-us/vclib/html/_CRT__close.asp
193                	_close		I: int fd   O:	int (0=success 1=failure)
194                	DUMMY  : FUNCTIONAL		FAKE : FUNCTIONAL 		REAL : FUNCTIONAL
195                */
196 rizwank    1.7 
197 rizwank    1.8 FNCLOSE(dummy_close) {
198                	printf("   FNCLOSE (dummy) just called with %d - returning %d\n",hf,0);	
199 rizwank    1.5 	return 0;
200 rizwank    1.3 }
201                
202 rizwank    1.8 FNCLOSE(fake_close) {
203                	printf("   FNCLOSE (fake) just called with %d - returning %d\n",hf,0);	
204                	return 0;
205                }
206 rizwank    1.3 
207 rizwank    1.8 FNCLOSE(real_close) {
208                	int closevalue = _close(hf);
209                	printf("   FNCLOSE (real) just called with %d - returning %d\n",hf,closevalue);	
210                	return closevalue;
211                }
212                
213                	
214 rizwank    2.0 
215                
216                
217 rizwank    1.8 FNWRITE(dummy_write) {
218                	printf("   FNWRITE just called with %d, %d, %d\n",hf, pv, cb);
219 rizwank    1.5 	return 0;
220 rizwank    1.3 }
221 rizwank    1.1 
222 cs130_alex 2.1 FNWRITE(real_write) {
223                	int write_value = _write(hf, pv, cb);
224                	printf("   FNWRITE just called with %d, %d, %d - returning %d\n",hf, pv, cb, write_value);
225                	return write_value;
226                }
227                
228                
229                
230                
231 rizwank    1.3 FNSEEK(dummy_seek) {
232 rizwank    1.8 	printf("   FNSEEK just called with %d, %d, %d\n",hf, dist, seektype);	
233 rizwank    1.5 	return 0;
234 rizwank    1.3 }
235                
236 cs130_alex 2.1 FNSEEK(real_seek) {
237                	long lseek_value = _lseek(hf, dist, seektype);
238                	printf("   FNSEEK just called with %d, %d, %d - returning %d\n",hf, dist, seektype,lseek_value);	
239                	return lseek_value;
240                }
241                
242                
243                
244                
245                
246                FNFDINOTIFY(dummy_notification){
247                	printf("   FNFDINOTIFY just called with %d, %d \n",fdint,pfdin);	
248                	return 0;
249                }
250                
251                FNFDINOTIFY(notification_function)
252                {
253 cs130_alex 2.2 	printf("   FNFDINOTIFY real just called with %d, %d \n",fdint,pfdin);	
254 cs130_alex 2.1 	switch (fdint)
255                	{
256                		case fdintCABINET_INFO: 
257 cs130_alex 2.2 		{
258 cs130_alex 2.1 			printf("fdintCABINET_INFO\n");
259                			return 0;
260 cs130_alex 2.2 		}
261 cs130_alex 2.1 		case fdintPARTIAL_FILE: 
262 cs130_alex 2.2 		{
263 cs130_alex 2.1 			printf("dintPARTIAL_FILE\n");	
264                			return 0;
265 cs130_alex 2.2 		}
266                		case fdintCOPY_FILE:
267                		{	
268                			int fih = 0;
269                			char target[256];
270 cs130_alex 2.1 
271                			printf("fdintCOPY_FILE\n");
272 cs130_alex 2.2 			printf("  file name: %s\n",	pfdin->psz1);
273                			sprintf(target, "./%s",pfdin->psz1);
274                			printf("%s\n",target);
275                
276                				fih = real_open(
277                					target,
278                					_O_BINARY | _O_CREAT | _O_WRONLY | _O_SEQUENTIAL,
279                					_S_IREAD | _S_IWRITE 
280                					);
281                
282                		        return fih;
283                		}	
284                						
285 cs130_alex 2.1 
286                		case fdintCLOSE_FILE_INFO:	
287 cs130_alex 2.2 		{
288                			
289 cs130_alex 2.1 			printf("fdintCLOSE_FILE_INFO\n");
290                			return 0;
291 cs130_alex 2.2 		}
292 cs130_alex 2.1 		case fdintNEXT_CABINET:	
293 cs130_alex 2.2 		{
294                	
295 cs130_alex 2.1 			printf("fdintNEXT_CABINET\n");
296                			return 0;
297 cs130_alex 2.2 		}
298                		case fdintENUMERATE:
299                		{
300                				printf("fdintENUMERATE\n");
301                				return 0;
302                		}
303 cs130_alex 2.1 	}
304                	return 0;
305                }
306                
307                
308                
309                
310                static void printCabInfo(FDICABINETINFO  cabinfo){
311                	//printf("INSIDE PRINT CABINFO\n");
312                		printf("Cabinet Data : cbC %d cF %d cFi %d si %d iC %d fr %b hp %d hn %d\n",
313                		cabinfo.cbCabinet,
314                		cabinfo.cFolders ,
315                		cabinfo.cFiles ,
316                		cabinfo.setID,
317                		cabinfo.iCabinet,
318                		cabinfo.fReserve ,
319                		cabinfo.hasprev ,
320                		cabinfo.hasnext );
321                }
322                
323 cs130_alex 2.2 static void CheckCabInfo(char *  cabname,
324                						 FDICABINETINFO cabinfo, 
325 cs130_alex 2.1 						 long        TcbCabinet,
326                						 USHORT      TcFolders,               
327                						 USHORT      TcFiles,                
328                						 USHORT      TsetID,             
329                						 USHORT      TiCabinet,             
330                						 BOOL        TfReserve,              
331                						 BOOL        Thasprev,               
332                						 BOOL        Thasnext){
333                
334 cs130_alex 2.2 							 ok2 ( cabinfo.cbCabinet == TcbCabinet, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
335                							 ok2 ( cabinfo.cFolders == TcFolders, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
336                							 ok2 ( cabinfo.cFiles == TcFiles, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
337                							 ok2 ( cabinfo.setID == TsetID, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
338                							 ok2 ( cabinfo.iCabinet == TiCabinet, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
339                							 ok2 ( cabinfo.fReserve == TfReserve, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
340                							 ok2 ( cabinfo.hasprev == Thasprev, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
341                							 ok2 ( cabinfo.hasnext == Thasnext, "FDIIsCabinet,cabinfo %s data did not match! Failed!\n", cabname);
342 cs130_alex 2.1 						}
343                
344                
345 rizwank    2.0 
346                
347 rizwank    1.7 HFDI hfdi_unknown_dummy, hfdi_unknown_fake,hfdi_unknown_real;
348 rizwank    1.4 /* yes its global and ugly */
349                
350 rizwank    2.0 /* Is CPU386 or Unknown more commonly used? */
351 rizwank    1.1 
352 rizwank    1.4 static void TestCreate(void) {
353                			
354                	ERF error_structure;
355                	
356                	printf("Starting TestCreate()\n");
357                	
358 rizwank    1.7 	hfdi_unknown_dummy = FDICreate(
359 rizwank    1.8 		final_alloc,
360                		final_free,
361 rizwank    1.5 		dummy_open,
362                		dummy_read,
363                		dummy_write,
364                		dummy_close,
365                		dummy_seek,
366                		cpuUNKNOWN,
367                		&error_structure
368                	);
369 rizwank    1.7 	ok(hfdi_unknown_dummy != NULL,"FDICreate (CPU = unknown) (functions=dummy) failed!\n");		
370                
371                	hfdi_unknown_fake = FDICreate(
372 rizwank    1.8 		final_alloc,
373                		final_free,
374 rizwank    1.7 		fake_open,
375                		fake_read,
376                		dummy_write,
377                		dummy_close,
378                		dummy_seek,
379                		cpuUNKNOWN,
380                		&error_structure
381                	);
382                	ok(hfdi_unknown_fake != NULL,"FDICreate (CPU = unknown) (functions=fake) failed!\n");		
383                
384                	hfdi_unknown_real = FDICreate(
385 rizwank    1.8 		final_alloc,
386                		final_free,
387 rizwank    1.7 		real_open,
388                		real_read,
389 cs130_alex 2.1 		real_write,
390 rizwank    1.8 		real_close,
391 cs130_alex 2.1 		real_seek,
392 rizwank    1.7 		cpuUNKNOWN,
393                		&error_structure
394                	);
395                	ok(hfdi_unknown_real != NULL,"FDICreate (CPU = unknown) (functions=real) failed!\n");		
396                		
397                	printf("Ending TestCreate()\n");		
398                }
399                
400 cs130_alex 2.1 
401                
402                
403 rizwank    1.7 static void TestInfo(void) {
404 rizwank    1.8 	/* Noticed Behavior :
405                		FDIIsCabinet does not open the file on its own, it requires a file open/close to be done externally.
406                			WHY?
407                		The only functions in HFDI that FDIIsCabinet directly accesses is FNREAD
408                		Important cases to check :
409                			If the filedescriptor == ERR, does it FAIL?							(dummy_read)
410                			If the filedescriptor == NOTCABINET, does it FAIL?					(fake_read, real_read)
411                			If the filedescriptor == CABINET, does it SUCCEED?					(fake_read, real_read)
412                			If the filedescriptor == CABINET, does it populate FDICABINETINFO?	(fake_read, real_read)
413                	*/
414                	
415 rizwank    1.7 	int realfd;
416                	int sizer;
417 rizwank    1.8 	FDICABINETINFO  fdi_cabinfo_dummy, fdi_cabinfo_simple, fdi_cabinfo_complex;
418 rizwank    1.7 	
419                	printf("Starting TestInfo()\n");
420 rizwank    1.8 
421                	/* TEST : ERR filehandle associated, dummy functions should return FALSE */
422                	ok ( FDIIsCabinet( hfdi_unknown_dummy, -1, &fdi_cabinfo_dummy) == FALSE,
423 rizwank    1.7 			"FDIIsCabinet (File = Error) failed!\n");	
424 rizwank    1.8 
425                	/* TEST : Fake filehandle associated, memory manually copied, should return TRUE */
426                	ok ( FDIIsCabinet( hfdi_unknown_fake, fakeFD, &fdi_cabinfo_simple) == TRUE,
427                			"FDIIsCabinet (FakeFile = Cabinet) failed!\n");
428                	
429 cs130_alex 2.2 		CheckCabInfo("simple.cab",fdi_cabinfo_simple,117,1,1,12345,0,0,0,0);
430 rizwank    1.8 		
431 rizwank    2.0 	/* simply this with macros?
432                	       yes, make one macro with inputs (cabname, testname, [expected values] ) --- using lambda notation
433                	   add checks for cabinfo data! 
434                	   Is it ok to reuse the same hfdi_unknown_real ? */
435                
436                	/* TEST : Opened filehandle associated, corrupted cab loaded, should return FALSE */
437                	/* We can see that the Windows implementation only reads the first 36 bytes - what if we corrupted a CAB after 36 bytes?*/
438                
439                	realfd = real_open( "broken.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0);
440                	
441                	ok ( FDIIsCabinet( hfdi_unknown_real, realfd, &fdi_cabinfo_complex) == FALSE,
442                			"FDIIsCabinet (File = Bad-Cabinet) broken.cab failed!\n");
443                	real_close(realfd);				
444                			
445                	realfd = real_open( "cabinet_fdi.c" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0);
446                	
447                	ok ( FDIIsCabinet( hfdi_unknown_real, realfd, &fdi_cabinfo_complex) == FALSE,
448                			"FDIIsCabinet (File = Non-Cabinet) cabinet_fdi.c failed!\n");
449                	real_close(realfd);	
450                	
451                	
452 rizwank    2.0 	/* TEST : Opened filehandle associated, valid cab loaded, should return TRUE */					
453                	realfd = real_open( "complex_lzw.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0);
454                	
455                	ok ( FDIIsCabinet( hfdi_unknown_real, realfd, &fdi_cabinfo_complex) == TRUE,
456                			"FDIIsCabinet (File = Cabinet) complex_lzw.cab failed!\n");
457                	real_close(realfd);
458                	
459 cs130_alex 2.1 	printCabInfo(fdi_cabinfo_complex);
460 rizwank    2.0 
461                	realfd = real_open( "complex_lzw2.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0);
462                	
463                	ok ( FDIIsCabinet( hfdi_unknown_real, realfd, &fdi_cabinfo_complex) == TRUE,
464                			"FDIIsCabinet (File = Cabinet) complex_lzw2.cab failed!\n");
465                	real_close(realfd);
466                	
467 cs130_alex 2.1 	printCabInfo(fdi_cabinfo_complex);
468 rizwank    2.0 
469                	realfd = real_open( "complex_zip.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0);
470                	
471 rizwank    1.8 	ok ( FDIIsCabinet( hfdi_unknown_real, realfd, &fdi_cabinfo_complex) == TRUE,
472 rizwank    2.0 			"FDIIsCabinet (File = Cabinet) complex_zip.cab failed!\n");
473 rizwank    1.8 	real_close(realfd);
474 rizwank    1.7 	
475 cs130_alex 2.1 	printCabInfo(fdi_cabinfo_complex);
476 rizwank    2.0 
477                	realfd = real_open( "complex_zip2.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0);
478                	
479                	ok ( FDIIsCabinet( hfdi_unknown_real, realfd, &fdi_cabinfo_complex) == TRUE,
480                			"FDIIsCabinet (File = Cabinet) complex_zip2.cab failed!\n");
481                	real_close(realfd);
482                	
483 cs130_alex 2.1 
484                	printCabInfo(fdi_cabinfo_complex);
485 rizwank    2.0 
486                	realfd = real_open( "complex_none.cab" , _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0);
487                	
488                	ok ( FDIIsCabinet( hfdi_unknown_real, realfd, &fdi_cabinfo_complex) == TRUE,
489                			"FDIIsCabinet (File = Cabinet) complex_zip.cab failed!\n");
490                	real_close(realfd);
491                	
492 cs130_alex 2.1 
493                	printCabInfo(fdi_cabinfo_complex);
494 rizwank    2.0 
495 rizwank    1.7 	
496                }
497 cs130_alex 2.1 
498                static void TestCopy(void){
499                	printf("Starting TestCopy()\n");
500                	printf("---simple.cab\n");
501                	FDICopy(hfdi_unknown_real,
502                			"simple.cab",
503 cs130_alex 2.2 			"./",
504                			//"C:\\cygwin\\home\\Administrator\\group3\\wine\\dlls\\cabinet\\tests\\",
505 cs130_alex 2.1 			0,
506                			notification_function,
507                			NULL,
508                			NULL);
509 cs130_alex 2.2 	/*printf("---complex_none.cab\n");
510 cs130_alex 2.1 	FDICopy(hfdi_unknown_real,
511                		"complex_none.cab",
512                		"C:\\cygwin\\home\\Administrator\\group3\\wine\\dlls\\cabinet\\tests\\",
513                		0,
514                		notification_function,
515                		NULL,
516                		NULL);
517                	printf("---complex_zip.cab\n");
518                    FDICopy(hfdi_unknown_real,
519                		"complex_zip.cab",
520                		"C:\\cygwin\\home\\Administrator\\group3\\wine\\dlls\\cabinet\\tests\\",
521                		0,
522                		notification_function,
523                		NULL,
524                		NULL);
525                	printf("---complex_lzw.cab\n");
526                	FDICopy(hfdi_unknown_real,
527                		"complex_lzw.cab",
528                		"C:\\cygwin\\home\\Administrator\\group3\\wine\\dlls\\cabinet\\tests\\",
529                		0,
530                		notification_function,
531 cs130_alex 2.1 		NULL,
532                		NULL);
533 cs130_alex 2.2 	*/
534 cs130_alex 2.1 
535                	printf("Ending TestCopy()\n");
536                }
537                
538 rizwank    1.7 		
539                static void TestDestroy(void) {
540                	printf("Starting TestDestroy()\n");
541 rizwank    2.0 		/* Should return TRUE if given a valid hfdi, else FALSE (only due to context errors?) */
542                									
543 rizwank    1.7 	ok(FDIDestroy(hfdi_unknown_dummy), "FDIDestroy (CPU = unknown) (functions=fake) failed!\n");
544                	ok(FDIDestroy(hfdi_unknown_fake), "FDIDestroy (CPU = unknown) (functions=fake) failed!\n");		
545 rizwank    2.0 	ok(FDIDestroy(hfdi_unknown_real), "FDIDestroy (CPU = unknown) (functions=real) failed!\n");	
546 rizwank    1.7 	printf("Ending TestDestroy()\n");
547 rizwank    1.5 		
548 rizwank    1.4 }
549 rizwank    1.1 
550                START_TEST(paths)
551                {
552 rizwank    1.4 	TestCreate();
553 rizwank    1.7 	TestInfo();
554 cs130_alex 2.1 	
555 rizwank    1.2 	TestCopy();
556 cs130_alex 2.1 	
557 rizwank    1.2 	TestDestroy();
558 rizwank    1.1 }

Rizwan Kassim
Powered by
ViewCVS 0.9.2