mirror of
https://github.com/reactos/reactos.git
synced 2024-07-07 21:25:05 +00:00
- Use typedefs64.h also for 64-bit host system compatibility in cabman.
This unifies the way of 64-bit compatibility and also enables cabman to compile with MSVC. The remaining "unsigned long"'s have to be used for casting pointers as the pointers are always 64-bit on 64-bit machines. - Silence some warnings in MSVC 2005 and also add a MSVC project file. When you compiled the zlib library with RosBE, you can now easily use this project file without any changes to compile cabman with MSVC. svn path=/trunk/; revision=28393
This commit is contained in:
parent
eca3c5411c
commit
2ebabda1fb
File diff suppressed because it is too large
Load diff
|
@ -14,13 +14,15 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <typedefs64.h>
|
||||||
|
typedef unsigned short USHORT, *PUSHORT;
|
||||||
|
#define _W64
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#ifndef MAX_PATH
|
#ifndef MAX_PATH
|
||||||
#define MAX_PATH 260
|
#define MAX_PATH 260
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -58,11 +60,7 @@
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
|
|
||||||
extern uint32_t DebugTraceLevel;
|
extern ULONG DebugTraceLevel;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#define __FUNCTION__ ""
|
|
||||||
#endif//_MSC_VER
|
|
||||||
|
|
||||||
#define DPRINT(_t_, _x_) \
|
#define DPRINT(_t_, _x_) \
|
||||||
if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
|
if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
|
||||||
|
@ -123,20 +121,20 @@ extern uint32_t DebugTraceLevel;
|
||||||
|
|
||||||
typedef struct _CFHEADER
|
typedef struct _CFHEADER
|
||||||
{
|
{
|
||||||
uint32_t Signature; // File signature 'MSCF' (CAB_SIGNATURE)
|
ULONG Signature; // File signature 'MSCF' (CAB_SIGNATURE)
|
||||||
uint32_t Reserved1; // Reserved field
|
ULONG Reserved1; // Reserved field
|
||||||
uint32_t CabinetSize; // Cabinet file size
|
ULONG CabinetSize; // Cabinet file size
|
||||||
uint32_t Reserved2; // Reserved field
|
ULONG Reserved2; // Reserved field
|
||||||
uint32_t FileTableOffset; // Offset of first CFFILE
|
ULONG FileTableOffset; // Offset of first CFFILE
|
||||||
uint32_t Reserved3; // Reserved field
|
ULONG Reserved3; // Reserved field
|
||||||
uint16_t Version; // Cabinet version (CAB_VERSION)
|
USHORT Version; // Cabinet version (CAB_VERSION)
|
||||||
uint16_t FolderCount; // Number of folders
|
USHORT FolderCount; // Number of folders
|
||||||
uint16_t FileCount; // Number of files
|
USHORT FileCount; // Number of files
|
||||||
uint16_t Flags; // Cabinet flags (CAB_FLAG_*)
|
USHORT Flags; // Cabinet flags (CAB_FLAG_*)
|
||||||
uint16_t SetID; // Cabinet set id
|
USHORT SetID; // Cabinet set id
|
||||||
uint16_t CabinetNumber; // Zero-based cabinet number
|
USHORT CabinetNumber; // Zero-based cabinet number
|
||||||
/* Optional fields (depends on Flags)
|
/* Optional fields (depends on Flags)
|
||||||
uint16_t CabinetResSize // Per-cabinet reserved area size
|
USHORT CabinetResSize // Per-cabinet reserved area size
|
||||||
char FolderResSize // Per-folder reserved area size
|
char FolderResSize // Per-folder reserved area size
|
||||||
char FileResSize // Per-file reserved area size
|
char FileResSize // Per-file reserved area size
|
||||||
char CabinetReserved[] // Per-cabinet reserved area
|
char CabinetReserved[] // Per-cabinet reserved area
|
||||||
|
@ -150,9 +148,9 @@ typedef struct _CFHEADER
|
||||||
|
|
||||||
typedef struct _CFFOLDER
|
typedef struct _CFFOLDER
|
||||||
{
|
{
|
||||||
uint32_t DataOffset; // Absolute offset of first CFDATA block in this folder
|
ULONG DataOffset; // Absolute offset of first CFDATA block in this folder
|
||||||
uint16_t DataBlockCount; // Number of CFDATA blocks in this folder in this cabinet
|
USHORT DataBlockCount; // Number of CFDATA blocks in this folder in this cabinet
|
||||||
uint16_t CompressionType; // Type of compression used for all CFDATA blocks in this folder
|
USHORT CompressionType; // Type of compression used for all CFDATA blocks in this folder
|
||||||
/* Optional fields (depends on Flags)
|
/* Optional fields (depends on Flags)
|
||||||
char FolderReserved[] // Per-folder reserved area
|
char FolderReserved[] // Per-folder reserved area
|
||||||
*/
|
*/
|
||||||
|
@ -161,21 +159,21 @@ typedef struct _CFFOLDER
|
||||||
|
|
||||||
typedef struct _CFFILE
|
typedef struct _CFFILE
|
||||||
{
|
{
|
||||||
uint32_t FileSize; // Uncompressed file size in bytes
|
ULONG FileSize; // Uncompressed file size in bytes
|
||||||
uint32_t FileOffset; // Uncompressed offset of file in the folder
|
ULONG FileOffset; // Uncompressed offset of file in the folder
|
||||||
uint16_t FileControlID; // File control ID (CAB_FILE_*)
|
USHORT FileControlID; // File control ID (CAB_FILE_*)
|
||||||
uint16_t FileDate; // File date stamp, as used by DOS
|
USHORT FileDate; // File date stamp, as used by DOS
|
||||||
uint16_t FileTime; // File time stamp, as used by DOS
|
USHORT FileTime; // File time stamp, as used by DOS
|
||||||
uint16_t Attributes; // File attributes (CAB_ATTRIB_*)
|
USHORT Attributes; // File attributes (CAB_ATTRIB_*)
|
||||||
/* After this is the NULL terminated filename */
|
/* After this is the NULL terminated filename */
|
||||||
} CFFILE, *PCFFILE;
|
} CFFILE, *PCFFILE;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _CFDATA
|
typedef struct _CFDATA
|
||||||
{
|
{
|
||||||
uint32_t Checksum; // Checksum of CFDATA entry
|
ULONG Checksum; // Checksum of CFDATA entry
|
||||||
uint16_t CompSize; // Number of compressed bytes in this block
|
USHORT CompSize; // Number of compressed bytes in this block
|
||||||
uint16_t UncompSize; // Number of uncompressed bytes in this block
|
USHORT UncompSize; // Number of uncompressed bytes in this block
|
||||||
/* Optional fields (depends on Flags)
|
/* Optional fields (depends on Flags)
|
||||||
char DataReserved[] // Per-datablock reserved area
|
char DataReserved[] // Per-datablock reserved area
|
||||||
*/
|
*/
|
||||||
|
@ -185,9 +183,9 @@ typedef struct _CFDATA_NODE
|
||||||
{
|
{
|
||||||
struct _CFDATA_NODE *Next;
|
struct _CFDATA_NODE *Next;
|
||||||
struct _CFDATA_NODE *Prev;
|
struct _CFDATA_NODE *Prev;
|
||||||
uint32_t ScratchFilePosition; // Absolute offset in scratch file
|
ULONG ScratchFilePosition; // Absolute offset in scratch file
|
||||||
uint32_t AbsoluteOffset; // Absolute offset in cabinet
|
ULONG AbsoluteOffset; // Absolute offset in cabinet
|
||||||
uint32_t UncompOffset; // Uncompressed offset in folder
|
ULONG UncompOffset; // Uncompressed offset in folder
|
||||||
CFDATA Data;
|
CFDATA Data;
|
||||||
} CFDATA_NODE, *PCFDATA_NODE;
|
} CFDATA_NODE, *PCFDATA_NODE;
|
||||||
|
|
||||||
|
@ -195,12 +193,12 @@ typedef struct _CFFOLDER_NODE
|
||||||
{
|
{
|
||||||
struct _CFFOLDER_NODE *Next;
|
struct _CFFOLDER_NODE *Next;
|
||||||
struct _CFFOLDER_NODE *Prev;
|
struct _CFFOLDER_NODE *Prev;
|
||||||
uint32_t UncompOffset; // File size accumulator
|
ULONG UncompOffset; // File size accumulator
|
||||||
uint32_t AbsoluteOffset;
|
ULONG AbsoluteOffset;
|
||||||
uint32_t TotalFolderSize; // Total size of folder in current disk
|
ULONG TotalFolderSize; // Total size of folder in current disk
|
||||||
PCFDATA_NODE DataListHead;
|
PCFDATA_NODE DataListHead;
|
||||||
PCFDATA_NODE DataListTail;
|
PCFDATA_NODE DataListTail;
|
||||||
uint32_t Index;
|
ULONG Index;
|
||||||
bool Commit; // true if the folder should be committed
|
bool Commit; // true if the folder should be committed
|
||||||
bool Delete; // true if marked for deletion
|
bool Delete; // true if marked for deletion
|
||||||
CFFOLDER Folder;
|
CFFOLDER Folder;
|
||||||
|
@ -254,15 +252,15 @@ public:
|
||||||
/* Default destructor */
|
/* Default destructor */
|
||||||
virtual ~CCABCodec() {};
|
virtual ~CCABCodec() {};
|
||||||
/* Compresses a data block */
|
/* Compresses a data block */
|
||||||
virtual uint32_t Compress(void* OutputBuffer,
|
virtual ULONG Compress(void* OutputBuffer,
|
||||||
void* InputBuffer,
|
void* InputBuffer,
|
||||||
uint32_t InputLength,
|
ULONG InputLength,
|
||||||
uint32_t* OutputLength) = 0;
|
PULONG OutputLength) = 0;
|
||||||
/* Uncompresses a data block */
|
/* Uncompresses a data block */
|
||||||
virtual uint32_t Uncompress(void* OutputBuffer,
|
virtual ULONG Uncompress(void* OutputBuffer,
|
||||||
void* InputBuffer,
|
void* InputBuffer,
|
||||||
uint32_t InputLength,
|
ULONG InputLength,
|
||||||
uint32_t* OutputLength) = 0;
|
PULONG OutputLength) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -289,13 +287,13 @@ public:
|
||||||
CCFDATAStorage();
|
CCFDATAStorage();
|
||||||
/* Default destructor */
|
/* Default destructor */
|
||||||
virtual ~CCFDATAStorage();
|
virtual ~CCFDATAStorage();
|
||||||
uint32_t Create(char* FileName);
|
ULONG Create(char* FileName);
|
||||||
uint32_t Destroy();
|
ULONG Destroy();
|
||||||
uint32_t Truncate();
|
ULONG Truncate();
|
||||||
uint32_t Position();
|
ULONG Position();
|
||||||
uint32_t Seek(int32_t Position);
|
ULONG Seek(LONG Position);
|
||||||
uint32_t ReadBlock(PCFDATA Data, void* Buffer, uint32_t* BytesRead);
|
ULONG ReadBlock(PCFDATA Data, void* Buffer, PULONG BytesRead);
|
||||||
uint32_t WriteBlock(PCFDATA Data, void* Buffer, uint32_t* BytesWritten);
|
ULONG WriteBlock(PCFDATA Data, void* Buffer, PULONG BytesWritten);
|
||||||
private:
|
private:
|
||||||
char FullName[MAX_PATH];
|
char FullName[MAX_PATH];
|
||||||
bool FileCreated;
|
bool FileCreated;
|
||||||
|
@ -319,7 +317,7 @@ public:
|
||||||
/* Removes a filename from a fully qualified filename */
|
/* Removes a filename from a fully qualified filename */
|
||||||
void RemoveFileName(char* Path);
|
void RemoveFileName(char* Path);
|
||||||
/* Normalizes a path */
|
/* Normalizes a path */
|
||||||
bool NormalizePath(char* Path, uint32_t Length);
|
bool NormalizePath(char* Path, ULONG Length);
|
||||||
/* Returns name of cabinet file */
|
/* Returns name of cabinet file */
|
||||||
char* GetCabinetName();
|
char* GetCabinetName();
|
||||||
/* Sets the name of the cabinet file */
|
/* Sets the name of the cabinet file */
|
||||||
|
@ -333,40 +331,40 @@ public:
|
||||||
/* Returns destination path */
|
/* Returns destination path */
|
||||||
char* GetDestinationPath();
|
char* GetDestinationPath();
|
||||||
/* Returns zero-based current disk number */
|
/* Returns zero-based current disk number */
|
||||||
uint32_t GetCurrentDiskNumber();
|
ULONG GetCurrentDiskNumber();
|
||||||
/* Opens the current cabinet file */
|
/* Opens the current cabinet file */
|
||||||
uint32_t Open();
|
ULONG Open();
|
||||||
/* Closes the current open cabinet file */
|
/* Closes the current open cabinet file */
|
||||||
void Close();
|
void Close();
|
||||||
/* Locates the first file in the current cabinet file that matches a search criteria */
|
/* Locates the first file in the current cabinet file that matches a search criteria */
|
||||||
uint32_t FindFirst(char* FileName, PCAB_SEARCH Search);
|
ULONG FindFirst(char* FileName, PCAB_SEARCH Search);
|
||||||
/* Locates the next file in the current cabinet file */
|
/* Locates the next file in the current cabinet file */
|
||||||
uint32_t FindNext(PCAB_SEARCH Search);
|
ULONG FindNext(PCAB_SEARCH Search);
|
||||||
/* Extracts a file from the current cabinet file */
|
/* Extracts a file from the current cabinet file */
|
||||||
uint32_t ExtractFile(char* FileName);
|
ULONG ExtractFile(char* FileName);
|
||||||
/* Select codec engine to use */
|
/* Select codec engine to use */
|
||||||
void SelectCodec(uint32_t Id);
|
void SelectCodec(ULONG Id);
|
||||||
#ifndef CAB_READ_ONLY
|
#ifndef CAB_READ_ONLY
|
||||||
/* Creates a new cabinet file */
|
/* Creates a new cabinet file */
|
||||||
uint32_t NewCabinet();
|
ULONG NewCabinet();
|
||||||
/* Forces a new disk to be created */
|
/* Forces a new disk to be created */
|
||||||
uint32_t NewDisk();
|
ULONG NewDisk();
|
||||||
/* Forces a new folder to be created */
|
/* Forces a new folder to be created */
|
||||||
uint32_t NewFolder();
|
ULONG NewFolder();
|
||||||
/* Writes a file to scratch storage */
|
/* Writes a file to scratch storage */
|
||||||
uint32_t WriteFileToScratchStorage(PCFFILE_NODE FileNode);
|
ULONG WriteFileToScratchStorage(PCFFILE_NODE FileNode);
|
||||||
/* Forces the current disk to be written */
|
/* Forces the current disk to be written */
|
||||||
uint32_t WriteDisk(uint32_t MoreDisks);
|
ULONG WriteDisk(ULONG MoreDisks);
|
||||||
/* Commits the current disk */
|
/* Commits the current disk */
|
||||||
uint32_t CommitDisk(uint32_t MoreDisks);
|
ULONG CommitDisk(ULONG MoreDisks);
|
||||||
/* Closes the current disk */
|
/* Closes the current disk */
|
||||||
uint32_t CloseDisk();
|
ULONG CloseDisk();
|
||||||
/* Closes the current cabinet */
|
/* Closes the current cabinet */
|
||||||
uint32_t CloseCabinet();
|
ULONG CloseCabinet();
|
||||||
/* Adds a file to the current disk */
|
/* Adds a file to the current disk */
|
||||||
uint32_t AddFile(char* FileName);
|
ULONG AddFile(char* FileName);
|
||||||
/* Sets the maximum size of the current disk */
|
/* Sets the maximum size of the current disk */
|
||||||
void SetMaxDiskSize(uint32_t Size);
|
void SetMaxDiskSize(ULONG Size);
|
||||||
#endif /* CAB_READ_ONLY */
|
#endif /* CAB_READ_ONLY */
|
||||||
|
|
||||||
/* Default event handlers */
|
/* Default event handlers */
|
||||||
|
@ -381,17 +379,17 @@ public:
|
||||||
/* Handler called when a file is about to be added */
|
/* Handler called when a file is about to be added */
|
||||||
virtual void OnAdd(PCFFILE Entry, char* FileName);
|
virtual void OnAdd(PCFFILE Entry, char* FileName);
|
||||||
/* Handler called when a cabinet need a name */
|
/* Handler called when a cabinet need a name */
|
||||||
virtual bool OnCabinetName(uint32_t Number, char* Name);
|
virtual bool OnCabinetName(ULONG Number, char* Name);
|
||||||
/* Handler called when a disk needs a label */
|
/* Handler called when a disk needs a label */
|
||||||
virtual bool OnDiskLabel(uint32_t Number, char* Label);
|
virtual bool OnDiskLabel(ULONG Number, char* Label);
|
||||||
#endif /* CAB_READ_ONLY */
|
#endif /* CAB_READ_ONLY */
|
||||||
private:
|
private:
|
||||||
PCFFOLDER_NODE LocateFolderNode(uint32_t Index);
|
PCFFOLDER_NODE LocateFolderNode(ULONG Index);
|
||||||
uint32_t GetAbsoluteOffset(PCFFILE_NODE File);
|
ULONG GetAbsoluteOffset(PCFFILE_NODE File);
|
||||||
uint32_t LocateFile(char* FileName, PCFFILE_NODE *File);
|
ULONG LocateFile(char* FileName, PCFFILE_NODE *File);
|
||||||
uint32_t ReadString(char* String, uint32_t MaxLength);
|
ULONG ReadString(char* String, ULONG MaxLength);
|
||||||
uint32_t ReadFileTable();
|
ULONG ReadFileTable();
|
||||||
uint32_t ReadDataBlocks(PCFFOLDER_NODE FolderNode);
|
ULONG ReadDataBlocks(PCFFOLDER_NODE FolderNode);
|
||||||
PCFFOLDER_NODE NewFolderNode();
|
PCFFOLDER_NODE NewFolderNode();
|
||||||
PCFFILE_NODE NewFileNode();
|
PCFFILE_NODE NewFileNode();
|
||||||
PCFDATA_NODE NewDataNode(PCFFOLDER_NODE FolderNode);
|
PCFDATA_NODE NewDataNode(PCFFOLDER_NODE FolderNode);
|
||||||
|
@ -400,45 +398,45 @@ private:
|
||||||
void DestroyDeletedFileNodes();
|
void DestroyDeletedFileNodes();
|
||||||
void DestroyFolderNodes();
|
void DestroyFolderNodes();
|
||||||
void DestroyDeletedFolderNodes();
|
void DestroyDeletedFolderNodes();
|
||||||
uint32_t ComputeChecksum(void* Buffer, unsigned int Size, uint32_t Seed);
|
ULONG ComputeChecksum(void* Buffer, ULONG Size, ULONG Seed);
|
||||||
uint32_t ReadBlock(void* Buffer, uint32_t Size, uint32_t* BytesRead);
|
ULONG ReadBlock(void* Buffer, ULONG Size, PULONG BytesRead);
|
||||||
#ifndef CAB_READ_ONLY
|
#ifndef CAB_READ_ONLY
|
||||||
uint32_t InitCabinetHeader();
|
ULONG InitCabinetHeader();
|
||||||
uint32_t WriteCabinetHeader(bool MoreDisks);
|
ULONG WriteCabinetHeader(bool MoreDisks);
|
||||||
uint32_t WriteFolderEntries();
|
ULONG WriteFolderEntries();
|
||||||
uint32_t WriteFileEntries();
|
ULONG WriteFileEntries();
|
||||||
uint32_t CommitDataBlocks(PCFFOLDER_NODE FolderNode);
|
ULONG CommitDataBlocks(PCFFOLDER_NODE FolderNode);
|
||||||
uint32_t WriteDataBlock();
|
ULONG WriteDataBlock();
|
||||||
uint32_t GetAttributesOnFile(PCFFILE_NODE File);
|
ULONG GetAttributesOnFile(PCFFILE_NODE File);
|
||||||
uint32_t SetAttributesOnFile(PCFFILE_NODE File);
|
ULONG SetAttributesOnFile(PCFFILE_NODE File);
|
||||||
uint32_t GetFileTimes(FILEHANDLE FileHandle, PCFFILE_NODE File);
|
ULONG GetFileTimes(FILEHANDLE FileHandle, PCFFILE_NODE File);
|
||||||
#if !defined(WIN32)
|
#if !defined(WIN32)
|
||||||
void ConvertDateAndTime(time_t* Time, uint16_t* DosDate, uint16_t* DosTime);
|
void ConvertDateAndTime(time_t* Time, PUSHORT DosDate, PUSHORT DosTime);
|
||||||
#endif
|
#endif
|
||||||
#endif /* CAB_READ_ONLY */
|
#endif /* CAB_READ_ONLY */
|
||||||
uint32_t CurrentDiskNumber; // Zero based disk number
|
ULONG CurrentDiskNumber; // Zero based disk number
|
||||||
char CabinetName[256]; // Filename of current cabinet
|
char CabinetName[256]; // Filename of current cabinet
|
||||||
char CabinetPrev[256]; // Filename of previous cabinet
|
char CabinetPrev[256]; // Filename of previous cabinet
|
||||||
char DiskPrev[256]; // Label of cabinet in file CabinetPrev
|
char DiskPrev[256]; // Label of cabinet in file CabinetPrev
|
||||||
char CabinetNext[256]; // Filename of next cabinet
|
char CabinetNext[256]; // Filename of next cabinet
|
||||||
char DiskNext[256]; // Label of cabinet in file CabinetNext
|
char DiskNext[256]; // Label of cabinet in file CabinetNext
|
||||||
uint32_t TotalHeaderSize; // Size of header and optional fields
|
ULONG TotalHeaderSize; // Size of header and optional fields
|
||||||
uint32_t NextFieldsSize; // Size of next cabinet name and next disk label
|
ULONG NextFieldsSize; // Size of next cabinet name and next disk label
|
||||||
uint32_t TotalFolderSize; // Size of all folder entries
|
ULONG TotalFolderSize; // Size of all folder entries
|
||||||
uint32_t TotalFileSize; // Size of all file entries
|
ULONG TotalFileSize; // Size of all file entries
|
||||||
uint32_t FolderUncompSize; // Uncompressed size of folder
|
ULONG FolderUncompSize; // Uncompressed size of folder
|
||||||
uint32_t BytesLeftInBlock; // Number of bytes left in current block
|
ULONG BytesLeftInBlock; // Number of bytes left in current block
|
||||||
bool ReuseBlock;
|
bool ReuseBlock;
|
||||||
char DestPath[MAX_PATH];
|
char DestPath[MAX_PATH];
|
||||||
char CabinetReservedFile[MAX_PATH];
|
char CabinetReservedFile[MAX_PATH];
|
||||||
void* CabinetReservedFileBuffer;
|
void* CabinetReservedFileBuffer;
|
||||||
uint32_t CabinetReservedFileSize;
|
ULONG CabinetReservedFileSize;
|
||||||
FILEHANDLE FileHandle;
|
FILEHANDLE FileHandle;
|
||||||
bool FileOpen;
|
bool FileOpen;
|
||||||
CFHEADER CABHeader;
|
CFHEADER CABHeader;
|
||||||
uint32_t CabinetReserved;
|
ULONG CabinetReserved;
|
||||||
uint32_t FolderReserved;
|
ULONG FolderReserved;
|
||||||
uint32_t DataReserved;
|
ULONG DataReserved;
|
||||||
PCFFOLDER_NODE FolderListHead;
|
PCFFOLDER_NODE FolderListHead;
|
||||||
PCFFOLDER_NODE FolderListTail;
|
PCFFOLDER_NODE FolderListTail;
|
||||||
PCFFOLDER_NODE CurrentFolderNode;
|
PCFFOLDER_NODE CurrentFolderNode;
|
||||||
|
@ -446,32 +444,32 @@ private:
|
||||||
PCFFILE_NODE FileListHead;
|
PCFFILE_NODE FileListHead;
|
||||||
PCFFILE_NODE FileListTail;
|
PCFFILE_NODE FileListTail;
|
||||||
CCABCodec *Codec;
|
CCABCodec *Codec;
|
||||||
uint32_t CodecId;
|
ULONG CodecId;
|
||||||
bool CodecSelected;
|
bool CodecSelected;
|
||||||
void* InputBuffer;
|
void* InputBuffer;
|
||||||
void* CurrentIBuffer; // Current offset in input buffer
|
void* CurrentIBuffer; // Current offset in input buffer
|
||||||
uint32_t CurrentIBufferSize; // Bytes left in input buffer
|
ULONG CurrentIBufferSize; // Bytes left in input buffer
|
||||||
void* OutputBuffer;
|
void* OutputBuffer;
|
||||||
uint32_t TotalCompSize; // Total size of current CFDATA block
|
ULONG TotalCompSize; // Total size of current CFDATA block
|
||||||
void* CurrentOBuffer; // Current offset in output buffer
|
void* CurrentOBuffer; // Current offset in output buffer
|
||||||
uint32_t CurrentOBufferSize; // Bytes left in output buffer
|
ULONG CurrentOBufferSize; // Bytes left in output buffer
|
||||||
uint32_t BytesLeftInCabinet;
|
ULONG BytesLeftInCabinet;
|
||||||
bool RestartSearch;
|
bool RestartSearch;
|
||||||
uint32_t LastFileOffset; // Uncompressed offset of last extracted file
|
ULONG LastFileOffset; // Uncompressed offset of last extracted file
|
||||||
#ifndef CAB_READ_ONLY
|
#ifndef CAB_READ_ONLY
|
||||||
uint32_t LastBlockStart; // Uncompressed offset of last block in folder
|
ULONG LastBlockStart; // Uncompressed offset of last block in folder
|
||||||
uint32_t MaxDiskSize;
|
ULONG MaxDiskSize;
|
||||||
uint32_t DiskSize;
|
ULONG DiskSize;
|
||||||
uint32_t PrevCabinetNumber; // Previous cabinet number (where split file starts)
|
ULONG PrevCabinetNumber; // Previous cabinet number (where split file starts)
|
||||||
bool CreateNewDisk;
|
bool CreateNewDisk;
|
||||||
bool CreateNewFolder;
|
bool CreateNewFolder;
|
||||||
|
|
||||||
CCFDATAStorage *ScratchFile;
|
CCFDATAStorage *ScratchFile;
|
||||||
FILEHANDLE SourceFile;
|
FILEHANDLE SourceFile;
|
||||||
bool ContinueFile;
|
bool ContinueFile;
|
||||||
uint32_t TotalBytesLeft;
|
ULONG TotalBytesLeft;
|
||||||
bool BlockIsSplit; // true if current data block is split
|
bool BlockIsSplit; // true if current data block is split
|
||||||
uint32_t NextFolderNumber; // Zero based folder number
|
ULONG NextFolderNumber; // Zero based folder number
|
||||||
#endif /* CAB_READ_ONLY */
|
#endif /* CAB_READ_ONLY */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ private:
|
||||||
virtual void OnAdd(PCFFILE Entry, char* FileName);
|
virtual void OnAdd(PCFFILE Entry, char* FileName);
|
||||||
/* Configuration */
|
/* Configuration */
|
||||||
bool ProcessAll;
|
bool ProcessAll;
|
||||||
uint32_t Mode;
|
ULONG Mode;
|
||||||
bool PromptOnOverwrite;
|
bool PromptOnOverwrite;
|
||||||
char Location[MAX_PATH];
|
char Location[MAX_PATH];
|
||||||
char FileName[MAX_PATH];
|
char FileName[MAX_PATH];
|
||||||
|
|
20
reactos/tools/cabman/cabman.sln
Normal file
20
reactos/tools/cabman/cabman.sln
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
|
# Visual C++ Express 2005
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cabman", "cabman.vcproj", "{3A9CBD2C-BD87-4838-917E-F85C49BC3617}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{3A9CBD2C-BD87-4838-917E-F85C49BC3617}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{3A9CBD2C-BD87-4838-917E-F85C49BC3617}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{3A9CBD2C-BD87-4838-917E-F85C49BC3617}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{3A9CBD2C-BD87-4838-917E-F85C49BC3617}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
232
reactos/tools/cabman/cabman.vcproj
Normal file
232
reactos/tools/cabman/cabman.vcproj
Normal file
|
@ -0,0 +1,232 @@
|
||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8,00"
|
||||||
|
Name="cabman"
|
||||||
|
ProjectGUID="{3A9CBD2C-BD87-4838-917E-F85C49BC3617}"
|
||||||
|
RootNamespace="cabman"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="0"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
UseUnicodeResponseFiles="true"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="../../include/reactos;../../lib/3rdparty/zlib"
|
||||||
|
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_WARNINGS"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="kernel32.lib ../../obj-i386/lib/3rdparty/zlib/zlib.a $(NOINHERIT)"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="0"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories="../../include/reactos;../../lib/3rdparty/zlib"
|
||||||
|
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_WARNINGS"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="kernel32.lib ../../obj-i386/lib/3rdparty/zlib/zlib.a $(NOINHERIT)"
|
||||||
|
LinkIncremental="1"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\cabinet.cxx"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\dfp.cxx"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\main.cxx"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\mszip.cxx"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\raw.cxx"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\cabinet.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\cabman.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\dfp.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\mszip.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\raw.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
|
@ -12,6 +12,7 @@
|
||||||
* CSH 15/08-2003 Made it portable
|
* CSH 15/08-2003 Made it portable
|
||||||
* CF 04/05-2007 Reformatted the code to be more consistent and use TABs instead of spaces
|
* CF 04/05-2007 Reformatted the code to be more consistent and use TABs instead of spaces
|
||||||
* CF 04/05-2007 Made it compatible with 64-bit operating systems
|
* CF 04/05-2007 Made it compatible with 64-bit operating systems
|
||||||
|
* CF 18/08-2007 Use typedefs64.h and the Windows types for compatibility with 64-bit operating systems
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -21,31 +22,31 @@
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
#define GetSizeOfFile(handle) _GetSizeOfFile(handle)
|
#define GetSizeOfFile(handle) _GetSizeOfFile(handle)
|
||||||
static int32_t _GetSizeOfFile(FILEHANDLE handle)
|
static LONG _GetSizeOfFile(FILEHANDLE handle)
|
||||||
{
|
{
|
||||||
uint32_t size = GetFileSize(handle, NULL);
|
ULONG size = GetFileSize(handle, NULL);
|
||||||
if (size == INVALID_FILE_SIZE)
|
if (size == INVALID_FILE_SIZE)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
#define ReadFileData(handle, buffer, size, bytesread) _ReadFileData(handle, buffer, size, bytesread)
|
#define ReadFileData(handle, buffer, size, bytesread) _ReadFileData(handle, buffer, size, bytesread)
|
||||||
static bool _ReadFileData(FILEHANDLE handle, void* buffer, uint32_t size, uint32_t* bytesread)
|
static bool _ReadFileData(FILEHANDLE handle, void* buffer, ULONG size, PULONG bytesread)
|
||||||
{
|
{
|
||||||
return ReadFile(handle, buffer, size, (LPDWORD)bytesread, NULL);
|
return ReadFile(handle, buffer, size, (LPDWORD)bytesread, NULL);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define GetSizeOfFile(handle) _GetSizeOfFile(handle)
|
#define GetSizeOfFile(handle) _GetSizeOfFile(handle)
|
||||||
static int32_t _GetSizeOfFile(FILEHANDLE handle)
|
static LONG _GetSizeOfFile(FILEHANDLE handle)
|
||||||
{
|
{
|
||||||
int32_t size;
|
LONG size;
|
||||||
fseek(handle, 0, SEEK_END);
|
fseek(handle, 0, SEEK_END);
|
||||||
size = ftell(handle);
|
size = ftell(handle);
|
||||||
fseek(handle, 0, SEEK_SET);
|
fseek(handle, 0, SEEK_SET);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
#define ReadFileData(handle, buffer, size, bytesread) _ReadFileData(handle, buffer, size, bytesread)
|
#define ReadFileData(handle, buffer, size, bytesread) _ReadFileData(handle, buffer, size, bytesread)
|
||||||
static bool _ReadFileData(FILEHANDLE handle, void* buffer, uint32_t size, uint32_t* bytesread)
|
static bool _ReadFileData(FILEHANDLE handle, void* buffer, ULONG size, PULONG bytesread)
|
||||||
{
|
{
|
||||||
*bytesread = fread(buffer, 1, size, handle);
|
*bytesread = fread(buffer, 1, size, handle);
|
||||||
return *bytesread == size;
|
return *bytesread == size;
|
||||||
|
@ -128,7 +129,7 @@ void CDFParser::WriteInfLine(char* InfLine)
|
||||||
char eolbuf[2];
|
char eolbuf[2];
|
||||||
char* destpath;
|
char* destpath;
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
uint32_t BytesWritten;
|
ULONG BytesWritten;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (DontGenerateInf)
|
if (DontGenerateInf)
|
||||||
|
@ -160,14 +161,14 @@ void CDFParser::WriteInfLine(char* InfLine)
|
||||||
NULL); // No attribute template
|
NULL); // No attribute template
|
||||||
if (InfFileHandle == INVALID_HANDLE_VALUE)
|
if (InfFileHandle == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
DPRINT(MID_TRACE, ("Error creating '%d'.\n", (unsigned int)GetLastError()));
|
DPRINT(MID_TRACE, ("Error creating '%d'.\n", (ULONG)GetLastError()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else /* !WIN32 */
|
#else /* !WIN32 */
|
||||||
InfFileHandle = fopen(buf, "wb");
|
InfFileHandle = fopen(buf, "wb");
|
||||||
if (InfFileHandle == NULL)
|
if (InfFileHandle == NULL)
|
||||||
{
|
{
|
||||||
DPRINT(MID_TRACE, ("Error creating '%d'.\n", (unsigned int)errno));
|
DPRINT(MID_TRACE, ("Error creating '%d'.\n", (ULONG)errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -176,7 +177,7 @@ void CDFParser::WriteInfLine(char* InfLine)
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
if (!WriteFile(InfFileHandle, InfLine, (DWORD)strlen(InfLine), (LPDWORD)&BytesWritten, NULL))
|
if (!WriteFile(InfFileHandle, InfLine, (DWORD)strlen(InfLine), (LPDWORD)&BytesWritten, NULL))
|
||||||
{
|
{
|
||||||
DPRINT(MID_TRACE, ("ERROR WRITING '%d'.\n", (unsigned int)GetLastError()));
|
DPRINT(MID_TRACE, ("ERROR WRITING '%d'.\n", (ULONG)GetLastError()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -190,7 +191,7 @@ void CDFParser::WriteInfLine(char* InfLine)
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
if (!WriteFile(InfFileHandle, eolbuf, sizeof(eolbuf), (LPDWORD)&BytesWritten, NULL))
|
if (!WriteFile(InfFileHandle, eolbuf, sizeof(eolbuf), (LPDWORD)&BytesWritten, NULL))
|
||||||
{
|
{
|
||||||
DPRINT(MID_TRACE, ("ERROR WRITING '%d'.\n", (unsigned int)GetLastError()));
|
DPRINT(MID_TRACE, ("ERROR WRITING '%d'.\n", (ULONG)GetLastError()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -200,7 +201,7 @@ void CDFParser::WriteInfLine(char* InfLine)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t CDFParser::Load(char* FileName)
|
ULONG CDFParser::Load(char* FileName)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Loads a directive file into memory
|
* FUNCTION: Loads a directive file into memory
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -209,8 +210,8 @@ uint32_t CDFParser::Load(char* FileName)
|
||||||
* Status of operation
|
* Status of operation
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
uint32_t BytesRead;
|
ULONG BytesRead;
|
||||||
int32_t FileSize;
|
LONG FileSize;
|
||||||
|
|
||||||
if (FileLoaded)
|
if (FileLoaded)
|
||||||
return CAB_STATUS_SUCCESS;
|
return CAB_STATUS_SUCCESS;
|
||||||
|
@ -239,7 +240,7 @@ uint32_t CDFParser::Load(char* FileName)
|
||||||
return CAB_STATUS_CANNOT_OPEN;
|
return CAB_STATUS_CANNOT_OPEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileBufferSize = (uint32_t)FileSize;
|
FileBufferSize = (ULONG)FileSize;
|
||||||
|
|
||||||
FileBuffer = (char*)AllocateMemory(FileBufferSize);
|
FileBuffer = (char*)AllocateMemory(FileBufferSize);
|
||||||
if (!FileBuffer)
|
if (!FileBuffer)
|
||||||
|
@ -266,7 +267,7 @@ uint32_t CDFParser::Load(char* FileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t CDFParser::Parse()
|
ULONG CDFParser::Parse()
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Parses a loaded directive file
|
* FUNCTION: Parses a loaded directive file
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
|
@ -274,7 +275,7 @@ uint32_t CDFParser::Parse()
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
bool Command;
|
bool Command;
|
||||||
uint32_t Status;
|
ULONG Status;
|
||||||
|
|
||||||
if (!FileLoaded)
|
if (!FileLoaded)
|
||||||
return CAB_STATUS_NOFILE;
|
return CAB_STATUS_NOFILE;
|
||||||
|
@ -346,7 +347,7 @@ uint32_t CDFParser::Parse()
|
||||||
|
|
||||||
if (Status == CAB_STATUS_FAILURE)
|
if (Status == CAB_STATUS_FAILURE)
|
||||||
{
|
{
|
||||||
printf("Directive file contains errors at line %d.\n", (unsigned int)CurrentLine);
|
printf("Directive file contains errors at line %d.\n", (ULONG)CurrentLine);
|
||||||
DPRINT(MID_TRACE, ("Error while executing command.\n"));
|
DPRINT(MID_TRACE, ("Error while executing command.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +361,7 @@ uint32_t CDFParser::Parse()
|
||||||
|
|
||||||
if (Status != CAB_STATUS_SUCCESS)
|
if (Status != CAB_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
printf("Directive file contains errors at line %d.\n", (unsigned int)CurrentLine);
|
printf("Directive file contains errors at line %d.\n", (ULONG)CurrentLine);
|
||||||
DPRINT(MID_TRACE, ("Error while copying file.\n"));
|
DPRINT(MID_TRACE, ("Error while copying file.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,8 +382,8 @@ uint32_t CDFParser::Parse()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("Directive file contains errors at line %d.\n", (unsigned int)CurrentLine);
|
printf("Directive file contains errors at line %d.\n", (ULONG)CurrentLine);
|
||||||
DPRINT(MID_TRACE, ("Token is (%d).\n", (unsigned int)CurrentToken));
|
DPRINT(MID_TRACE, ("Token is (%d).\n", (ULONG)CurrentToken));
|
||||||
return CAB_STATUS_SUCCESS;
|
return CAB_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
NextToken();
|
NextToken();
|
||||||
|
@ -401,7 +402,7 @@ uint32_t CDFParser::Parse()
|
||||||
Status = CloseDisk();
|
Status = CloseDisk();
|
||||||
if (Status != CAB_STATUS_SUCCESS)
|
if (Status != CAB_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT(MIN_TRACE, ("Cannot write disk (%d).\n", (unsigned int)Status));
|
DPRINT(MIN_TRACE, ("Cannot write disk (%d).\n", (ULONG)Status));
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -411,7 +412,7 @@ uint32_t CDFParser::Parse()
|
||||||
Status = CloseCabinet();
|
Status = CloseCabinet();
|
||||||
if (Status != CAB_STATUS_SUCCESS)
|
if (Status != CAB_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT(MIN_TRACE, ("Cannot close cabinet (%d).\n", (unsigned int)Status));
|
DPRINT(MIN_TRACE, ("Cannot close cabinet (%d).\n", (ULONG)Status));
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -437,7 +438,7 @@ void CDFParser::SetFileRelativePath(char* Path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CDFParser::OnDiskLabel(uint32_t Number, char* Label)
|
bool CDFParser::OnDiskLabel(ULONG Number, char* Label)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Called when a disk needs a label
|
* FUNCTION: Called when a disk needs a label
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -448,13 +449,13 @@ bool CDFParser::OnDiskLabel(uint32_t Number, char* Label)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
char Buffer[20];
|
char Buffer[20];
|
||||||
unsigned int i;
|
ULONG i;
|
||||||
int j;
|
int j;
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
Number += 1;
|
Number += 1;
|
||||||
|
|
||||||
DPRINT(MID_TRACE, ("Giving disk (%d) a label...\n", (unsigned int)Number));
|
DPRINT(MID_TRACE, ("Giving disk (%d) a label...\n", (ULONG)Number));
|
||||||
|
|
||||||
if (GetDiskName(&DiskLabel, Number, Label))
|
if (GetDiskName(&DiskLabel, Number, Label))
|
||||||
return true;
|
return true;
|
||||||
|
@ -470,7 +471,7 @@ bool CDFParser::OnDiskLabel(uint32_t Number, char* Label)
|
||||||
{
|
{
|
||||||
sprintf(Buffer, "%lu", Number);
|
sprintf(Buffer, "%lu", Number);
|
||||||
strcat(Label, Buffer);
|
strcat(Label, Buffer);
|
||||||
j += (int)strlen(Buffer);
|
j += (LONG)strlen(Buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -489,7 +490,7 @@ bool CDFParser::OnDiskLabel(uint32_t Number, char* Label)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CDFParser::OnCabinetName(uint32_t Number, char* Name)
|
bool CDFParser::OnCabinetName(ULONG Number, char* Name)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Called when a cabinet needs a name
|
* FUNCTION: Called when a cabinet needs a name
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -500,13 +501,13 @@ bool CDFParser::OnCabinetName(uint32_t Number, char* Name)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
char Buffer[MAX_PATH];
|
char Buffer[MAX_PATH];
|
||||||
unsigned int i;
|
ULONG i;
|
||||||
int j;
|
int j;
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
Number += 1;
|
Number += 1;
|
||||||
|
|
||||||
DPRINT(MID_TRACE, ("Giving cabinet (%d) a name...\n", (unsigned int)Number));
|
DPRINT(MID_TRACE, ("Giving cabinet (%d) a name...\n", (ULONG)Number));
|
||||||
|
|
||||||
if (GetDiskName(&CabinetName, Number, Buffer))
|
if (GetDiskName(&CabinetName, Number, Buffer))
|
||||||
{
|
{
|
||||||
|
@ -518,7 +519,7 @@ bool CDFParser::OnCabinetName(uint32_t Number, char* Name)
|
||||||
if (CabinetNameTemplateSet)
|
if (CabinetNameTemplateSet)
|
||||||
{
|
{
|
||||||
strcpy(Name, GetDestinationPath());
|
strcpy(Name, GetDestinationPath());
|
||||||
j = (int)strlen(Name);
|
j = (LONG)strlen(Name);
|
||||||
for (i = 0; i < strlen(CabinetNameTemplate); i++)
|
for (i = 0; i < strlen(CabinetNameTemplate); i++)
|
||||||
{
|
{
|
||||||
ch = CabinetNameTemplate[i];
|
ch = CabinetNameTemplate[i];
|
||||||
|
@ -526,7 +527,7 @@ bool CDFParser::OnCabinetName(uint32_t Number, char* Name)
|
||||||
{
|
{
|
||||||
sprintf(Buffer, "%lu", Number);
|
sprintf(Buffer, "%lu", Number);
|
||||||
strcat(Name, Buffer);
|
strcat(Name, Buffer);
|
||||||
j += (int)strlen(Buffer);
|
j += (LONG)strlen(Buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -544,7 +545,7 @@ bool CDFParser::OnCabinetName(uint32_t Number, char* Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CDFParser::SetDiskName(PCABINET_NAME *List, uint32_t Number, char* String)
|
bool CDFParser::SetDiskName(PCABINET_NAME *List, ULONG Number, char* String)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Sets an entry in a list
|
* FUNCTION: Sets an entry in a list
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -582,7 +583,7 @@ bool CDFParser::SetDiskName(PCABINET_NAME *List, uint32_t Number, char* String)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CDFParser::GetDiskName(PCABINET_NAME *List, uint32_t Number, char* String)
|
bool CDFParser::GetDiskName(PCABINET_NAME *List, ULONG Number, char* String)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Returns an entry in a list
|
* FUNCTION: Returns an entry in a list
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -610,7 +611,7 @@ bool CDFParser::GetDiskName(PCABINET_NAME *List, uint32_t Number, char* String)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CDFParser::SetDiskNumber(PDISK_NUMBER *List, uint32_t Number, uint32_t Value)
|
bool CDFParser::SetDiskNumber(PDISK_NUMBER *List, ULONG Number, ULONG Value)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Sets an entry in a list
|
* FUNCTION: Sets an entry in a list
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -648,7 +649,7 @@ bool CDFParser::SetDiskNumber(PDISK_NUMBER *List, uint32_t Number, uint32_t Valu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CDFParser::GetDiskNumber(PDISK_NUMBER *List, uint32_t Number, uint32_t* Value)
|
bool CDFParser::GetDiskNumber(PDISK_NUMBER *List, ULONG Number, PULONG Value)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Returns an entry in a list
|
* FUNCTION: Returns an entry in a list
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -676,7 +677,7 @@ bool CDFParser::GetDiskNumber(PDISK_NUMBER *List, uint32_t Number, uint32_t* Val
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CDFParser::DoDiskLabel(uint32_t Number, char* Label)
|
bool CDFParser::DoDiskLabel(ULONG Number, char* Label)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Sets the label of a disk
|
* FUNCTION: Sets the label of a disk
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -686,7 +687,7 @@ bool CDFParser::DoDiskLabel(uint32_t Number, char* Label)
|
||||||
* false if there was not enough free memory available
|
* false if there was not enough free memory available
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DPRINT(MID_TRACE, ("Setting label of disk (%d) to '%s'\n", (unsigned int)Number, Label));
|
DPRINT(MID_TRACE, ("Setting label of disk (%d) to '%s'\n", (ULONG)Number, Label));
|
||||||
|
|
||||||
return SetDiskName(&DiskLabel, Number, Label);
|
return SetDiskName(&DiskLabel, Number, Label);
|
||||||
}
|
}
|
||||||
|
@ -706,7 +707,7 @@ void CDFParser::DoDiskLabelTemplate(char* Template)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CDFParser::DoCabinetName(uint32_t Number, char* Name)
|
bool CDFParser::DoCabinetName(ULONG Number, char* Name)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Sets the name of a cabinet
|
* FUNCTION: Sets the name of a cabinet
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -716,7 +717,7 @@ bool CDFParser::DoCabinetName(uint32_t Number, char* Name)
|
||||||
* false if there was not enough free memory available
|
* false if there was not enough free memory available
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DPRINT(MID_TRACE, ("Setting name of cabinet (%d) to '%s'\n", (unsigned int)Number, Name));
|
DPRINT(MID_TRACE, ("Setting name of cabinet (%d) to '%s'\n", (ULONG)Number, Name));
|
||||||
|
|
||||||
return SetDiskName(&CabinetName, Number, Name);
|
return SetDiskName(&CabinetName, Number, Name);
|
||||||
}
|
}
|
||||||
|
@ -736,7 +737,7 @@ void CDFParser::DoCabinetNameTemplate(char* Template)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t CDFParser::DoMaxDiskSize(bool NumberValid, uint32_t Number)
|
ULONG CDFParser::DoMaxDiskSize(bool NumberValid, ULONG Number)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Sets the maximum disk size
|
* FUNCTION: Sets the maximum disk size
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -748,7 +749,7 @@ uint32_t CDFParser::DoMaxDiskSize(bool NumberValid, uint32_t Number)
|
||||||
* Standard sizes are 2.88M, 1.44M, 1.25M, 1.2M, 720K, 360K, and CDROM
|
* Standard sizes are 2.88M, 1.44M, 1.25M, 1.2M, 720K, 360K, and CDROM
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
uint32_t A, B, Value;
|
ULONG A, B, Value;
|
||||||
|
|
||||||
if (IsNextToken(TokenInteger, true))
|
if (IsNextToken(TokenInteger, true))
|
||||||
{
|
{
|
||||||
|
@ -853,14 +854,14 @@ void CDFParser::DoInfFileName(char* FileName)
|
||||||
InfFileNameSet = true;
|
InfFileNameSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CDFParser::SetupNewDisk()
|
ULONG CDFParser::SetupNewDisk()
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Sets up parameters for a new disk
|
* FUNCTION: Sets up parameters for a new disk
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
* Status of operation
|
* Status of operation
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
uint32_t Value;
|
ULONG Value;
|
||||||
|
|
||||||
if (!GetDiskNumber(&MaxDiskSize, GetCurrentDiskNumber(), &Value))
|
if (!GetDiskNumber(&MaxDiskSize, GetCurrentDiskNumber(), &Value))
|
||||||
{
|
{
|
||||||
|
@ -875,7 +876,7 @@ uint32_t CDFParser::SetupNewDisk()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t CDFParser::PerformSetCommand()
|
ULONG CDFParser::PerformSetCommand()
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Performs a set variable command
|
* FUNCTION: Performs a set variable command
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
|
@ -884,7 +885,7 @@ uint32_t CDFParser::PerformSetCommand()
|
||||||
{
|
{
|
||||||
SETTYPE SetType;
|
SETTYPE SetType;
|
||||||
bool NumberValid = false;
|
bool NumberValid = false;
|
||||||
uint32_t Number = 0;
|
ULONG Number = 0;
|
||||||
|
|
||||||
if (!IsNextToken(TokenIdentifier, true))
|
if (!IsNextToken(TokenIdentifier, true))
|
||||||
return CAB_STATUS_FAILURE;
|
return CAB_STATUS_FAILURE;
|
||||||
|
@ -971,7 +972,7 @@ uint32_t CDFParser::PerformSetCommand()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t CDFParser::PerformNewCommand()
|
ULONG CDFParser::PerformNewCommand()
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Performs a new disk|cabinet|folder command
|
* FUNCTION: Performs a new disk|cabinet|folder command
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
|
@ -979,7 +980,7 @@ uint32_t CDFParser::PerformNewCommand()
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
NEWTYPE NewType;
|
NEWTYPE NewType;
|
||||||
uint32_t Status;
|
ULONG Status;
|
||||||
|
|
||||||
if (!IsNextToken(TokenIdentifier, true))
|
if (!IsNextToken(TokenIdentifier, true))
|
||||||
return CAB_STATUS_FAILURE;
|
return CAB_STATUS_FAILURE;
|
||||||
|
@ -1003,7 +1004,7 @@ uint32_t CDFParser::PerformNewCommand()
|
||||||
Status = CloseDisk();
|
Status = CloseDisk();
|
||||||
if (Status != CAB_STATUS_SUCCESS)
|
if (Status != CAB_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT(MIN_TRACE, ("Cannot write disk (%d).\n", (unsigned int)Status));
|
DPRINT(MIN_TRACE, ("Cannot write disk (%d).\n", (ULONG)Status));
|
||||||
return CAB_STATUS_SUCCESS;
|
return CAB_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
DiskCreated = false;
|
DiskCreated = false;
|
||||||
|
@ -1012,7 +1013,7 @@ uint32_t CDFParser::PerformNewCommand()
|
||||||
Status = NewDisk();
|
Status = NewDisk();
|
||||||
if (Status != CAB_STATUS_SUCCESS)
|
if (Status != CAB_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT(MIN_TRACE, ("Cannot create disk (%d).\n", (unsigned int)Status));
|
DPRINT(MIN_TRACE, ("Cannot create disk (%d).\n", (ULONG)Status));
|
||||||
return CAB_STATUS_SUCCESS;
|
return CAB_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
DiskCreated = true;
|
DiskCreated = true;
|
||||||
|
@ -1027,7 +1028,7 @@ uint32_t CDFParser::PerformNewCommand()
|
||||||
Status = CloseDisk();
|
Status = CloseDisk();
|
||||||
if (Status != CAB_STATUS_SUCCESS)
|
if (Status != CAB_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT(MIN_TRACE, ("Cannot write disk (%d).\n", (unsigned int)Status));
|
DPRINT(MIN_TRACE, ("Cannot write disk (%d).\n", (ULONG)Status));
|
||||||
return CAB_STATUS_SUCCESS;
|
return CAB_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
DiskCreated = false;
|
DiskCreated = false;
|
||||||
|
@ -1036,7 +1037,7 @@ uint32_t CDFParser::PerformNewCommand()
|
||||||
Status = NewCabinet();
|
Status = NewCabinet();
|
||||||
if (Status != CAB_STATUS_SUCCESS)
|
if (Status != CAB_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT(MIN_TRACE, ("Cannot create cabinet (%d).\n", (unsigned int)Status));
|
DPRINT(MIN_TRACE, ("Cannot create cabinet (%d).\n", (ULONG)Status));
|
||||||
return CAB_STATUS_SUCCESS;
|
return CAB_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
DiskCreated = true;
|
DiskCreated = true;
|
||||||
|
@ -1054,7 +1055,7 @@ uint32_t CDFParser::PerformNewCommand()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t CDFParser::PerformInfBeginCommand()
|
ULONG CDFParser::PerformInfBeginCommand()
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Begins inf mode
|
* FUNCTION: Begins inf mode
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
|
@ -1066,7 +1067,7 @@ uint32_t CDFParser::PerformInfBeginCommand()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t CDFParser::PerformInfEndCommand()
|
ULONG CDFParser::PerformInfEndCommand()
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Begins inf mode
|
* FUNCTION: Begins inf mode
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
|
@ -1078,7 +1079,7 @@ uint32_t CDFParser::PerformInfEndCommand()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t CDFParser::PerformCommand()
|
ULONG CDFParser::PerformCommand()
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Performs a command
|
* FUNCTION: Performs a command
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
|
@ -1098,15 +1099,15 @@ uint32_t CDFParser::PerformCommand()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t CDFParser::PerformFileCopy()
|
ULONG CDFParser::PerformFileCopy()
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Performs a file copy
|
* FUNCTION: Performs a file copy
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
* Status of operation
|
* Status of operation
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
uint32_t Status;
|
ULONG Status;
|
||||||
uint32_t i, j;
|
ULONG i, j;
|
||||||
char ch;
|
char ch;
|
||||||
char SrcName[MAX_PATH];
|
char SrcName[MAX_PATH];
|
||||||
char DstName[MAX_PATH];
|
char DstName[MAX_PATH];
|
||||||
|
@ -1139,7 +1140,7 @@ uint32_t CDFParser::PerformFileCopy()
|
||||||
|
|
||||||
if (CurrentToken != TokenEnd)
|
if (CurrentToken != TokenEnd)
|
||||||
{
|
{
|
||||||
j = (uint32_t)strlen(CurrentString); i = 0;
|
j = (ULONG)strlen(CurrentString); i = 0;
|
||||||
while ((CurrentChar + i < LineLength) &&
|
while ((CurrentChar + i < LineLength) &&
|
||||||
((ch = Line[CurrentChar + i]) != ' ') &&
|
((ch = Line[CurrentChar + i]) != ' ') &&
|
||||||
(ch != 0x09) &&
|
(ch != 0x09) &&
|
||||||
|
@ -1159,7 +1160,7 @@ uint32_t CDFParser::PerformFileCopy()
|
||||||
|
|
||||||
if (CurrentToken != TokenEnd)
|
if (CurrentToken != TokenEnd)
|
||||||
{
|
{
|
||||||
j = (uint32_t)strlen(CurrentString); i = 0;
|
j = (ULONG)strlen(CurrentString); i = 0;
|
||||||
while ((CurrentChar + i < LineLength) &&
|
while ((CurrentChar + i < LineLength) &&
|
||||||
((ch = Line[CurrentChar + i]) != ' ') &&
|
((ch = Line[CurrentChar + i]) != ' ') &&
|
||||||
(ch != 0x09) &&
|
(ch != 0x09) &&
|
||||||
|
@ -1181,7 +1182,7 @@ uint32_t CDFParser::PerformFileCopy()
|
||||||
Status = NewCabinet();
|
Status = NewCabinet();
|
||||||
if (Status != CAB_STATUS_SUCCESS)
|
if (Status != CAB_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT(MIN_TRACE, ("Cannot create cabinet (%d).\n", (unsigned int)Status));
|
DPRINT(MIN_TRACE, ("Cannot create cabinet (%d).\n", (ULONG)Status));
|
||||||
printf("Cannot create cabinet.\n");
|
printf("Cannot create cabinet.\n");
|
||||||
return CAB_STATUS_FAILURE;
|
return CAB_STATUS_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -1192,7 +1193,7 @@ uint32_t CDFParser::PerformFileCopy()
|
||||||
Status = NewDisk();
|
Status = NewDisk();
|
||||||
if (Status != CAB_STATUS_SUCCESS)
|
if (Status != CAB_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT(MIN_TRACE, ("Cannot create disk (%d).\n", (unsigned int)Status));
|
DPRINT(MIN_TRACE, ("Cannot create disk (%d).\n", (ULONG)Status));
|
||||||
printf("Cannot create disk.\n");
|
printf("Cannot create disk.\n");
|
||||||
return CAB_STATUS_FAILURE;
|
return CAB_STATUS_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -1275,7 +1276,7 @@ bool CDFParser::ReadLine()
|
||||||
* true if there is a new line, false if not
|
* true if there is a new line, false if not
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
uint32_t i, j;
|
ULONG i, j;
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
if (CurrentOffset >= FileBufferSize)
|
if (CurrentOffset >= FileBufferSize)
|
||||||
|
@ -1312,7 +1313,7 @@ void CDFParser::NextToken()
|
||||||
* FUNCTION: Reads the next token from the current line
|
* FUNCTION: Reads the next token from the current line
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
uint32_t i;
|
ULONG i;
|
||||||
char ch = ' ';
|
char ch = ' ';
|
||||||
|
|
||||||
if (CurrentChar >= LineLength)
|
if (CurrentChar >= LineLength)
|
||||||
|
|
|
@ -11,14 +11,14 @@
|
||||||
|
|
||||||
typedef struct _CABINET_NAME {
|
typedef struct _CABINET_NAME {
|
||||||
struct _CABINET_NAME *Next;
|
struct _CABINET_NAME *Next;
|
||||||
uint32_t DiskNumber;
|
ULONG DiskNumber;
|
||||||
char Name[128];
|
char Name[128];
|
||||||
} CABINET_NAME, *PCABINET_NAME;
|
} CABINET_NAME, *PCABINET_NAME;
|
||||||
|
|
||||||
typedef struct _DISK_NUMBER {
|
typedef struct _DISK_NUMBER {
|
||||||
struct _DISK_NUMBER *Next;
|
struct _DISK_NUMBER *Next;
|
||||||
uint32_t DiskNumber;
|
ULONG DiskNumber;
|
||||||
uint32_t Number;
|
ULONG Number;
|
||||||
} DISK_NUMBER, *PDISK_NUMBER;
|
} DISK_NUMBER, *PDISK_NUMBER;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -58,35 +58,35 @@ class CDFParser : public CCabinet {
|
||||||
public:
|
public:
|
||||||
CDFParser();
|
CDFParser();
|
||||||
virtual ~CDFParser();
|
virtual ~CDFParser();
|
||||||
uint32_t Load(char* FileName);
|
ULONG Load(char* FileName);
|
||||||
uint32_t Parse();
|
ULONG Parse();
|
||||||
void SetFileRelativePath(char* Path);
|
void SetFileRelativePath(char* Path);
|
||||||
bool InfFileOnly;
|
bool InfFileOnly;
|
||||||
bool DontGenerateInf;
|
bool DontGenerateInf;
|
||||||
char FileRelativePath[300];
|
char FileRelativePath[300];
|
||||||
private:
|
private:
|
||||||
/* Event handlers */
|
/* Event handlers */
|
||||||
virtual bool OnDiskLabel(uint32_t Number, char* Label);
|
virtual bool OnDiskLabel(ULONG Number, char* Label);
|
||||||
virtual bool OnCabinetName(uint32_t Number, char* Name);
|
virtual bool OnCabinetName(ULONG Number, char* Name);
|
||||||
|
|
||||||
void WriteInfLine(char* InfLine);
|
void WriteInfLine(char* InfLine);
|
||||||
bool SetDiskName(PCABINET_NAME *List, uint32_t Number, char* String);
|
bool SetDiskName(PCABINET_NAME *List, ULONG Number, char* String);
|
||||||
bool GetDiskName(PCABINET_NAME *List, uint32_t Number, char* String);
|
bool GetDiskName(PCABINET_NAME *List, ULONG Number, char* String);
|
||||||
bool SetDiskNumber(PDISK_NUMBER *List, uint32_t Number, uint32_t Value);
|
bool SetDiskNumber(PDISK_NUMBER *List, ULONG Number, ULONG Value);
|
||||||
bool GetDiskNumber(PDISK_NUMBER *List, uint32_t Number, uint32_t* Value);
|
bool GetDiskNumber(PDISK_NUMBER *List, ULONG Number, PULONG Value);
|
||||||
bool DoDiskLabel(uint32_t Number, char* Label);
|
bool DoDiskLabel(ULONG Number, char* Label);
|
||||||
void DoDiskLabelTemplate(char* Template);
|
void DoDiskLabelTemplate(char* Template);
|
||||||
bool DoCabinetName(uint32_t Number, char* Name);
|
bool DoCabinetName(ULONG Number, char* Name);
|
||||||
void DoCabinetNameTemplate(char* Template);
|
void DoCabinetNameTemplate(char* Template);
|
||||||
void DoInfFileName(char* InfFileName);
|
void DoInfFileName(char* InfFileName);
|
||||||
uint32_t DoMaxDiskSize(bool NumberValid, uint32_t Number);
|
ULONG DoMaxDiskSize(bool NumberValid, ULONG Number);
|
||||||
uint32_t SetupNewDisk();
|
ULONG SetupNewDisk();
|
||||||
uint32_t PerformSetCommand();
|
ULONG PerformSetCommand();
|
||||||
uint32_t PerformNewCommand();
|
ULONG PerformNewCommand();
|
||||||
uint32_t PerformInfBeginCommand();
|
ULONG PerformInfBeginCommand();
|
||||||
uint32_t PerformInfEndCommand();
|
ULONG PerformInfEndCommand();
|
||||||
uint32_t PerformCommand();
|
ULONG PerformCommand();
|
||||||
uint32_t PerformFileCopy();
|
ULONG PerformFileCopy();
|
||||||
void SkipSpaces();
|
void SkipSpaces();
|
||||||
bool IsNextToken(DFP_TOKEN Token, bool NoSpaces);
|
bool IsNextToken(DFP_TOKEN Token, bool NoSpaces);
|
||||||
bool ReadLine();
|
bool ReadLine();
|
||||||
|
@ -95,15 +95,15 @@ private:
|
||||||
bool FileLoaded;
|
bool FileLoaded;
|
||||||
FILEHANDLE FileHandle;
|
FILEHANDLE FileHandle;
|
||||||
char* FileBuffer;
|
char* FileBuffer;
|
||||||
uint32_t FileBufferSize;
|
ULONG FileBufferSize;
|
||||||
uint32_t CurrentOffset;
|
ULONG CurrentOffset;
|
||||||
char Line[128];
|
char Line[128];
|
||||||
uint32_t LineLength;
|
ULONG LineLength;
|
||||||
uint32_t CurrentLine;
|
ULONG CurrentLine;
|
||||||
uint32_t CurrentChar;
|
ULONG CurrentChar;
|
||||||
/* Token */
|
/* Token */
|
||||||
DFP_TOKEN CurrentToken;
|
DFP_TOKEN CurrentToken;
|
||||||
uint32_t CurrentInteger;
|
ULONG CurrentInteger;
|
||||||
char CurrentString[256];
|
char CurrentString[256];
|
||||||
|
|
||||||
/* State */
|
/* State */
|
||||||
|
@ -112,27 +112,27 @@ private:
|
||||||
bool FolderCreated;
|
bool FolderCreated;
|
||||||
/* Standard directive variable */
|
/* Standard directive variable */
|
||||||
bool Cabinet;
|
bool Cabinet;
|
||||||
uint32_t CabinetFileCountThreshold;
|
ULONG CabinetFileCountThreshold;
|
||||||
PCABINET_NAME CabinetName;
|
PCABINET_NAME CabinetName;
|
||||||
bool CabinetNameTemplateSet;
|
bool CabinetNameTemplateSet;
|
||||||
char CabinetNameTemplate[128];
|
char CabinetNameTemplate[128];
|
||||||
bool InfFileNameSet;
|
bool InfFileNameSet;
|
||||||
char InfFileName[256];
|
char InfFileName[256];
|
||||||
bool Compress;
|
bool Compress;
|
||||||
uint32_t CompressionType;
|
ULONG CompressionType;
|
||||||
PCABINET_NAME DiskLabel;
|
PCABINET_NAME DiskLabel;
|
||||||
bool DiskLabelTemplateSet;
|
bool DiskLabelTemplateSet;
|
||||||
char DiskLabelTemplate[128];
|
char DiskLabelTemplate[128];
|
||||||
uint32_t FolderFileCountThreshold;
|
ULONG FolderFileCountThreshold;
|
||||||
uint32_t FolderSizeThreshold;
|
ULONG FolderSizeThreshold;
|
||||||
uint32_t MaxCabinetSize;
|
ULONG MaxCabinetSize;
|
||||||
uint32_t MaxDiskFileCount;
|
ULONG MaxDiskFileCount;
|
||||||
PDISK_NUMBER MaxDiskSize;
|
PDISK_NUMBER MaxDiskSize;
|
||||||
bool MaxDiskSizeAllSet;
|
bool MaxDiskSizeAllSet;
|
||||||
uint32_t MaxDiskSizeAll;
|
ULONG MaxDiskSizeAll;
|
||||||
uint32_t ReservePerCabinetSize;
|
ULONG ReservePerCabinetSize;
|
||||||
uint32_t ReservePerDataBlockSize;
|
ULONG ReservePerDataBlockSize;
|
||||||
uint32_t ReservePerFolderSize;
|
ULONG ReservePerFolderSize;
|
||||||
char SourceDir[256];
|
char SourceDir[256];
|
||||||
FILEHANDLE InfFileHandle;
|
FILEHANDLE InfFileHandle;
|
||||||
bool InfModeEnabled;
|
bool InfModeEnabled;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
* CSH 15/08-2003 Made it portable
|
* CSH 15/08-2003 Made it portable
|
||||||
* CF 04/05-2007 Reformatted the code to be more consistent and use TABs instead of spaces
|
* CF 04/05-2007 Reformatted the code to be more consistent and use TABs instead of spaces
|
||||||
* CF 04/05-2007 Made it compatible with 64-bit operating systems
|
* CF 04/05-2007 Made it compatible with 64-bit operating systems
|
||||||
|
* CF 18/08-2007 Use typedefs64.h and the Windows types for compatibility with 64-bit operating systems
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -20,9 +21,9 @@
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
|
|
||||||
uint32_t DebugTraceLevel = MIN_TRACE;
|
ULONG DebugTraceLevel = MIN_TRACE;
|
||||||
//uint32_t DebugTraceLevel = MID_TRACE;
|
//ULONG DebugTraceLevel = MID_TRACE;
|
||||||
//uint32_t DebugTraceLevel = MAX_TRACE;
|
//ULONG DebugTraceLevel = MAX_TRACE;
|
||||||
|
|
||||||
#endif /* DBG */
|
#endif /* DBG */
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ uint32_t DebugTraceLevel = MIN_TRACE;
|
||||||
#define CM_VERSION "0.9"
|
#define CM_VERSION "0.9"
|
||||||
|
|
||||||
|
|
||||||
char* Pad(char* Str, char PadChar, unsigned int Length)
|
char* Pad(char* Str, char PadChar, ULONG Length)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Pads a string with a character to make a given length
|
* FUNCTION: Pads a string with a character to make a given length
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -43,9 +44,9 @@ char* Pad(char* Str, char PadChar, unsigned int Length)
|
||||||
* Str must be at least Length + 1 bytes
|
* Str must be at least Length + 1 bytes
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
unsigned int Len;
|
ULONG Len;
|
||||||
|
|
||||||
Len = (uint32_t)strlen(Str);
|
Len = (ULONG)strlen(Str);
|
||||||
|
|
||||||
if (Len < Length)
|
if (Len < Length)
|
||||||
{
|
{
|
||||||
|
@ -56,7 +57,7 @@ char* Pad(char* Str, char PadChar, unsigned int Length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* Date2Str(char* Str, uint16_t Date)
|
char* Date2Str(char* Str, USHORT Date)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Converts a DOS style date to a string
|
* FUNCTION: Converts a DOS style date to a string
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -66,7 +67,7 @@ char* Date2Str(char* Str, uint16_t Date)
|
||||||
* Pointer to string
|
* Pointer to string
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
uint32_t dw;
|
ULONG dw;
|
||||||
|
|
||||||
/* Month */
|
/* Month */
|
||||||
Str[0] = (char)('0' + ((Date & 0x01E0) >> 5) / 10);
|
Str[0] = (char)('0' + ((Date & 0x01E0) >> 5) / 10);
|
||||||
|
@ -87,7 +88,7 @@ char* Date2Str(char* Str, uint16_t Date)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* Time2Str(char* Str, uint16_t Time)
|
char* Time2Str(char* Str, USHORT Time)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Converts a DOS style time to a string
|
* FUNCTION: Converts a DOS style time to a string
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -98,8 +99,8 @@ char* Time2Str(char* Str, uint16_t Time)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
bool PM;
|
bool PM;
|
||||||
uint32_t Hour;
|
ULONG Hour;
|
||||||
uint32_t dw;
|
ULONG dw;
|
||||||
|
|
||||||
Hour = ((Time & 0xF800) >> 11);
|
Hour = ((Time & 0xF800) >> 11);
|
||||||
PM = (Hour >= 12);
|
PM = (Hour >= 12);
|
||||||
|
@ -127,7 +128,7 @@ char* Time2Str(char* Str, uint16_t Time)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* Attr2Str(char* Str, uint16_t Attr)
|
char* Attr2Str(char* Str, USHORT Attr)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Converts attributes to a string
|
* FUNCTION: Converts attributes to a string
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -365,7 +366,7 @@ bool CCABManager::CreateCabinet()
|
||||||
* FUNCTION: Create cabinet
|
* FUNCTION: Create cabinet
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
uint32_t Status;
|
ULONG Status;
|
||||||
|
|
||||||
Status = Load((char*)&FileName);
|
Status = Load((char*)&FileName);
|
||||||
if (Status != CAB_STATUS_SUCCESS)
|
if (Status != CAB_STATUS_SUCCESS)
|
||||||
|
@ -385,19 +386,19 @@ bool CCABManager::CreateSimpleCabinet()
|
||||||
* FUNCTION: Create cabinet
|
* FUNCTION: Create cabinet
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
uint32_t Status;
|
ULONG Status;
|
||||||
|
|
||||||
Status = NewCabinet();
|
Status = NewCabinet();
|
||||||
if (Status != CAB_STATUS_SUCCESS)
|
if (Status != CAB_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT(MIN_TRACE, ("Cannot create cabinet (%d).\n", (unsigned int)Status));
|
DPRINT(MIN_TRACE, ("Cannot create cabinet (%d).\n", (ULONG)Status));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = AddFile(FileName);
|
Status = AddFile(FileName);
|
||||||
if (Status != CAB_STATUS_SUCCESS)
|
if (Status != CAB_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT(MIN_TRACE, ("Cannot add file to cabinet (%d).\n", (unsigned int)Status));
|
DPRINT(MIN_TRACE, ("Cannot add file to cabinet (%d).\n", (ULONG)Status));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,7 +407,7 @@ bool CCABManager::CreateSimpleCabinet()
|
||||||
Status = CloseDisk();
|
Status = CloseDisk();
|
||||||
if (Status != CAB_STATUS_SUCCESS)
|
if (Status != CAB_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT(MIN_TRACE, ("Cannot write disk (%d).\n", (unsigned int)Status));
|
DPRINT(MIN_TRACE, ("Cannot write disk (%d).\n", (ULONG)Status));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,8 +424,8 @@ bool CCABManager::DisplayCabinet()
|
||||||
{
|
{
|
||||||
CAB_SEARCH Search;
|
CAB_SEARCH Search;
|
||||||
char Str[20];
|
char Str[20];
|
||||||
uint32_t FileCount = 0;
|
ULONG FileCount = 0;
|
||||||
uint32_t ByteCount = 0;
|
ULONG ByteCount = 0;
|
||||||
|
|
||||||
if (Open() == CAB_STATUS_SUCCESS)
|
if (Open() == CAB_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -486,7 +487,7 @@ bool CCABManager::ExtractFromCabinet()
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
CAB_SEARCH Search;
|
CAB_SEARCH Search;
|
||||||
uint32_t Status;
|
ULONG Status;
|
||||||
|
|
||||||
if (Open() == CAB_STATUS_SUCCESS)
|
if (Open() == CAB_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -513,7 +514,7 @@ bool CCABManager::ExtractFromCabinet()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("Unspecified error code (%d).\n", (unsigned int)Status);
|
printf("Unspecified error code (%d).\n", (ULONG)Status);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} while (FindNext(&Search) == CAB_STATUS_SUCCESS);
|
} while (FindNext(&Search) == CAB_STATUS_SUCCESS);
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
* CSH 15/08-2003 Made it portable
|
* CSH 15/08-2003 Made it portable
|
||||||
* CF 04/05-2007 Reformatted the code to be more consistent and use TABs instead of spaces
|
* CF 04/05-2007 Reformatted the code to be more consistent and use TABs instead of spaces
|
||||||
* CF 04/05-2007 Made it compatible with 64-bit operating systems
|
* CF 04/05-2007 Made it compatible with 64-bit operating systems
|
||||||
|
* CF 18/08-2007 Use typedefs64.h and the Windows types for compatibility with 64-bit operating systems
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "mszip.h"
|
#include "mszip.h"
|
||||||
|
@ -53,10 +54,10 @@ CMSZipCodec::~CMSZipCodec()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t CMSZipCodec::Compress(void* OutputBuffer,
|
ULONG CMSZipCodec::Compress(void* OutputBuffer,
|
||||||
void* InputBuffer,
|
void* InputBuffer,
|
||||||
uint32_t InputLength,
|
ULONG InputLength,
|
||||||
uint32_t* OutputLength)
|
PULONG OutputLength)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Compresses data in a buffer
|
* FUNCTION: Compresses data in a buffer
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -66,16 +67,16 @@ uint32_t CMSZipCodec::Compress(void* OutputBuffer,
|
||||||
* OutputLength = Address of buffer to place size of compressed data
|
* OutputLength = Address of buffer to place size of compressed data
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
uint16_t* Magic;
|
PUSHORT Magic;
|
||||||
|
|
||||||
DPRINT(MAX_TRACE, ("InputLength (%lu).\n", InputLength));
|
DPRINT(MAX_TRACE, ("InputLength (%lu).\n", InputLength));
|
||||||
|
|
||||||
Magic = (uint16_t*)OutputBuffer;
|
Magic = (PUSHORT)OutputBuffer;
|
||||||
*Magic = MSZIP_MAGIC;
|
*Magic = MSZIP_MAGIC;
|
||||||
|
|
||||||
ZStream.next_in = (unsigned char*)InputBuffer;
|
ZStream.next_in = (unsigned char*)InputBuffer;
|
||||||
ZStream.avail_in = InputLength;
|
ZStream.avail_in = InputLength;
|
||||||
ZStream.next_out = (unsigned char*)((uintptr_t)OutputBuffer + 2);
|
ZStream.next_out = (unsigned char*)((_W64 unsigned long)OutputBuffer + 2);
|
||||||
ZStream.avail_out = CAB_BLOCKSIZE + 12;
|
ZStream.avail_out = CAB_BLOCKSIZE + 12;
|
||||||
|
|
||||||
/* WindowBits is passed < 0 to tell that there is no zlib header */
|
/* WindowBits is passed < 0 to tell that there is no zlib header */
|
||||||
|
@ -113,10 +114,10 @@ uint32_t CMSZipCodec::Compress(void* OutputBuffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t CMSZipCodec::Uncompress(void* OutputBuffer,
|
ULONG CMSZipCodec::Uncompress(void* OutputBuffer,
|
||||||
void* InputBuffer,
|
void* InputBuffer,
|
||||||
uint32_t InputLength,
|
ULONG InputLength,
|
||||||
uint32_t* OutputLength)
|
PULONG OutputLength)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Uncompresses data in a buffer
|
* FUNCTION: Uncompresses data in a buffer
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -126,11 +127,11 @@ uint32_t CMSZipCodec::Uncompress(void* OutputBuffer,
|
||||||
* OutputLength = Address of buffer to place size of uncompressed data
|
* OutputLength = Address of buffer to place size of uncompressed data
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
uint16_t Magic;
|
USHORT Magic;
|
||||||
|
|
||||||
DPRINT(MAX_TRACE, ("InputLength (%lu).\n", InputLength));
|
DPRINT(MAX_TRACE, ("InputLength (%lu).\n", InputLength));
|
||||||
|
|
||||||
Magic = *((uint16_t*)InputBuffer);
|
Magic = *((PUSHORT)InputBuffer);
|
||||||
|
|
||||||
if (Magic != MSZIP_MAGIC)
|
if (Magic != MSZIP_MAGIC)
|
||||||
{
|
{
|
||||||
|
@ -138,7 +139,7 @@ uint32_t CMSZipCodec::Uncompress(void* OutputBuffer,
|
||||||
return CS_BADSTREAM;
|
return CS_BADSTREAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZStream.next_in = (unsigned char*)((uintptr_t)InputBuffer + 2);
|
ZStream.next_in = (unsigned char*)((_W64 unsigned long)InputBuffer + 2);
|
||||||
ZStream.avail_in = InputLength - 2;
|
ZStream.avail_in = InputLength - 2;
|
||||||
ZStream.next_out = (unsigned char*)OutputBuffer;
|
ZStream.next_out = (unsigned char*)OutputBuffer;
|
||||||
ZStream.avail_out = CAB_BLOCKSIZE + 12;
|
ZStream.avail_out = CAB_BLOCKSIZE + 12;
|
||||||
|
|
|
@ -22,15 +22,15 @@ public:
|
||||||
/* Default destructor */
|
/* Default destructor */
|
||||||
virtual ~CMSZipCodec();
|
virtual ~CMSZipCodec();
|
||||||
/* Compresses a data block */
|
/* Compresses a data block */
|
||||||
virtual uint32_t Compress(void* OutputBuffer,
|
virtual ULONG Compress(void* OutputBuffer,
|
||||||
void* InputBuffer,
|
void* InputBuffer,
|
||||||
uint32_t InputLength,
|
ULONG InputLength,
|
||||||
uint32_t* OutputLength);
|
PULONG OutputLength);
|
||||||
/* Uncompresses a data block */
|
/* Uncompresses a data block */
|
||||||
virtual uint32_t Uncompress(void* OutputBuffer,
|
virtual ULONG Uncompress(void* OutputBuffer,
|
||||||
void* InputBuffer,
|
void* InputBuffer,
|
||||||
uint32_t InputLength,
|
ULONG InputLength,
|
||||||
uint32_t* OutputLength);
|
PULONG OutputLength);
|
||||||
private:
|
private:
|
||||||
int Status;
|
int Status;
|
||||||
z_stream ZStream; /* Zlib stream */
|
z_stream ZStream; /* Zlib stream */
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
* CSH 15/08-2003 Made it portable
|
* CSH 15/08-2003 Made it portable
|
||||||
* CF 04/05-2007 Reformatted the code to be more consistent and use TABs instead of spaces
|
* CF 04/05-2007 Reformatted the code to be more consistent and use TABs instead of spaces
|
||||||
* CF 04/05-2007 Made it compatible with 64-bit operating systems
|
* CF 04/05-2007 Made it compatible with 64-bit operating systems
|
||||||
|
* CF 18/08-2007 Use typedefs64.h and the Windows types for compatibility with 64-bit operating systems
|
||||||
*/
|
*/
|
||||||
#include "raw.h"
|
#include "raw.h"
|
||||||
|
|
||||||
|
@ -32,10 +33,10 @@ CRawCodec::~CRawCodec()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t CRawCodec::Compress(void* OutputBuffer,
|
ULONG CRawCodec::Compress(void* OutputBuffer,
|
||||||
void* InputBuffer,
|
void* InputBuffer,
|
||||||
uint32_t InputLength,
|
ULONG InputLength,
|
||||||
uint32_t* OutputLength)
|
PULONG OutputLength)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Compresses data in a buffer
|
* FUNCTION: Compresses data in a buffer
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -50,10 +51,10 @@ uint32_t CRawCodec::Compress(void* OutputBuffer,
|
||||||
return CS_SUCCESS;
|
return CS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CRawCodec::Uncompress(void* OutputBuffer,
|
ULONG CRawCodec::Uncompress(void* OutputBuffer,
|
||||||
void* InputBuffer,
|
void* InputBuffer,
|
||||||
uint32_t InputLength,
|
ULONG InputLength,
|
||||||
uint32_t* OutputLength)
|
PULONG OutputLength)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Uncompresses data in a buffer
|
* FUNCTION: Uncompresses data in a buffer
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
|
|
@ -19,15 +19,15 @@ public:
|
||||||
/* Default destructor */
|
/* Default destructor */
|
||||||
virtual ~CRawCodec();
|
virtual ~CRawCodec();
|
||||||
/* Compresses a data block */
|
/* Compresses a data block */
|
||||||
virtual uint32_t Compress(void* OutputBuffer,
|
virtual ULONG Compress(void* OutputBuffer,
|
||||||
void* InputBuffer,
|
void* InputBuffer,
|
||||||
uint32_t InputLength,
|
ULONG InputLength,
|
||||||
uint32_t* OutputLength);
|
PULONG OutputLength);
|
||||||
/* Uncompresses a data block */
|
/* Uncompresses a data block */
|
||||||
virtual uint32_t Uncompress(void* OutputBuffer,
|
virtual ULONG Uncompress(void* OutputBuffer,
|
||||||
void* InputBuffer,
|
void* InputBuffer,
|
||||||
uint32_t InputLength,
|
ULONG InputLength,
|
||||||
uint32_t* OutputLength);
|
PULONG OutputLength);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __RAW_H */
|
#endif /* __RAW_H */
|
||||||
|
|
Loading…
Reference in a new issue