Author: cfinck
Date: Sat Aug 18 17:08:58 2007
New Revision: 28393
URL: 
http://svn.reactos.org/svn/reactos?rev=28393&view=rev
Log:
- 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.
Added:
    trunk/reactos/tools/cabman/cabman.sln
    trunk/reactos/tools/cabman/cabman.vcproj
Modified:
    trunk/reactos/tools/cabman/cabinet.cxx
    trunk/reactos/tools/cabman/cabinet.h
    trunk/reactos/tools/cabman/cabman.h
    trunk/reactos/tools/cabman/dfp.cxx
    trunk/reactos/tools/cabman/dfp.h
    trunk/reactos/tools/cabman/main.cxx
    trunk/reactos/tools/cabman/mszip.cxx
    trunk/reactos/tools/cabman/mszip.h
    trunk/reactos/tools/cabman/raw.cxx
    trunk/reactos/tools/cabman/raw.h
Modified: trunk/reactos/tools/cabman/cabinet.cxx
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/cabinet.cxx?r…
==============================================================================
--- trunk/reactos/tools/cabman/cabinet.cxx (original)
+++ trunk/reactos/tools/cabman/cabinet.cxx Sat Aug 18 17:08:58 2007
@@ -11,6 +11,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
  * TODO:
  *   - Checksum of datablocks should be calculated
  *   - EXTRACT.EXE complains if a disk is created manually
@@ -28,31 +29,31 @@
 #if defined(WIN32)
 #define GetSizeOfFile(handle) _GetSizeOfFile(handle)
-static int32_t _GetSizeOfFile(FILEHANDLE handle)
-{
-       uint32_t size = GetFileSize(handle, NULL);
+static LONG _GetSizeOfFile(FILEHANDLE handle)
+{
+       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) != 0;
 }
 #else
 #define GetSizeOfFile(handle) _GetSizeOfFile(handle)
