cabinet dll conformance test n.
Skip this Video
Download Presentation
Cabinet.dll Conformance Test

Loading in 2 Seconds...

play fullscreen
1 / 20

Cabinet.dll Conformance Test - PowerPoint PPT Presentation

  • Uploaded on

Cabinet.dll Conformance Test. Wine 3 Aleksandr Liber Rizwan Kassim. Purpose of the test. Check for functional equivalence of Microsoft and WINE implementations Not really focusing on finding bugs, but in verifying that the WINE version outputs exactly what the Microsoft version does.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Cabinet.dll Conformance Test' - danil

Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
cabinet dll conformance test

Cabinet.dll Conformance Test

Wine 3

Aleksandr Liber

Rizwan Kassim

purpose of the test
Purpose of the test
  • Check for functional equivalence of Microsoft and WINE implementations
  • Not really focusing on finding bugs, but in verifying that the WINE version outputs exactly what the Microsoft version does
what is a cabinet
What is a Cabinet?
  • Microsoft archive format
  • Used in the Windows installation, Microsoft installers, and ActiveX component downloads
  • Large Cab files can be split into groups of smaller ones and then combined back together
cabinet file format
Cabinet File Format
  • Each file is stored in a folder. A folder can have many files.
  • Files are compressed as a single unit for improved compression ratios
  • Random Access speed however is adversely affected.
  • Cabinet currently supports: MSZip and LXW compression
cabinet api
FCI (File Compression Interface)

FCICreate - Create an FCI context.

FCIAddFile - Add a file to the cabinet being created.

FCIFlushCabinet - Complete the cabinet.

FCIFlushFolder - Complete the folder and begin a new one.

FCIDestroy - Destroy the FCI context.

FDI (File Decompression Interface

FDICreate - Create an FDI context.

FDIIsCabinet – Check whether or not a file is a cabinet, if it is the function returns information about it.

FDICopy - Extract files from the cabinet.

FDIDestroy – Destroy the FDI context.

Cabinet API
callback functions
Callback Functions
  • The API makes extensive use of callback functions
  • Most are for memory management and file I/O.
  • Others: Notify, Decrypt
cabinet api in wine
Cabinet API in WINE
  • FCI not implemented since the majority of operations are done with extraction
  • FDI appears to be fully implemented.
  • So our decision was to focus on FDI
patch description
Patch Description

Wine cabinet.dll FDI Conformance Test PatchRaw files available at : patch adds tests for the cabinet dll, specifically testing thefunctions FDICreate, FDIDestroy, FDICopy and FDIIsCabinet. As theFCI functions are still marked *FIXME* in wine, they haven't been tested.The package is self containing, allowing additional cabinetfeatures to be tested by preparing other cabinets in the same mannerthat ours were.  A patch of -p1 will be needed.This patch has been successfully applied to the wine tree and ran.

files included
Files Included
  • Modified and
  • cabinet_fdi.c - the actual code of the test for FDI
  • data.h - cabinet files and files used to make then stored in hex using C arrays
  • - shell script that can recreate data.h, useful for expansions to the test
  • tvfs.h - Our virtual file system interface
  • tvfs.c - Implementation of the above
  • - Perl script that does the actual translation of a binary file to an array of hexadecimal values and creates C code out of it.
running of the test
Running of the Test
  • TestCreate()
    • Tests creation of an FDI context
    • Just uses allocation functions
  • TestInfo()
    • “Creates”, opens and reads it. Checks CABINFO struct. Repeat for
  • TestCopy()
    • “Creates”, open, reads it. Enumerates files in cabinet and prints list. Extracts all files in cabinet to virtual file system and byte-compares them with reference. Repeat for complex.
  • TestDestroy()
    • Destroys FDI context
    • Only fails if its pointed to a non context
compilation options
Compilation Options
  • To build outside Wine tree, compile with cl -DSTANDALONE -D_X86_ tvfs.c cabinet_fdi.c FDI.lib
  • For verbose output in the test, compile with -DVERBOSE
  • To enable debugging output in the virtual file system use -DTVFS_DEBUG
virtual file system
Virtual File System
  • TVFS-trivial virtual file system
  • Provides virtual versions of the file system calls needed by FDI: open, read, write, lseek, close.
  • Each returns the same return values as the corresponding _open, _read, _write, _lseek, _close calls in Win32
  • Functions for creating whole files from binary arrays, and comparing whole files to binary arrays as a testing aid
  • Allows debugging insertion of various errors, “Disk Full” “Access Denied” “CRC Error”
virtual file system structure
Virtual File System Structure
  • Two arrays of structs, “files” and “handlers”
  • tvfs_create creates a “file” with a specific name, size and content
  • tvfs_open checks for existing file and assigns a handler
  • tvfs_free performs bookkeeping, freeing dynamically associated memory.
cabinet file generation
Cabinet File Generation
  • data.h is generated using the genfiles shell script.
  • This allow for easy addition of new cab files to the test.
  • It uses cabarc.exe to create the cabinet files, and then uses to convert the file into a hexadecimal C array
snippets of genfiles sh
Snippets of
  • set -ex
  • test -f cabsdk.exe || wget -c
  • mkdir cabsdk; cd cabsdk
  • unzip ../cabsdk.exe ; cd ..
  • chmod 744 cabsdk/BIN/CABARC.EXE
  • # Simple archive, just one 42 byte file
  • echo > simple.txt
  • wine cabsdk/BIN/CABARC.EXE N simple.txt
  • # More complicated archive, with two files
  • cp ../../../README README
  • cp ../../../COPYING.LIB lgpl.txt
  • wine cabsdk/BIN/CABARC.EXE N README lgpl.txt
  • # Pack source files and archives into hex arrays
  • perl ../../../tools/ simple.txt README lgpl.txt > data.h
sample data h
Sample data.h
  • const static char name_simple_txt[] = "simple.txt";
  • const static char file_simple_txt[] = {0x53, 0x6f, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x61, 0x6e, 0x6b, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x73, 0x68, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x0a};
  • const static int size_simple_txt = sizeof(file_simple_txt);
  • 'So long, and thanks for all the fish.....'
current tests
Current Tests
  • – contains a single text file whose contents are “So long and thanks for all the fish….”
  • – a larger cabinet consisting of two text files, the wine README and lgpl.txt. (Previous versions compressed “A Midsummer’s Nights Dream”)
further plans
Further Plans
  • Current patch size with
    • 300k. (“Too big” – AJ)
    • Data.h representation bloats filesize x5
  • Implement programmatic series to generate data
    • Rand() with given srand
    • Fibonacci series % 255
    • Use this data as the ‘raw uncompressed data’
    • Data.h will just contain the compressed cabinet
  • Add features to tvfs
    • “Disk full”, etc notifications via ENOENT.
    • Directory structure?
further information
Further Information
  • Wiki
  • CVS