Cabinet dll conformance test
This presentation is the property of its rightful owner.
Sponsored Links
1 / 20

Cabinet.dll Conformance Test PowerPoint PPT Presentation


  • 95 Views
  • Uploaded on
  • Presentation posted in: General

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.

Download Presentation

Cabinet.dll Conformance Test

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 :http://www.geekymedia.com/viewcvs/cgi/viewcvs.cgi/group3/wine/This 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 Makefile.in(s) and configure.ac

  • 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

  • genfiles.sh - 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

  • chexify.pl - 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” simple.cab, opens and reads it. Checks CABINFO struct. Repeat for complex.cab

  • TestCopy()

    • “Creates” simple.cab, 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 chexify.pl to convert the file into a hexadecimal C array


Snippets of genfiles sh

Snippets of genfiles.sh

  • set -ex

  • test -f cabsdk.exe || wget -c http://download.microsoft.com/download/platformsdk/cab/2.0/w98nt42kmexp/en-us/cabsdk.exe

  • 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.cab simple.txt

  • # More complicated archive, with two files

  • cp ../../../README README

  • cp ../../../COPYING.LIB lgpl.txt

  • wine cabsdk/BIN/CABARC.EXE N complex.cab README lgpl.txt

  • # Pack source files and archives into hex arrays

  • perl ../../../tools/chexify.pl simple.txt README lgpl.txt simple.cab complex.cab > 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

  • Simple.cab – contains a single text file whose contents are “So long and thanks for all the fish….”

  • Complex.cab – 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 complex.cab

    • 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 www.geekymedia.com/twiki/bin/view.cgi/WineDev/Group3

  • CVS www.geekymedia.com/viewcvs/cgi/viewcvs.cgi/group3/wine/


  • Login