-static int32_t _GetSizeOfFile(FILEHANDLE handle)
-{
-       int32_t size;
+static LONG _GetSizeOfFile(FILEHANDLE handle)
+{
+       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;
@@ -64,10 +65,10 @@
 #if 0
 #ifdef DBG
-void DumpBuffer(void* Buffer, uint32_t Size)
+void DumpBuffer(void* Buffer, ULONG Size)
 {
        FILEHANDLE FileHandle;
-       uint32_t BytesWritten;
+       ULONG BytesWritten;
        /* Create file, overwrite if it already exists */
        FileHandle = CreateFile("dump.bin", // Create this file
@@ -79,13 +80,13 @@
                NULL);                          // No attribute template
        if (FileHandle == INVALID_HANDLE_VALUE)
        {
-               DPRINT(MID_TRACE, ("ERROR OPENING '%d'.\n", (unsigned
int)GetLastError()));
+               DPRINT(MID_TRACE, ("ERROR OPENING '%d'.\n",
(ULONG)GetLastError()));
                return;
        }
        if (!WriteFile(FileHandle, Buffer, Size, &BytesWritten, NULL))
        {
-               DPRINT(MID_TRACE, ("ERROR WRITING '%d'.\n", (unsigned
int)GetLastError()));
+               DPRINT(MID_TRACE, ("ERROR WRITING '%d'.\n",
(ULONG)GetLastError()));
        }
        CloseFile(FileHandle);
@@ -114,7 +115,7 @@
 }
-uint32_t CCFDATAStorage::Create(char* FileName)
+ULONG CCFDATAStorage::Create(char* FileName)
 /*
  * FUNCTION: Creates the file
  * ARGUMENTS:
@@ -143,7 +144,7 @@
                NULL);                          // No attribute template
        if (FileHandle == INVALID_HANDLE_VALUE)
        {
-               DPRINT(MID_TRACE, ("ERROR '%d'.\n", (unsigned
int)GetLastError()));
+               DPRINT(MID_TRACE, ("ERROR '%d'.\n",
(ULONG)GetLastError()));
                return CAB_STATUS_CANNOT_CREATE;
        }
 #else /* !WIN32 */
@@ -153,7 +154,7 @@
                /*
        FileHandle = fopen(FullName, "w+b");
        if (FileHandle == NULL) {
-               DPRINT(MID_TRACE, ("ERROR '%d'.\n", (unsigned
int)errno));
+               DPRINT(MID_TRACE, ("ERROR '%d'.\n", (ULONG)errno));
                return CAB_STATUS_CANNOT_CREATE;
        }
                */
@@ -165,7 +166,7 @@
 }
-uint32_t CCFDATAStorage::Destroy()
+ULONG CCFDATAStorage::Destroy()
 /*
  * FUNCTION: Destroys the file
  * RETURNS:
@@ -182,7 +183,7 @@
 }
-uint32_t CCFDATAStorage::Truncate()
+ULONG CCFDATAStorage::Truncate()
 /*
  * FUNCTION: Truncate the scratch file to zero bytes
  * RETURNS:
@@ -199,7 +200,7 @@
        FileHandle = tmpfile();
        if (FileHandle == NULL)
        {
-               DPRINT(MID_TRACE, ("ERROR '%d'.\n", (unsigned
int)errno));
+               DPRINT(MID_TRACE, ("ERROR '%d'.\n", (ULONG)errno));
                return CAB_STATUS_FAILURE;
        }
 #endif
@@ -207,7 +208,7 @@
 }
-uint32_t CCFDATAStorage::Position()
+ULONG CCFDATAStorage::Position()
 /*
  * FUNCTION: Returns current position in file
  * RETURNS:
@@ -217,12 +218,12 @@
 #if defined(WIN32)
        return SetFilePointer(FileHandle, 0, NULL, FILE_CURRENT);
 #else
-       return (uint32_t)ftell(FileHandle);
-#endif
-}
-
-
-uint32_t CCFDATAStorage::Seek(int32_t Position)
+       return (ULONG)ftell(FileHandle);
+#endif
+}
+
+
+ULONG CCFDATAStorage::Seek(LONG Position)
 /*
  * FUNCTION: Seeks to an absolute position
  * ARGUMENTS:
@@ -248,7 +249,7 @@
 }
-uint32_t CCFDATAStorage::ReadBlock(PCFDATA Data, void* Buffer, uint32_t* BytesRead)
+ULONG CCFDATAStorage::ReadBlock(PCFDATA Data, void* Buffer, PULONG BytesRead)
 /*
  * FUNCTION: Reads a CFDATA block from the file
  * ARGUMENTS:
@@ -272,7 +273,7 @@
 }
-uint32_t CCFDATAStorage::WriteBlock(PCFDATA Data, void* Buffer, uint32_t* BytesWritten)
+ULONG CCFDATAStorage::WriteBlock(PCFDATA Data, void* Buffer, PULONG BytesWritten)
 /*
  * FUNCTION: Writes a CFDATA block to the file
  * ARGUMENTS:
@@ -419,7 +420,7 @@
  *     Pointer to filename
  */
 {
-       uint32_t i, j;
+       ULONG i, j;
        j = i = (Path[0] ? (Path[1] == ':' ? 2 : 0) : 0);
@@ -439,7 +440,7 @@
  */
 {
        char* FileName;
-       uint32_t i;
+       ULONG i;
        i = (Path [0] ? (Path[1] == ':' ? 2 : 0) : 0);
        FileName = GetFileName(Path + i);
@@ -453,7 +454,7 @@
 bool CCabinet::NormalizePath(char* Path,
-                             uint32_t Length)
+                             ULONG Length)
 /*
  * FUNCTION: Normalizes a path
  * ARGUMENTS:
@@ -463,10 +464,10 @@
  *     true if there was enough room in Path, or false
  */
 {
-       uint32_t n;
+       ULONG n;
        bool OK = true;
-       if ((n = (uint32_t)strlen(Path)) &&
+       if ((n = (ULONG)strlen(Path)) &&
                (!IsSeparator(Path[n - 1])) &&
                (OK = ((n + 1) < Length)))
        {
@@ -532,7 +533,7 @@
  */
 {
        FILEHANDLE FileHandle;
-       uint32_t BytesRead;
+       ULONG BytesRead;
 #if defined(WIN32)
        FileHandle = CreateFile(ConvertPath(FileName, true),  // Open this file
@@ -557,7 +558,7 @@
 #endif
        CabinetReservedFileSize = GetSizeOfFile(FileHandle);
-       if (CabinetReservedFileSize == (uint32_t)-1)
+       if (CabinetReservedFileSize == (ULONG)-1)
        {
                DPRINT(MIN_TRACE, ("Cannot read from cabinet reserved
file.\n"));
                return false;
@@ -601,7 +602,7 @@
 }
-uint32_t CCabinet::GetCurrentDiskNumber()
+ULONG CCabinet::GetCurrentDiskNumber()
 /*
  * FUNCTION: Returns current disk number
  * RETURNS:
@@ -612,7 +613,7 @@
 }
-uint32_t CCabinet::Open()
+ULONG CCabinet::Open()
 /*
  * FUNCTION: Opens a cabinet file
  * RETURNS:
@@ -620,13 +621,13 @@
  */
 {
        PCFFOLDER_NODE FolderNode;
-       uint32_t Status;
-       uint32_t Index;
+       ULONG Status;
+       ULONG Index;
        if (!FileOpen)
        {
-               uint32_t BytesRead;
-               uint32_t Size;
+               ULONG BytesRead;
+               ULONG Size;
                OutputBuffer = AllocateMemory(CAB_BLOCKSIZE + 12);    // This should be
enough
                if (!OutputBuffer)
@@ -661,7 +662,7 @@
                if ((Status = ReadBlock(&CABHeader, sizeof(CFHEADER), &BytesRead))
                        != CAB_STATUS_SUCCESS)
                {
-                       DPRINT(MIN_TRACE, ("Cannot read from file (%d).\n",
(unsigned int)Status));
+                       DPRINT(MIN_TRACE, ("Cannot read from file (%d).\n",
(ULONG)Status));
                        return CAB_STATUS_INVALID_CAB;
                }
@@ -683,10 +684,10 @@
                /* Read/skip any reserved bytes */
                if (CABHeader.Flags & CAB_FLAG_RESERVE)
                {
-                       if ((Status = ReadBlock(&Size, sizeof(uint32_t),
&BytesRead))
+                       if ((Status = ReadBlock(&Size, sizeof(ULONG), &BytesRead))
                                != CAB_STATUS_SUCCESS)
                        {
-                               DPRINT(MIN_TRACE, ("Cannot read from file
(%d).\n", (unsigned int)Status));
+                               DPRINT(MIN_TRACE, ("Cannot read from file
(%d).\n", (ULONG)Status));
                                return CAB_STATUS_INVALID_CAB;
                        }
                        CabinetReserved = Size & 0xFFFF;
@@ -761,7 +762,7 @@
                        if ((Status = ReadBlock(&FolderNode->Folder,
                                sizeof(CFFOLDER), &BytesRead)) != CAB_STATUS_SUCCESS)
                        {
-                               DPRINT(MIN_TRACE, ("Cannot read from file
(%d).\n", (unsigned int)Status));
+                               DPRINT(MIN_TRACE, ("Cannot read from file
(%d).\n", (ULONG)Status));
                                return CAB_STATUS_INVALID_CAB;
                        }
                }
@@ -770,7 +771,7 @@
                Status = ReadFileTable();
                if (Status != CAB_STATUS_SUCCESS)
                {
-                       DPRINT(MIN_TRACE, ("ReadFileTable() failed (%d).\n",
(unsigned int)Status));
+                       DPRINT(MIN_TRACE, ("ReadFileTable() failed (%d).\n",
(ULONG)Status));
                        return Status;
                }
@@ -781,7 +782,7 @@
                        Status = ReadDataBlocks(FolderNode);
                        if (Status != CAB_STATUS_SUCCESS)
                        {
-                               DPRINT(MIN_TRACE, ("ReadDataBlocks() failed
(%d).\n", (unsigned int)Status));
+                               DPRINT(MIN_TRACE, ("ReadDataBlocks() failed
(%d).\n", (ULONG)Status));
                                return Status;
                        }
                        FolderNode = FolderNode->Next;
@@ -804,7 +805,7 @@
 }
-uint32_t CCabinet::FindFirst(char* FileName,
+ULONG CCabinet::FindFirst(char* FileName,
                              PCAB_SEARCH Search)
 /*
  * FUNCTION: Finds the first file in the cabinet that matches a search criteria
@@ -822,7 +823,7 @@
 }
-uint32_t CCabinet::FindNext(PCAB_SEARCH Search)
+ULONG CCabinet::FindNext(PCAB_SEARCH Search)
 /*
  * FUNCTION: Finds next file in the cabinet that matches a search criteria
  * ARGUMENTS:
@@ -831,7 +832,7 @@
  *     Status of operation
  */
 {
-       uint32_t Status;
+       ULONG Status;
        if (RestartSearch)
        {
@@ -881,7 +882,7 @@
 }
-uint32_t CCabinet::ExtractFile(char* FileName)
+ULONG CCabinet::ExtractFile(char* FileName)
 /*
  * FUNCTION: Extracts a file from the cabinet
  * ARGUMENTS:
@@ -890,21 +891,21 @@
  *     Status of operation
  */
 {
-       uint32_t Size;
-       uint32_t Offset;
-       uint32_t BytesRead;
-       uint32_t BytesToRead;
-       uint32_t BytesWritten;
-       uint32_t BytesSkipped;
-       uint32_t BytesToWrite;
-       uint32_t TotalBytesRead;
-       uint32_t CurrentOffset;
+       ULONG Size;
+       ULONG Offset;
+       ULONG BytesRead;
+       ULONG BytesToRead;
+       ULONG BytesWritten;
+       ULONG BytesSkipped;
+       ULONG BytesToWrite;
+       ULONG TotalBytesRead;
+       ULONG CurrentOffset;
        unsigned char* Buffer;
        unsigned char* CurrentBuffer;
        FILEHANDLE DestFile;
        PCFFILE_NODE File;
        CFDATA CFData;
-       uint32_t Status;
+       ULONG Status;
        bool Skip;
 #if defined(WIN32)
        FILETIME FileTime;
@@ -915,7 +916,7 @@
        Status = LocateFile(FileName, &File);
        if (Status != CAB_STATUS_SUCCESS)
        {
-               DPRINT(MID_TRACE, ("Cannot locate file (%d).\n", (unsigned
int)Status));
+               DPRINT(MID_TRACE, ("Cannot locate file (%d).\n",
(ULONG)Status));
                return Status;
        }
@@ -936,10 +937,10 @@
        }
        DPRINT(MAX_TRACE, ("Extracting file at uncompressed offset (0x%X)  Size (%d
bytes)  AO (0x%X)  UO (0x%X).\n",
-               (unsigned int)File->File.FileOffset,
-               (unsigned int)File->File.FileSize,
-               (unsigned int)File->DataBlock->AbsoluteOffset,
-               (unsigned int)File->DataBlock->UncompOffset));
+               (ULONG)File->File.FileOffset,
+               (ULONG)File->File.FileSize,
+               (ULONG)File->DataBlock->AbsoluteOffset,
+               (ULONG)File->DataBlock->UncompOffset));
        strcpy(DestName, DestPath);
        strcat(DestName, FileName);
@@ -1057,12 +1058,12 @@
                do
                {
                        DPRINT(MAX_TRACE, ("CO (0x%lX)    ReuseBlock (%d)    Offset
(0x%lX)   Size (%ld)  BytesLeftInBlock (%ld)\n",
-                               File->DataBlock->UncompOffset, (unsigned
int)ReuseBlock, Offset, Size,
+                               File->DataBlock->UncompOffset, (ULONG)ReuseBlock,
Offset, Size,
                                BytesLeftInBlock));
                        if (/*(CurrentDataNode != File->DataBlock) &&*/
(!ReuseBlock) || (BytesLeftInBlock <= 0))
                        {
-                               DPRINT(MAX_TRACE, ("Filling buffer. ReuseBlock
(%d)\n", (unsigned int)ReuseBlock));
+                               DPRINT(MAX_TRACE, ("Filling buffer. ReuseBlock
(%d)\n", (ULONG)ReuseBlock));
                                CurrentBuffer  = Buffer;
                                TotalBytesRead = 0;
@@ -1075,28 +1076,28 @@
                                        {
                                                CloseFile(DestFile);
                                                FreeMemory(Buffer);
-                                               DPRINT(MIN_TRACE, ("Cannot read from
file (%d).\n", (unsigned int)Status));
+                                               DPRINT(MIN_TRACE, ("Cannot read from
file (%d).\n", (ULONG)Status));
                                                return CAB_STATUS_INVALID_CAB;
                                        }
                                        DPRINT(MAX_TRACE, ("Data block: Checksum
(0x%X)  CompSize (%d bytes)  UncompSize (%d bytes)\n",
-                                               (unsigned int)CFData.Checksum,
-                                               (unsigned int)CFData.CompSize,
-                                               (unsigned int)CFData.UncompSize));
+                                               (ULONG)CFData.Checksum,
+                                               (ULONG)CFData.CompSize,
+                                               (ULONG)CFData.UncompSize));
                                        ASSERT(CFData.CompSize <= CAB_BLOCKSIZE + 12);
                                        BytesToRead = CFData.CompSize;
                                        DPRINT(MAX_TRACE, ("Read:
(0x%lX,0x%lX).\n",
-                                               (uintptr_t)CurrentBuffer,
(uintptr_t)Buffer));
+                                               (_W64 unsigned long)CurrentBuffer, (_W64
unsigned long)Buffer));
                                        if (((Status = ReadBlock(CurrentBuffer,
BytesToRead, &BytesRead)) !=
                                                CAB_STATUS_SUCCESS) || (BytesToRead !=
BytesRead))
                                        {
                                                CloseFile(DestFile);
                                                FreeMemory(Buffer);
-                                               DPRINT(MIN_TRACE, ("Cannot read from
file (%d).\n", (unsigned int)Status));
+                                               DPRINT(MIN_TRACE, ("Cannot read from
file (%d).\n", (ULONG)Status));
                                                return CAB_STATUS_INVALID_CAB;
                                        }
@@ -1104,7 +1105,7 @@
 /*
                                        if (CFData.Checksum != 0)
                                        {
-                                               uint32_t Checksum =
ComputeChecksum(CurrentBuffer, BytesRead, 0);
+                                               ULONG Checksum =
ComputeChecksum(CurrentBuffer, BytesRead, 0);
                                                if (Checksum != CFData.Checksum)
                                                {
                                                        CloseFile(DestFile);
@@ -1144,7 +1145,7 @@
                                                Status = LocateFile(TempName, &File);
                                                if (Status == CAB_STATUS_NOFILE)
                                                {
-                                                       DPRINT(MID_TRACE, ("Cannot
locate file (%d).\n", (unsigned int)Status));
+                                                       DPRINT(MID_TRACE, ("Cannot
locate file (%d).\n", (ULONG)Status));
                                                        return Status;
                                                }
@@ -1171,10 +1172,10 @@
 #endif
                                                DPRINT(MAX_TRACE, ("Continuing
extraction of file at uncompressed offset (0x%X)  Size (%d bytes)  AO (0x%X)  UO
(0x%X).\n",
-                                                       (unsigned
int)File->File.FileOffset,
-                                                       (unsigned
int)File->File.FileSize,
-                                                       (unsigned
int)File->DataBlock->AbsoluteOffset,
-                                                       (unsigned
int)File->DataBlock->UncompOffset));
+                                                       (ULONG)File->File.FileOffset,
+                                                       (ULONG)File->File.FileSize,
+
(ULONG)File->DataBlock->AbsoluteOffset,
+
(ULONG)File->DataBlock->UncompOffset));
                                                CurrentDataNode = File->DataBlock;
                                                ReuseBlock = true;
@@ -1207,7 +1208,7 @@
                        }
                        else
                        {
-                               DPRINT(MAX_TRACE, ("Using same buffer. ReuseBlock
(%d)\n", (unsigned int)ReuseBlock));
+                               DPRINT(MAX_TRACE, ("Using same buffer. ReuseBlock
(%d)\n", (ULONG)ReuseBlock));
                                BytesToWrite = BytesLeftInBlock;
@@ -1220,7 +1221,7 @@
                                {
                                        CloseFile(DestFile);
                                        FreeMemory(Buffer);
-                                       DPRINT(MIN_TRACE, ("Cannot read from file
(%d).\n", (unsigned int)Status));
+                                       DPRINT(MIN_TRACE, ("Cannot read from file
(%d).\n", (ULONG)Status));
                                        return CAB_STATUS_INVALID_CAB;
                                }
@@ -1262,21 +1263,21 @@
                                BytesToWrite = Size;
                        DPRINT(MAX_TRACE, ("Offset (0x%X)  CurrentOffset (0x%X)
ToWrite (%d)  Skipped (%d)(%d)  Size (%d).\n",
-                               (unsigned int)Offset,
-                               (unsigned int)CurrentOffset,
-                               (unsigned int)BytesToWrite,
-                               (unsigned int)BytesSkipped, (unsigned int)Skip,
-                               (unsigned int)Size));
-
-#if defined(WIN32)
-                       if (!WriteFile(DestFile, (void*)((uintptr_t)OutputBuffer +
BytesSkipped),
+                               (ULONG)Offset,
+                               (ULONG)CurrentOffset,
+                               (ULONG)BytesToWrite,
+                               (ULONG)BytesSkipped, (ULONG)Skip,
+                               (ULONG)Size));
+
+#if defined(WIN32)
+                       if (!WriteFile(DestFile, (void*)((unsigned long *)OutputBuffer +
BytesSkipped),
                                BytesToWrite, (LPDWORD)&BytesWritten, NULL) ||
                                (BytesToWrite != BytesWritten))
                        {
                                                DPRINT(MIN_TRACE, ("Status
0x%lX.\n", GetLastError()));
 #else
                        BytesWritten = BytesToWrite;
-                       if (fwrite((void*)((uintptr_t)OutputBuffer + BytesSkipped),
+                       if (fwrite((void*)((unsigned long *)OutputBuffer + BytesSkipped),
                                BytesToWrite, 1, DestFile) < 1)
                        {
 #endif
@@ -1302,7 +1303,7 @@
 }
-void CCabinet::SelectCodec(uint32_t Id)
+void CCabinet::SelectCodec(ULONG Id)
 /*
  * FUNCTION: Selects codec engine to use
  * ARGUMENTS:
@@ -1343,14 +1344,14 @@
 /* CAB write methods */
-uint32_t CCabinet::NewCabinet()
+ULONG CCabinet::NewCabinet()
 /*
  * FUNCTION: Creates a new cabinet
  * RETURNS:
  *     Status of operation
  */
 {
-       uint32_t Status;
+       ULONG Status;
        CurrentDiskNumber = 0;
@@ -1414,7 +1415,7 @@
 }
-uint32_t CCabinet::NewDisk()
+ULONG CCabinet::NewDisk()
 /*
  * FUNCTION: Forces a new disk to be created
  * RETURNS:
@@ -1438,7 +1439,7 @@
 }
-uint32_t CCabinet::NewFolder()
+ULONG CCabinet::NewFolder()
 /*
  * FUNCTION: Forces a new folder to be created
  * RETURNS:
@@ -1483,7 +1484,7 @@
 }
-uint32_t CCabinet::WriteFileToScratchStorage(PCFFILE_NODE FileNode)
+ULONG CCabinet::WriteFileToScratchStorage(PCFFILE_NODE FileNode)
 /*
  * FUNCTION: Writes a file to the scratch file
  * ARGUMENTS:
@@ -1492,10 +1493,10 @@
  *     Status of operation
  */
 {
-       uint32_t BytesToRead;
-       uint32_t BytesRead;
-       uint32_t Status;
-       uint32_t Size;
+       ULONG BytesToRead;
+       ULONG BytesRead;
+       ULONG Status;
+       ULONG Size;
        if (!ContinueFile)
        {
@@ -1540,11 +1541,11 @@
                FileNode->File.FileOffset        = CurrentFolderNode->UncompOffset;
                CurrentFolderNode->UncompOffset += TotalBytesLeft;
-               FileNode->File.FileControlID     = (uint16_t)(NextFolderNumber - 1);
+               FileNode->File.FileControlID     = (USHORT)(NextFolderNumber - 1);
                CurrentFolderNode->Commit        = true;
                PrevCabinetNumber                                = CurrentDiskNumber;
-               Size = sizeof(CFFILE) +
(uint32_t)strlen(GetFileName(FileNode->FileName)) + 1;
+               Size = sizeof(CFFILE) + (ULONG)strlen(GetFileName(FileNode->FileName))
+ 1;
                CABHeader.FileTableOffset += Size;
                TotalFileSize += Size;
                DiskSize += Size;
@@ -1556,7 +1557,7 @@
        {
                do
                {
-                       if (TotalBytesLeft > (uint32_t)CAB_BLOCKSIZE -
CurrentIBufferSize)
+                       if (TotalBytesLeft > (ULONG)CAB_BLOCKSIZE - CurrentIBufferSize)
                                BytesToRead = CAB_BLOCKSIZE - CurrentIBufferSize;
                        else
                                BytesToRead = TotalBytesLeft;
@@ -1570,7 +1571,7 @@
                        *(unsigned char**)&CurrentIBuffer += BytesRead;
-                       CurrentIBufferSize += (uint16_t)BytesRead;
+                       CurrentIBufferSize += (USHORT)BytesRead;
                        if (CurrentIBufferSize == CAB_BLOCKSIZE)
                        {
@@ -1614,7 +1615,7 @@
 }
-uint32_t CCabinet::WriteDisk(uint32_t MoreDisks)
+ULONG CCabinet::WriteDisk(ULONG MoreDisks)
 /*
  * FUNCTION: Forces the current disk to be written
  * ARGUMENTS:
@@ -1624,7 +1625,7 @@
  */
 {
        PCFFILE_NODE FileNode;
-       uint32_t Status;
+       ULONG Status;
        ContinueFile = false;
        FileNode = FileListHead;
@@ -1700,7 +1701,7 @@
 }
-uint32_t CCabinet::CommitDisk(uint32_t MoreDisks)
+ULONG CCabinet::CommitDisk(ULONG MoreDisks)
 /*
  * FUNCTION: Commits the current disk
  * ARGUMENTS:
@@ -1710,7 +1711,7 @@
  */
 {
        PCFFOLDER_NODE FolderNode;
-       uint32_t Status;
+       ULONG Status;
        OnCabinetName(CurrentDiskNumber, CabinetName);
@@ -1725,7 +1726,7 @@
                NULL);                           // No attribute template
        if (FileHandle == INVALID_HANDLE_VALUE)
        {
-               uint32_t Status;
+               ULONG Status;
                /* If file exists, ask to overwrite file */
                if (((Status = GetLastError()) == ERROR_FILE_EXISTS) &&
                        (OnOverwrite(NULL, CabinetName)))
@@ -1806,7 +1807,7 @@
 }
-uint32_t CCabinet::CloseDisk()
+ULONG CCabinet::CloseDisk()
 /*
  * FUNCTION: Closes the current disk
  * RETURNS:
@@ -1824,14 +1825,14 @@
 }
-uint32_t CCabinet::CloseCabinet()
+ULONG CCabinet::CloseCabinet()
 /*
  * FUNCTION: Closes the current cabinet
  * RETURNS:
  *     Status of operation
  */
 {
-       uint32_t Status;
+       ULONG Status;
        DestroyFileNodes();
@@ -1862,7 +1863,7 @@
 }
-uint32_t CCabinet::AddFile(char* FileName)
+ULONG CCabinet::AddFile(char* FileName)
 /*
  * FUNCTION: Adds a file to the current disk
  * ARGUMENTS:
@@ -1923,7 +1924,7 @@
        /* FIXME: Check for and handle large files (>= 2GB) */
        FileNode->File.FileSize = GetSizeOfFile(SrcFile);
-       if (FileNode->File.FileSize == (uint32_t)-1)
+       if (FileNode->File.FileSize == (ULONG)-1)
        {
                DPRINT(MIN_TRACE, ("Cannot read from file.\n"));
                FreeMemory(NewFileName);
@@ -1940,7 +1941,7 @@
 }
-void CCabinet::SetMaxDiskSize(uint32_t Size)
+void CCabinet::SetMaxDiskSize(ULONG Size)
 /*
  * FUNCTION: Sets the maximum size of the current disk
  * ARGUMENTS:
@@ -2008,7 +2009,7 @@
 }
-bool CCabinet::OnDiskLabel(uint32_t Number, char* Label)
+bool CCabinet::OnDiskLabel(ULONG Number, char* Label)
 /*
  * FUNCTION: Called when a disk needs a label
  * ARGUMENTS:
@@ -2022,7 +2023,7 @@
 }
-bool CCabinet::OnCabinetName(uint32_t Number, char* Name)
+bool CCabinet::OnCabinetName(ULONG Number, char* Name)
 /*
  * FUNCTION: Called when a cabinet needs a name
  * ARGUMENTS:
@@ -2037,7 +2038,7 @@
 #endif /* CAB_READ_ONLY */
-PCFFOLDER_NODE CCabinet::LocateFolderNode(uint32_t Index)
+PCFFOLDER_NODE CCabinet::LocateFolderNode(ULONG Index)
 /*
  * FUNCTION: Locates a folder node
  * ARGUMENTS:
@@ -2069,7 +2070,7 @@
 }
-uint32_t CCabinet::GetAbsoluteOffset(PCFFILE_NODE File)
+ULONG CCabinet::GetAbsoluteOffset(PCFFILE_NODE File)
 /*
  * FUNCTION: Returns the absolute offset of a file
  * ARGUMENTS:
@@ -2082,16 +2083,16 @@
        DPRINT(MAX_TRACE, ("FileName '%s'  FileOffset (0x%X)  FileSize
(%d).\n",
                (char*)File->FileName,
-               (unsigned int)File->File.FileOffset,
-               (unsigned int)File->File.FileSize));
+               (ULONG)File->File.FileOffset,
+               (ULONG)File->File.FileSize));
        Node = CurrentFolderNode->DataListHead;
        while (Node != NULL)
        {
                DPRINT(MAX_TRACE, ("GetAbsoluteOffset(): Comparing (0x%X, 0x%X)
(%d).\n",
-                       (unsigned int)Node->UncompOffset,
-                       (unsigned int)Node->UncompOffset + Node->Data.UncompSize,
-                       (unsigned int)Node->Data.UncompSize));
+                       (ULONG)Node->UncompOffset,
+                       (ULONG)Node->UncompOffset + Node->Data.UncompSize,
+                       (ULONG)Node->Data.UncompSize));
                /* Node->Data.UncompSize will be 0 if the block is split
                   (ie. it is the last block in this cabinet) */
@@ -2110,7 +2111,7 @@
 }
-uint32_t CCabinet::LocateFile(char* FileName,
+ULONG CCabinet::LocateFile(char* FileName,
                               PCFFILE_NODE *File)
 /*
  * FUNCTION: Locates a file in the cabinet
@@ -2124,7 +2125,7 @@
  */
 {
        PCFFILE_NODE Node;
-       uint32_t Status;
+       ULONG Status;
        DPRINT(MAX_TRACE, ("FileName '%s'\n", FileName));
@@ -2137,7 +2138,7 @@
                        if (!CurrentFolderNode)
                        {
                                DPRINT(MID_TRACE, ("Folder with index number (%d) not
found.\n",
-                                       (unsigned int)Node->File.FileControlID));
+                                       (ULONG)Node->File.FileControlID));
                                return CAB_STATUS_INVALID_CAB;
                        }
@@ -2155,7 +2156,7 @@
 }
-uint32_t CCabinet::ReadString(char* String, uint32_t MaxLength)
+ULONG CCabinet::ReadString(char* String, ULONG MaxLength)
 /*
  * FUNCTION: Reads a NULL-terminated string from the cabinet
  * ARGUMENTS:
@@ -2165,10 +2166,10 @@
  *     Status of operation
  */
 {
-       uint32_t BytesRead;
-       uint32_t Offset;
-       uint32_t Status;
-       uint32_t Size;
+       ULONG BytesRead;
+       ULONG Offset;
+       ULONG Status;
+       ULONG Size;
        bool Found;
        Offset = 0;
@@ -2186,7 +2187,7 @@
                Status = ReadBlock(&String[Offset], Size, &BytesRead);
                if ((Status != CAB_STATUS_SUCCESS) || (BytesRead != Size))
                {
-                       DPRINT(MIN_TRACE, ("Cannot read from file (%d).\n",
(unsigned int)Status));
+                       DPRINT(MIN_TRACE, ("Cannot read from file (%d).\n",
(ULONG)Status));
                        return CAB_STATUS_INVALID_CAB;
                }
@@ -2207,8 +2208,8 @@
        Size = (BytesRead - Size) - 1;
 #if defined(WIN32)
        SetLastError(NO_ERROR);
-       (unsigned int)SetFilePointer(FileHandle,
-               -(int32_t)Size,
+       (ULONG)SetFilePointer(FileHandle,
+               -(LONG)Size,
                NULL,
                FILE_CURRENT);
        if (GetLastError() != NO_ERROR)
@@ -2217,7 +2218,7 @@
                return CAB_STATUS_INVALID_CAB;
        }
 #else
-       if (fseek(FileHandle, (off_t)(-(int32_t)Size), SEEK_CUR) != 0)
+       if (fseek(FileHandle, (off_t)(-(LONG)Size), SEEK_CUR) != 0)
        {
                DPRINT(MIN_TRACE, ("fseek() failed.\n"));
                return CAB_STATUS_INVALID_CAB;
@@ -2227,16 +2228,16 @@
 }
-uint32_t CCabinet::ReadFileTable()
+ULONG CCabinet::ReadFileTable()
 /*
  * FUNCTION: Reads the file table from the cabinet file
  * RETURNS:
  *     Status of operation
  */
 {
-       uint32_t i;
-       uint32_t Status;
-       uint32_t BytesRead;
+       ULONG i;
+       ULONG Status;
+       ULONG BytesRead;
        PCFFILE_NODE File;
        DPRINT(MAX_TRACE, ("Reading file table at absolute offset (0x%lX).\n",
@@ -2275,7 +2276,7 @@
                if ((Status = ReadBlock(&File->File, sizeof(CFFILE),
                        &BytesRead)) != CAB_STATUS_SUCCESS)
                {
-                       DPRINT(MIN_TRACE, ("Cannot read from file (%d).\n",
(unsigned int)Status));
+                       DPRINT(MIN_TRACE, ("Cannot read from file (%d).\n",
(ULONG)Status));
                        return CAB_STATUS_INVALID_CAB;
                }
@@ -2293,16 +2294,16 @@
                DPRINT(MAX_TRACE, ("Found file '%s' at uncompressed offset
(0x%X).  Size (%d bytes)  ControlId (0x%X).\n",
                        (char*)File->FileName,
-                       (unsigned int)File->File.FileOffset,
-                       (unsigned int)File->File.FileSize,
-                       (unsigned int)File->File.FileControlID));
+                       (ULONG)File->File.FileOffset,
+                       (ULONG)File->File.FileSize,
+                       (ULONG)File->File.FileControlID));
        }
        return CAB_STATUS_SUCCESS;
 }
-uint32_t CCabinet::ReadDataBlocks(PCFFOLDER_NODE FolderNode)
+ULONG CCabinet::ReadDataBlocks(PCFFOLDER_NODE FolderNode)
 /*
  * FUNCTION: Reads all CFDATA blocks for a folder from the cabinet file
  * ARGUMENTS:
@@ -2311,12 +2312,12 @@
  *     Status of operation
  */
 {
-       uint32_t AbsoluteOffset;
-       uint32_t UncompOffset;
+       ULONG AbsoluteOffset;
+       ULONG UncompOffset;
        PCFDATA_NODE Node;
-       uint32_t BytesRead;
-       uint32_t Status;
-       uint32_t i;
+       ULONG BytesRead;
+       ULONG Status;
+       ULONG i;
        DPRINT(MAX_TRACE, ("Reading data blocks for folder (%lu)  at absolute offset
(0x%lX).\n",
                FolderNode->Index, FolderNode->Folder.DataOffset));
@@ -2356,16 +2357,16 @@
                if ((Status = ReadBlock(&Node->Data, sizeof(CFDATA),
                        &BytesRead)) != CAB_STATUS_SUCCESS)
                {
-                       DPRINT(MIN_TRACE, ("Cannot read from file (%d).\n",
(unsigned int)Status));
+                       DPRINT(MIN_TRACE, ("Cannot read from file (%d).\n",
(ULONG)Status));
                        return CAB_STATUS_INVALID_CAB;
                }
                DPRINT(MAX_TRACE, ("AbsOffset (0x%X)  UncompOffset (0x%X)  Checksum
(0x%X)  CompSize (%d)  UncompSize (%d).\n",
-                       (unsigned int)AbsoluteOffset,
-                       (unsigned int)UncompOffset,
-                       (unsigned int)Node->Data.Checksum,
-                       (unsigned int)Node->Data.CompSize,
-                       (unsigned int)Node->Data.UncompSize));
+                       (ULONG)AbsoluteOffset,
+                       (ULONG)UncompOffset,
+                       (ULONG)Node->Data.Checksum,
+                       (ULONG)Node->Data.CompSize,
+                       (ULONG)Node->Data.UncompSize));
                Node->AbsoluteOffset = AbsoluteOffset;
                Node->UncompOffset   = UncompOffset;
@@ -2551,7 +2552,7 @@
                        DPRINT(MAX_TRACE, ("Deleting file: '%s'\n",
CurNode->FileName));
-                       TotalFileSize -= (sizeof(CFFILE) +
(uint32_t)strlen(GetFileName(CurNode->FileName)) + 1);
+                       TotalFileSize -= (sizeof(CFFILE) +
(ULONG)strlen(GetFileName(CurNode->FileName)) + 1);
                        if (CurNode->FileName)
                                FreeMemory(CurNode->FileName);
@@ -2626,9 +2627,9 @@
 }
-uint32_t CCabinet::ComputeChecksum(void* Buffer,
-                                   unsigned int Size,
-                                   uint32_t Seed)
+ULONG CCabinet::ComputeChecksum(void* Buffer,
+                                   ULONG Size,
+                                   ULONG Seed)
 /*
  * FUNCTION: Computes checksum for data block
  * ARGUMENTS:
@@ -2640,9 +2641,9 @@
  */
 {
        int UlongCount; // Number of ULONGs in block
-       uint32_t Checksum; // Checksum accumulator
+       ULONG Checksum; // Checksum accumulator
        unsigned char* pb;
-       uint32_t ul;
+       ULONG ul;
        /* FIXME: Doesn't seem to be correct. EXTRACT.EXE
           won't accept checksums computed by this routine */
@@ -2656,11 +2657,11 @@
        /* Checksum integral multiple of ULONGs */
        while (UlongCount-- > 0)
        {
-               /* NOTE: Build uint32_t in big/little-endian independent manner */
+               /* NOTE: Build ULONG in big/little-endian independent manner */
                ul = *pb++;                     // Get low-order byte
-               ul |= (((uint32_t)(*pb++)) <<  8); // Add 2nd byte
-               ul |= (((uint32_t)(*pb++)) << 16); // Add 3nd byte
-               ul |= (((uint32_t)(*pb++)) << 24); // Add 4th byte
+               ul |= (((ULONG)(*pb++)) <<  8); // Add 2nd byte
+               ul |= (((ULONG)(*pb++)) << 16); // Add 3nd byte
+               ul |= (((ULONG)(*pb++)) << 24); // Add 4th byte
                Checksum ^= ul;                 // Update checksum
        }
@@ -2670,9 +2671,9 @@
        switch (Size % 4)
        {
                case 3:
-                       ul |= (((uint32_t)(*pb++)) << 16); // Add 3rd byte
+                       ul |= (((ULONG)(*pb++)) << 16); // Add 3rd byte
                case 2:
-                       ul |= (((uint32_t)(*pb++)) <<  8); // Add 2nd byte
+                       ul |= (((ULONG)(*pb++)) <<  8); // Add 2nd byte
                case 1:
                        ul |= *pb++;                    // Get low-order byte
                default:
@@ -2685,15 +2686,15 @@
 }
-uint32_t CCabinet::ReadBlock(void* Buffer,
-                             uint32_t Size,
-                             uint32_t* BytesRead)
+ULONG CCabinet::ReadBlock(void* Buffer,
+                             ULONG Size,
+                             PULONG BytesRead)
 /*
  * FUNCTION: Read a block of data from file
  * ARGUMENTS:
  *     Buffer    = Pointer to data buffer
  *     Size      = Length of data buffer
- *     BytesRead = Pointer to uint32_t that on return will contain
+ *     BytesRead = Pointer to ULONG that on return will contain
  *                 number of bytes read
  * RETURNS:
  *     Status of operation
@@ -2706,22 +2707,22 @@
 #ifndef CAB_READ_ONLY
-uint32_t CCabinet::InitCabinetHeader()
+ULONG CCabinet::InitCabinetHeader()
 /*
  * FUNCTION: Initializes cabinet header and optional fields
  * RETURNS:
  *     Status of operation
  */
 {
-       uint32_t TotalSize;
-       uint32_t Size;
+       ULONG TotalSize;
+       ULONG Size;
        CABHeader.FileTableOffset = 0;    // Not known yet
        CABHeader.FolderCount     = 0;    // Not known yet
        CABHeader.FileCount       = 0;    // Not known yet
        CABHeader.Flags           = 0;    // Not known yet
-       CABHeader.CabinetNumber = (uint16_t)CurrentDiskNumber;
+       CABHeader.CabinetNumber = (USHORT)CurrentDiskNumber;
        if ((CurrentDiskNumber > 0) && (OnCabinetName(PrevCabinetNumber,
CabinetPrev)))
        {
@@ -2745,10 +2746,10 @@
                DPRINT(MAX_TRACE, ("CabinetPrev '%s'.\n", CabinetPrev));
                /* Calculate size of name of previous cabinet */
-               TotalSize += (uint32_t)strlen(CabinetPrev) + 1;
+               TotalSize += (ULONG)strlen(CabinetPrev) + 1;
                /* Calculate size of label of previous disk */
-               TotalSize += (uint32_t)strlen(DiskPrev) + 1;
+               TotalSize += (ULONG)strlen(DiskPrev) + 1;
        }
        if ((CABHeader.Flags & CAB_FLAG_HASNEXT) > 0)
@@ -2757,12 +2758,12 @@
                DPRINT(MAX_TRACE, ("CabinetNext '%s'.\n", CabinetNext));
                /* Calculate size of name of next cabinet */
-               Size = (uint32_t)strlen(CabinetNext) + 1;
+               Size = (ULONG)strlen(CabinetNext) + 1;
                TotalSize += Size;
                NextFieldsSize = Size;
                /* Calculate size of label of next disk */
-               Size = (uint32_t)strlen(DiskNext) + 1;
+               Size = (ULONG)strlen(DiskNext) + 1;
                TotalSize += Size;
                NextFieldsSize += Size;
        }
@@ -2774,7 +2775,7 @@
        {
                CABHeader.Flags |= CAB_FLAG_RESERVE;
                TotalSize += CabinetReservedFileSize;
-               TotalSize += sizeof(uint32_t); /* For CabinetResSize, FolderResSize, and
FileResSize fields */
+               TotalSize += sizeof(ULONG); /* For CabinetResSize, FolderResSize, and
FileResSize fields */
        }
        DiskSize += TotalSize;
@@ -2785,7 +2786,7 @@
 }
-uint32_t CCabinet::WriteCabinetHeader(bool MoreDisks)
+ULONG CCabinet::WriteCabinetHeader(bool MoreDisks)
 /*
  * FUNCTION: Writes the cabinet header and optional fields
  * ARGUMENTS:
@@ -2796,8 +2797,8 @@
 {
        PCFFOLDER_NODE FolderNode;
        PCFFILE_NODE FileNode;
-       uint32_t BytesWritten;
-       uint32_t Size;
+       ULONG BytesWritten;
+       ULONG Size;
        if (MoreDisks)
        {
@@ -2860,20 +2861,20 @@
        /* Write per-cabinet reserved area if present */
        if (CABHeader.Flags & CAB_FLAG_RESERVE)
        {
-               uint32_t ReservedSize;
+               ULONG ReservedSize;
                ReservedSize = CabinetReservedFileSize & 0xffff;
                ReservedSize |= (0 << 16); /* Folder reserved area size */
                ReservedSize |= (0 << 24); /* Folder reserved area size */
 #if defined(WIN32)
-               if (!WriteFile(FileHandle, &ReservedSize, sizeof(uint32_t),
(LPDWORD)&BytesWritten, NULL))
+               if (!WriteFile(FileHandle, &ReservedSize, sizeof(ULONG),
(LPDWORD)&BytesWritten, NULL))
                {
                        DPRINT(MIN_TRACE, ("Cannot write to file.\n"));
                        return CAB_STATUS_CANNOT_WRITE;
                }
 #else
-               BytesWritten = sizeof(uint32_t);
-               if (fwrite(&ReservedSize, sizeof(uint32_t), 1, FileHandle) < 1)
+               BytesWritten = sizeof(ULONG);
+               if (fwrite(&ReservedSize, sizeof(ULONG), 1, FileHandle) < 1)
                {
                        DPRINT(MIN_TRACE, ("Cannot write to file.\n"));
                        return CAB_STATUS_CANNOT_WRITE;
@@ -2901,7 +2902,7 @@
                DPRINT(MAX_TRACE, ("CabinetPrev '%s'.\n", CabinetPrev));
                /* Write name of previous cabinet */
-               Size = (uint32_t)strlen(CabinetPrev) + 1;
+               Size = (ULONG)strlen(CabinetPrev) + 1;
 #if defined(WIN32)
                if (!WriteFile(FileHandle, CabinetPrev, Size, (LPDWORD)&BytesWritten,
NULL))
                {
@@ -2920,7 +2921,7 @@
                DPRINT(MAX_TRACE, ("DiskPrev '%s'.\n", DiskPrev));
                /* Write label of previous disk */
-               Size = (uint32_t)strlen(DiskPrev) + 1;
+               Size = (ULONG)strlen(DiskPrev) + 1;
 #if defined(WIN32)
                if (!WriteFile(FileHandle, DiskPrev, Size, (LPDWORD)&BytesWritten,
NULL))
                {
@@ -2942,7 +2943,7 @@
                DPRINT(MAX_TRACE, ("CabinetNext '%s'.\n", CabinetNext));
                /* Write name of next cabinet */
-               Size = (uint32_t)strlen(CabinetNext) + 1;
+               Size = (ULONG)strlen(CabinetNext) + 1;
 #if defined(WIN32)
                if (!WriteFile(FileHandle, CabinetNext, Size, (LPDWORD)&BytesWritten,
NULL))
                {
@@ -2961,7 +2962,7 @@
                DPRINT(MAX_TRACE, ("DiskNext '%s'.\n", DiskNext));
                /* Write label of next disk */
-               Size = (uint32_t)strlen(DiskNext) + 1;
+               Size = (ULONG)strlen(DiskNext) + 1;
 #if defined(WIN32)
                if (!WriteFile(FileHandle, DiskNext, Size, (LPDWORD)&BytesWritten,
NULL))
                {
@@ -2982,7 +2983,7 @@
 }
-uint32_t CCabinet::WriteFolderEntries()
+ULONG CCabinet::WriteFolderEntries()
 /*
  * FUNCTION: Writes folder entries
  * RETURNS:
@@ -2990,7 +2991,7 @@
  */
 {
        PCFFOLDER_NODE FolderNode;
-       uint32_t BytesWritten;
+       ULONG BytesWritten;
        DPRINT(MAX_TRACE, ("Writing folder table.\n"));
@@ -3028,7 +3029,7 @@
 }
-uint32_t CCabinet::WriteFileEntries()
+ULONG CCabinet::WriteFileEntries()
 /*
  * FUNCTION: Writes file entries for all files
  * RETURNS:
@@ -3036,7 +3037,7 @@
  */
 {
        PCFFILE_NODE File;
-       uint32_t BytesWritten;
+       ULONG BytesWritten;
        bool SetCont = false;
        DPRINT(MAX_TRACE, ("Writing file table.\n"));
@@ -3109,7 +3110,7 @@
 }
-uint32_t CCabinet::CommitDataBlocks(PCFFOLDER_NODE FolderNode)
+ULONG CCabinet::CommitDataBlocks(PCFFOLDER_NODE FolderNode)
 /*
  * FUNCTION: Writes data blocks to the cabinet
  * ARGUMENTS:
@@ -3119,9 +3120,9 @@
  */
 {
        PCFDATA_NODE DataNode;
-       uint32_t BytesWritten;
-       uint32_t BytesRead;
-       uint32_t Status;
+       ULONG BytesWritten;
+       ULONG BytesRead;
+       ULONG Status;
        DataNode = FolderNode->DataListHead;
        if (DataNode != NULL)
@@ -3140,7 +3141,7 @@
                Status = ScratchFile->ReadBlock(&DataNode->Data, InputBuffer,
&BytesRead);
                if (Status != CAB_STATUS_SUCCESS)
                {
-                       DPRINT(MIN_TRACE, ("Cannot read from scratch file
(%d).\n", (unsigned int)Status));
+                       DPRINT(MIN_TRACE, ("Cannot read from scratch file
(%d).\n", (ULONG)Status));
                        return Status;
                }
@@ -3182,15 +3183,15 @@
 }
-uint32_t CCabinet::WriteDataBlock()
+ULONG CCabinet::WriteDataBlock()
 /*
  * FUNCTION: Writes the current data block to the scratch file
  * RETURNS:
  *     Status of operation
  */
 {
-       uint32_t Status;
-       uint32_t BytesWritten;
+       ULONG Status;
+       ULONG BytesWritten;
        PCFDATA_NODE DataNode;
        if (!BlockIsSplit)
@@ -3224,14 +3225,14 @@
        if (BlockIsSplit)
        {
-               DataNode->Data.CompSize   = (uint16_t)(MaxDiskSize - DiskSize);
+               DataNode->Data.CompSize   = (USHORT)(MaxDiskSize - DiskSize);
                DataNode->Data.UncompSize = 0;
                CreateNewDisk = true;
        }
        else
        {
-               DataNode->Data.CompSize   = (uint16_t)CurrentOBufferSize;
-               DataNode->Data.UncompSize = (uint16_t)CurrentIBufferSize;
+               DataNode->Data.CompSize   = (USHORT)CurrentOBufferSize;
+               DataNode->Data.UncompSize = (USHORT)CurrentIBufferSize;
        }
        DataNode->Data.Checksum = 0;
@@ -3241,9 +3242,9 @@
        //DataNode->Data.Checksum = ComputeChecksum(CurrentOBuffer,
DataNode->Data.CompSize, 0);
        DPRINT(MAX_TRACE, ("Writing block. Checksum (0x%X)  CompSize (%d)  UncompSize
(%d).\n",
-               (unsigned int)DataNode->Data.Checksum,
-               (unsigned int)DataNode->Data.CompSize,
-               (unsigned int)DataNode->Data.UncompSize));
+               (ULONG)DataNode->Data.Checksum,
+               (ULONG)DataNode->Data.CompSize,
+               (ULONG)DataNode->Data.UncompSize));
        Status = ScratchFile->WriteBlock(&DataNode->Data,
                CurrentOBuffer, &BytesWritten);
@@ -3269,12 +3270,11 @@
        return CAB_STATUS_SUCCESS;
 }
-
 #if !defined(WIN32)
 void CCabinet::ConvertDateAndTime(time_t* Time,
-                                  uint16_t* DosDate,
-                                  uint16_t* DosTime)
+                                  PUSHORT DosDate,
+                                  PUSHORT DosTime)
 /*
  * FUNCTION: Returns file times of a file
  * ARGUMENTS:
@@ -3304,7 +3304,7 @@
 #endif // !WIN32
-uint32_t CCabinet::GetFileTimes(FILEHANDLE FileHandle, PCFFILE_NODE File)
+ULONG CCabinet::GetFileTimes(FILEHANDLE FileHandle, PCFFILE_NODE File)
 /*
  * FUNCTION: Returns file times of a file
  * ARGUMENTS:
@@ -3344,7 +3344,7 @@
 }
-uint32_t CCabinet::GetAttributesOnFile(PCFFILE_NODE File)
+ULONG CCabinet::GetAttributesOnFile(PCFFILE_NODE File)
 /*
  * FUNCTION: Returns attributes on a file
  * ARGUMENTS:
@@ -3354,7 +3354,7 @@
  */
 {
 #if defined(WIN32)
-       int32_t Attributes;
+       LONG Attributes;
        Attributes = GetFileAttributes(File->FileName);
        if (Attributes == -1)
@@ -3407,7 +3407,7 @@
 }
-uint32_t CCabinet::SetAttributesOnFile(PCFFILE_NODE File)
+ULONG CCabinet::SetAttributesOnFile(PCFFILE_NODE File)
 /*
  * FUNCTION: Sets attributes on a file
  * ARGUMENTS:
@@ -3417,7 +3417,7 @@
  */
 {
 #if defined(WIN32)
-       uint32_t Attributes = 0;
+       ULONG Attributes = 0;
        if (File->File.Attributes & CAB_ATTRIB_READONLY)
                Attributes |= FILE_ATTRIBUTE_READONLY;
Modified: trunk/reactos/tools/cabman/cabinet.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/cabinet.h?rev…
==============================================================================
--- trunk/reactos/tools/cabman/cabinet.h (original)
+++ trunk/reactos/tools/cabman/cabinet.h Sat Aug 18 17:08:58 2007
@@ -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 @@
 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 _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 _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 @@
 {
        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 @@
 {
        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 @@
        /* 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 @@
        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 @@
        /* 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 @@
        /* 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 @@
        /* 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 @@
        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 @@
        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 */
 };
Modified: trunk/reactos/tools/cabman/cabman.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/cabman.h?rev=…
==============================================================================
--- trunk/reactos/tools/cabman/cabman.h (original)
+++ trunk/reactos/tools/cabman/cabman.h Sat Aug 18 17:08:58 2007
@@ -37,7 +37,7 @@
        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];
Added: trunk/reactos/tools/cabman/cabman.sln
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/cabman.sln?re…
==============================================================================
--- trunk/reactos/tools/cabman/cabman.sln (added)
+++ trunk/reactos/tools/cabman/cabman.sln Sat Aug 18 17:08:58 2007
@@ -1,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
Added: trunk/reactos/tools/cabman/cabman.vcproj
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/cabman.vcproj…
==============================================================================
--- trunk/reactos/tools/cabman/cabman.vcproj (added)
+++ trunk/reactos/tools/cabman/cabman.vcproj Sat Aug 18 17:08:58 2007
@@ -1,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>
Modified: trunk/reactos/tools/cabman/dfp.cxx
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/dfp.cxx?rev=2…
==============================================================================
--- trunk/reactos/tools/cabman/dfp.cxx (original)
+++ trunk/reactos/tools/cabman/dfp.cxx Sat Aug 18 17:08:58 2007
@@ -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)
-{
-       uint32_t size = GetFileSize(handle, NULL);
+static LONG _GetSizeOfFile(FILEHANDLE handle)
+{
+       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)
-{
-       int32_t size;
+static LONG _GetSizeOfFile(FILEHANDLE handle)
+{
+       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 @@
        char eolbuf[2];
        char* destpath;
 #if defined(WIN32)
-       uint32_t BytesWritten;
+       ULONG BytesWritten;
 #endif
        if (DontGenerateInf)
@@ -160,14 +161,14 @@
                        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 @@
 #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 @@
 #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 @@
 }
-uint32_t CDFParser::Load(char* FileName)
+ULONG CDFParser::Load(char* FileName)
 /*
  * FUNCTION: Loads a directive file into memory
  * ARGUMENTS:
@@ -209,8 +210,8 @@
  *     Status of operation
  */
 {
-       uint32_t BytesRead;
-       int32_t FileSize;
+       ULONG BytesRead;
+       LONG FileSize;
        if (FileLoaded)
                return CAB_STATUS_SUCCESS;
@@ -239,7 +240,7 @@
                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::Parse()
+ULONG CDFParser::Parse()
 /*
  * FUNCTION: Parses a loaded directive file
  * RETURNS:
@@ -274,7 +275,7 @@
  */
 {
        bool Command;
-       uint32_t Status;
+       ULONG Status;
        if (!FileLoaded)
                return CAB_STATUS_NOFILE;
@@ -346,7 +347,7 @@
                                                        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 @@
                                                        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 @@
                                                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 @@
                                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 @@
                        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 @@
 }
-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 @@
  */
 {
        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 @@
                        {
                                sprintf(Buffer, "%lu", Number);
                                strcat(Label, Buffer);
-                               j += (int)strlen(Buffer);
+                               j += (LONG)strlen(Buffer);
                        }
                        else
                        {
@@ -489,7 +490,7 @@
 }
-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 @@
  */
 {
        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 @@
        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 @@
                        {
                                sprintf(Buffer, "%lu", Number);
                                strcat(Name, Buffer);
-                               j += (int)strlen(Buffer);
+                               j += (LONG)strlen(Buffer);
                        }
                        else
                        {
@@ -544,7 +545,7 @@
 }
-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::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::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::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::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 @@
  *     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 @@
 }
-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 @@
  *     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 @@
 }
-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 @@
  *     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 @@
        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::PerformSetCommand()
+ULONG CDFParser::PerformSetCommand()
 /*
  * FUNCTION: Performs a set variable command
  * RETURNS:
@@ -884,7 +885,7 @@
 {
        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::PerformNewCommand()
+ULONG CDFParser::PerformNewCommand()
 /*
  * FUNCTION: Performs a new disk|cabinet|folder command
  * RETURNS:
@@ -979,7 +980,7 @@
  */
 {
        NEWTYPE NewType;
-       uint32_t Status;
+       ULONG Status;
        if (!IsNextToken(TokenIdentifier, true))
                return CAB_STATUS_FAILURE;
@@ -1003,7 +1004,7 @@
                                        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 @@
                        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 @@
                                        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 @@
                        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::PerformInfBeginCommand()
+ULONG CDFParser::PerformInfBeginCommand()
 /*
  * FUNCTION: Begins inf mode
  * RETURNS:
@@ -1066,7 +1067,7 @@
 }
-uint32_t CDFParser::PerformInfEndCommand()
+ULONG CDFParser::PerformInfEndCommand()
 /*
  * FUNCTION: Begins inf mode
  * RETURNS:
@@ -1078,7 +1079,7 @@
 }
-uint32_t CDFParser::PerformCommand()
+ULONG CDFParser::PerformCommand()
 /*
  * FUNCTION: Performs a command
  * RETURNS:
@@ -1098,15 +1099,15 @@
 }
-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 @@
        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 @@
        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 @@
                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 @@
                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 @@
  *     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 @@
  * FUNCTION: Reads the next token from the current line
  */
 {
-       uint32_t i;
+       ULONG i;
        char ch = ' ';
        if (CurrentChar >= LineLength)
Modified: trunk/reactos/tools/cabman/dfp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/dfp.h?rev=283…
==============================================================================
--- trunk/reactos/tools/cabman/dfp.h (original)
+++ trunk/reactos/tools/cabman/dfp.h Sat Aug 18 17:08:58 2007
@@ -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 @@
 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 @@
        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 @@
        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;
Modified: trunk/reactos/tools/cabman/main.cxx
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/main.cxx?rev=…
==============================================================================
--- trunk/reactos/tools/cabman/main.cxx (original)
+++ trunk/reactos/tools/cabman/main.cxx Sat Aug 18 17:08:58 2007
@@ -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 @@
 #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 @@
  *     Str must be at least Length + 1 bytes
  */
 {
-       unsigned int Len;
-
-       Len = (uint32_t)strlen(Str);
+       ULONG Len;
+
+       Len = (ULONG)strlen(Str);
        if (Len < Length)
        {
@@ -56,7 +57,7 @@
 }
-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 @@
  *     Pointer to string
  */
 {
-       uint32_t dw;
+       ULONG dw;
        /* Month */
        Str[0] = (char)('0' + ((Date & 0x01E0) >> 5) / 10);
@@ -87,7 +88,7 @@
 }
-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 @@
  */
 {
        bool PM;
-       uint32_t Hour;
-       uint32_t dw;
+       ULONG Hour;
+       ULONG dw;
        Hour = ((Time & 0xF800) >> 11);
        PM = (Hour >= 12);
@@ -127,7 +128,7 @@
 }
-char* Attr2Str(char* Str, uint16_t Attr)
+char* Attr2Str(char* Str, USHORT Attr)
 /*
  * FUNCTION: Converts attributes to a string
  * ARGUMENTS:
@@ -365,7 +366,7 @@
  * FUNCTION: Create cabinet
  */
 {
-       uint32_t Status;
+       ULONG Status;
        Status = Load((char*)&FileName);
        if (Status != CAB_STATUS_SUCCESS)
@@ -385,19 +386,19 @@
  * 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 @@
                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 @@
 {
        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 @@
  */
 {
        CAB_SEARCH Search;
-       uint32_t Status;
+       ULONG Status;
        if (Open() == CAB_STATUS_SUCCESS)
        {
@@ -513,7 +514,7 @@
                                                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);
Modified: trunk/reactos/tools/cabman/mszip.cxx
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/mszip.cxx?rev…
==============================================================================
--- trunk/reactos/tools/cabman/mszip.cxx (original)
+++ trunk/reactos/tools/cabman/mszip.cxx Sat Aug 18 17:08:58 2007
@@ -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 @@
 }
-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 @@
  *     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::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 @@
  *     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 @@
                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;
Modified: trunk/reactos/tools/cabman/mszip.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/mszip.h?rev=2…
==============================================================================
--- trunk/reactos/tools/cabman/mszip.h (original)
+++ trunk/reactos/tools/cabman/mszip.h Sat Aug 18 17:08:58 2007
@@ -22,15 +22,15 @@
        /* 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 */
Modified: trunk/reactos/tools/cabman/raw.cxx
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/raw.cxx?rev=2…
==============================================================================
--- trunk/reactos/tools/cabman/raw.cxx (original)
+++ trunk/reactos/tools/cabman/raw.cxx Sat Aug 18 17:08:58 2007
@@ -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 @@
 }
-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 @@
        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:
Modified: trunk/reactos/tools/cabman/raw.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/raw.h?rev=283…
==============================================================================
--- trunk/reactos/tools/cabman/raw.h (original)
+++ trunk/reactos/tools/cabman/raw.h Sat Aug 18 17:08:58 2007
@@ -19,15 +19,15 @@
        /* 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 */