Index: tools/cabman/dfp.h
===================================================================
--- tools/cabman/dfp.h	(revision 23829)
+++ tools/cabman/dfp.h	(working copy)
@@ -11,14 +11,14 @@
 
 typedef struct _CABINET_NAME {
     struct _CABINET_NAME *Next;
-    unsigned long DiskNumber;
+    unsigned int DiskNumber;
     char Name[128];
 } CABINET_NAME, *PCABINET_NAME;
 
 typedef struct _DISK_NUMBER {
     struct _DISK_NUMBER *Next;
-    unsigned long DiskNumber;
-    unsigned long Number;
+    unsigned int DiskNumber;
+    unsigned int Number;
 } DISK_NUMBER, *PDISK_NUMBER;
 
 typedef enum {
@@ -58,35 +58,35 @@
 public:
     CDFParser();
     virtual ~CDFParser();
-    unsigned long Load(char* FileName);
-    unsigned long Parse();
+    unsigned int Load(char* FileName);
+    unsigned int Parse();
     void SetFileRelativePath(char* Path);
 	bool InfFileOnly;
     bool DontGenerateInf;
     char FileRelativePath[300];
 private:
     /* Event handlers */
-    virtual bool OnDiskLabel(unsigned long Number, char* Label);
-    virtual bool OnCabinetName(unsigned long Number, char* Name);
+    virtual bool OnDiskLabel(unsigned int Number, char* Label);
+    virtual bool OnCabinetName(unsigned int Number, char* Name);
 
     void WriteInfLine(char* InfLine);
-    bool SetDiskName(PCABINET_NAME *List, unsigned long Number, char* String);
-    bool GetDiskName(PCABINET_NAME *List, unsigned long Number, char* String);
-    bool SetDiskNumber(PDISK_NUMBER *List, unsigned long Number, unsigned long Value);
-    bool GetDiskNumber(PDISK_NUMBER *List, unsigned long Number, unsigned long* Value);
-    bool DoDiskLabel(unsigned long Number, char* Label);
+    bool SetDiskName(PCABINET_NAME *List, unsigned int Number, char* String);
+    bool GetDiskName(PCABINET_NAME *List, unsigned int Number, char* String);
+    bool SetDiskNumber(PDISK_NUMBER *List, unsigned int Number, unsigned int Value);
+    bool GetDiskNumber(PDISK_NUMBER *List, unsigned int Number, unsigned int* Value);
+    bool DoDiskLabel(unsigned int Number, char* Label);
     void DoDiskLabelTemplate(char* Template);
-    bool DoCabinetName(unsigned long Number, char* Name);
+    bool DoCabinetName(unsigned int Number, char* Name);
     void DoCabinetNameTemplate(char* Template);
     void DoInfFileName(char* InfFileName);
-    unsigned long DoMaxDiskSize(bool NumberValid, unsigned long Number);
-    unsigned long SetupNewDisk();
-    unsigned long PerformSetCommand();
-    unsigned long PerformNewCommand();
-    unsigned long PerformInfBeginCommand();
-    unsigned long PerformInfEndCommand();
-    unsigned long PerformCommand();
-    unsigned long PerformFileCopy();
+    unsigned int DoMaxDiskSize(bool NumberValid, unsigned int Number);
+    unsigned int SetupNewDisk();
+    unsigned int PerformSetCommand();
+    unsigned int PerformNewCommand();
+    unsigned int PerformInfBeginCommand();
+    unsigned int PerformInfEndCommand();
+    unsigned int PerformCommand();
+    unsigned int PerformFileCopy();
     void SkipSpaces();
     bool IsNextToken(DFP_TOKEN Token, bool NoSpaces);
     bool ReadLine();
@@ -95,15 +95,15 @@
     bool FileLoaded;
     FILEHANDLE FileHandle;
     char* FileBuffer;
-    unsigned long FileBufferSize;
-    unsigned long CurrentOffset;
+    unsigned int FileBufferSize;
+    unsigned int CurrentOffset;
     char Line[128];
-    unsigned long LineLength;
-    unsigned long CurrentLine;
-    unsigned long CurrentChar;
+    unsigned int LineLength;
+    unsigned int CurrentLine;
+    unsigned int CurrentChar;
     /* Token */
     DFP_TOKEN CurrentToken;
-    unsigned long CurrentInteger;
+    unsigned int CurrentInteger;
     char CurrentString[256];
 
     /* State */
@@ -112,27 +112,27 @@
     bool FolderCreated;
     /* Standard directive variable */
     bool Cabinet;
-    unsigned long CabinetFileCountThreshold;
+    unsigned int CabinetFileCountThreshold;
     PCABINET_NAME CabinetName;
     bool CabinetNameTemplateSet;
     char CabinetNameTemplate[128];
     bool InfFileNameSet;
     char InfFileName[256];
     bool Compress;
-    unsigned long CompressionType;
+    unsigned int CompressionType;
     PCABINET_NAME DiskLabel;
     bool DiskLabelTemplateSet;
     char DiskLabelTemplate[128];
-    unsigned long FolderFileCountThreshold;
-    unsigned long FolderSizeThreshold;
-    unsigned long MaxCabinetSize;
-    unsigned long MaxDiskFileCount;
+    unsigned int FolderFileCountThreshold;
+    unsigned int FolderSizeThreshold;
+    unsigned int MaxCabinetSize;
+    unsigned int MaxDiskFileCount;
     PDISK_NUMBER MaxDiskSize;
     bool MaxDiskSizeAllSet;
-    unsigned long MaxDiskSizeAll;
-    unsigned long ReservePerCabinetSize;
-    unsigned long ReservePerDataBlockSize;
-    unsigned long ReservePerFolderSize;
+    unsigned int MaxDiskSizeAll;
+    unsigned int ReservePerCabinetSize;
+    unsigned int ReservePerDataBlockSize;
+    unsigned int ReservePerFolderSize;
     char SourceDir[256];
     FILEHANDLE InfFileHandle;
     bool InfModeEnabled;
Index: tools/cabman/raw.h
===================================================================
--- tools/cabman/raw.h	(revision 23829)
+++ tools/cabman/raw.h	(working copy)
@@ -19,15 +19,15 @@
     /* Default destructor */
     virtual ~CRawCodec();
     /* Compresses a data block */
-    virtual unsigned long Compress(void* OutputBuffer,
+    virtual unsigned int Compress(void* OutputBuffer,
         void* InputBuffer,
-        unsigned long InputLength,
-        unsigned long* OutputLength);
+        unsigned int InputLength,
+        unsigned int* OutputLength);
     /* Uncompresses a data block */
-    virtual unsigned long Uncompress(void* OutputBuffer,
+    virtual unsigned int Uncompress(void* OutputBuffer,
         void* InputBuffer,
-        unsigned long InputLength,
-        unsigned long* OutputLength);
+        unsigned int InputLength,
+        unsigned int* OutputLength);
 };
 
 #endif /* __RAW_H */
Index: tools/cabman/mszip.cxx
===================================================================
--- tools/cabman/mszip.cxx	(revision 23829)
+++ tools/cabman/mszip.cxx	(working copy)
@@ -50,10 +50,10 @@
 }
 
 
-unsigned long CMSZipCodec::Compress(void* OutputBuffer,
+unsigned int CMSZipCodec::Compress(void* OutputBuffer,
                             void* InputBuffer,
-                            unsigned long InputLength,
-                            unsigned long* OutputLength)
+                            unsigned int InputLength,
+                            unsigned int* OutputLength)
 /*
  * FUNCTION: Compresses data in a buffer
  * ARGUMENTS:
@@ -72,7 +72,7 @@
 
     ZStream.next_in   = (unsigned char*)InputBuffer;
     ZStream.avail_in  = InputLength;
-    ZStream.next_out  = (unsigned char*)((unsigned long)OutputBuffer + 2);
+    ZStream.next_out  = (unsigned char*)((unsigned int*)OutputBuffer + 2);
     ZStream.avail_out = CAB_BLOCKSIZE + 12;
 
     /* WindowBits is passed < 0 to tell that there is no zlib header */
@@ -107,10 +107,10 @@
 }
 
 
-unsigned long CMSZipCodec::Uncompress(void* OutputBuffer,
+unsigned int CMSZipCodec::Uncompress(void* OutputBuffer,
                               void* InputBuffer,
-                              unsigned long InputLength,
-                              unsigned long* OutputLength)
+                              unsigned int InputLength,
+                              unsigned int* OutputLength)
 /*
  * FUNCTION: Uncompresses data in a buffer
  * ARGUMENTS:
@@ -131,7 +131,7 @@
         return CS_BADSTREAM;
     }
 	
-	ZStream.next_in   = (unsigned char*)((unsigned long)InputBuffer + 2);
+	ZStream.next_in   = (unsigned char*)((unsigned int*)InputBuffer + 2);
 	ZStream.avail_in  = InputLength - 2;
 	ZStream.next_out  = (unsigned char*)OutputBuffer;
     ZStream.avail_out = CAB_BLOCKSIZE + 12;
Index: tools/cabman/main.cxx
===================================================================
--- tools/cabman/main.cxx	(revision 23829)
+++ tools/cabman/main.cxx	(working copy)
@@ -17,9 +17,9 @@
 
 #ifdef DBG
 
-unsigned long DebugTraceLevel = MIN_TRACE;
-//unsigned long DebugTraceLevel = MID_TRACE;
-//unsigned long DebugTraceLevel = MAX_TRACE;
+unsigned int DebugTraceLevel = MIN_TRACE;
+//unsigned int DebugTraceLevel = MID_TRACE;
+//unsigned int DebugTraceLevel = MAX_TRACE;
 
 #endif /* DBG */
 
