mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +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
12 changed files with 730 additions and 476 deletions
File diff suppressed because it is too large
Load diff
|
@ -14,13 +14,15 @@
|
|||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <typedefs64.h>
|
||||
typedef unsigned short USHORT, *PUSHORT;
|
||||
#define _W64
|
||||
#include <unistd.h>
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 260
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -58,11 +60,7 @@
|
|||
|
||||
#ifdef DBG
|
||||
|
||||
extern uint32_t DebugTraceLevel;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define __FUNCTION__ ""
|
||||
#endif//_MSC_VER
|
||||
extern ULONG DebugTraceLevel;
|
||||
|
||||
#define DPRINT(_t_, _x_) \
|
||||
if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
|
||||
|
@ -123,20 +121,20 @@ extern uint32_t DebugTraceLevel;
|
|||
|
||||
typedef struct _CFHEADER
|
||||
{
|
||||
uint32_t Signature; // File signature 'MSCF' (CAB_SIGNATURE)
|
||||
uint32_t Reserved1; // Reserved field
|
||||
uint32_t CabinetSize; // Cabinet file size
|
||||
uint32_t Reserved2; // Reserved field
|
||||
uint32_t FileTableOffset; // Offset of first CFFILE
|
||||
uint32_t Reserved3; // Reserved field
|
||||
uint16_t Version; // Cabinet version (CAB_VERSION)
|
||||
uint16_t FolderCount; // Number of folders
|
||||
uint16_t FileCount; // Number of files
|
||||
uint16_t Flags; // Cabinet flags (CAB_FLAG_*)
|
||||
uint16_t SetID; // Cabinet set id
|
||||
uint16_t CabinetNumber; // Zero-based cabinet number
|
||||
ULONG Signature; // File signature 'MSCF' (CAB_SIGNATURE)
|
||||
ULONG Reserved1; // Reserved field
|
||||
ULONG CabinetSize; // Cabinet file size
|
||||
ULONG Reserved2; // Reserved field
|
||||
ULONG FileTableOffset; // Offset of first CFFILE
|
||||
ULONG Reserved3; // Reserved field
|
||||
USHORT Version; // Cabinet version (CAB_VERSION)
|
||||
USHORT FolderCount; // Number of folders
|
||||
USHORT FileCount; // Number of files
|
||||
USHORT Flags; // Cabinet flags (CAB_FLAG_*)
|
||||
USHORT SetID; // Cabinet set id
|
||||
USHORT CabinetNumber; // Zero-based cabinet number
|
||||
/* 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 FileResSize // Per-file reserved area size
|
||||
char CabinetReserved[] // Per-cabinet reserved area
|
||||
|
@ -150,9 +148,9 @@ typedef struct _CFHEADER
|
|||
|
||||
typedef struct _CFFOLDER
|
||||
{
|
||||
uint32_t DataOffset; // Absolute offset of first CFDATA block in this folder
|
||||
uint16_t 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
|
||||
ULONG DataOffset; // Absolute offset of first CFDATA block in this folder
|
||||
USHORT DataBlockCount; // Number of CFDATA blocks in this folder in this cabinet
|
||||
USHORT CompressionType; // Type of compression used for all CFDATA blocks in this folder
|
||||
/* Optional fields (depends on Flags)
|
||||
char FolderReserved[] // Per-folder reserved area
|
||||
*/
|
||||
|
@ -161,21 +159,21 @@ typedef struct _CFFOLDER
|
|||
|
||||
typedef struct _CFFILE
|
||||
{
|
||||
uint32_t FileSize; // Uncompressed file size in bytes
|
||||
uint32_t FileOffset; // Uncompressed offset of file in the folder
|
||||
uint16_t FileControlID; // File control ID (CAB_FILE_*)
|
||||
uint16_t FileDate; // File date stamp, as used by DOS
|
||||
uint16_t FileTime; // File time stamp, as used by DOS
|
||||
uint16_t Attributes; // File attributes (CAB_ATTRIB_*)
|
||||
ULONG FileSize; // Uncompressed file size in bytes
|
||||
ULONG FileOffset; // Uncompressed offset of file in the folder
|
||||
USHORT FileControlID; // File control ID (CAB_FILE_*)
|
||||
USHORT FileDate; // File date stamp, as used by DOS
|
||||
USHORT FileTime; // File time stamp, as used by DOS
|
||||
USHORT Attributes; // File attributes (CAB_ATTRIB_*)
|
||||
/* After this is the NULL terminated filename */
|
||||
} CFFILE, *PCFFILE;
|
||||
|
||||
|
||||
typedef struct _CFDATA
|
||||
{
|
||||
uint32_t Checksum; // Checksum of CFDATA entry
|
||||
uint16_t CompSize; // Number of compressed bytes in this block
|
||||
uint16_t UncompSize; // Number of uncompressed bytes in this block
|
||||
ULONG Checksum; // Checksum of CFDATA entry
|
||||
USHORT CompSize; // Number of compressed bytes in this block
|
||||
USHORT UncompSize; // Number of uncompressed bytes in this block
|
||||
/* Optional fields (depends on Flags)
|
||||
char DataReserved[] // Per-datablock reserved area
|
||||
*/
|
||||
|
@ -185,9 +183,9 @@ typedef struct _CFDATA_NODE
|
|||
{
|
||||
struct _CFDATA_NODE *Next;
|
||||
struct _CFDATA_NODE *Prev;
|
||||
uint32_t ScratchFilePosition; // Absolute offset in scratch file
|
||||
uint32_t AbsoluteOffset; // Absolute offset in cabinet
|
||||
uint32_t UncompOffset; // Uncompressed offset in folder
|
||||
ULONG ScratchFilePosition; // Absolute offset in scratch file
|
||||
ULONG AbsoluteOffset; // Absolute offset in cabinet
|
||||
ULONG UncompOffset; // Uncompressed offset in folder
|
||||
CFDATA Data;
|
||||
} CFDATA_NODE, *PCFDATA_NODE;
|
||||
|
||||
|
@ -195,12 +193,12 @@ typedef struct _CFFOLDER_NODE
|
|||
{
|
||||
struct _CFFOLDER_NODE *Next;
|
||||
struct _CFFOLDER_NODE *Prev;
|
||||
uint32_t UncompOffset; // File size accumulator
|
||||
uint32_t AbsoluteOffset;
|
||||
uint32_t TotalFolderSize; // Total size of folder in current disk
|
||||
ULONG UncompOffset; // File size accumulator
|
||||
ULONG AbsoluteOffset;
|
||||
ULONG TotalFolderSize; // Total size of folder in current disk
|
||||
PCFDATA_NODE DataListHead;
|
||||
PCFDATA_NODE DataListTail;
|
||||
uint32_t Index;
|
||||
ULONG Index;
|
||||
bool Commit; // true if the folder should be committed
|
||||
bool Delete; // true if marked for deletion
|
||||
CFFOLDER Folder;
|
||||
|
@ -254,15 +252,15 @@ public:
|
|||
/* Default destructor */
|
||||
virtual ~CCABCodec() {};
|
||||
/* Compresses a data block */
|
||||
virtual uint32_t Compress(void* OutputBuffer,
|
||||
virtual ULONG Compress(void* OutputBuffer,
|
||||
void* InputBuffer,
|
||||
uint32_t InputLength,
|
||||
uint32_t* OutputLength) = 0;
|
||||
ULONG InputLength,
|
||||
PULONG OutputLength) = 0;
|
||||
/* Uncompresses a data block */
|
||||
virtual uint32_t Uncompress(void* OutputBuffer,
|
||||
virtual ULONG Uncompress(void* OutputBuffer,
|
||||
void* InputBuffer,
|
||||
uint32_t InputLength,
|
||||
uint32_t* OutputLength) = 0;
|
||||
ULONG InputLength,
|
||||
PULONG OutputLength) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -289,13 +287,13 @@ public:
|
|||
CCFDATAStorage();
|
||||
/* Default destructor */
|
||||
virtual ~CCFDATAStorage();
|
||||
uint32_t Create(char* FileName);
|
||||
uint32_t Destroy();
|
||||
uint32_t Truncate();
|
||||
uint32_t Position();
|
||||
uint32_t Seek(int32_t Position);
|
||||
uint32_t ReadBlock(PCFDATA Data, void* Buffer, uint32_t* BytesRead);
|
||||
uint32_t WriteBlock(PCFDATA Data, void* Buffer, uint32_t* BytesWritten);
|
||||
ULONG Create(char* FileName);
|
||||
ULONG Destroy();
|
||||
ULONG Truncate();
|
||||
ULONG Position();
|
||||
ULONG Seek(LONG Position);
|
||||
ULONG ReadBlock(PCFDATA Data, void* Buffer, PULONG BytesRead);
|
||||
ULONG WriteBlock(PCFDATA Data, void* Buffer, PULONG BytesWritten);
|
||||
private:
|
||||
char FullName[MAX_PATH];
|
||||
bool FileCreated;
|
||||
|
@ -319,7 +317,7 @@ public:
|
|||
/* Removes a filename from a fully qualified filename */
|
||||
void RemoveFileName(char* Path);
|
||||
/* Normalizes a path */
|
||||
bool NormalizePath(char* Path, uint32_t Length);
|
||||
bool NormalizePath(char* Path, ULONG Length);
|
||||
/* Returns name of cabinet file */
|
||||
char* GetCabinetName();
|
||||
/* Sets the name of the cabinet file */
|
||||
|
@ -333,40 +331,40 @@ public:
|
|||
/* Returns destination path */
|
||||
char* GetDestinationPath();
|
||||
/* Returns zero-based current disk number */
|
||||
uint32_t GetCurrentDiskNumber();
|
||||
ULONG GetCurrentDiskNumber();
|
||||
/* Opens the current cabinet file */
|
||||
uint32_t Open();
|
||||
ULONG Open();
|
||||
/* Closes the current open cabinet file */
|
||||
void Close();
|
||||
/* 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 */
|
||||
uint32_t FindNext(PCAB_SEARCH Search);
|
||||
ULONG FindNext(PCAB_SEARCH Search);
|
||||
/* Extracts a file from the current cabinet file */
|
||||
uint32_t ExtractFile(char* FileName);
|
||||
ULONG ExtractFile(char* FileName);
|
||||
/* Select codec engine to use */
|
||||
void SelectCodec(uint32_t Id);
|
||||
void SelectCodec(ULONG Id);
|
||||
#ifndef CAB_READ_ONLY
|
||||
/* Creates a new cabinet file */
|
||||
uint32_t NewCabinet();
|
||||
ULONG NewCabinet();
|
||||
/* Forces a new disk to be created */
|
||||
uint32_t NewDisk();
|
||||
ULONG NewDisk();
|
||||
/* Forces a new folder to be created */
|
||||
uint32_t NewFolder();
|
||||
ULONG NewFolder();
|
||||
/* Writes a file to scratch storage */
|
||||
uint32_t WriteFileToScratchStorage(PCFFILE_NODE FileNode);
|
||||
ULONG WriteFileToScratchStorage(PCFFILE_NODE FileNode);
|
||||
/* Forces the current disk to be written */
|
||||
uint32_t WriteDisk(uint32_t MoreDisks);
|
||||
ULONG WriteDisk(ULONG MoreDisks);
|
||||
/* Commits the current disk */
|
||||
uint32_t CommitDisk(uint32_t MoreDisks);
|
||||
ULONG CommitDisk(ULONG MoreDisks);
|
||||
/* Closes the current disk */
|
||||
uint32_t CloseDisk();
|
||||
ULONG CloseDisk();
|
||||
/* Closes the current cabinet */
|
||||
uint32_t CloseCabinet();
|
||||
ULONG CloseCabinet();
|
||||
/* Adds a file to the current disk */
|
||||
uint32_t AddFile(char* FileName);
|
||||
ULONG AddFile(char* FileName);
|
||||
/* Sets the maximum size of the current disk */
|
||||
void SetMaxDiskSize(uint32_t Size);
|
||||
void SetMaxDiskSize(ULONG Size);
|
||||
#endif /* CAB_READ_ONLY */
|
||||
|
||||
/* Default event handlers */
|
||||
|
@ -381,17 +379,17 @@ public:
|
|||
/* Handler called when a file is about to be added */
|
||||
virtual void OnAdd(PCFFILE Entry, char* FileName);
|
||||
/* 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 */
|
||||
virtual bool OnDiskLabel(uint32_t Number, char* Label);
|
||||
virtual bool OnDiskLabel(ULONG Number, char* Label);
|
||||
#endif /* CAB_READ_ONLY */
|
||||
private:
|
||||
PCFFOLDER_NODE LocateFolderNode(uint32_t Index);
|
||||
uint32_t GetAbsoluteOffset(PCFFILE_NODE File);
|
||||
uint32_t LocateFile(char* FileName, PCFFILE_NODE *File);
|
||||
uint32_t ReadString(char* String, uint32_t MaxLength);
|
||||
uint32_t ReadFileTable();
|
||||
uint32_t ReadDataBlocks(PCFFOLDER_NODE FolderNode);
|
||||
PCFFOLDER_NODE LocateFolderNode(ULONG Index);
|
||||
ULONG GetAbsoluteOffset(PCFFILE_NODE File);
|
||||
ULONG LocateFile(char* FileName, PCFFILE_NODE *File);
|
||||
ULONG ReadString(char* String, ULONG MaxLength);
|
||||
ULONG ReadFileTable();
|
||||
ULONG ReadDataBlocks(PCFFOLDER_NODE FolderNode);
|
||||
PCFFOLDER_NODE NewFolderNode();
|
||||
PCFFILE_NODE NewFileNode();
|
||||
PCFDATA_NODE NewDataNode(PCFFOLDER_NODE FolderNode);
|
||||
|
@ -400,45 +398,45 @@ private:
|
|||
void DestroyDeletedFileNodes();
|
||||
void DestroyFolderNodes();
|
||||
void DestroyDeletedFolderNodes();
|
||||
uint32_t ComputeChecksum(void* Buffer, unsigned int Size, uint32_t Seed);
|
||||
uint32_t ReadBlock(void* Buffer, uint32_t Size, uint32_t* BytesRead);
|
||||
ULONG ComputeChecksum(void* Buffer, ULONG Size, ULONG Seed);
|
||||
ULONG ReadBlock(void* Buffer, ULONG Size, PULONG BytesRead);
|
||||
#ifndef CAB_READ_ONLY
|
||||
uint32_t InitCabinetHeader();
|
||||
uint32_t WriteCabinetHeader(bool MoreDisks);
|
||||
uint32_t WriteFolderEntries();
|
||||
uint32_t WriteFileEntries();
|
||||
uint32_t CommitDataBlocks(PCFFOLDER_NODE FolderNode);
|
||||
uint32_t WriteDataBlock();
|
||||
uint32_t GetAttributesOnFile(PCFFILE_NODE File);
|
||||
uint32_t SetAttributesOnFile(PCFFILE_NODE File);
|
||||
uint32_t GetFileTimes(FILEHANDLE FileHandle, PCFFILE_NODE File);
|
||||
ULONG InitCabinetHeader();
|
||||
ULONG WriteCabinetHeader(bool MoreDisks);
|
||||
ULONG WriteFolderEntries();
|
||||
ULONG WriteFileEntries();
|
||||
ULONG CommitDataBlocks(PCFFOLDER_NODE FolderNode);
|
||||
ULONG WriteDataBlock();
|
||||
ULONG GetAttributesOnFile(PCFFILE_NODE File);
|
||||
ULONG SetAttributesOnFile(PCFFILE_NODE File);
|
||||
ULONG GetFileTimes(FILEHANDLE FileHandle, PCFFILE_NODE File);
|
||||
#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 /* CAB_READ_ONLY */
|
||||
uint32_t CurrentDiskNumber; // Zero based disk number
|
||||
ULONG CurrentDiskNumber; // Zero based disk number
|
||||
char CabinetName[256]; // Filename of current cabinet
|
||||
char CabinetPrev[256]; // Filename of previous cabinet
|
||||
char DiskPrev[256]; // Label of cabinet in file CabinetPrev
|
||||
char CabinetNext[256]; // Filename of next cabinet
|
||||
char DiskNext[256]; // Label of cabinet in file CabinetNext
|
||||
uint32_t TotalHeaderSize; // Size of header and optional fields
|
||||
uint32_t NextFieldsSize; // Size of next cabinet name and next disk label
|
||||
uint32_t TotalFolderSize; // Size of all folder entries
|
||||
uint32_t TotalFileSize; // Size of all file entries
|
||||
uint32_t FolderUncompSize; // Uncompressed size of folder
|
||||
uint32_t BytesLeftInBlock; // Number of bytes left in current block
|
||||
ULONG TotalHeaderSize; // Size of header and optional fields
|
||||
ULONG NextFieldsSize; // Size of next cabinet name and next disk label
|
||||
ULONG TotalFolderSize; // Size of all folder entries
|
||||
ULONG TotalFileSize; // Size of all file entries
|
||||
ULONG FolderUncompSize; // Uncompressed size of folder
|
||||
ULONG BytesLeftInBlock; // Number of bytes left in current block
|
||||
bool ReuseBlock;
|
||||
char DestPath[MAX_PATH];
|
||||
char CabinetReservedFile[MAX_PATH];
|
||||
void* CabinetReservedFileBuffer;
|
||||
uint32_t CabinetReservedFileSize;
|
||||
ULONG CabinetReservedFileSize;
|
||||
FILEHANDLE FileHandle;
|
||||
bool FileOpen;
|
||||
CFHEADER CABHeader;
|
||||
uint32_t CabinetReserved;
|
||||
uint32_t FolderReserved;
|
||||
uint32_t DataReserved;
|
||||
ULONG CabinetReserved;
|
||||
ULONG FolderReserved;
|
||||
ULONG DataReserved;
|
||||
PCFFOLDER_NODE FolderListHead;
|
||||
PCFFOLDER_NODE FolderListTail;
|
||||
PCFFOLDER_NODE CurrentFolderNode;
|
||||
|
@ -446,32 +444,32 @@ private:
|
|||
PCFFILE_NODE FileListHead;
|
||||
PCFFILE_NODE FileListTail;
|
||||
CCABCodec *Codec;
|
||||
uint32_t CodecId;
|
||||
ULONG CodecId;
|
||||
bool CodecSelected;
|
||||
void* InputBuffer;
|
||||
void* CurrentIBuffer; // Current offset in input buffer
|
||||
uint32_t CurrentIBufferSize; // Bytes left in input buffer
|
||||
ULONG CurrentIBufferSize; // Bytes left in input buffer
|
||||
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
|
||||
uint32_t CurrentOBufferSize; // Bytes left in output buffer
|
||||
uint32_t BytesLeftInCabinet;
|
||||
ULONG CurrentOBufferSize; // Bytes left in output buffer
|
||||
ULONG BytesLeftInCabinet;
|
||||
bool RestartSearch;
|
||||
uint32_t LastFileOffset; // Uncompressed offset of last extracted file
|
||||
ULONG LastFileOffset; // Uncompressed offset of last extracted file
|
||||
#ifndef CAB_READ_ONLY
|
||||
uint32_t LastBlockStart; // Uncompressed offset of last block in folder
|
||||
uint32_t MaxDiskSize;
|
||||
uint32_t DiskSize;
|
||||
uint32_t PrevCabinetNumber; // Previous cabinet number (where split file starts)
|
||||
ULONG LastBlockStart; // Uncompressed offset of last block in folder
|
||||
ULONG MaxDiskSize;
|
||||
ULONG DiskSize;
|
||||
ULONG PrevCabinetNumber; // Previous cabinet number (where split file starts)
|
||||
bool CreateNewDisk;
|
||||
bool CreateNewFolder;
|
||||
|
||||
CCFDATAStorage *ScratchFile;
|
||||
FILEHANDLE SourceFile;
|
||||
bool ContinueFile;
|
||||
uint32_t TotalBytesLeft;
|
||||
ULONG TotalBytesLeft;
|
||||
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 */
|
||||
};
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ private:
|
|||
virtual void OnAdd(PCFFILE Entry, char* FileName);
|
||||
/* Configuration */
|
||||
bool ProcessAll;
|
||||
uint32_t Mode;
|
||||
ULONG Mode;
|
||||
bool PromptOnOverwrite;
|
||||
char Location[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
|
||||
* 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 18/08-2007 Use typedefs64.h and the Windows types for compatibility with 64-bit operating systems
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
@ -21,31 +22,31 @@
|
|||
|
||||
#if defined(WIN32)
|
||||
#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)
|
||||
return -1;
|
||||
|
||||
return size;
|
||||
}
|
||||
#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);
|
||||
}
|
||||
#else
|
||||
#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);
|
||||
size = ftell(handle);
|
||||
fseek(handle, 0, SEEK_SET);
|
||||
return size;
|
||||
}
|
||||
#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);
|
||||
return *bytesread == size;
|
||||
|
@ -128,7 +129,7 @@ void CDFParser::WriteInfLine(char* InfLine)
|
|||
char eolbuf[2];
|
||||
char* destpath;
|
||||
#if defined(WIN32)
|
||||
uint32_t BytesWritten;
|
||||
ULONG BytesWritten;
|
||||
#endif
|
||||
|
||||
if (DontGenerateInf)
|
||||
|
@ -160,14 +161,14 @@ void CDFParser::WriteInfLine(char* InfLine)
|
|||
NULL); // No attribute template
|
||||
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;
|
||||
}
|
||||
#else /* !WIN32 */
|
||||
InfFileHandle = fopen(buf, "wb");
|
||||
if (InfFileHandle == NULL)
|
||||
{
|
||||
DPRINT(MID_TRACE, ("Error creating '%d'.\n", (unsigned int)errno));
|
||||
DPRINT(MID_TRACE, ("Error creating '%d'.\n", (ULONG)errno));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -176,7 +177,7 @@ void CDFParser::WriteInfLine(char* InfLine)
|
|||
#if defined(WIN32)
|
||||
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;
|
||||
}
|
||||
#else
|
||||
|
@ -190,7 +191,7 @@ void CDFParser::WriteInfLine(char* InfLine)
|
|||
#if defined(WIN32)
|
||||
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;
|
||||
}
|
||||
#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
|
||||
* ARGUMENTS:
|
||||
|
@ -209,8 +210,8 @@ uint32_t CDFParser::Load(char* FileName)
|
|||
* Status of operation
|
||||
*/
|
||||
{
|
||||
uint32_t BytesRead;
|
||||
int32_t FileSize;
|
||||
ULONG BytesRead;
|
||||
LONG FileSize;
|
||||
|
||||
if (FileLoaded)
|
||||
return CAB_STATUS_SUCCESS;
|
||||
|
@ -239,7 +240,7 @@ uint32_t CDFParser::Load(char* FileName)
|
|||
return CAB_STATUS_CANNOT_OPEN;
|
||||
}
|
||||
|
||||
FileBufferSize = (uint32_t)FileSize;
|
||||
FileBufferSize = (ULONG)FileSize;
|
||||
|
||||
FileBuffer = (char*)AllocateMemory(FileBufferSize);
|
||||
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
|
||||
* RETURNS:
|
||||
|
@ -274,7 +275,7 @@ uint32_t CDFParser::Parse()
|
|||
*/
|
||||
{
|
||||
bool Command;
|
||||
uint32_t Status;
|
||||
ULONG Status;
|
||||
|
||||
if (!FileLoaded)
|
||||
return CAB_STATUS_NOFILE;
|
||||
|
@ -346,7 +347,7 @@ uint32_t CDFParser::Parse()
|
|||
|
||||
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"));
|
||||
}
|
||||
|
||||
|
@ -360,7 +361,7 @@ uint32_t CDFParser::Parse()
|
|||
|
||||
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"));
|
||||
}
|
||||
|
||||
|
@ -381,8 +382,8 @@ uint32_t CDFParser::Parse()
|
|||
break;
|
||||
|
||||
default:
|
||||
printf("Directive file contains errors at line %d.\n", (unsigned int)CurrentLine);
|
||||
DPRINT(MID_TRACE, ("Token is (%d).\n", (unsigned int)CurrentToken));
|
||||
printf("Directive file contains errors at line %d.\n", (ULONG)CurrentLine);
|
||||
DPRINT(MID_TRACE, ("Token is (%d).\n", (ULONG)CurrentToken));
|
||||
return CAB_STATUS_SUCCESS;
|
||||
}
|
||||
NextToken();
|
||||
|
@ -401,7 +402,7 @@ uint32_t CDFParser::Parse()
|
|||
Status = CloseDisk();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -411,7 +412,7 @@ uint32_t CDFParser::Parse()
|
|||
Status = CloseCabinet();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
* ARGUMENTS:
|
||||
|
@ -448,13 +449,13 @@ bool CDFParser::OnDiskLabel(uint32_t Number, char* Label)
|
|||
*/
|
||||
{
|
||||
char Buffer[20];
|
||||
unsigned int i;
|
||||
ULONG i;
|
||||
int j;
|
||||
char ch;
|
||||
|
||||
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))
|
||||
return true;
|
||||
|
@ -470,7 +471,7 @@ bool CDFParser::OnDiskLabel(uint32_t Number, char* Label)
|
|||
{
|
||||
sprintf(Buffer, "%lu", Number);
|
||||
strcat(Label, Buffer);
|
||||
j += (int)strlen(Buffer);
|
||||
j += (LONG)strlen(Buffer);
|
||||
}
|
||||
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
|
||||
* ARGUMENTS:
|
||||
|
@ -500,13 +501,13 @@ bool CDFParser::OnCabinetName(uint32_t Number, char* Name)
|
|||
*/
|
||||
{
|
||||
char Buffer[MAX_PATH];
|
||||
unsigned int i;
|
||||
ULONG i;
|
||||
int j;
|
||||
char ch;
|
||||
|
||||
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))
|
||||
{
|
||||
|
@ -518,7 +519,7 @@ bool CDFParser::OnCabinetName(uint32_t Number, char* Name)
|
|||
if (CabinetNameTemplateSet)
|
||||
{
|
||||
strcpy(Name, GetDestinationPath());
|
||||
j = (int)strlen(Name);
|
||||
j = (LONG)strlen(Name);
|
||||
for (i = 0; i < strlen(CabinetNameTemplate); i++)
|
||||
{
|
||||
ch = CabinetNameTemplate[i];
|
||||
|
@ -526,7 +527,7 @@ bool CDFParser::OnCabinetName(uint32_t Number, char* Name)
|
|||
{
|
||||
sprintf(Buffer, "%lu", Number);
|
||||
strcat(Name, Buffer);
|
||||
j += (int)strlen(Buffer);
|
||||
j += (LONG)strlen(Buffer);
|
||||
}
|
||||
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
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* ARGUMENTS:
|
||||
|
@ -686,7 +687,7 @@ bool CDFParser::DoDiskLabel(uint32_t Number, char* Label)
|
|||
* 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);
|
||||
}
|
||||
|
@ -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
|
||||
* ARGUMENTS:
|
||||
|
@ -716,7 +717,7 @@ bool CDFParser::DoCabinetName(uint32_t Number, char* Name)
|
|||
* 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);
|
||||
}
|
||||
|
@ -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
|
||||
* 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
|
||||
*/
|
||||
{
|
||||
uint32_t A, B, Value;
|
||||
ULONG A, B, Value;
|
||||
|
||||
if (IsNextToken(TokenInteger, true))
|
||||
{
|
||||
|
@ -853,14 +854,14 @@ void CDFParser::DoInfFileName(char* FileName)
|
|||
InfFileNameSet = true;
|
||||
}
|
||||
|
||||
uint32_t CDFParser::SetupNewDisk()
|
||||
ULONG CDFParser::SetupNewDisk()
|
||||
/*
|
||||
* FUNCTION: Sets up parameters for a new disk
|
||||
* RETURNS:
|
||||
* Status of operation
|
||||
*/
|
||||
{
|
||||
uint32_t Value;
|
||||
ULONG 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
|
||||
* RETURNS:
|
||||
|
@ -884,7 +885,7 @@ uint32_t CDFParser::PerformSetCommand()
|
|||
{
|
||||
SETTYPE SetType;
|
||||
bool NumberValid = false;
|
||||
uint32_t Number = 0;
|
||||
ULONG Number = 0;
|
||||
|
||||
if (!IsNextToken(TokenIdentifier, true))
|
||||
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
|
||||
* RETURNS:
|
||||
|
@ -979,7 +980,7 @@ uint32_t CDFParser::PerformNewCommand()
|
|||
*/
|
||||
{
|
||||
NEWTYPE NewType;
|
||||
uint32_t Status;
|
||||
ULONG Status;
|
||||
|
||||
if (!IsNextToken(TokenIdentifier, true))
|
||||
return CAB_STATUS_FAILURE;
|
||||
|
@ -1003,7 +1004,7 @@ uint32_t CDFParser::PerformNewCommand()
|
|||
Status = CloseDisk();
|
||||
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;
|
||||
}
|
||||
DiskCreated = false;
|
||||
|
@ -1012,7 +1013,7 @@ uint32_t CDFParser::PerformNewCommand()
|
|||
Status = NewDisk();
|
||||
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;
|
||||
}
|
||||
DiskCreated = true;
|
||||
|
@ -1027,7 +1028,7 @@ uint32_t CDFParser::PerformNewCommand()
|
|||
Status = CloseDisk();
|
||||
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;
|
||||
}
|
||||
DiskCreated = false;
|
||||
|
@ -1036,7 +1037,7 @@ uint32_t CDFParser::PerformNewCommand()
|
|||
Status = NewCabinet();
|
||||
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;
|
||||
}
|
||||
DiskCreated = true;
|
||||
|
@ -1054,7 +1055,7 @@ uint32_t CDFParser::PerformNewCommand()
|
|||
}
|
||||
|
||||
|
||||
uint32_t CDFParser::PerformInfBeginCommand()
|
||||
ULONG CDFParser::PerformInfBeginCommand()
|
||||
/*
|
||||
* FUNCTION: Begins inf mode
|
||||
* RETURNS:
|
||||
|
@ -1066,7 +1067,7 @@ uint32_t CDFParser::PerformInfBeginCommand()
|
|||
}
|
||||
|
||||
|
||||
uint32_t CDFParser::PerformInfEndCommand()
|
||||
ULONG CDFParser::PerformInfEndCommand()
|
||||
/*
|
||||
* FUNCTION: Begins inf mode
|
||||
* RETURNS:
|
||||
|
@ -1078,7 +1079,7 @@ uint32_t CDFParser::PerformInfEndCommand()
|
|||
}
|
||||
|
||||
|
||||
uint32_t CDFParser::PerformCommand()
|
||||
ULONG CDFParser::PerformCommand()
|
||||
/*
|
||||
* FUNCTION: Performs a command
|
||||
* RETURNS:
|
||||
|
@ -1098,15 +1099,15 @@ uint32_t CDFParser::PerformCommand()
|
|||
}
|
||||
|
||||
|
||||
uint32_t CDFParser::PerformFileCopy()
|
||||
ULONG CDFParser::PerformFileCopy()
|
||||
/*
|
||||
* FUNCTION: Performs a file copy
|
||||
* RETURNS:
|
||||
* Status of operation
|
||||
*/
|
||||
{
|
||||
uint32_t Status;
|
||||
uint32_t i, j;
|
||||
ULONG Status;
|
||||
ULONG i, j;
|
||||
char ch;
|
||||
char SrcName[MAX_PATH];
|
||||
char DstName[MAX_PATH];
|
||||
|
@ -1139,7 +1140,7 @@ uint32_t CDFParser::PerformFileCopy()
|
|||
|
||||
if (CurrentToken != TokenEnd)
|
||||
{
|
||||
j = (uint32_t)strlen(CurrentString); i = 0;
|
||||
j = (ULONG)strlen(CurrentString); i = 0;
|
||||
while ((CurrentChar + i < LineLength) &&
|
||||
((ch = Line[CurrentChar + i]) != ' ') &&
|
||||
(ch != 0x09) &&
|
||||
|
@ -1159,7 +1160,7 @@ uint32_t CDFParser::PerformFileCopy()
|
|||
|
||||
if (CurrentToken != TokenEnd)
|
||||
{
|
||||
j = (uint32_t)strlen(CurrentString); i = 0;
|
||||
j = (ULONG)strlen(CurrentString); i = 0;
|
||||
while ((CurrentChar + i < LineLength) &&
|
||||
((ch = Line[CurrentChar + i]) != ' ') &&
|
||||
(ch != 0x09) &&
|
||||
|
@ -1181,7 +1182,7 @@ uint32_t CDFParser::PerformFileCopy()
|
|||
Status = NewCabinet();
|
||||
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");
|
||||
return CAB_STATUS_FAILURE;
|
||||
}
|
||||
|
@ -1192,7 +1193,7 @@ uint32_t CDFParser::PerformFileCopy()
|
|||
Status = NewDisk();
|
||||
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");
|
||||
return CAB_STATUS_FAILURE;
|
||||
}
|
||||
|
@ -1275,7 +1276,7 @@ bool CDFParser::ReadLine()
|
|||
* true if there is a new line, false if not
|
||||
*/
|
||||
{
|
||||
uint32_t i, j;
|
||||
ULONG i, j;
|
||||
char ch;
|
||||
|
||||
if (CurrentOffset >= FileBufferSize)
|
||||
|
@ -1312,7 +1313,7 @@ void CDFParser::NextToken()
|
|||
* FUNCTION: Reads the next token from the current line
|
||||
*/
|
||||
{
|
||||
uint32_t i;
|
||||
ULONG i;
|
||||
char ch = ' ';
|
||||
|
||||
if (CurrentChar >= LineLength)
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
|
||||
typedef struct _CABINET_NAME {
|
||||
struct _CABINET_NAME *Next;
|
||||
uint32_t DiskNumber;
|
||||
ULONG DiskNumber;
|
||||
char Name[128];
|
||||
} CABINET_NAME, *PCABINET_NAME;
|
||||
|
||||
typedef struct _DISK_NUMBER {
|
||||
struct _DISK_NUMBER *Next;
|
||||
uint32_t DiskNumber;
|
||||
uint32_t Number;
|
||||
ULONG DiskNumber;
|
||||
ULONG Number;
|
||||
} DISK_NUMBER, *PDISK_NUMBER;
|
||||
|
||||
typedef enum {
|
||||
|
@ -58,35 +58,35 @@ class CDFParser : public CCabinet {
|
|||
public:
|
||||
CDFParser();
|
||||
virtual ~CDFParser();
|
||||
uint32_t Load(char* FileName);
|
||||
uint32_t Parse();
|
||||
ULONG Load(char* FileName);
|
||||
ULONG Parse();
|
||||
void SetFileRelativePath(char* Path);
|
||||
bool InfFileOnly;
|
||||
bool DontGenerateInf;
|
||||
char FileRelativePath[300];
|
||||
private:
|
||||
/* Event handlers */
|
||||
virtual bool OnDiskLabel(uint32_t Number, char* Label);
|
||||
virtual bool OnCabinetName(uint32_t Number, char* Name);
|
||||
virtual bool OnDiskLabel(ULONG Number, char* Label);
|
||||
virtual bool OnCabinetName(ULONG Number, char* Name);
|
||||
|
||||
void WriteInfLine(char* InfLine);
|
||||
bool SetDiskName(PCABINET_NAME *List, uint32_t Number, char* String);
|
||||
bool GetDiskName(PCABINET_NAME *List, uint32_t Number, char* String);
|
||||
bool SetDiskNumber(PDISK_NUMBER *List, uint32_t Number, uint32_t Value);
|
||||
bool GetDiskNumber(PDISK_NUMBER *List, uint32_t Number, uint32_t* Value);
|
||||
bool DoDiskLabel(uint32_t Number, char* Label);
|
||||
bool SetDiskName(PCABINET_NAME *List, ULONG Number, char* String);
|
||||
bool GetDiskName(PCABINET_NAME *List, ULONG Number, char* String);
|
||||
bool SetDiskNumber(PDISK_NUMBER *List, ULONG Number, ULONG Value);
|
||||
bool GetDiskNumber(PDISK_NUMBER *List, ULONG Number, PULONG Value);
|
||||
bool DoDiskLabel(ULONG Number, char* Label);
|
||||
void DoDiskLabelTemplate(char* Template);
|
||||
bool DoCabinetName(uint32_t Number, char* Name);
|
||||
bool DoCabinetName(ULONG Number, char* Name);
|
||||
void DoCabinetNameTemplate(char* Template);
|
||||
void DoInfFileName(char* InfFileName);
|
||||
uint32_t DoMaxDiskSize(bool NumberValid, uint32_t Number);
|
||||
uint32_t SetupNewDisk();
|
||||
uint32_t PerformSetCommand();
|
||||
uint32_t PerformNewCommand();
|
||||
uint32_t PerformInfBeginCommand();
|
||||
uint32_t PerformInfEndCommand();
|
||||
uint32_t PerformCommand();
|
||||
uint32_t PerformFileCopy();
|
||||
ULONG DoMaxDiskSize(bool NumberValid, ULONG Number);
|
||||
ULONG SetupNewDisk();
|
||||
ULONG PerformSetCommand();
|
||||
ULONG PerformNewCommand();
|
||||
ULONG PerformInfBeginCommand();
|
||||
ULONG PerformInfEndCommand();
|
||||
ULONG PerformCommand();
|
||||
ULONG PerformFileCopy();
|
||||
void SkipSpaces();
|
||||
bool IsNextToken(DFP_TOKEN Token, bool NoSpaces);
|
||||
bool ReadLine();
|
||||
|
@ -95,15 +95,15 @@ private:
|
|||
bool FileLoaded;
|
||||
FILEHANDLE FileHandle;
|
||||
char* FileBuffer;
|
||||
uint32_t FileBufferSize;
|
||||
uint32_t CurrentOffset;
|
||||
ULONG FileBufferSize;
|
||||
ULONG CurrentOffset;
|
||||
char Line[128];
|
||||
uint32_t LineLength;
|
||||
uint32_t CurrentLine;
|
||||
uint32_t CurrentChar;
|
||||
ULONG LineLength;
|
||||
ULONG CurrentLine;
|
||||
ULONG CurrentChar;
|
||||
/* Token */
|
||||
DFP_TOKEN CurrentToken;
|
||||
uint32_t CurrentInteger;
|
||||
ULONG CurrentInteger;
|
||||
char CurrentString[256];
|
||||
|
||||
/* State */
|
||||
|
@ -112,27 +112,27 @@ private:
|
|||
bool FolderCreated;
|
||||
/* Standard directive variable */
|
||||
bool Cabinet;
|
||||
uint32_t CabinetFileCountThreshold;
|
||||
ULONG CabinetFileCountThreshold;
|
||||
PCABINET_NAME CabinetName;
|
||||
bool CabinetNameTemplateSet;
|
||||
char CabinetNameTemplate[128];
|
||||
bool InfFileNameSet;
|
||||
char InfFileName[256];
|
||||
bool Compress;
|
||||
uint32_t CompressionType;
|
||||
ULONG CompressionType;
|
||||
PCABINET_NAME DiskLabel;
|
||||
bool DiskLabelTemplateSet;
|
||||
char DiskLabelTemplate[128];
|
||||
uint32_t FolderFileCountThreshold;
|
||||
uint32_t FolderSizeThreshold;
|
||||
uint32_t MaxCabinetSize;
|
||||
uint32_t MaxDiskFileCount;
|
||||
ULONG FolderFileCountThreshold;
|
||||
ULONG FolderSizeThreshold;
|
||||
ULONG MaxCabinetSize;
|
||||
ULONG MaxDiskFileCount;
|
||||
PDISK_NUMBER MaxDiskSize;
|
||||
bool MaxDiskSizeAllSet;
|
||||
uint32_t MaxDiskSizeAll;
|
||||
uint32_t ReservePerCabinetSize;
|
||||
uint32_t ReservePerDataBlockSize;
|
||||
uint32_t ReservePerFolderSize;
|
||||
ULONG MaxDiskSizeAll;
|
||||
ULONG ReservePerCabinetSize;
|
||||
ULONG ReservePerDataBlockSize;
|
||||
ULONG ReservePerFolderSize;
|
||||
char SourceDir[256];
|
||||
FILEHANDLE InfFileHandle;
|
||||
bool InfModeEnabled;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* 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 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 <stdarg.h>
|
||||
|
@ -20,9 +21,9 @@
|
|||
|
||||
#ifdef DBG
|
||||
|
||||
uint32_t DebugTraceLevel = MIN_TRACE;
|
||||
//uint32_t DebugTraceLevel = MID_TRACE;
|
||||
//uint32_t DebugTraceLevel = MAX_TRACE;
|
||||
ULONG DebugTraceLevel = MIN_TRACE;
|
||||
//ULONG DebugTraceLevel = MID_TRACE;
|
||||
//ULONG DebugTraceLevel = MAX_TRACE;
|
||||
|
||||
#endif /* DBG */
|
||||
|
||||
|
@ -30,7 +31,7 @@ uint32_t DebugTraceLevel = MIN_TRACE;
|
|||
#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
|
||||
* ARGUMENTS:
|
||||
|
@ -43,9 +44,9 @@ char* Pad(char* Str, char PadChar, unsigned int Length)
|
|||
* 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)
|
||||
{
|
||||
|
@ -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
|
||||
* ARGUMENTS:
|
||||
|
@ -66,7 +67,7 @@ char* Date2Str(char* Str, uint16_t Date)
|
|||
* Pointer to string
|
||||
*/
|
||||
{
|
||||
uint32_t dw;
|
||||
ULONG dw;
|
||||
|
||||
/* Month */
|
||||
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
|
||||
* ARGUMENTS:
|
||||
|
@ -98,8 +99,8 @@ char* Time2Str(char* Str, uint16_t Time)
|
|||
*/
|
||||
{
|
||||
bool PM;
|
||||
uint32_t Hour;
|
||||
uint32_t dw;
|
||||
ULONG Hour;
|
||||
ULONG dw;
|
||||
|
||||
Hour = ((Time & 0xF800) >> 11);
|
||||
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
|
||||
* ARGUMENTS:
|
||||
|
@ -365,7 +366,7 @@ bool CCABManager::CreateCabinet()
|
|||
* FUNCTION: Create cabinet
|
||||
*/
|
||||
{
|
||||
uint32_t Status;
|
||||
ULONG Status;
|
||||
|
||||
Status = Load((char*)&FileName);
|
||||
if (Status != CAB_STATUS_SUCCESS)
|
||||
|
@ -385,19 +386,19 @@ bool CCABManager::CreateSimpleCabinet()
|
|||
* FUNCTION: Create cabinet
|
||||
*/
|
||||
{
|
||||
uint32_t Status;
|
||||
ULONG Status;
|
||||
|
||||
Status = NewCabinet();
|
||||
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;
|
||||
}
|
||||
|
||||
Status = AddFile(FileName);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -406,7 +407,7 @@ bool CCABManager::CreateSimpleCabinet()
|
|||
Status = CloseDisk();
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -423,8 +424,8 @@ bool CCABManager::DisplayCabinet()
|
|||
{
|
||||
CAB_SEARCH Search;
|
||||
char Str[20];
|
||||
uint32_t FileCount = 0;
|
||||
uint32_t ByteCount = 0;
|
||||
ULONG FileCount = 0;
|
||||
ULONG ByteCount = 0;
|
||||
|
||||
if (Open() == CAB_STATUS_SUCCESS)
|
||||
{
|
||||
|
@ -486,7 +487,7 @@ bool CCABManager::ExtractFromCabinet()
|
|||
*/
|
||||
{
|
||||
CAB_SEARCH Search;
|
||||
uint32_t Status;
|
||||
ULONG Status;
|
||||
|
||||
if (Open() == CAB_STATUS_SUCCESS)
|
||||
{
|
||||
|
@ -513,7 +514,7 @@ bool CCABManager::ExtractFromCabinet()
|
|||
return false;
|
||||
|
||||
default:
|
||||
printf("Unspecified error code (%d).\n", (unsigned int)Status);
|
||||
printf("Unspecified error code (%d).\n", (ULONG)Status);
|
||||
return false;
|
||||
}
|
||||
} while (FindNext(&Search) == CAB_STATUS_SUCCESS);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* 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 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 "mszip.h"
|
||||
|
@ -53,10 +54,10 @@ CMSZipCodec::~CMSZipCodec()
|
|||
}
|
||||
|
||||
|
||||
uint32_t CMSZipCodec::Compress(void* OutputBuffer,
|
||||
ULONG CMSZipCodec::Compress(void* OutputBuffer,
|
||||
void* InputBuffer,
|
||||
uint32_t InputLength,
|
||||
uint32_t* OutputLength)
|
||||
ULONG InputLength,
|
||||
PULONG OutputLength)
|
||||
/*
|
||||
* FUNCTION: Compresses data in a buffer
|
||||
* ARGUMENTS:
|
||||
|
@ -66,16 +67,16 @@ uint32_t CMSZipCodec::Compress(void* OutputBuffer,
|
|||
* OutputLength = Address of buffer to place size of compressed data
|
||||
*/
|
||||
{
|
||||
uint16_t* Magic;
|
||||
PUSHORT Magic;
|
||||
|
||||
DPRINT(MAX_TRACE, ("InputLength (%lu).\n", InputLength));
|
||||
|
||||
Magic = (uint16_t*)OutputBuffer;
|
||||
Magic = (PUSHORT)OutputBuffer;
|
||||
*Magic = MSZIP_MAGIC;
|
||||
|
||||
ZStream.next_in = (unsigned char*)InputBuffer;
|
||||
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;
|
||||
|
||||
/* 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,
|
||||
uint32_t InputLength,
|
||||
uint32_t* OutputLength)
|
||||
ULONG InputLength,
|
||||
PULONG OutputLength)
|
||||
/*
|
||||
* FUNCTION: Uncompresses data in a buffer
|
||||
* ARGUMENTS:
|
||||
|
@ -126,11 +127,11 @@ uint32_t CMSZipCodec::Uncompress(void* OutputBuffer,
|
|||
* OutputLength = Address of buffer to place size of uncompressed data
|
||||
*/
|
||||
{
|
||||
uint16_t Magic;
|
||||
USHORT Magic;
|
||||
|
||||
DPRINT(MAX_TRACE, ("InputLength (%lu).\n", InputLength));
|
||||
|
||||
Magic = *((uint16_t*)InputBuffer);
|
||||
Magic = *((PUSHORT)InputBuffer);
|
||||
|
||||
if (Magic != MSZIP_MAGIC)
|
||||
{
|
||||
|
@ -138,7 +139,7 @@ uint32_t CMSZipCodec::Uncompress(void* OutputBuffer,
|
|||
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.next_out = (unsigned char*)OutputBuffer;
|
||||
ZStream.avail_out = CAB_BLOCKSIZE + 12;
|
||||
|
|
|
@ -22,15 +22,15 @@ public:
|
|||
/* Default destructor */
|
||||
virtual ~CMSZipCodec();
|
||||
/* Compresses a data block */
|
||||
virtual uint32_t Compress(void* OutputBuffer,
|
||||
virtual ULONG Compress(void* OutputBuffer,
|
||||
void* InputBuffer,
|
||||
uint32_t InputLength,
|
||||
uint32_t* OutputLength);
|
||||
ULONG InputLength,
|
||||
PULONG OutputLength);
|
||||
/* Uncompresses a data block */
|
||||
virtual uint32_t Uncompress(void* OutputBuffer,
|
||||
virtual ULONG Uncompress(void* OutputBuffer,
|
||||
void* InputBuffer,
|
||||
uint32_t InputLength,
|
||||
uint32_t* OutputLength);
|
||||
ULONG InputLength,
|
||||
PULONG OutputLength);
|
||||
private:
|
||||
int Status;
|
||||
z_stream ZStream; /* Zlib stream */
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* 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 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"
|
||||
|
||||
|
@ -32,10 +33,10 @@ CRawCodec::~CRawCodec()
|
|||
}
|
||||
|
||||
|
||||
uint32_t CRawCodec::Compress(void* OutputBuffer,
|
||||
void* InputBuffer,
|
||||
uint32_t InputLength,
|
||||
uint32_t* OutputLength)
|
||||
ULONG CRawCodec::Compress(void* OutputBuffer,
|
||||
void* InputBuffer,
|
||||
ULONG InputLength,
|
||||
PULONG OutputLength)
|
||||
/*
|
||||
* FUNCTION: Compresses data in a buffer
|
||||
* ARGUMENTS:
|
||||
|
@ -50,10 +51,10 @@ uint32_t CRawCodec::Compress(void* OutputBuffer,
|
|||
return CS_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t CRawCodec::Uncompress(void* OutputBuffer,
|
||||
void* InputBuffer,
|
||||
uint32_t InputLength,
|
||||
uint32_t* OutputLength)
|
||||
ULONG CRawCodec::Uncompress(void* OutputBuffer,
|
||||
void* InputBuffer,
|
||||
ULONG InputLength,
|
||||
PULONG OutputLength)
|
||||
/*
|
||||
* FUNCTION: Uncompresses data in a buffer
|
||||
* ARGUMENTS:
|
||||
|
|
|
@ -19,15 +19,15 @@ public:
|
|||
/* Default destructor */
|
||||
virtual ~CRawCodec();
|
||||
/* Compresses a data block */
|
||||
virtual uint32_t Compress(void* OutputBuffer,
|
||||
virtual ULONG Compress(void* OutputBuffer,
|
||||
void* InputBuffer,
|
||||
uint32_t InputLength,
|
||||
uint32_t* OutputLength);
|
||||
ULONG InputLength,
|
||||
PULONG OutputLength);
|
||||
/* Uncompresses a data block */
|
||||
virtual uint32_t Uncompress(void* OutputBuffer,
|
||||
virtual ULONG Uncompress(void* OutputBuffer,
|
||||
void* InputBuffer,
|
||||
uint32_t InputLength,
|
||||
uint32_t* OutputLength);
|
||||
ULONG InputLength,
|
||||
PULONG OutputLength);
|
||||
};
|
||||
|
||||
#endif /* __RAW_H */
|
||||
|
|
Loading…
Reference in a new issue