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

Diff for /group3/wine/dlls/cabinet/tests/cabinet_fdi.c between version 2.6 and 2.8

version 2.6, 2005/02/26 03:39:28 version 2.8, 2005/02/27 05:21:08
Line 44 
Line 44 
 #define todo_wine #define todo_wine
 #endif #endif
  
   #define TVFS
   
 #include <winerror.h> #include <winerror.h>
 #include <fdi.h> #include <fdi.h>
 #include <fcntl.h> #include <fcntl.h>
Line 129 
Line 131 
                         printf("  file name: %s\n",     pfdin->psz1);                         printf("  file name: %s\n",     pfdin->psz1);
                         sprintf(target, "./%s",pfdin->psz1);                         sprintf(target, "./%s",pfdin->psz1);
                         printf("%s\n",target);                         printf("%s\n",target);
   #ifdef TVFS
                                 fih = tvfs_open (target,                                 fih = tvfs_open (target,
                                         _O_BINARY | _O_CREAT | _O_WRONLY | _O_SEQUENTIAL,                                         _O_BINARY | _O_CREAT | _O_WRONLY | _O_SEQUENTIAL,
                                         _S_IREAD | _S_IWRITE                                         _S_IREAD | _S_IWRITE
                                                                 );                                                                 );
                         return fih;                         return fih;
   #else
                                   fih = real_open (target,
                                           _O_BINARY | _O_CREAT | _O_WRONLY | _O_SEQUENTIAL,
                                           _S_IREAD | _S_IWRITE
                                                                   );
                           return fih;
   #endif
                 }                 }
                 case fdintCLOSE_FILE_INFO:                 case fdintCLOSE_FILE_INFO:
                 {                 {
                           char filebuf[256];
                           int result;
   
   /*
           printf("Testing direct file compare and lseek of %s\n", name_simple_txt);
           printf("Reading and comparing file\n");
           result = tvfs_read(7, filebuf, size_simple_txt);
           result = tvfs_compare( filebuf , file_simple_txt, size_simple_txt);
  
                         printf("fdintCLOSE_FILE_INFO\n");  */
                         return 0;                         return 0;
                 }                 }
                 case fdintNEXT_CABINET:                 case fdintNEXT_CABINET:
Line 168 
Line 185 
                 cabinfo.hasprev ,                 cabinfo.hasprev ,
                 cabinfo.hasnext );                 cabinfo.hasnext );
 } }
   #ifndef TVFS
   FNREAD(real_read) {
           int szBuffer = _read(hf,pv,cb);
           printf("   FNREAD (read) just called with %d, %d, %d\n",hf, pv, cb);
           printf("   FNREAD (read) returning size (%d)\n",szBuffer);
           return szBuffer;
   }
   FNCLOSE(real_close) {
           int closevalue = _close(hf);
           printf("   FNCLOSE (real) just called with %d - returning %d\n",hf,closevalue);
           return closevalue;
   }
   
   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(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;
   }
   
   FNOPEN(real_open) {
           int handler = _open(pszFile,oflag,pmode);
           printf("   FNOPEN (real) just called with %s, %d, %d\n",pszFile, oflag, pmode);
           printf("   FNOPEN (real) returning handler (%d)\n",handler);
           return handler;
   }
   #endif
  
 static void CheckCabInfo(char *  cabname, static void CheckCabInfo(char *  cabname,
                                                  FDICABINETINFO cabinfo,                                                  FDICABINETINFO cabinfo,
Line 215 
Line 264 
         hfdi_unknown_tvfs = FDICreate(         hfdi_unknown_tvfs = FDICreate(
                 final_alloc,                 final_alloc,
                 final_free,                 final_free,
                 tvfs_open,  #ifdef TVFS
                 tvfs_read,                  tvfs_open, tvfs_read, tvfs_write, tvfs_close, tvfs_lseek,
                 tvfs_write,  #else
                 tvfs_close,                  real_open, real_read, real_write, real_close,real_seek,
                 tvfs_lseek,  #endif
                 cpuUNKNOWN,                 cpuUNKNOWN,
                 &error_structure                 &error_structure
         );         );
Line 229 
Line 278 
 } }
  
 static void TestInfo(void) { static void TestInfo(void) {
   #ifdef TVFS
         int fd;         int fd;
  
         FDICABINETINFO  fdi_cabinfo_dummy, fdi_cabinfo_simple, fdi_cabinfo_complex;         FDICABINETINFO  fdi_cabinfo_dummy, fdi_cabinfo_simple, fdi_cabinfo_complex;
Line 263 
Line 312 
                 CheckCabInfo("complex.cab",fdi_cabinfo_complex,12918,1,2,0,0,0,0,0);                 CheckCabInfo("complex.cab",fdi_cabinfo_complex,12918,1,2,0,0,0,0,0);
  
         tvfs_close(fd);         tvfs_close(fd);
           tvfs_free();
  
         printf("Ending TestInfo()\n");         printf("Ending TestInfo()\n");
         printf(" SEEK_CUR %d \n",SEEK_CUR);  #endif
 } }
  
 static void TestCopy(void){ static void TestCopy(void){
   
           char name_file_path[256];
           int result;
   
         printf("Starting TestCopy()\n");         printf("Starting TestCopy()\n");
         printf("---simple.cab\n");         printf("---simple.cab\n");
   #ifdef TVFS
           tvfs_create( name_simple_cab, file_simple_cab, size_simple_cab);
   #endif
         FDICopy(hfdi_unknown_tvfs,         FDICopy(hfdi_unknown_tvfs,
                         "simple.cab",                         "simple.cab",
                         "",                         "",
Line 279 
Line 336 
                         NULL,                         NULL,
                         NULL);                         NULL);
  
   #ifdef TVFS
           /* Filename when extracted is ./<filename> */
           sprintf(name_file_path, "./%s", name_simple_txt);
           result = tvfs_compare(name_file_path, file_simple_txt, size_simple_txt);
           if (result)
                   printf ("File compare failed!\n");
           tvfs_free();
   #endif
   
   
           printf("---complex.cab\n");
   #ifdef TVFS
           tvfs_create( name_complex_cab, file_complex_cab, size_complex_cab);
   #endif
           FDICopy(hfdi_unknown_tvfs,
                           "complex.cab",
                           "",
                           0,
                           notification_function,
                           NULL,
                           NULL);
   
   #ifdef TVFS
           /* Filename when extracted is ./<filename> */
           sprintf(name_file_path, "./%s", name_README);
           result = tvfs_compare(name_file_path, file_README, size_README);
           if (result)
                   printf ("File compare failed!\n");
           tvfs_free();
   #endif
   
   
   
         printf("Ending TestCopy()\n");         printf("Ending TestCopy()\n");
 } }
  


Legend:
Removed from v.2.6  
changed lines
  Added in v.2.8

Rizwan Kassim
Powered by
ViewCVS 0.9.2