@@ -62,7 +62,7 @@
  *     Pointer to string
  */
 {
-    unsigned long dw;
+    unsigned int dw;
 
     /* Month */
     Str[0] = (char)('0' + ((Date & 0x01E0) >> 5) / 10);
@@ -94,8 +94,8 @@
  */
 {
     bool PM;
-    unsigned long Hour;
-    unsigned long dw;
+    unsigned int Hour;
+    unsigned int dw;
 
     Hour = ((Time & 0xF800) >> 11);
     PM = (Hour >= 12);
@@ -317,7 +317,7 @@
  * FUNCTION: Create cabinet
  */
 {
-    unsigned long Status;
+    unsigned int Status;
 
     Status = Load((char*)&FileName);
     if (Status != CAB_STATUS_SUCCESS) {
@@ -336,7 +336,7 @@
  * FUNCTION: Create cabinet
  */
 {
-    unsigned long Status;
+    unsigned int Status;
 
     Status = NewCabinet();
     if (Status != CAB_STATUS_SUCCESS) {
@@ -371,8 +371,8 @@
 {
     CAB_SEARCH Search;
     char Str[20];
-    unsigned long FileCount = 0;
-    unsigned long ByteCount = 0;
+    unsigned int FileCount = 0;
+    unsigned int ByteCount = 0;
 
     if (Open() == CAB_STATUS_SUCCESS) {
         printf("Cabinet %s\n\n", GetCabinetName());
@@ -425,7 +425,7 @@
  */
 {
     CAB_SEARCH Search;
-    unsigned long Status;
+    unsigned int Status;
 
     if (Open() == CAB_STATUS_SUCCESS) {
         printf("Cabinet %s\n\n", GetCabinetName());
Index: tools/cabman/cabinet.cxx
===================================================================
--- tools/cabman/cabinet.cxx	(revision 23829)
+++ tools/cabman/cabinet.cxx	(working copy)
@@ -27,7 +27,7 @@
 #define GetSizeOfFile(handle) _GetSizeOfFile(handle)
 static long _GetSizeOfFile(FILEHANDLE handle)
 {
-    unsigned long size = GetFileSize(handle, NULL);
+    unsigned int size = GetFileSize(handle, NULL);
     if (size == INVALID_FILE_SIZE)
       {
         return -1;
@@ -35,7 +35,7 @@
     return size;
 }
 #define ReadFileData(handle, buffer, size, bytesread) _ReadFileData(handle, buffer, size, bytesread)
-static bool _ReadFileData(FILEHANDLE handle, void* buffer, unsigned long size, unsigned long* bytesread)
+static bool _ReadFileData(FILEHANDLE handle, void* buffer, unsigned int size, unsigned int* bytesread)
 {
     return ReadFile(handle, buffer, size, bytesread, NULL) != 0;
 }
@@ -50,7 +50,7 @@
     return size;
 }
 #define ReadFileData(handle, buffer, size, bytesread) _ReadFileData(handle, buffer, size, bytesread)
-static bool _ReadFileData(FILEHANDLE handle, void* buffer, unsigned long size, unsigned long* bytesread)
+static bool _ReadFileData(FILEHANDLE handle, void* buffer, unsigned int size, unsigned int* bytesread)
 {
     *bytesread = fread(buffer, 1, size, handle);
     return *bytesread == size;
@@ -62,10 +62,10 @@
 #if 0
 #ifdef DBG
 
-void DumpBuffer(void* Buffer, unsigned long Size)
+void DumpBuffer(void* Buffer, unsigned int Size)
 {
     FILEHANDLE FileHandle;
-    unsigned long BytesWritten;
+    unsigned int BytesWritten;
 
     /* Create file, overwrite if it already exists */
     FileHandle = CreateFile("dump.bin", // Create this file
@@ -110,7 +110,7 @@
 }
 
 
-unsigned long CCFDATAStorage::Create(char* FileName)
+unsigned int CCFDATAStorage::Create(char* FileName)
 /*
  * FUNCTION: Creates the file
  * ARGUMENTS:
@@ -160,7 +160,7 @@
 }
 
 
-unsigned long CCFDATAStorage::Destroy()
+unsigned int CCFDATAStorage::Destroy()
 /*
  * FUNCTION: Destroys the file
  * RETURNS:
@@ -177,7 +177,7 @@
 }
 
 
-unsigned long CCFDATAStorage::Truncate()
+unsigned int CCFDATAStorage::Truncate()
 /*
  * FUNCTION: Truncate the scratch file to zero bytes
  * RETURNS:
@@ -201,7 +201,7 @@
 }
 
 
-unsigned long CCFDATAStorage::Position()
+unsigned int CCFDATAStorage::Position()
 /*
  * FUNCTION: Returns current position in file
  * RETURNS:
@@ -211,12 +211,12 @@
 #if defined(WIN32)
     return SetFilePointer(FileHandle, 0, NULL, FILE_CURRENT);
 #else
-    return (unsigned long)ftell(FileHandle);
+    return (unsigned int)ftell(FileHandle);
 #endif
 }
 
 
-unsigned long CCFDATAStorage::Seek(long Position)
+unsigned int CCFDATAStorage::Seek(int Position)
 /*
  * FUNCTION: Seeks to an absolute position
  * ARGUMENTS:
@@ -243,7 +243,7 @@
 }
 
 
-unsigned long CCFDATAStorage::ReadBlock(PCFDATA Data, void* Buffer, unsigned long* BytesRead)
+unsigned int CCFDATAStorage::ReadBlock(PCFDATA Data, void* Buffer, unsigned int* BytesRead)
 /*
  * FUNCTION: Reads a CFDATA block from the file
  * ARGUMENTS:
@@ -268,7 +268,7 @@
 }
 
 
-unsigned long CCFDATAStorage::WriteBlock(PCFDATA Data, void* Buffer, unsigned long* BytesWritten)
+unsigned int CCFDATAStorage::WriteBlock(PCFDATA Data, void* Buffer, unsigned int* BytesWritten)
 /*
  * FUNCTION: Writes a CFDATA block to the file
  * ARGUMENTS:
@@ -415,7 +415,7 @@
  *     Pointer to filename
  */
 {
-    unsigned long i, j;
+    unsigned int i, j;
 
     j = i = (Path[0] ? (Path[1] == ':' ? 2 : 0) : 0);
 
@@ -434,7 +434,7 @@
  */
 {
     char* FileName;
-    unsigned long i;
+    unsigned int i;
 
     i = (Path [0] ? (Path[1] == ':' ? 2 : 0) : 0);
     FileName = GetFileName(Path + i);
@@ -448,7 +448,7 @@
 
 
 bool CCabinet::NormalizePath(char* Path,
-                             unsigned long Length)
+                             unsigned int Length)
 /*
  * FUNCTION: Normalizes a path
  * ARGUMENTS:
@@ -458,7 +458,7 @@
  *     true if there was enough room in Path, or false
  */
 {
-    unsigned long n;
+    unsigned int n;
     bool OK = true;
 
     if ((n = strlen(Path)) &&
@@ -526,7 +526,7 @@
  */
 {
     FILEHANDLE FileHandle;
-    unsigned long BytesRead;
+    unsigned int BytesRead;
 
 #if defined(WIN32)
     FileHandle = CreateFile(ConvertPath(FileName, true),  // Open this file
@@ -549,7 +549,7 @@
 #endif
 
     CabinetReservedFileSize = GetSizeOfFile(FileHandle);
-    if (CabinetReservedFileSize == (unsigned long)-1) {
+    if (CabinetReservedFileSize == (unsigned int)-1) {
         DPRINT(MIN_TRACE, ("Cannot read from cabinet reserved file.\n"));
         return false;
     }
@@ -590,7 +590,7 @@
 }
 
 
-unsigned long CCabinet::GetCurrentDiskNumber()
+unsigned int CCabinet::GetCurrentDiskNumber()
 /*
  * FUNCTION: Returns current disk number
  * RETURNS:
@@ -601,7 +601,7 @@
 }
 
 
-unsigned long CCabinet::Open()
+unsigned int CCabinet::Open()
 /*
  * FUNCTION: Opens a cabinet file
  * RETURNS:
@@ -609,12 +609,12 @@
  */
 {
     PCFFOLDER_NODE FolderNode;
-    unsigned long Status;
-    unsigned long Index;
+    unsigned int Status;
+    unsigned int Index;
 
     if (!FileOpen) {
-        unsigned long BytesRead;
-        unsigned long Size;
+        unsigned int BytesRead;
+        unsigned int Size;
 
         OutputBuffer = AllocateMemory(CAB_BLOCKSIZE + 12);    // This should be enough
         if (!OutputBuffer)
@@ -666,7 +666,7 @@
 
         /* Read/skip any reserved bytes */
         if (CABHeader.Flags & CAB_FLAG_RESERVE) {
-            if ((Status = ReadBlock(&Size, sizeof(unsigned long), &BytesRead))
+            if ((Status = ReadBlock(&Size, sizeof(unsigned int), &BytesRead))
                 != CAB_STATUS_SUCCESS) {
                 DPRINT(MIN_TRACE, ("Cannot read from file (%d).\n", (unsigned int)Status));
                 return CAB_STATUS_INVALID_CAB;
@@ -771,7 +771,7 @@
 }
 
 
-unsigned long CCabinet::FindFirst(char* FileName,
+unsigned int CCabinet::FindFirst(char* FileName,
                           PCAB_SEARCH Search)
 /*
  * FUNCTION: Finds the first file in the cabinet that matches a search criteria
@@ -789,7 +789,7 @@
 }
 
 
-unsigned long CCabinet::FindNext(PCAB_SEARCH Search)
+unsigned int CCabinet::FindNext(PCAB_SEARCH Search)
 /*
  * FUNCTION: Finds next file in the cabinet that matches a search criteria
  * ARGUMENTS:
@@ -798,7 +798,7 @@
  *     Status of operation
  */
 {
-    unsigned long Status;
+    unsigned int Status;
 
     if (RestartSearch) {
         Search->Next  = FileListHead;
@@ -843,7 +843,7 @@
 }
 
 
-unsigned long CCabinet::ExtractFile(char* FileName)
+unsigned int CCabinet::ExtractFile(char* FileName)
 /*
  * FUNCTION: Extracts a file from the cabinet
  * ARGUMENTS:
@@ -852,21 +852,21 @@
  *     Status of operation
  */
 {
-    unsigned long Size;
-    unsigned long Offset;
-    unsigned long BytesRead;
-    unsigned long BytesToRead;
-    unsigned long BytesWritten;
-    unsigned long BytesSkipped;
-    unsigned long BytesToWrite;
-    unsigned long TotalBytesRead;
-    unsigned long CurrentOffset;
+    unsigned int Size;
+    unsigned int Offset;
+    unsigned int BytesRead;
+    unsigned int BytesToRead;
+    unsigned int BytesWritten;
+    unsigned int BytesSkipped;
+    unsigned int BytesToWrite;
+    unsigned int TotalBytesRead;
+    unsigned int CurrentOffset;
     unsigned char* Buffer;
     unsigned char* CurrentBuffer;
     FILEHANDLE DestFile;
     PCFFILE_NODE File;
     CFDATA CFData;
-    unsigned long Status;
+    unsigned int Status;
     bool Skip;
 #if defined(WIN32)
     FILETIME FileTime;
@@ -1033,7 +1033,7 @@
                     BytesToRead = CFData.CompSize;
 
 					DPRINT(MAX_TRACE, ("Read: (0x%lX,0x%lX).\n",
-						(long unsigned int)CurrentBuffer, (long unsigned int)Buffer));
+						CurrentBuffer, Buffer));
 
                     if (((Status = ReadBlock(CurrentBuffer, BytesToRead, &BytesRead)) !=
                         CAB_STATUS_SUCCESS) || (BytesToRead != BytesRead)) {
@@ -1046,7 +1046,7 @@
                     /* FIXME: Does not work with files generated by makecab.exe */
 /*
                     if (CFData.Checksum != 0) {
-                        unsigned long Checksum = ComputeChecksum(CurrentBuffer, BytesRead, 0);
+                        unsigned int Checksum = ComputeChecksum(CurrentBuffer, BytesRead, 0);
                         if (Checksum != CFData.Checksum) {
                             CloseFile(DestFile);
                             FreeMemory(Buffer);
@@ -1199,14 +1199,13 @@
                 (unsigned int)Size));
 
 #if defined(WIN32)
-            if (!WriteFile(DestFile, (void*)((unsigned long)OutputBuffer + BytesSkipped),
+            if (!WriteFile(DestFile, (void*)((unsigned int)OutputBuffer + BytesSkipped),
                 BytesToWrite, &BytesWritten, NULL) ||
                 (BytesToWrite != BytesWritten)) {
 				        DPRINT(MIN_TRACE, ("Status 0x%lX.\n", GetLastError()));
 #else
             BytesWritten = BytesToWrite;
-            if (fwrite((void*)((unsigned long)OutputBuffer + BytesSkipped),
-                BytesToWrite, 1, DestFile) < 1) {
+            if (fwrite((unsigned int*)((unsigned int*)OutputBuffer + BytesSkipped), BytesToWrite, 1, DestFile) < 1) {
 #endif
                 CloseFile(DestFile);
                 FreeMemory(Buffer);
@@ -1230,7 +1229,7 @@
 }
 
 
-void CCabinet::SelectCodec(unsigned long Id)
+void CCabinet::SelectCodec(unsigned int Id)
 /*
  * FUNCTION: Selects codec engine to use
  * ARGUMENTS:
@@ -1267,14 +1266,14 @@
 
 /* CAB write methods */
 
-unsigned long CCabinet::NewCabinet()
+unsigned int CCabinet::NewCabinet()
 /*
  * FUNCTION: Creates a new cabinet
  * RETURNS:
  *     Status of operation
  */
 {
-    unsigned long Status;
+    unsigned int Status;
 
     CurrentDiskNumber = 0;
 
@@ -1336,7 +1335,7 @@
 }
 
 
-unsigned long CCabinet::NewDisk()
+unsigned int CCabinet::NewDisk()
 /*
  * FUNCTION: Forces a new disk to be created
  * RETURNS:
@@ -1360,7 +1359,7 @@
 }
 
 
-unsigned long CCabinet::NewFolder()
+unsigned int CCabinet::NewFolder()
 /*
  * FUNCTION: Forces a new folder to be created
  * RETURNS:
@@ -1402,7 +1401,7 @@
 }
 
 
-unsigned long CCabinet::WriteFileToScratchStorage(PCFFILE_NODE FileNode)
+unsigned int CCabinet::WriteFileToScratchStorage(PCFFILE_NODE FileNode)
 /*
  * FUNCTION: Writes a file to the scratch file
  * ARGUMENTS:
@@ -1411,10 +1410,10 @@
  *     Status of operation
  */
 {
-    unsigned long BytesToRead;
-    unsigned long BytesRead;
-    unsigned long Status;
-    unsigned long Size;
+    unsigned int BytesToRead;
+    unsigned int BytesRead;
+    unsigned int Status;
+    unsigned int Size;
 
     if (!ContinueFile) {
         /* Try to open file */
@@ -1469,7 +1468,7 @@
 
     if (TotalBytesLeft > 0) {
         do {
-            if (TotalBytesLeft > (unsigned long)CAB_BLOCKSIZE - CurrentIBufferSize)
+            if (TotalBytesLeft > (unsigned int)CAB_BLOCKSIZE - CurrentIBufferSize)
                 BytesToRead = CAB_BLOCKSIZE - CurrentIBufferSize;
             else
                 BytesToRead = TotalBytesLeft;
@@ -1520,7 +1519,7 @@
 }
 
 
-unsigned long CCabinet::WriteDisk(unsigned long MoreDisks)
+unsigned int CCabinet::WriteDisk(unsigned int MoreDisks)
 /*
  * FUNCTION: Forces the current disk to be written
  * ARGUMENTS:
@@ -1530,7 +1529,7 @@
  */
 {
     PCFFILE_NODE FileNode;
-    unsigned long Status;
+    unsigned int Status;
 
     ContinueFile = false;
     FileNode = FileListHead;
@@ -1596,7 +1595,7 @@
 }
 
 
-unsigned long CCabinet::CommitDisk(unsigned long MoreDisks)
+unsigned int CCabinet::CommitDisk(unsigned int MoreDisks)
 /*
  * FUNCTION: Commits the current disk
  * ARGUMENTS:
@@ -1606,7 +1605,7 @@
  */
 {
     PCFFOLDER_NODE FolderNode;
-    unsigned long Status;
+    unsigned int Status;
 
     OnCabinetName(CurrentDiskNumber, CabinetName);
 
@@ -1620,7 +1619,7 @@
         FILE_ATTRIBUTE_NORMAL,           // Normal file
         NULL);                           // No attribute template
     if (FileHandle == INVALID_HANDLE_VALUE) {
-        unsigned long Status;
+        unsigned int Status;
         /* If file exists, ask to overwrite file */
         if (((Status = GetLastError()) == ERROR_FILE_EXISTS) &&
             (OnOverwrite(NULL, CabinetName))) {
@@ -1693,7 +1692,7 @@
 }
 
 
-unsigned long CCabinet::CloseDisk()
+unsigned int CCabinet::CloseDisk()
 /*
  * FUNCTION: Closes the current disk
  * RETURNS:
@@ -1711,14 +1710,14 @@
 }
 
 
-unsigned long CCabinet::CloseCabinet()
+unsigned int CCabinet::CloseCabinet()
 /*
  * FUNCTION: Closes the current cabinet
  * RETURNS:
  *     Status of operation
  */
 {
-    unsigned long Status;
+    unsigned int Status;
 
     DestroyFileNodes();
 
@@ -1746,7 +1745,7 @@
 }
 
 
-unsigned long CCabinet::AddFile(char* FileName)
+unsigned int CCabinet::AddFile(char* FileName)
 /*
  * FUNCTION: Adds a file to the current disk
  * ARGUMENTS:
@@ -1803,7 +1802,7 @@
 
     /* FIXME: Check for and handle large files (>= 2GB) */
     FileNode->File.FileSize = GetSizeOfFile(SrcFile);
-    if (FileNode->File.FileSize == (unsigned long)-1) {
+    if (FileNode->File.FileSize == (unsigned int)-1) {
         DPRINT(MIN_TRACE, ("Cannot read from file.\n"));
         FreeMemory(NewFileName);
         return CAB_STATUS_CANNOT_READ;
@@ -1819,7 +1818,7 @@
 }
 
 
-void CCabinet::SetMaxDiskSize(unsigned long Size)
+void CCabinet::SetMaxDiskSize(unsigned int Size)
 /*
  * FUNCTION: Sets the maximum size of the current disk
  * ARGUMENTS:
@@ -1887,7 +1886,7 @@
 }
 
 
-bool CCabinet::OnDiskLabel(unsigned long Number, char* Label)
+bool CCabinet::OnDiskLabel(unsigned int Number, char* Label)
 /*
  * FUNCTION: Called when a disk needs a label
  * ARGUMENTS:
@@ -1901,7 +1900,7 @@
 }
 
 
-bool CCabinet::OnCabinetName(unsigned long Number, char* Name)
+bool CCabinet::OnCabinetName(unsigned int Number, char* Name)
 /*
  * FUNCTION: Called when a cabinet needs a name
  * ARGUMENTS:
@@ -1916,7 +1915,7 @@
 
 #endif /* CAB_READ_ONLY */
 
-PCFFOLDER_NODE CCabinet::LocateFolderNode(unsigned long Index)
+PCFFOLDER_NODE CCabinet::LocateFolderNode(unsigned int Index)
 /*
  * FUNCTION: Locates a folder node
  * ARGUMENTS:
@@ -1946,7 +1945,7 @@
 }
 
 
-unsigned long CCabinet::GetAbsoluteOffset(PCFFILE_NODE File)
+unsigned int CCabinet::GetAbsoluteOffset(PCFFILE_NODE File)
 /*
  * FUNCTION: Returns the absolute offset of a file
  * ARGUMENTS:
@@ -1986,7 +1985,7 @@
 }
 
 
-unsigned long CCabinet::LocateFile(char* FileName,
+unsigned int CCabinet::LocateFile(char* FileName,
                            PCFFILE_NODE *File)
 /*
  * FUNCTION: Locates a file in the cabinet
@@ -2000,7 +1999,7 @@
  */
 {
     PCFFILE_NODE Node;
-    unsigned long Status;
+    unsigned int Status;
 
     DPRINT(MAX_TRACE, ("FileName '%s'\n", FileName));
 
@@ -2028,7 +2027,7 @@
 }
 
 
-unsigned long CCabinet::ReadString(char* String, unsigned long MaxLength)
+unsigned int CCabinet::ReadString(char* String, unsigned int MaxLength)
 /*
  * FUNCTION: Reads a NULL-terminated string from the cabinet
  * ARGUMENTS:
@@ -2038,10 +2037,10 @@
  *     Status of operation
  */
 {
-    unsigned long BytesRead;
-    unsigned long Offset;
-    unsigned long Status;
-    unsigned long Size;
+    unsigned int BytesRead;
+    unsigned int Offset;
+    unsigned int Status;
+    unsigned int Size;
     bool Found;
 
     Offset = 0;
@@ -2084,7 +2083,7 @@
   		return CAB_STATUS_INVALID_CAB;
   	}
 #else
-    if (fseek(FileHandle, (off_t)(-(long)Size), SEEK_CUR) != 0) {
+    if (fseek(FileHandle, (off_t)(-(int)Size), SEEK_CUR) != 0) {
         DPRINT(MIN_TRACE, ("fseek() failed.\n"));
         return CAB_STATUS_INVALID_CAB;
     }
@@ -2093,16 +2092,16 @@
 }
 
 
-unsigned long CCabinet::ReadFileTable()
+unsigned int CCabinet::ReadFileTable()
 /*
  * FUNCTION: Reads the file table from the cabinet file
  * RETURNS:
  *     Status of operation
  */
 {
-    unsigned long i;
-    unsigned long Status;
-    unsigned long BytesRead;
+    unsigned int i;
+    unsigned int Status;
+    unsigned int BytesRead;
     PCFFILE_NODE File;
 
     DPRINT(MAX_TRACE, ("Reading file table at absolute offset (0x%lX).\n",
@@ -2162,7 +2161,7 @@
 }
 
 
-unsigned long CCabinet::ReadDataBlocks(PCFFOLDER_NODE FolderNode)
+unsigned int CCabinet::ReadDataBlocks(PCFFOLDER_NODE FolderNode)
 /*
  * FUNCTION: Reads all CFDATA blocks for a folder from the cabinet file
  * ARGUMENTS:
@@ -2171,12 +2170,12 @@
  *     Status of operation
  */
 {
-    unsigned long AbsoluteOffset;
-    unsigned long UncompOffset;
+    unsigned int AbsoluteOffset;
+    unsigned int UncompOffset;
     PCFDATA_NODE Node;
-    unsigned long BytesRead;
-    unsigned long Status;
-    unsigned long i;
+    unsigned int BytesRead;
+    unsigned int Status;
+    unsigned int i;
 
     DPRINT(MAX_TRACE, ("Reading data blocks for folder (%lu)  at absolute offset (0x%lX).\n",
         FolderNode->Index, FolderNode->Folder.DataOffset));
@@ -2470,9 +2469,9 @@
 }
 
 
-unsigned long CCabinet::ComputeChecksum(void* Buffer,
+unsigned int CCabinet::ComputeChecksum(void* Buffer,
                                 unsigned int Size,
-                                unsigned long Seed)
+                                unsigned int Seed)
 /*
  * FUNCTION: Computes checksum for data block
  * ARGUMENTS:
@@ -2484,9 +2483,9 @@
  */
 {
     int UlongCount; // Number of ULONGs in block
-    unsigned long Checksum; // Checksum accumulator
+    unsigned int Checksum; // Checksum accumulator
     unsigned char* pb;
-    unsigned long ul;
+    unsigned int ul;
 
     /* FIXME: Doesn't seem to be correct. EXTRACT.EXE
        won't accept checksums computed by this routine */
@@ -2499,11 +2498,11 @@
 
     /* Checksum integral multiple of ULONGs */
     while (UlongCount-- > 0) {
-        /* NOTE: Build unsigned long in big/little-endian independent manner */
+        /* NOTE: Build unsigned int in big/little-endian independent manner */
         ul = *pb++;                     // Get low-order byte
-        ul |= (((unsigned long)(*pb++)) <<  8); // Add 2nd byte
-        ul |= (((unsigned long)(*pb++)) << 16); // Add 3nd byte
-        ul |= (((unsigned long)(*pb++)) << 24); // Add 4th byte
+        ul |= (((unsigned int)(*pb++)) <<  8); // Add 2nd byte
+        ul |= (((unsigned int)(*pb++)) << 16); // Add 3nd byte
+        ul |= (((unsigned int)(*pb++)) << 24); // Add 4th byte
 
         Checksum ^= ul;                 // Update checksum
     }
@@ -2512,9 +2511,9 @@
     ul = 0;
     switch (Size % 4) {
         case 3:
-            ul |= (((unsigned long)(*pb++)) << 16); // Add 3rd byte
+            ul |= (((unsigned int)(*pb++)) << 16); // Add 3rd byte
         case 2:
-            ul |= (((unsigned long)(*pb++)) <<  8); // Add 2nd byte
+            ul |= (((unsigned int)(*pb++)) <<  8); // Add 2nd byte
         case 1:
             ul |= *pb++;                    // Get low-order byte
         default:
@@ -2527,15 +2526,15 @@
 }
 
 
-unsigned long CCabinet::ReadBlock(void* Buffer,
-                          unsigned long Size,
-                          unsigned long* BytesRead)
+unsigned int CCabinet::ReadBlock(void* Buffer,
+                          unsigned int Size,
+                          unsigned int* BytesRead)
 /*
  * FUNCTION: Read a block of data from file
  * ARGUMENTS:
  *     Buffer    = Pointer to data buffer
  *     Size      = Length of data buffer
- *     BytesRead = Pointer to unsigned long that on return will contain
+ *     BytesRead = Pointer to unsigned int that on return will contain
  *                 number of bytes read
  * RETURNS:
  *     Status of operation
@@ -2548,15 +2547,15 @@
 
 #ifndef CAB_READ_ONLY
 
-unsigned long CCabinet::InitCabinetHeader()
+unsigned int CCabinet::InitCabinetHeader()
 /*
  * FUNCTION: Initializes cabinet header and optional fields
  * RETURNS:
  *     Status of operation
  */
 {
-    unsigned long TotalSize;
-    unsigned long Size;
+    unsigned int TotalSize;
+    unsigned int Size;
 
     CABHeader.FileTableOffset = 0;    // Not known yet
     CABHeader.FolderCount     = 0;    // Not known yet
@@ -2611,7 +2610,7 @@
       {
         CABHeader.Flags |= CAB_FLAG_RESERVE;
         TotalSize += CabinetReservedFileSize;
-        TotalSize += sizeof(unsigned long); /* For CabinetResSize, FolderResSize, and FileResSize fields */
+        TotalSize += sizeof(unsigned int); /* For CabinetResSize, FolderResSize, and FileResSize fields */
       }
 
     DiskSize += TotalSize;
@@ -2622,7 +2621,7 @@
 }
 
 
-unsigned long CCabinet::WriteCabinetHeader(bool MoreDisks)
+unsigned int CCabinet::WriteCabinetHeader(bool MoreDisks)
 /*
  * FUNCTION: Writes the cabinet header and optional fields
  * ARGUMENTS:
@@ -2633,8 +2632,8 @@
 {
     PCFFOLDER_NODE FolderNode;
     PCFFILE_NODE FileNode;
-    unsigned long BytesWritten;
-    unsigned long Size;
+    unsigned int BytesWritten;
+    unsigned int Size;
 
     if (MoreDisks) {
         CABHeader.Flags |= CAB_FLAG_HASNEXT;
@@ -2689,19 +2688,19 @@
 
     /* Write per-cabinet reserved area if present */
     if (CABHeader.Flags & CAB_FLAG_RESERVE) {
-        unsigned long ReservedSize;
+        unsigned int 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(unsigned long), &BytesWritten, NULL)) {
+        if (!WriteFile(FileHandle, &ReservedSize, sizeof(unsigned int), &BytesWritten, NULL)) {
             DPRINT(MIN_TRACE, ("Cannot write to file.\n"));
             return CAB_STATUS_CANNOT_WRITE;
         }
 #else
-        BytesWritten = sizeof(unsigned long);
-        if (fwrite(&ReservedSize, sizeof(unsigned long), 1, FileHandle) < 1) {
+        BytesWritten = sizeof(unsigned int);
+        if (fwrite(&ReservedSize, sizeof(unsigned int), 1, FileHandle) < 1) {
             DPRINT(MIN_TRACE, ("Cannot write to file.\n"));
             return CAB_STATUS_CANNOT_WRITE;
         }
@@ -2799,7 +2798,7 @@
 }
 
 
-unsigned long CCabinet::WriteFolderEntries()
+unsigned int CCabinet::WriteFolderEntries()
 /*
  * FUNCTION: Writes folder entries
  * RETURNS:
@@ -2807,7 +2806,7 @@
  */
 {
     PCFFOLDER_NODE FolderNode;
-    unsigned long BytesWritten;
+    unsigned int BytesWritten;
 
     DPRINT(MAX_TRACE, ("Writing folder table.\n"));
 
@@ -2842,7 +2841,7 @@
 }
 
 
-unsigned long CCabinet::WriteFileEntries()
+unsigned int CCabinet::WriteFileEntries()
 /*
  * FUNCTION: Writes file entries for all files
  * RETURNS:
@@ -2850,7 +2849,7 @@
  */
 {
     PCFFILE_NODE File;
-    unsigned long BytesWritten;
+    unsigned int BytesWritten;
     bool SetCont;
 
     DPRINT(MAX_TRACE, ("Writing file table.\n"));
@@ -2915,7 +2914,7 @@
 }
 
 
-unsigned long CCabinet::CommitDataBlocks(PCFFOLDER_NODE FolderNode)
+unsigned int CCabinet::CommitDataBlocks(PCFFOLDER_NODE FolderNode)
 /*
  * FUNCTION: Writes data blocks to the cabinet
  * ARGUMENTS:
@@ -2925,9 +2924,9 @@
  */
 {
     PCFDATA_NODE DataNode;
-    unsigned long BytesWritten;
-    unsigned long BytesRead;
-    unsigned long Status;
+    unsigned int BytesWritten;
+    unsigned int BytesRead;
+    unsigned int Status;
 
     DataNode = FolderNode->DataListHead;
     if (DataNode != NULL)
@@ -2982,15 +2981,15 @@
 }
 
 
-unsigned long CCabinet::WriteDataBlock()
+unsigned int CCabinet::WriteDataBlock()
 /*
  * FUNCTION: Writes the current data block to the scratch file
  * RETURNS:
  *     Status of operation
  */
 {
-    unsigned long Status;
-    unsigned long BytesWritten;
+    unsigned int Status;
+    unsigned int BytesWritten;
     PCFDATA_NODE DataNode;
 
     if (!BlockIsSplit) {
@@ -3098,7 +3097,7 @@
 #endif // !WIN32
 
 
-unsigned long CCabinet::GetFileTimes(FILEHANDLE FileHandle, PCFFILE_NODE File)
+unsigned int CCabinet::GetFileTimes(FILEHANDLE FileHandle, PCFFILE_NODE File)
 /*
  * FUNCTION: Returns file times of a file
  * ARGUMENTS:
@@ -3142,7 +3141,7 @@
 }
 
 
-unsigned long CCabinet::GetAttributesOnFile(PCFFILE_NODE File)
+unsigned int CCabinet::GetAttributesOnFile(PCFFILE_NODE File)
 /*
  * FUNCTION: Returns attributes on a file
  * ARGUMENTS:
@@ -3209,7 +3208,7 @@
 }
 
 
-unsigned long CCabinet::SetAttributesOnFile(PCFFILE_NODE File)
+unsigned int CCabinet::SetAttributesOnFile(PCFFILE_NODE File)
 /*
  * FUNCTION: Sets attributes on a file
  * ARGUMENTS:
@@ -3219,7 +3218,7 @@
  */
 {
 #if defined(WIN32)
-    unsigned long Attributes = 0;
+    unsigned int Attributes = 0;
 
     if (File->File.Attributes & CAB_ATTRIB_READONLY)
         Attributes |= FILE_ATTRIBUTE_READONLY;
Index: tools/cabman/cabman.h
===================================================================
--- tools/cabman/cabman.h	(revision 23829)
+++ tools/cabman/cabman.h	(working copy)
@@ -37,7 +37,7 @@
     virtual void OnAdd(PCFFILE Entry, char* FileName);
     /* Configuration */
     bool ProcessAll;
-    unsigned long Mode;
+    unsigned int Mode;
     bool PromptOnOverwrite;
     char Location[MAX_PATH];
     char FileName[MAX_PATH];
Index: tools/cabman/mszip.h
===================================================================
--- tools/cabman/mszip.h	(revision 23829)
+++ tools/cabman/mszip.h	(working copy)
@@ -22,15 +22,15 @@
     /* Default destructor */
     virtual ~CMSZipCodec();
     /* Compresses a data block */
-    virtual unsigned long Compress(void* OutputBuffer,
+    virtual unsigned int Compress(void* OutputBuffer,
                            void* InputBuffer,
-                           unsigned long InputLength,
-                           unsigned long* OutputLength);
+                           unsigned int InputLength,
+                           unsigned int* OutputLength);
     /* Uncompresses a data block */
-    virtual unsigned long Uncompress(void* OutputBuffer,
+    virtual unsigned int Uncompress(void* OutputBuffer,
                              void* InputBuffer,
-                             unsigned long InputLength,
-                             unsigned long* OutputLength);
+                             unsigned int InputLength,
+                             unsigned int* OutputLength);
 private:
     int Status;
     z_stream ZStream; /* Zlib stream */
Index: tools/cabman/dfp.cxx
===================================================================
--- tools/cabman/dfp.cxx	(revision 23829)
+++ tools/cabman/dfp.cxx	(working copy)
@@ -18,9 +18,9 @@
 
 #if defined(WIN32)
 #define GetSizeOfFile(handle) _GetSizeOfFile(handle)
-static long _GetSizeOfFile(FILEHANDLE handle)
+static int _GetSizeOfFile(FILEHANDLE handle)
 {
-    unsigned long size = GetFileSize(handle, NULL);
+    unsigned int size = GetFileSize(handle, NULL);
     if (size == INVALID_FILE_SIZE)
       {
         return -1;
@@ -28,22 +28,22 @@
     return size;
 }
 #define ReadFileData(handle, buffer, size, bytesread) _ReadFileData(handle, buffer, size, bytesread)
-static bool _ReadFileData(FILEHANDLE handle, void* buffer, unsigned long size, unsigned long* bytesread)
+static bool _ReadFileData(FILEHANDLE handle, void* buffer, unsigned int size, unsigned int* bytesread)
 {
     return ReadFile(handle, buffer, size, bytesread, NULL);
 }
 #else
 #define GetSizeOfFile(handle) _GetSizeOfFile(handle)
-static long _GetSizeOfFile(FILEHANDLE handle)
+static int _GetSizeOfFile(FILEHANDLE handle)
 {
-    long size;
+    int 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, unsigned long size, unsigned long* bytesread)
+static bool _ReadFileData(FILEHANDLE handle, void* buffer, unsigned int size, unsigned int* bytesread)
 {
     *bytesread = fread(buffer, 1, size, handle);
     return *bytesread == size;
@@ -124,7 +124,7 @@
     char eolbuf[2];
     char* destpath;
 #if defined(WIN32)
-    unsigned long BytesWritten;
+    unsigned int BytesWritten;
 #endif
 
     if (DontGenerateInf) {
@@ -192,7 +192,7 @@
 }
 
 
-unsigned long CDFParser::Load(char* FileName)
+unsigned int CDFParser::Load(char* FileName)
 /*
  * FUNCTION: Loads a directive file into memory
  * ARGUMENTS:
@@ -201,8 +201,8 @@
  *     Status of operation
  */
 {
-    unsigned long BytesRead;
-    long FileSize;
+    unsigned int BytesRead;
+    int FileSize;
 
     if (FileLoaded)
         return CAB_STATUS_SUCCESS;
@@ -231,7 +231,7 @@
         return CAB_STATUS_CANNOT_OPEN;
     }
 
-    FileBufferSize = (unsigned long)FileSize;
+    FileBufferSize = (unsigned int)FileSize;
 
     FileBuffer = (char*)AllocateMemory(FileBufferSize);
     if (!FileBuffer) {
@@ -256,7 +256,7 @@
 }
 
 
-unsigned long CDFParser::Parse()
+unsigned int CDFParser::Parse()
 /*
  * FUNCTION: Parses a loaded directive file
  * RETURNS:
@@ -264,7 +264,7 @@
  */
 {
     bool Command;
-    unsigned long Status;
+    unsigned int Status;
 
     if (!FileLoaded)
         return CAB_STATUS_NOFILE;
@@ -401,7 +401,7 @@
 }
 
 
-bool CDFParser::OnDiskLabel(unsigned long Number, char* Label)
+bool CDFParser::OnDiskLabel(unsigned int Number, char* Label)
 /*
  * FUNCTION: Called when a disk needs a label
  * ARGUMENTS:
@@ -447,7 +447,7 @@
 }
 
 
-bool CDFParser::OnCabinetName(unsigned long Number, char* Name)
+bool CDFParser::OnCabinetName(unsigned int Number, char* Name)
 /*
  * FUNCTION: Called when a cabinet needs a name
  * ARGUMENTS:
@@ -496,7 +496,7 @@
 }
 
 
-bool CDFParser::SetDiskName(PCABINET_NAME *List, unsigned long Number, char* String)
+bool CDFParser::SetDiskName(PCABINET_NAME *List, unsigned int Number, char* String)
 /*
  * FUNCTION: Sets an entry in a list
  * ARGUMENTS:
@@ -532,7 +532,7 @@
 }
 
 
-bool CDFParser::GetDiskName(PCABINET_NAME *List, unsigned long Number, char* String)
+bool CDFParser::GetDiskName(PCABINET_NAME *List, unsigned int Number, char* String)
 /*
  * FUNCTION: Returns an entry in a list
  * ARGUMENTS:
@@ -558,7 +558,7 @@
 }
 
 
-bool CDFParser::SetDiskNumber(PDISK_NUMBER *List, unsigned long Number, unsigned long Value)
+bool CDFParser::SetDiskNumber(PDISK_NUMBER *List, unsigned int Number, unsigned int Value)
 /*
  * FUNCTION: Sets an entry in a list
  * ARGUMENTS:
@@ -594,7 +594,7 @@
 }
 
 
-bool CDFParser::GetDiskNumber(PDISK_NUMBER *List, unsigned long Number, unsigned long* Value)
+bool CDFParser::GetDiskNumber(PDISK_NUMBER *List, unsigned int Number, unsigned int* Value)
 /*
  * FUNCTION: Returns an entry in a list
  * ARGUMENTS:
@@ -620,7 +620,7 @@
 }
 
 
-bool CDFParser::DoDiskLabel(unsigned long Number, char* Label)
+bool CDFParser::DoDiskLabel(unsigned int Number, char* Label)
 /*
  * FUNCTION: Sets the label of a disk
  * ARGUMENTS:
@@ -650,7 +650,7 @@
 }
 
 
-bool CDFParser::DoCabinetName(unsigned long Number, char* Name)
+bool CDFParser::DoCabinetName(unsigned int Number, char* Name)
 /*
  * FUNCTION: Sets the name of a cabinet
  * ARGUMENTS:
@@ -680,7 +680,7 @@
 }
 
 
-unsigned long CDFParser::DoMaxDiskSize(bool NumberValid, unsigned long Number)
+unsigned int CDFParser::DoMaxDiskSize(bool NumberValid, unsigned int Number)
 /*
  * FUNCTION: Sets the maximum disk size
  * ARGUMENTS:
@@ -692,7 +692,7 @@
  *     Standard sizes are 2.88M, 1.44M, 1.25M, 1.2M, 720K, 360K, and CDROM
  */
 {
-    unsigned long A, B, Value;
+    unsigned int A, B, Value;
 
     if (IsNextToken(TokenInteger, true)) {
 
@@ -784,14 +784,14 @@
     InfFileNameSet = true;
 }
 
-unsigned long CDFParser::SetupNewDisk()
+unsigned int CDFParser::SetupNewDisk()
 /*
  * FUNCTION: Sets up parameters for a new disk
  * RETURNS:
  *     Status of operation
  */
 {
-    unsigned long Value;
+    unsigned int Value;
 
     if (!GetDiskNumber(&MaxDiskSize, GetCurrentDiskNumber(), &Value))  {
         if (MaxDiskSizeAllSet)
@@ -805,7 +805,7 @@
 }
 
 
-unsigned long CDFParser::PerformSetCommand()
+unsigned int CDFParser::PerformSetCommand()
 /*
  * FUNCTION: Performs a set variable command
  * RETURNS:
@@ -814,7 +814,7 @@
 {
     SETTYPE SetType;
     bool NumberValid = false;
-    unsigned long Number = 0;
+    unsigned int Number = 0;
 
     if (!IsNextToken(TokenIdentifier, true))
         return CAB_STATUS_FAILURE;
@@ -886,7 +886,7 @@
 }
 
 
-unsigned long CDFParser::PerformNewCommand()
+unsigned int CDFParser::PerformNewCommand()
 /*
  * FUNCTION: Performs a new disk|cabinet|folder command
  * RETURNS:
@@ -894,7 +894,7 @@
  */
 {
     NEWTYPE NewType;
-    unsigned long Status;
+    unsigned int Status;
 
     if (!IsNextToken(TokenIdentifier, true))
         return CAB_STATUS_FAILURE;
@@ -959,7 +959,7 @@
 }
 
 
-unsigned long CDFParser::PerformInfBeginCommand()
+unsigned int CDFParser::PerformInfBeginCommand()
 /*
  * FUNCTION: Begins inf mode
  * RETURNS:
@@ -971,7 +971,7 @@
 }
 
 
-unsigned long CDFParser::PerformInfEndCommand()
+unsigned int CDFParser::PerformInfEndCommand()
 /*
  * FUNCTION: Begins inf mode
  * RETURNS:
@@ -983,7 +983,7 @@
 }
 
 
-unsigned long CDFParser::PerformCommand()
+unsigned int CDFParser::PerformCommand()
 /*
  * FUNCTION: Performs a command
  * RETURNS:
@@ -1003,15 +1003,15 @@
 }
 
 
-unsigned long CDFParser::PerformFileCopy()
+unsigned int CDFParser::PerformFileCopy()
 /*
  * FUNCTION: Performs a file copy
  * RETURNS:
  *     Status of operation
  */
 {
-    unsigned long Status;
-    unsigned long i, j;
+    unsigned int Status;
+    unsigned int i, j;
     char ch;
     char SrcName[MAX_PATH];
     char DstName[MAX_PATH];
@@ -1167,7 +1167,7 @@
  *     true if there is a new line, false if not
  */
 {
-    unsigned long i, j;
+    unsigned int i, j;
     char ch;
 
     if (CurrentOffset >= FileBufferSize)
@@ -1203,7 +1203,7 @@
  * FUNCTION: Reads the next token from the current line
  */
 {
-    unsigned long i;
+    unsigned int i;
     char ch = ' ';
 
     if (CurrentChar >= LineLength) {
Index: tools/cabman/raw.cxx
===================================================================
--- tools/cabman/raw.cxx	(revision 23829)
+++ tools/cabman/raw.cxx	(working copy)
@@ -29,10 +29,10 @@
 }
 
 
-unsigned long CRawCodec::Compress(void* OutputBuffer,
+unsigned int CRawCodec::Compress(void* OutputBuffer,
     void* InputBuffer,
-    unsigned long InputLength,
-    unsigned long* OutputLength)
+    unsigned int InputLength,
+    unsigned int* OutputLength)
 /*
  * FUNCTION: Compresses data in a buffer
  * ARGUMENTS:
@@ -47,10 +47,10 @@
     return CS_SUCCESS;
 }
 
-unsigned long CRawCodec::Uncompress(void* OutputBuffer,
+unsigned int CRawCodec::Uncompress(void* OutputBuffer,
     void* InputBuffer,
-    unsigned long InputLength,
-    unsigned long* OutputLength)
+    unsigned int InputLength,
+    unsigned int* OutputLength)
 /*
  * FUNCTION: Uncompresses data in a buffer
  * ARGUMENTS:
Index: tools/cabman/cabinet.h
===================================================================
--- tools/cabman/cabinet.h	(revision 23829)
+++ tools/cabman/cabinet.h	(working copy)
@@ -56,7 +56,7 @@
 
 #ifdef DBG
 
-extern unsigned long DebugTraceLevel;
+extern unsigned int DebugTraceLevel;
 
 #ifdef _MSC_VER
 #define __FUNCTION__ ""
@@ -121,12 +121,12 @@
 
 typedef struct _CFHEADER
 {
-    unsigned long Signature;        // File signature 'MSCF' (CAB_SIGNATURE)
-    unsigned long Reserved1;        // Reserved field
-    unsigned long CabinetSize;      // Cabinet file size
-    unsigned long Reserved2;        // Reserved field
-    unsigned long FileTableOffset;  // Offset of first CFFILE
-    unsigned long Reserved3;        // Reserved field
+    unsigned int Signature;        // File signature 'MSCF' (CAB_SIGNATURE)
+    unsigned int Reserved1;        // Reserved field
+    unsigned int CabinetSize;      // Cabinet file size
+    unsigned int Reserved2;        // Reserved field
+    unsigned int FileTableOffset;  // Offset of first CFFILE
+    unsigned int Reserved3;        // Reserved field
     unsigned short  Version;          // Cabinet version (CAB_VERSION)
     unsigned short  FolderCount;      // Number of folders
     unsigned short  FileCount;        // Number of files
@@ -148,7 +148,7 @@
 
 typedef struct _CFFOLDER
 {
-    unsigned long  DataOffset;       // Absolute offset of first CFDATA block in this folder
+    unsigned int  DataOffset;       // Absolute offset of first CFDATA block in this folder
     unsigned short DataBlockCount;   // Number of CFDATA blocks in this folder in this cabinet
     unsigned short CompressionType;  // Type of compression used for all CFDATA blocks in this folder
 /* Optional fields (depends on Flags)
@@ -159,8 +159,8 @@
 
 typedef struct _CFFILE
 {
-    unsigned long  FileSize;         // Uncompressed file size in bytes
-    unsigned long  FileOffset;       // Uncompressed offset of file in the folder
+    unsigned int  FileSize;         // Uncompressed file size in bytes
+    unsigned int  FileOffset;       // Uncompressed offset of file in the folder
     unsigned short FileControlID;    // File control ID (CAB_FILE_*)
     unsigned short FileDate;         // File date stamp, as used by DOS
     unsigned short FileTime;         // File time stamp, as used by DOS
@@ -171,7 +171,7 @@
 
 typedef struct _CFDATA
 {
-    unsigned long  Checksum;         // Checksum of CFDATA entry
+    unsigned int  Checksum;         // Checksum of CFDATA entry
     unsigned short CompSize;         // Number of compressed bytes in this block
     unsigned short UncompSize;       // Number of uncompressed bytes in this block
 /* Optional fields (depends on Flags)
@@ -183,9 +183,9 @@
 {
     struct _CFDATA_NODE *Next;
     struct _CFDATA_NODE *Prev;
-    unsigned long       ScratchFilePosition;    // Absolute offset in scratch file
-    unsigned long       AbsoluteOffset;         // Absolute offset in cabinet
-    unsigned long       UncompOffset;           // Uncompressed offset in folder
+    unsigned int       ScratchFilePosition;    // Absolute offset in scratch file
+    unsigned int       AbsoluteOffset;         // Absolute offset in cabinet
+    unsigned int       UncompOffset;           // Uncompressed offset in folder
     CFDATA              Data;
 } CFDATA_NODE, *PCFDATA_NODE;
 
@@ -193,12 +193,12 @@
 {
     struct _CFFOLDER_NODE *Next;
     struct _CFFOLDER_NODE *Prev;
-    unsigned long         UncompOffset;     // File size accumulator
-    unsigned long         AbsoluteOffset;
-    unsigned long         TotalFolderSize;  // Total size of folder in current disk
+    unsigned int         UncompOffset;     // File size accumulator
+    unsigned int         AbsoluteOffset;
+    unsigned int         TotalFolderSize;  // Total size of folder in current disk
     PCFDATA_NODE          DataListHead;
     PCFDATA_NODE          DataListTail;
-    unsigned long         Index;
+    unsigned int         Index;
     bool                  Commit;           // true if the folder should be committed
     bool                  Delete;           // true if marked for deletion
     CFFOLDER              Folder;
@@ -252,15 +252,15 @@
     /* Default destructor */
     virtual ~CCABCodec() {};
     /* Compresses a data block */
-    virtual unsigned long Compress(void* OutputBuffer,
+    virtual unsigned int Compress(void* OutputBuffer,
                            void* InputBuffer,
-                           unsigned long InputLength,
-                           unsigned long* OutputLength) = 0;
+                           unsigned int InputLength,
+                           unsigned int* OutputLength) = 0;
     /* Uncompresses a data block */
-    virtual unsigned long Uncompress(void* OutputBuffer,
+    virtual unsigned int Uncompress(void* OutputBuffer,
                              void* InputBuffer,
-                             unsigned long InputLength,
-                             unsigned long* OutputLength) = 0;
+                             unsigned int InputLength,
+                             unsigned int* OutputLength) = 0;
 };
 
 
@@ -287,13 +287,13 @@
     CCFDATAStorage();
     /* Default destructor */
     virtual ~CCFDATAStorage();
-    unsigned long Create(char* FileName);
-    unsigned long Destroy();
-    unsigned long Truncate();
-    unsigned long Position();
-    unsigned long Seek(long Position);
-    unsigned long ReadBlock(PCFDATA Data, void* Buffer, unsigned long* BytesRead);
-    unsigned long WriteBlock(PCFDATA Data, void* Buffer, unsigned long* BytesWritten);
+    unsigned int Create(char* FileName);
+    unsigned int Destroy();
+    unsigned int Truncate();
+    unsigned int Position();
+    unsigned int Seek(int Position);
+    unsigned int ReadBlock(PCFDATA Data, void* Buffer, unsigned int* BytesRead);
+    unsigned int WriteBlock(PCFDATA Data, void* Buffer, unsigned int* BytesWritten);
 private:
     char FullName[MAX_PATH];
     bool FileCreated;
@@ -317,7 +317,7 @@
     /* Removes a filename from a fully qualified filename */
     void RemoveFileName(char* Path);
     /* Normalizes a path */
-    bool NormalizePath(char* Path, unsigned long Length);
+    bool NormalizePath(char* Path, unsigned int Length);
     /* Returns name of cabinet file */
     char* GetCabinetName();
     /* Sets the name of the cabinet file */
@@ -331,40 +331,40 @@
     /* Returns destination path */
     char* GetDestinationPath();
     /* Returns zero-based current disk number */
-    unsigned long GetCurrentDiskNumber();
+    unsigned int GetCurrentDiskNumber();
     /* Opens the current cabinet file */
-    unsigned long Open();
+    unsigned int Open();
     /* Closes the current open cabinet file */
     void Close();
     /* Locates the first file in the current cabinet file that matches a search criteria */
-    unsigned long FindFirst(char* FileName, PCAB_SEARCH Search);
+    unsigned int FindFirst(char* FileName, PCAB_SEARCH Search);
     /* Locates the next file in the current cabinet file */
-    unsigned long FindNext(PCAB_SEARCH Search);
+    unsigned int FindNext(PCAB_SEARCH Search);
     /* Extracts a file from the current cabinet file */
-    unsigned long ExtractFile(char* FileName);
+    unsigned int ExtractFile(char* FileName);
     /* Select codec engine to use */
-    void SelectCodec(unsigned long Id);
+    void SelectCodec(unsigned int Id);
 #ifndef CAB_READ_ONLY
     /* Creates a new cabinet file */
-    unsigned long NewCabinet();
+    unsigned int NewCabinet();
     /* Forces a new disk to be created */
-    unsigned long NewDisk();
+    unsigned int NewDisk();
     /* Forces a new folder to be created */
-    unsigned long NewFolder();
+    unsigned int NewFolder();
     /* Writes a file to scratch storage */
-    unsigned long WriteFileToScratchStorage(PCFFILE_NODE FileNode);
+    unsigned int WriteFileToScratchStorage(PCFFILE_NODE FileNode);
     /* Forces the current disk to be written */
-    unsigned long WriteDisk(unsigned long MoreDisks);
+    unsigned int WriteDisk(unsigned int MoreDisks);
     /* Commits the current disk */
-    unsigned long CommitDisk(unsigned long MoreDisks);
+    unsigned int CommitDisk(unsigned int MoreDisks);
     /* Closes the current disk */
-    unsigned long CloseDisk();
+    unsigned int CloseDisk();
     /* Closes the current cabinet */
-    unsigned long CloseCabinet();
+    unsigned int CloseCabinet();
     /* Adds a file to the current disk */
-    unsigned long AddFile(char* FileName);
+    unsigned int AddFile(char* FileName);
     /* Sets the maximum size of the current disk */
-    void SetMaxDiskSize(unsigned long Size);
+    void SetMaxDiskSize(unsigned int Size);
 #endif /* CAB_READ_ONLY */
 
     /* Default event handlers */
@@ -379,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(unsigned long Number, char* Name);
+    virtual bool OnCabinetName(unsigned int Number, char* Name);
     /* Handler called when a disk needs a label */
-    virtual bool OnDiskLabel(unsigned long Number, char* Label);
+    virtual bool OnDiskLabel(unsigned int Number, char* Label);
 #endif /* CAB_READ_ONLY */
 private:
-    PCFFOLDER_NODE LocateFolderNode(unsigned long Index);
-    unsigned long GetAbsoluteOffset(PCFFILE_NODE File);
-    unsigned long LocateFile(char* FileName, PCFFILE_NODE *File);
-    unsigned long ReadString(char* String, unsigned long MaxLength);
-    unsigned long ReadFileTable();
-    unsigned long ReadDataBlocks(PCFFOLDER_NODE FolderNode);
+    PCFFOLDER_NODE LocateFolderNode(unsigned int Index);
+    unsigned int GetAbsoluteOffset(PCFFILE_NODE File);
+    unsigned int LocateFile(char* FileName, PCFFILE_NODE *File);
+    unsigned int ReadString(char* String, unsigned int MaxLength);
+    unsigned int ReadFileTable();
+    unsigned int ReadDataBlocks(PCFFOLDER_NODE FolderNode);
     PCFFOLDER_NODE NewFolderNode();
     PCFFILE_NODE NewFileNode();
     PCFDATA_NODE NewDataNode(PCFFOLDER_NODE FolderNode);
@@ -398,45 +398,45 @@
     void DestroyDeletedFileNodes();
     void DestroyFolderNodes();
     void DestroyDeletedFolderNodes();
-    unsigned long ComputeChecksum(void* Buffer, unsigned int Size, unsigned long Seed);
-    unsigned long ReadBlock(void* Buffer, unsigned long Size, unsigned long* BytesRead);
+    unsigned int ComputeChecksum(void* Buffer, unsigned int Size, unsigned int Seed);
+    unsigned int ReadBlock(void* Buffer, unsigned int Size, unsigned int* BytesRead);
 #ifndef CAB_READ_ONLY
-    unsigned long InitCabinetHeader();
-    unsigned long WriteCabinetHeader(bool MoreDisks);
-    unsigned long WriteFolderEntries();
-    unsigned long WriteFileEntries();
-    unsigned long CommitDataBlocks(PCFFOLDER_NODE FolderNode);
-    unsigned long WriteDataBlock();
-    unsigned long GetAttributesOnFile(PCFFILE_NODE File);
-    unsigned long SetAttributesOnFile(PCFFILE_NODE File);
-    unsigned long GetFileTimes(FILEHANDLE FileHandle, PCFFILE_NODE File);
+    unsigned int InitCabinetHeader();
+    unsigned int WriteCabinetHeader(bool MoreDisks);
+    unsigned int WriteFolderEntries();
+    unsigned int WriteFileEntries();
+    unsigned int CommitDataBlocks(PCFFOLDER_NODE FolderNode);
+    unsigned int WriteDataBlock();
+    unsigned int GetAttributesOnFile(PCFFILE_NODE File);
+    unsigned int SetAttributesOnFile(PCFFILE_NODE File);
+    unsigned int GetFileTimes(FILEHANDLE FileHandle, PCFFILE_NODE File);
 #if !defined(WIN32)
     void ConvertDateAndTime(time_t* Time, unsigned short* DosDate, unsigned short* DosTime);
 #endif
 #endif /* CAB_READ_ONLY */
-    unsigned long CurrentDiskNumber;    // Zero based disk number
+    unsigned int 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
-    unsigned long TotalHeaderSize;      // Size of header and optional fields
-    unsigned long NextFieldsSize;       // Size of next cabinet name and next disk label
-    unsigned long TotalFolderSize;      // Size of all folder entries
-    unsigned long TotalFileSize;        // Size of all file entries
-    unsigned long FolderUncompSize;     // Uncompressed size of folder
-    unsigned long BytesLeftInBlock;     // Number of bytes left in current block
+    unsigned int TotalHeaderSize;      // Size of header and optional fields
+    unsigned int NextFieldsSize;       // Size of next cabinet name and next disk label
+    unsigned int TotalFolderSize;      // Size of all folder entries
+    unsigned int TotalFileSize;        // Size of all file entries
+    unsigned int FolderUncompSize;     // Uncompressed size of folder
+    unsigned int BytesLeftInBlock;     // Number of bytes left in current block
     bool ReuseBlock;
     char DestPath[MAX_PATH];
     char CabinetReservedFile[MAX_PATH];
     void* CabinetReservedFileBuffer;
-    unsigned long CabinetReservedFileSize;
+    unsigned int CabinetReservedFileSize;
     FILEHANDLE FileHandle;
     bool FileOpen;
     CFHEADER CABHeader;
-    unsigned long CabinetReserved;
-    unsigned long FolderReserved;
-    unsigned long DataReserved;
+    unsigned int CabinetReserved;
+    unsigned int FolderReserved;
+    unsigned int DataReserved;
     PCFFOLDER_NODE FolderListHead;
     PCFFOLDER_NODE FolderListTail;
     PCFFOLDER_NODE CurrentFolderNode;
@@ -444,32 +444,32 @@
     PCFFILE_NODE FileListHead;
     PCFFILE_NODE FileListTail;
     CCABCodec *Codec;
-    unsigned long CodecId;
+    unsigned int CodecId;
     bool CodecSelected;
     void* InputBuffer;
     void* CurrentIBuffer;               // Current offset in input buffer
-    unsigned long CurrentIBufferSize;   // Bytes left in input buffer
+    unsigned int CurrentIBufferSize;   // Bytes left in input buffer
     void* OutputBuffer;
-    unsigned long TotalCompSize;        // Total size of current CFDATA block
+    unsigned int TotalCompSize;        // Total size of current CFDATA block
     void* CurrentOBuffer;               // Current offset in output buffer
-    unsigned long CurrentOBufferSize;   // Bytes left in output buffer
-    unsigned long BytesLeftInCabinet;
+    unsigned int CurrentOBufferSize;   // Bytes left in output buffer
+    unsigned int BytesLeftInCabinet;
     bool RestartSearch;
-    unsigned long LastFileOffset;       // Uncompressed offset of last extracted file
+    unsigned int LastFileOffset;       // Uncompressed offset of last extracted file
 #ifndef CAB_READ_ONLY
-    unsigned long LastBlockStart;       // Uncompressed offset of last block in folder
-    unsigned long MaxDiskSize;
-    unsigned long DiskSize;
-    unsigned long PrevCabinetNumber;    // Previous cabinet number (where split file starts)
+    unsigned int LastBlockStart;       // Uncompressed offset of last block in folder
+    unsigned int MaxDiskSize;
+    unsigned int DiskSize;
+    unsigned int PrevCabinetNumber;    // Previous cabinet number (where split file starts)
     bool CreateNewDisk;
     bool CreateNewFolder;
 
     CCFDATAStorage *ScratchFile;
     FILEHANDLE SourceFile;
     bool ContinueFile;
-    unsigned long TotalBytesLeft;
+    unsigned int TotalBytesLeft;
     bool BlockIsSplit;                  // true if current data block is split
-    unsigned long NextFolderNumber;     // Zero based folder number
+    unsigned int NextFolderNumber;     // Zero based folder number
 #endif /* CAB_READ_ONLY */
 };
 
