[UDFS] Fix 64 bit issues
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Mon, 20 Aug 2018 17:02:00 +0000 (19:02 +0200)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 2 Apr 2019 08:53:23 +0000 (10:53 +0200)
23 files changed:
drivers/filesystems/udfs/Include/Sys_spec_lib.cpp
drivers/filesystems/udfs/Include/phys_lib.cpp
drivers/filesystems/udfs/Include/phys_lib.h
drivers/filesystems/udfs/Include/wcache_lib.cpp
drivers/filesystems/udfs/Include/wcache_lib.h
drivers/filesystems/udfs/close.cpp
drivers/filesystems/udfs/create.cpp
drivers/filesystems/udfs/env_spec.cpp
drivers/filesystems/udfs/env_spec.h
drivers/filesystems/udfs/fastio.cpp
drivers/filesystems/udfs/fileinfo.cpp
drivers/filesystems/udfs/fscntrl.cpp
drivers/filesystems/udfs/protos.h
drivers/filesystems/udfs/read.cpp
drivers/filesystems/udfs/udf_info/alloc.cpp
drivers/filesystems/udfs/udf_info/dirtree.cpp
drivers/filesystems/udfs/udf_info/extent.cpp
drivers/filesystems/udfs/udf_info/mount.cpp
drivers/filesystems/udfs/udf_info/remap.cpp
drivers/filesystems/udfs/udf_info/udf_info.cpp
drivers/filesystems/udfs/udf_info/udf_info.h
drivers/filesystems/udfs/udf_info/udf_rel.h
drivers/filesystems/udfs/write.cpp

index d775e86..0c21ff9 100644 (file)
@@ -245,7 +245,7 @@ UDFFileDirInfoToNT(
 
     UDFPrint(("@=%#x, FileDirNdx %x\n", &Vcb, FileDirNdx));
 
-    ASSERT((ULONG)NTFileInfo > 0x1000);
+    ASSERT((ULONG_PTR)NTFileInfo > 0x1000);
     RtlZeroMemory(NTFileInfo, sizeof(FILE_BOTH_DIR_INFORMATION));
     
     DosName.Buffer = (PWCHAR)&(NTFileInfo->ShortName);
index dbe411d..5ee90d3 100644 (file)
@@ -94,20 +94,20 @@ __fastcall
 UDFTIOVerify(
     IN void* _Vcb,
     IN void* Buffer,     // Target buffer
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN uint32 LBA,
-    OUT uint32* IOBytes,
+    OUT PSIZE_T IOBytes,
     IN uint32 Flags
     )
 {
     OSSTATUS RC = STATUS_SUCCESS;
     uint32 i, j;
-    uint32 mask;
+    SIZE_T mask;
     uint32 lba0, len, lba1;
     PUCHAR tmp_buff;
     PUCHAR p;
     PCHAR cached_block;
-    uint32 tmp_wb;
+    SIZE_T tmp_wb;
     BOOLEAN need_remap;
     OSSTATUS final_RC = STATUS_SUCCESS;
     BOOLEAN zero;
@@ -127,7 +127,7 @@ UDFTIOVerify(
     UDFAcquireResourceExclusive(&(Vcb->IoResource), TRUE);
     Flags |= PH_IO_LOCKED;
 
-    tmp_wb = (uint32)_Vcb;
+    tmp_wb = (SIZE_T)_Vcb;
     if(Flags & PH_EX_WRITE) {
         UDFPrint(("IO-Write-Verify\n"));
         RC = UDFTWrite(_Vcb, Buffer, Length, LBA, &tmp_wb, Flags | PH_VCB_IN_RETLEN);
@@ -248,7 +248,7 @@ UDFTIOVerify(
             packet_ok = FALSE;
             if(!single_packet) {
                 // try to read entire packet, this returs error more often then sequential reading of all blocks one by one
-                tmp_wb = (uint32)_Vcb;
+                tmp_wb = (SIZE_T)_Vcb;
                 RC = UDFTRead(_Vcb, p, Vcb->SparingBlockSize << Vcb->BlockSizeBits, lba0+i, &tmp_wb,
                               Flags | PH_READ_VERIFY_CACHE | PH_TMP_BUFFER | PH_VCB_IN_RETLEN);
             } else {
@@ -271,7 +271,7 @@ UDFTIOVerify(
                 // even if block is cached, we have to verify if it is readable
                 if(!packet_ok && !UDFVIsStored(Vcb, lba0+i)) {
 
-                    tmp_wb = (uint32)_Vcb;
+                    tmp_wb = (SIZE_T)_Vcb;
                     RC = UDFTRead(_Vcb, p, Vcb->BlockSize, lba0+i, &tmp_wb,
                                   Flags | PH_FORGET_VERIFIED | PH_READ_VERIFY_CACHE | PH_TMP_BUFFER | PH_VCB_IN_RETLEN);
                     if(!OS_SUCCESS(RC)) {
@@ -297,7 +297,7 @@ UDFTIOVerify(
 
             } else {
                 if(!UDFVIsStored(Vcb, lba0+i)) {
-                    tmp_wb = (uint32)_Vcb;
+                    tmp_wb = (SIZE_T)_Vcb;
                     RC = UDFTRead(_Vcb, p, Vcb->BlockSize, lba0+i, &tmp_wb,
                                   Flags | PH_FORGET_VERIFIED | PH_READ_VERIFY_CACHE | PH_TMP_BUFFER | PH_VCB_IN_RETLEN);
                 } else {
@@ -363,7 +363,7 @@ do_remap:
                         UDFPrint(("  remap status %x\n", RC));
                         if(OS_SUCCESS(RC)) {
                             // write to remapped area
-                            tmp_wb = (uint32)_Vcb;
+                            tmp_wb = (SIZE_T)_Vcb;
                             RC = UDFTWrite(_Vcb, tmp_buff, Vcb->SparingBlockSize << Vcb->BlockSizeBits, lba1, &tmp_wb,
                                           Flags | PH_FORGET_VERIFIED | PH_READ_VERIFY_CACHE | PH_TMP_BUFFER | PH_VCB_IN_RETLEN);
                             UDFPrint(("  write status %x\n", RC));
@@ -397,7 +397,7 @@ do_remap:
         DbgFreePool(tmp_buff);
     }
 
-    tmp_wb = (uint32)_Vcb;
+    tmp_wb = (SIZE_T)_Vcb;
     if(Flags & PH_EX_WRITE) {
         UDFPrint(("IO-Write-Verify (2)\n"));
         //RC = UDFTWrite(_Vcb, Buffer, Length, LBA, &tmp_wb, Flags | PH_FORGET_VERIFIED | PH_VCB_IN_RETLEN);
@@ -420,9 +420,9 @@ OSSTATUS
 UDFTWriteVerify(
     IN void* _Vcb,
     IN void* Buffer,     // Target buffer
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN uint32 LBA,
-    OUT uint32* WrittenBytes,
+    OUT PSIZE_T WrittenBytes,
     IN uint32 Flags
     )
 {
@@ -433,9 +433,9 @@ OSSTATUS
 UDFTReadVerify(
     IN void* _Vcb,
     IN void* Buffer,     // Target buffer
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN uint32 LBA,
-    OUT uint32* ReadBytes,
+    OUT PSIZE_T ReadBytes,
     IN uint32 Flags
     )
 {
@@ -453,9 +453,9 @@ OSSTATUS
 UDFTWrite(
     IN void* _Vcb,
     IN void* Buffer,     // Target buffer
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN uint32 LBA,
-    OUT uint32* WrittenBytes,
+    OUT PSIZE_T WrittenBytes,
     IN uint32 Flags
     )
 {
@@ -526,7 +526,7 @@ retry_1:
                 try_return(RC);
             }
             if(Flags & PH_VCB_IN_RETLEN) {
-                (*WrittenBytes) = (ULONG)Vcb;
+                (*WrittenBytes) = (ULONG_PTR)Vcb;
             }
             RC = UDFPhWriteVerifySynchronous(Vcb->TargetDeviceObject, Buffer, Length,
                        ((uint64)rLba) << Vcb->BlockSizeBits, WrittenBytes, Flags);
@@ -543,7 +543,7 @@ retry_1:
         // write according to relocation table
         RelocExtent_saved = RelocExtent;
         for(i=0; RelocExtent->extLength; i++, RelocExtent++) {
-            uint32 _WrittenBytes;
+            SIZE_T _WrittenBytes;
             rLba = RelocExtent->extLocation;
             BCount = RelocExtent->extLength>>Vcb->BlockSizeBits;
             retry = UDF_WRITE_MAX_RETRY;
@@ -554,7 +554,7 @@ retry_2:
                 break;
             }
             if(Flags & PH_VCB_IN_RETLEN) {
-                _WrittenBytes = (ULONG)Vcb;
+                _WrittenBytes = (ULONG_PTR)Vcb;
             }
             RC = UDFPhWriteVerifySynchronous(Vcb->TargetDeviceObject, Buffer, RelocExtent->extLength,
                        ((uint64)rLba) << Vcb->BlockSizeBits, &_WrittenBytes, Flags);
@@ -596,9 +596,9 @@ OSSTATUS
 UDFTRead(
     IN void* _Vcb,
     IN void* Buffer,     // Target buffer
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN uint32 LBA,
-    OUT uint32* ReadBytes,
+    OUT PSIZE_T ReadBytes,
     IN uint32 Flags
     ) 
 {
@@ -651,7 +651,7 @@ retry_1:
             if(!OS_SUCCESS(RC)) return RC; // this is for !_BROWSE_UDF only
 #endif //_BROWSE_UDF_
             if(Flags & PH_VCB_IN_RETLEN) {
-                (*ReadBytes) = (ULONG)Vcb;
+                (*ReadBytes) = (SIZE_T)Vcb;
             }
             RC = UDFPhReadSynchronous(Vcb->TargetDeviceObject, Buffer, Length,
                        ((uint64)rLba) << Vcb->BlockSizeBits, ReadBytes, Flags);
@@ -674,7 +674,7 @@ retry_1:
         // read according to relocation table
         RelocExtent_saved = RelocExtent;
         for(i=0; RelocExtent->extLength; i++, RelocExtent++) {
-            uint32 _ReadBytes;
+            SIZE_T _ReadBytes;
             rLba = RelocExtent->extLocation;
             if(rLba >= (Vcb->CDR_Mode ? Vcb->NWA : Vcb->LastLBA + 1)) {
                 RtlZeroMemory(Buffer, _ReadBytes = RelocExtent->extLength);
@@ -688,7 +688,7 @@ retry_2:
             if(!OS_SUCCESS(RC)) break;
             rLba = UDFFixFPAddress(Vcb, rLba);
             if(Flags & PH_VCB_IN_RETLEN) {
-                _ReadBytes = (ULONG)Vcb;
+                _ReadBytes = (SIZE_T)Vcb;
             }
             RC = UDFPhReadSynchronous(Vcb->TargetDeviceObject, Buffer, RelocExtent->extLength,
                        ((uint64)rLba) << Vcb->BlockSizeBits, &_ReadBytes, Flags);
@@ -731,9 +731,9 @@ UDFTReadAsync(
     IN void* _Vcb,
     IN void* _WContext,
     IN void* Buffer,     // Target buffer
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN uint32 LBA,
-    OUT uint32* ReadBytes
+    OUT PSIZE_T ReadBytes
     ) 
 {
     PEXTENT_MAP RelocExtent;
@@ -774,7 +774,7 @@ retry_1:
     // read according to relocation table
     RelocExtent_saved = RelocExtent;
     for(uint32 i=0; RelocExtent->extLength; i++, RelocExtent++) {
-        uint32 _ReadBytes;
+        SIZE_T _ReadBytes;
         rLba = RelocExtent->extLocation;
         if(rLba >= (Vcb->CDR_Mode ? Vcb->NWA : Vcb->LastLBA + 1)) {
             RtlZeroMemory(Buffer, _ReadBytes = RelocExtent->extLength);
@@ -1157,7 +1157,7 @@ check_dvd_bg_format:
                  && (Lba > Vcb->LastLBA)) {
    
             ULONG fLba;
-            ULONG WrittenBytes;
+            SIZE_T WrittenBytes;
             ULONG PSz = BCount << Vcb->BlockSizeBits;
 #ifdef _BROWSE_UDF_
             ULONG retry;
@@ -2151,7 +2151,7 @@ MRWRetry_label:
                 } else
                 if(Vcb->MRWStatus) {
                     uint8* buff;
-                    uint32 ReadBytes;
+                    SIZE_T ReadBytes;
 
                     UDFPrint((" MRW state %x\n", Vcb->MRWStatus));
 
@@ -2397,7 +2397,7 @@ UDFUseStandard(
 #ifdef _BROWSE_UDF_
     uint32                  OldTrkNum;
     uint32                  TrkNum;
-    uint32                  ReadBytes, i, len;
+    SIZE_T                  ReadBytes, i, len;
 #endif //_BROWSE_UDF_
 #ifdef UDF_FORMAT_MEDIA
     PUDFFmtState            fms = Vcb->fms;
@@ -2879,7 +2879,7 @@ UDFCheckTrackFPAddressing(
     uint32 lba=0;
     uint32 i;
     uint8* Buffer;
-//    uint32 ReadBytes;
+//    SIZE_T ReadBytes;
 
     uint8  user_data;
 
@@ -3682,7 +3682,7 @@ UDFPrepareForReadOperation(
 #ifdef _BROWSE_UDF_
     PUCHAR tmp;
     OSSTATUS RC;
-    ULONG ReadBytes;
+    SIZE_T ReadBytes;
 #endif //_BROWSE_UDF_
 
 #ifdef _UDF_STRUCTURES_H_
@@ -3887,7 +3887,7 @@ UDFReadSectors(
     IN uint32 Lba,
     IN uint32 BCount,
     OUT int8* Buffer,
-    OUT uint32* ReadBytes
+    OUT PSIZE_T ReadBytes
     )
 {
 
@@ -3911,12 +3911,12 @@ UDFReadInSector(
     IN uint32 l,                 // transfer length
     IN BOOLEAN Direct,          // Disable access to non-cached data
     OUT int8* Buffer,
-    OUT uint32* ReadBytes
+    OUT PSIZE_T ReadBytes
     )
 {
     int8* tmp_buff;
     OSSTATUS status;
-    uint32 _ReadBytes;
+    SIZE_T _ReadBytes;
 
     (*ReadBytes) = 0;
     if(WCacheIsInitialized__(&(Vcb->FastCache)) && (KeGetCurrentIrql() < DISPATCH_LEVEL)) {
@@ -3953,13 +3953,13 @@ UDFReadData(
     IN uint32 Length,
     IN BOOLEAN Direct,          // Disable access to non-cached data
     OUT int8* Buffer,
-    OUT uint32* ReadBytes
+    OUT PSIZE_T ReadBytes
     )
 {
     uint32 i, l, Lba, BS=Vcb->BlockSize;
     uint32 BSh=Vcb->BlockSizeBits;
     OSSTATUS status;
-    uint32 _ReadBytes = 0;
+    SIZE_T _ReadBytes = 0;
     Vcb->VCBFlags |= UDF_VCB_SKIP_EJECT_CHECK;
     uint32 to_read;
 
@@ -4016,7 +4016,7 @@ UDFWriteSectors(
     IN uint32 BCount,
     IN BOOLEAN Direct,          // Disable access to non-cached data
     IN int8* Buffer,
-    OUT uint32* WrittenBytes
+    OUT PSIZE_T WrittenBytes
     )
 {
     OSSTATUS status;
@@ -4045,7 +4045,7 @@ UDFWriteSectors(
     }
 /*    void* buffer;
     OSSTATUS status;
-    uint32 _ReadBytes;
+    SIZE_T _ReadBytes;
     (*WrittenBytes) = 0;
     buffer = DbgAllocatePool(NonPagedPool, Vcb->WriteBlockSize);
     if(!buffer) return STATUS_INSUFFICIENT_RESOURCES;
@@ -4068,14 +4068,14 @@ UDFWriteInSector(
     IN uint32 l,                 // transfer length
     IN BOOLEAN Direct,          // Disable access to non-cached data
     OUT int8* Buffer,
-    OUT uint32* WrittenBytes
+    OUT PSIZE_T WrittenBytes
     )
 {
     int8* tmp_buff;
     OSSTATUS status;
 #ifdef _BROWSE_UDF_
-    uint32 _WrittenBytes;
-    uint32 ReadBytes;
+    SIZE_T _WrittenBytes;
+    SIZE_T ReadBytes;
 
     if(!Vcb->Modified) {
         UDFSetModified(Vcb);
@@ -4142,17 +4142,17 @@ UDFWriteData(
     IN PVCB Vcb,
     IN BOOLEAN Translate,      // Translate Logical to Physical
     IN int64 Offset,
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN BOOLEAN Direct,         // setting this flag delays flushing of given
                                // data to indefinite term
     IN int8* Buffer,
-    OUT uint32* WrittenBytes
+    OUT PSIZE_T WrittenBytes
     )
 {
     uint32 i, l, Lba, BS=Vcb->BlockSize;
     uint32 BSh=Vcb->BlockSizeBits;
     OSSTATUS status;
-    uint32 _WrittenBytes;
+    SIZE_T _WrittenBytes;
     Vcb->VCBFlags |= UDF_VCB_SKIP_EJECT_CHECK;
 
     (*WrittenBytes) = 0;
index 1ec4fe3..1287c4b 100644 (file)
@@ -22,9 +22,9 @@ __fastcall
 UDFTIOVerify(
     IN void* _Vcb,
     IN void* Buffer,     // Target buffer
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN uint32 LBA,
-    OUT uint32* IOBytes,
+    OUT PSIZE_T IOBytes,
     IN uint32 Flags
     );
 
@@ -32,9 +32,9 @@ extern OSSTATUS
 UDFTWriteVerify(
     IN void* _Vcb,
     IN void* Buffer,     // Target buffer
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN uint32 LBA,
-    OUT uint32* WrittenBytes,
+    OUT PSIZE_T WrittenBytes,
     IN uint32 Flags
     );
 
@@ -42,24 +42,24 @@ extern OSSTATUS
 UDFTReadVerify(
     IN void* _Vcb,
     IN void* Buffer,     // Target buffer
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN uint32 LBA,
-    OUT uint32* ReadBytes,
+    OUT PSIZE_T ReadBytes,
     IN uint32 Flags
     );
 
 extern OSSTATUS UDFTRead(PVOID           _Vcb,
                          PVOID           Buffer,     // Target buffer
-                         ULONG           Length,
+                         SIZE_T          Length,
                          ULONG           LBA,
-                         PULONG          ReadBytes,
+                         PSIZE_T         ReadBytes,
                          ULONG           Flags = 0);
 
 extern OSSTATUS UDFTWrite(IN PVOID _Vcb,
                    IN PVOID Buffer,     // Target buffer
-                   IN ULONG Length,
+                   IN SIZE_T Length,
                    IN ULONG LBA,
-                   OUT PULONG WrittenBytes,
+                   OUT PSIZE_T WrittenBytes,
                    IN ULONG Flags = 0);
 
 #define PH_TMP_BUFFER          1
@@ -126,7 +126,7 @@ extern OSSTATUS UDFDoDismountSequence(IN PVCB Vcb,
 #define UDFReadSectors(Vcb, Translate, Lba, BCount, Direct, Buffer, ReadBytes)                 \
     (( WCacheIsInitialized__(&((Vcb)->FastCache)) && (KeGetCurrentIrql() < DISPATCH_LEVEL)) ?              \
         (WCacheReadBlocks__(&((Vcb)->FastCache), Vcb, Buffer, Lba, BCount, ReadBytes, Direct)) : \
-        (UDFTRead(Vcb, Buffer, (BCount)<<((Vcb)->BlockSizeBits), Lba, ReadBytes, 0)))
+        (UDFTRead(Vcb, Buffer, ((SIZE_T)(BCount))<<((Vcb)->BlockSizeBits), Lba, ReadBytes, 0)))
 
 
 // read data inside physical sector
@@ -137,7 +137,7 @@ extern OSSTATUS UDFReadInSector(IN PVCB Vcb,
                          IN ULONG l,                 // transfer length
                          IN BOOLEAN Direct,
                          OUT PCHAR Buffer,
-                         OUT PULONG ReadBytes);
+                         OUT PSIZE_T ReadBytes);
 // read unaligned data
 extern OSSTATUS UDFReadData(IN PVCB Vcb,
                      IN BOOLEAN Translate,   // Translate Logical to Physical
@@ -145,7 +145,7 @@ extern OSSTATUS UDFReadData(IN PVCB Vcb,
                      IN ULONG Length,
                      IN BOOLEAN Direct,
                      OUT PCHAR Buffer,
-                     OUT PULONG ReadBytes);
+                     OUT PSIZE_T ReadBytes);
 
 #ifndef UDF_READ_ONLY_BUILD
 // write physical sectors
@@ -156,7 +156,7 @@ OSSTATUS UDFWriteSectors(IN PVCB Vcb,
                          IN BOOLEAN Direct,         // setting this flag delays flushing of given
                                                     // data to indefinite term
                          IN PCHAR Buffer,
-                         OUT PULONG WrittenBytes);
+                         OUT PSIZE_T WrittenBytes);
 // write directly to cached sector
 OSSTATUS UDFWriteInSector(IN PVCB Vcb,
                           IN BOOLEAN Translate,       // Translate Logical to Physical
@@ -165,16 +165,16 @@ OSSTATUS UDFWriteInSector(IN PVCB Vcb,
                           IN ULONG l,                 // transfer length
                           IN BOOLEAN Direct,
                           OUT PCHAR Buffer,
-                          OUT PULONG WrittenBytes);
+                          OUT PSIZE_T WrittenBytes);
 // write data at unaligned offset & length
 OSSTATUS UDFWriteData(IN PVCB Vcb,
                       IN BOOLEAN Translate,      // Translate Logical to Physical
                       IN LONGLONG Offset,
-                      IN ULONG Length,
+                      IN SIZE_T Length,
                       IN BOOLEAN Direct,         // setting this flag delays flushing of given
                                                  // data to indefinite term
                       IN PCHAR Buffer,
-                      OUT PULONG WrittenBytes);
+                      OUT PSIZE_T WrittenBytes);
 #endif //UDF_READ_ONLY_BUILD
 
 OSSTATUS UDFResetDeviceDriver(IN PVCB Vcb,
index e23ae29..d0e15b7 100644 (file)
@@ -70,7 +70,7 @@ typedef struct _W_CACHE_ASYNC {
     PW_CACHE Cache;
     PVOID Buffer;
     PVOID Buffer2;
-    ULONG TransferredBytes;
+    SIZE_T TransferredBytes;
     ULONG BCount;
     lba_t Lba;
     struct _W_CACHE_ASYNC* NextWContext;
@@ -119,7 +119,7 @@ WCacheInit__(
                               //   simultaneously
     IN ULONG MaxBlocks,       // maximum number of Blocks to be kept in memory
                               //   simultaneously
-    IN ULONG MaxBytesToRead,  // maximum IO length (split boundary)
+    IN SIZE_T MaxBytesToRead,  // maximum IO length (split boundary)
     IN ULONG PacketSizeSh,    // number of blocks in packet (bit shift)
                               //   Packes size = 2^PacketSizeSh
     IN ULONG BlockSizeSh,     // Block size (bit shift)
@@ -756,7 +756,7 @@ WCacheInitFrame(
     //Cache->FrameList[frame].AccessCount = 0;
 
     if(block_array) {
-        ASSERT((ULONG)block_array > 0x1000);
+        ASSERT((ULONG_PTR)block_array > 0x1000);
         WCacheInsertItemToList(Cache->CachedFramesList, &(Cache->FrameCount), frame);
         RtlZeroMemory(block_array, l);
     } else {
@@ -862,7 +862,7 @@ WCacheRemoveFrame(
   Internal routine
  */
 #define WCacheSectorAddr(block_array, i) \
-    ((ULONG)(block_array[i].Sector) & WCACHE_ADDR_MASK)
+    ((ULONG_PTR)(block_array[i].Sector) & WCACHE_ADDR_MASK)
 
 /*
   WCacheFreeSector() releases memory block containing cached
@@ -996,7 +996,7 @@ WCacheUpdatePacket(
     IN ULONG BS,              // Block size (bytes)
     IN ULONG PS,              // Packet size (bytes)
     IN ULONG PSs,             // Packet size (sectors)
-    IN PULONG ReadBytes,      // pointer to number of successfully read/written bytes
+    IN PSIZE_T ReadBytes,      // pointer to number of successfully read/written bytes
     IN BOOLEAN PrefereWrite,  // allow physical write (flush) of modified packet
     IN ULONG State            // callers state
     )
@@ -1379,7 +1379,7 @@ WCacheCheckLimitsRW(
     ULONG try_count = 0;
     PW_CACHE_ENTRY block_array;
     OSSTATUS status;
-    ULONG ReadBytes;
+    SIZE_T ReadBytes;
     ULONG FreeFrameCount = 0;
 //    PVOID addr;
     PW_CACHE_ASYNC FirstWContext = NULL;
@@ -1553,7 +1553,7 @@ WCacheFlushBlocksRAM(
     ULONG BS = Cache->BlockSize;
 //    ULONG PS = BS << Cache->PacketSizeSh; // packet size (bytes)
     ULONG PSs = Cache->PacketSize;
-    ULONG _WrittenBytes;
+    SIZE_T _WrittenBytes;
     OSSTATUS status = STATUS_SUCCESS;
 
     frame = List[firstPos] >> Cache->BlocksPerFrameSh;
@@ -1864,7 +1864,7 @@ WCachePreReadPacket__(
     ULONG BSh = Cache->BlockSizeSh;
     ULONG BS = Cache->BlockSize;
     PCHAR addr;
-    ULONG _ReadBytes;
+    SIZE_T _ReadBytes;
     ULONG PS = Cache->PacketSize; // (in blocks)
     ULONG BCount = PS;
     ULONG i, n, err_count;
@@ -2014,7 +2014,7 @@ WCacheReadBlocks__(
     IN PCHAR Buffer,          // user-supplied buffer for read blocks
     IN lba_t Lba,             // LBA to start read from
     IN ULONG BCount,          // number of blocks to be read
-    OUT PULONG ReadBytes,     // user-supplied pointer to ULONG that will
+    OUT PSIZE_T ReadBytes,     // user-supplied pointer to ULONG that will
                               //   recieve number of actually read bytes
     IN BOOLEAN CachedOnly     // specifies that cache is already locked
     )
@@ -2024,11 +2024,11 @@ WCacheReadBlocks__(
     OSSTATUS status = STATUS_SUCCESS;
     PW_CACHE_ENTRY block_array;
     ULONG BSh = Cache->BlockSizeSh;
-    ULONG BS = Cache->BlockSize;
+    SIZE_T BS = Cache->BlockSize;
     PCHAR addr;
     ULONG to_read, saved_to_read;
 //    PCHAR saved_buff = Buffer;
-    ULONG _ReadBytes;
+    SIZE_T _ReadBytes;
     ULONG PS = Cache->PacketSize;
     ULONG MaxR = Cache->MaxBytesToRead;
     ULONG PacketMask = PS-1; // here we assume that Packet Size value is 2^n
@@ -2283,7 +2283,7 @@ WCacheWriteBlocks__(
     IN PCHAR Buffer,          // user-supplied buffer containing data to be written    
     IN lba_t Lba,             // LBA to start write from
     IN ULONG BCount,          // number of blocks to be written
-    OUT PULONG WrittenBytes,  // user-supplied pointer to ULONG that will
+    OUT PSIZE_T WrittenBytes,  // user-supplied pointer to ULONG that will
                               //   recieve number of actually written bytes
     IN BOOLEAN CachedOnly     // specifies that cache is already locked
     )
@@ -2296,7 +2296,7 @@ WCacheWriteBlocks__(
     ULONG BS = Cache->BlockSize;
     PCHAR addr;
 //    PCHAR saved_buff = Buffer;
-    ULONG _WrittenBytes;
+    SIZE_T _WrittenBytes;
     ULONG PS = Cache->PacketSize;
     ULONG PacketMask = PS-1; // here we assume that Packet Size value is 2^n
     ULONG block_type;
@@ -2634,7 +2634,7 @@ WCachePurgeAllRW(
     ULONG PSs = Cache->PacketSize;
     PW_CACHE_ENTRY block_array;
 //    OSSTATUS status;
-    ULONG ReadBytes;
+    SIZE_T ReadBytes;
     PW_CACHE_ASYNC FirstWContext = NULL;
     PW_CACHE_ASYNC PrevWContext = NULL;
     ULONG chain_count = 0;
@@ -2702,7 +2702,7 @@ WCacheFlushAllRW(
     ULONG BFs = Cache->BlocksPerFrameSh;
     PW_CACHE_ENTRY block_array;
 //    OSSTATUS status;
-    ULONG ReadBytes;
+    SIZE_T ReadBytes;
     PW_CACHE_ASYNC FirstWContext = NULL;
     PW_CACHE_ASYNC PrevWContext = NULL;
     ULONG i;
@@ -2841,7 +2841,7 @@ WCacheFlushBlocksRW(
     ULONG BFs = Cache->BlocksPerFrameSh;
     PW_CACHE_ENTRY block_array;
 //    OSSTATUS status;
-    ULONG ReadBytes;
+    SIZE_T ReadBytes;
     PW_CACHE_ASYNC FirstWContext = NULL;
     PW_CACHE_ASYNC PrevWContext = NULL;
     ULONG i;
@@ -2960,7 +2960,7 @@ WCacheDirect__(
     PW_CACHE_ENTRY block_array;
     ULONG BS = Cache->BlockSize;
     PCHAR addr;
-    ULONG _ReadBytes;
+    SIZE_T _ReadBytes;
     ULONG block_type;
 
     WcPrint(("WC:%sD %x (1)\n", Modified ? "W" : "R", Lba));
@@ -3206,7 +3206,7 @@ WCacheCheckLimitsR(
     PW_CACHE_ENTRY block_array;
     BOOLEAN mod;
     OSSTATUS status;
-    ULONG ReadBytes;
+    SIZE_T ReadBytes;
     ULONG MaxReloc = Cache->PacketSize;
     PULONG reloc_tab = Cache->reloc_tab;
 
@@ -3324,7 +3324,7 @@ WCachePurgeAllR(
     PW_CACHE_ENTRY block_array;
     BOOLEAN mod;
     OSSTATUS status;
-    ULONG ReadBytes;
+    SIZE_T ReadBytes;
     ULONG MaxReloc = Cache->PacketSize;
     PULONG reloc_tab = Cache->reloc_tab;
     ULONG RelocCount = 0;
index f1eddae..cc5a2a3 100644 (file)
@@ -21,32 +21,32 @@ extern "C" {
 
 typedef OSSTATUS     (*PWRITE_BLOCK) (IN PVOID Context,
                                       IN PVOID Buffer,     // Target buffer
-                                      IN ULONG Length,
+                                      IN SIZE_T Length,
                                       IN lba_t Lba,
-                                      OUT PULONG WrittenBytes,
+                                      OUT PSIZE_T WrittenBytes,
                                       IN uint32 Flags);
 
 typedef OSSTATUS     (*PREAD_BLOCK) (IN PVOID Context,
                                      IN PVOID Buffer,     // Target buffer
-                                     IN ULONG Length,
+                                     IN SIZE_T Length,
                                      IN lba_t Lba,
-                                     OUT PULONG ReadBytes,
+                                     OUT PSIZE_T ReadBytes,
                                      IN uint32 Flags);
 
 typedef OSSTATUS     (*PWRITE_BLOCK_ASYNC) (IN PVOID Context,
                                             IN PVOID WContext,
                                             IN PVOID Buffer,     // Target buffer
-                                            IN ULONG Length,
+                                            IN SIZE_T Length,
                                             IN lba_t Lba,
-                                            OUT PULONG WrittenBytes,
+                                            OUT PSIZE_T WrittenBytes,
                                             IN BOOLEAN FreeBuffer);
 
 typedef OSSTATUS     (*PREAD_BLOCK_ASYNC) (IN PVOID Context,
                                            IN PVOID WContext,
                                            IN PVOID Buffer,     // Source buffer
-                                           IN ULONG Length,
+                                           IN SIZE_T Length,
                                            IN lba_t Lba,
-                                           OUT PULONG ReadBytes);
+                                           OUT PSIZE_T ReadBytes);
 
 /*typedef BOOLEAN      (*PCHECK_BLOCK) (IN PVOID Context,
                                       IN lba_t Lba);*/
@@ -208,7 +208,7 @@ typedef struct _W_CACHE {
 OSSTATUS WCacheInit__(IN PW_CACHE Cache,
                       IN ULONG MaxFrames,
                       IN ULONG MaxBlocks,
-                      IN ULONG MaxBytesToRead,
+                      IN SIZE_T MaxBytesToRead,
                       IN ULONG PacketSizeSh,    // number of blocks in packet (bit shift)
                       IN ULONG BlockSizeSh,     // bit shift
                       IN ULONG BlocksPerFrameSh,// bit shift
@@ -230,7 +230,7 @@ OSSTATUS WCacheWriteBlocks__(IN PW_CACHE Cache,
                              IN PCHAR Buffer,
                              IN lba_t Lba,
                              IN ULONG BCount,
-                             OUT PULONG WrittenBytes,
+                             OUT PSIZE_T WrittenBytes,
                              IN BOOLEAN CachedOnly);
 // read cached
 OSSTATUS WCacheReadBlocks__(IN PW_CACHE Cache,
@@ -238,7 +238,7 @@ OSSTATUS WCacheReadBlocks__(IN PW_CACHE Cache,
                             IN PCHAR Buffer,
                             IN lba_t Lba,
                             IN ULONG BCount,
-                            OUT PULONG ReadBytes,
+                            OUT PSIZE_T ReadBytes,
                             IN BOOLEAN CachedOnly);
 // flush blocks
 OSSTATUS WCacheFlushBlocks__(IN PW_CACHE Cache,
index a75954e..e8e0b62 100644 (file)
@@ -1007,7 +1007,7 @@ UDFCloseAllXXXDelayedInDir(
                     if(CurFileInfo &&
                        (Fcb = CurFileInfo->Fcb)) {
                         NtReqFcb = Fcb->NTRequiredFCB;
-                        ASSERT((ULONG)NtReqFcb > 0x1000);
+                        ASSERT((ULONG_PTR)NtReqFcb > 0x1000);
 //                            ASSERT((ULONG)(NtReqFcb->SectionObject) > 0x1000);
                         if(!(NtReqFcb->NtReqFCBFlags & UDF_NTREQ_FCB_DELETED) &&
                             (NtReqFcb->NtReqFCBFlags & UDF_NTREQ_FCB_MODIFIED)) {
index 75f209f..3c777e8 100644 (file)
@@ -1116,7 +1116,7 @@ op_vol_accs_dnd:
             // get next path part...
             TmpBuffer = TailName.Buffer;
             TailName.Buffer = UDFDissectName(TailName.Buffer,&(CurName.Length) );
-            TailName.Length -= (USHORT)((ULONG)(TailName.Buffer) - (ULONG)TmpBuffer);
+            TailName.Length -= (USHORT)((ULONG_PTR)(TailName.Buffer) - (ULONG_PTR)TmpBuffer);
             CurName.Buffer = TailName.Buffer - CurName.Length;
             CurName.Length *= sizeof(WCHAR);
             CurName.MaximumLength = CurName.Length + sizeof(WCHAR);
index 3f86608..9201815 100644 (file)
@@ -130,9 +130,9 @@ NTAPI
 UDFPhReadSynchronous(
     PDEVICE_OBJECT      DeviceObject,   // the physical device object
     PVOID               Buffer,
-    ULONG               Length,
+    SIZE_T              Length,
     LONGLONG            Offset,
-    PULONG              ReadBytes,
+    PSIZE_T             ReadBytes,
     ULONG               Flags
     )
 {
@@ -276,9 +276,9 @@ NTAPI
 UDFPhWriteSynchronous(
     PDEVICE_OBJECT  DeviceObject,   // the physical device object
     PVOID           Buffer,
-    ULONG           Length,
+    SIZE_T          Length,
     LONGLONG        Offset,
-    PULONG          WrittenBytes,
+    PSIZE_T         WrittenBytes,
     ULONG           Flags
     )
 {
@@ -422,9 +422,9 @@ NTSTATUS
 UDFPhWriteVerifySynchronous(
     PDEVICE_OBJECT  DeviceObject,   // the physical device object
     PVOID           Buffer,
-    ULONG           Length,
+    SIZE_T          Length,
     LONGLONG        Offset,
-    PULONG          WrittenBytes,
+    PSIZE_T         WrittenBytes,
     ULONG           Flags
     )
 {
index 9ac343a..203809e 100644 (file)
 extern NTSTATUS NTAPI UDFPhReadSynchronous(
                    PDEVICE_OBJECT      DeviceObject,
                    PVOID           Buffer,
-                   ULONG           Length,
+                   SIZE_T          Length,
                    LONGLONG        Offset,
-                   PULONG          ReadBytes,
+                   PSIZE_T         ReadBytes,
                    ULONG           Flags);
 
 extern NTSTATUS NTAPI UDFPhWriteSynchronous(
                    PDEVICE_OBJECT  DeviceObject,   // the physical device object
                    PVOID           Buffer,
-                   ULONG           Length,
+                   SIZE_T          Length,
                    LONGLONG        Offset,
-                   PULONG          WrittenBytes,
+                   PSIZE_T         WrittenBytes,
                    ULONG           Flags);
 /*
 extern NTSTATUS UDFPhWriteVerifySynchronous(
                    PDEVICE_OBJECT  DeviceObject,   // the physical device object
                    PVOID           Buffer,
-                   ULONG           Length,
+                   SIZE_T          Length,
                    LONGLONG        Offset,
-                   PULONG          WrittenBytes,
+                   PSIZE_T         WrittenBytes,
                    ULONG           Flags);
 */
 #define UDFPhWriteVerifySynchronous UDFPhWriteSynchronous
@@ -122,7 +122,7 @@ __inline VOID UDFNotifyFullReportChange(
 }
 
 #define CollectStatisticsEx(VCB, Field, a) {                                 \
-    ((VCB)->Statistics[KeGetCurrentProcessorNumber()].Common.##Field) += a;  \
+    ((VCB)->Statistics[KeGetCurrentProcessorNumber()].Common.##Field) += (ULONG)a;  \
 }
 
 #define CollectStatistics2(VCB, Field) {                                     \
@@ -149,7 +149,7 @@ NTSTATUS NTAPI UDFSyncCompletionRoutine2(IN PDEVICE_OBJECT DeviceObject,
 
 #define OSGetCurrentThread()     PsGetCurrentThread()
 
-#define GetCurrentPID()   ((ULONG)PsGetCurrentProcessId())
+#define GetCurrentPID()   HandleToUlong(PsGetCurrentProcessId())
 
 
 #endif  // _UDF_ENV_SPEC_H_
index 66a07df..f7f53b3 100644 (file)
@@ -440,7 +440,7 @@ BOOLEAN NTAPI UDFAcqLazyWrite(
 
     // Now, set the lazy-writer thread id.
     ASSERT(!(NtReqFcb->LazyWriterThreadID));
-    NtReqFcb->LazyWriterThreadID = (unsigned int)(PsGetCurrentThread());
+    NtReqFcb->LazyWriterThreadID = HandleToUlong(PsGetCurrentThreadId());
 
     ASSERT(IoGetTopLevelIrp() == NULL);
     IoSetTopLevelIrp((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
@@ -481,7 +481,7 @@ UDFRelLazyWrite(
 
     // Remove the current thread-id from the NT_REQ_FCB
     // and release the MainResource.
-    ASSERT((NtReqFcb->LazyWriterThreadID) == (unsigned int)PsGetCurrentThread());
+    ASSERT((NtReqFcb->LazyWriterThreadID) == HandleToUlong(PsGetCurrentThreadId()));
     NtReqFcb->LazyWriterThreadID = 0;
 
     // Release the acquired resource.
index cb87cf4..46fadac 100644 (file)
@@ -137,7 +137,7 @@ UDFCommonFileInfo(
     TmPrint(("UDFCommonFileInfo: irp %x\n", Irp));
 
         TopIrp = IoGetTopLevelIrp();
-        switch((ULONG)TopIrp) {
+        switch((ULONG_PTR)TopIrp) {
         case FSRTL_FSP_TOP_LEVEL_IRP:
             UDFPrint(("  FSRTL_FSP_TOP_LEVEL_IRP\n"));
             break;
index 2dd3e5d..d18ae74 100644 (file)
@@ -1111,7 +1111,7 @@ unwind_3:
     if(NT_SUCCESS(RC)) {
 
         int8* buff;
-        uint32 len;
+        SIZE_T len;
         PUDF_FILE_INFO CfgFileInfo = NULL;
 
         RC = UDFOpenFile__(Vcb, FALSE, TRUE, &LocalPath, RootFcb->FileInfo, &CfgFileInfo, NULL);
@@ -1686,7 +1686,7 @@ UDFIsPathnameValid(
             // get next path part...
             TmpBuffer = PathName.Buffer;
             PathName.Buffer = UDFDissectName(PathName.Buffer,&(CurName.Length) );
-            PathName.Length -= (USHORT)((ULONG)(PathName.Buffer) - (ULONG)TmpBuffer);
+            PathName.Length -= (USHORT)((ULONG_PTR)(PathName.Buffer) - (ULONG_PTR)TmpBuffer);
             CurName.Buffer = PathName.Buffer - CurName.Length;
             CurName.Length *= sizeof(WCHAR);
             CurName.MaximumLength -= CurName.Length;
index f118b74..401b864 100644 (file)
@@ -784,7 +784,7 @@ extern OSSTATUS UDFDoDismountSequence(IN PVCB Vcb,
 #define UDFReadSectors(Vcb, Translate, Lba, BCount, Direct, Buffer, ReadBytes)                 \
     (( WCacheIsInitialized__(&((Vcb)->FastCache)) && (KeGetCurrentIrql() < DISPATCH_LEVEL)) ?              \
         (WCacheReadBlocks__(&((Vcb)->FastCache), Vcb, Buffer, Lba, BCount, ReadBytes, Direct)) : \
-        (UDFTRead(Vcb, Buffer, (BCount)<<((Vcb)->BlockSizeBits), Lba, ReadBytes, 0)))
+        (UDFTRead(Vcb, Buffer, ((SIZE_T)(BCount))<<((Vcb)->BlockSizeBits), Lba, ReadBytes, 0)))
 
 
 // read data inside physical sector
index 5f60bd5..088f9f6 100644 (file)
@@ -235,7 +235,7 @@ UDFCommonRead(
     PIO_STACK_LOCATION      IrpSp = NULL;
     LARGE_INTEGER           ByteOffset;
     ULONG                   ReadLength = 0, TruncatedLength = 0;
-    ULONG                   NumberBytesRead = 0;
+    SIZE_T                  NumberBytesRead = 0;
     PFILE_OBJECT            FileObject = NULL;
     PtrUDFFCB               Fcb = NULL;
     PtrUDFCCB               Ccb = NULL;
@@ -262,7 +262,7 @@ UDFCommonRead(
     _SEH2_TRY {
 
         TopIrp = IoGetTopLevelIrp();
-        switch((ULONG)TopIrp) {
+        switch((ULONG_PTR)TopIrp) {
         case FSRTL_FSP_TOP_LEVEL_IRP:
             UDFPrint(("  FSRTL_FSP_TOP_LEVEL_IRP\n"));
             break;
@@ -684,11 +684,11 @@ UDFCommonRead(
             MmPrint(("    Read NonBufferedIo\n"));
 
 #if 1
-            if((ULONG)TopIrp == FSRTL_MOD_WRITE_TOP_LEVEL_IRP) {
+            if((ULONG_PTR)TopIrp == FSRTL_MOD_WRITE_TOP_LEVEL_IRP) {
                 UDFPrint(("FSRTL_MOD_WRITE_TOP_LEVEL_IRP => CanWait\n"));
                 CanWait = TRUE;
             } else
-            if((ULONG)TopIrp == FSRTL_CACHE_TOP_LEVEL_IRP) {
+            if((ULONG_PTR)TopIrp == FSRTL_CACHE_TOP_LEVEL_IRP) {
                 UDFPrint(("FSRTL_CACHE_TOP_LEVEL_IRP => CanWait\n"));
                 CanWait = TRUE;
             }
index 49905fb..a7e9816 100644 (file)
@@ -324,12 +324,12 @@ EO_gpl:
 #if defined (_X86_) && defined (_MSC_VER)
 
 __declspec (naked)
-uint32
+SIZE_T
 __stdcall
 UDFGetBitmapLen(
     uint32* Bitmap,
-    uint32 Offs,
-    uint32 Lim          // NOT included
+    SIZE_T Offs,
+    SIZE_T Lim          // NOT included
     )
 {
   _asm {
@@ -491,12 +491,12 @@ exit_count:
 
 #else   // NO X86 optimization , use generic C/C++
 
-uint32
+SIZE_T
 __stdcall
 UDFGetBitmapLen(
     uint32* Bitmap,
-    uint32 Offs,
-    uint32 Lim          // NOT included
+    SIZE_T Offs,
+    SIZE_T Lim          // NOT included
     )
 {
     ASSERT(Offs <= Lim);
@@ -505,8 +505,8 @@ UDFGetBitmapLen(
     }
 
     BOOLEAN bit = UDFGetBit(Bitmap, Offs);
-    uint32 i=Offs>>5;
-    uint32 len=0;
+    SIZE_T i=Offs>>5;
+    SIZE_T len=0;
     uint8 j=(uint8)(Offs&31);
     uint8 lLim=(uint8)(Lim&31);
 
@@ -552,7 +552,7 @@ While_3:
     This routine scans disc free space Bitmap for minimal suitable extent.
     It returns maximal available extent if no long enough extents found.
  */
-uint32
+SIZE_T
 UDFFindMinSuitableExtent(
     IN PVCB Vcb,
     IN uint32 Length, // in blocks
@@ -562,14 +562,14 @@ UDFFindMinSuitableExtent(
     IN uint8  AllocFlags
     )
 {
-    uint32 i, len;
+    SIZE_T i, len;
     uint32* cur;
-    uint32 best_lba=0;
-    uint32 best_len=0;
-    uint32 max_lba=0;
-    uint32 max_len=0;
+    SIZE_T best_lba=0;
+    SIZE_T best_len=0;
+    SIZE_T max_lba=0;
+    SIZE_T max_len=0;
     BOOLEAN align = FALSE;
-    uint32 PS = Vcb->WriteBlockSize >> Vcb->BlockSizeBits;
+    SIZE_T PS = Vcb->WriteBlockSize >> Vcb->BlockSizeBits;
 
     UDF_CHECK_BITMAP_RESOURCE(Vcb);
 
index d20e353..8f4b3ee 100644 (file)
@@ -519,7 +519,7 @@ UDFIndexDirectory(
     int8* buff;
     PEXTENT_INFO ExtInfo;  // Extent array for directory
     uint16 PartNum;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
     uint16 valueCRC;
 
     if(!FileInfo) return STATUS_INVALID_PARAMETER;
@@ -753,7 +753,7 @@ UDFPackDirectory__(
     uint32 Offset, curOffset;
     int8* Buf;
     OSSTATUS status;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
     int8* storedFI;
     PUDF_FILE_INFO curFileInfo;
     PDIR_INDEX_ITEM DirNdx, DirNdx2;
@@ -901,7 +901,7 @@ UDFReTagDirectory(
     uint32 Offset;
     int8* Buf;
     OSSTATUS status;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
     PUDF_FILE_INFO curFileInfo;
     PDIR_INDEX_ITEM DirNdx;
     UDF_DIR_SCAN_CONTEXT ScanContext;
index f949cf1..db4f23f 100644 (file)
@@ -30,7 +30,7 @@ UDFExtentOffsetToLba(
     IN PEXTENT_MAP Extent,   // Extent array
     IN int64 Offset,      // offset in extent
     OUT uint32* SectorOffset,
-    OUT uint32* AvailLength,  // available data in this block
+    OUT PSIZE_T AvailLength,  // available data in this block
     OUT uint32* Flags,
     OUT uint32* Index
     )
@@ -79,7 +79,7 @@ uint32
 UDFNextExtentToLba(
     IN PVCB Vcb,
     IN PEXTENT_MAP Extent,   // Extent array
-    OUT uint32* AvailLength,  // available data in this block
+    OUT PSIZE_T AvailLength,  // available data in this block
     OUT uint32* Flags,
     OUT uint32* Index
     )
@@ -306,7 +306,7 @@ UDFShortAllocDescToMapping(
     EXTENT_AD AllocExt;
     PALLOC_EXT_DESC NextAllocDesc;
     lb_addr locAddr;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
     EXTENT_INFO NextAllocLoc;
     BOOLEAN w2k_compat = FALSE;
 
@@ -467,7 +467,7 @@ UDFLongAllocDescToMapping(
     PEXTENT_MAP Extent, Extent2, AllocMap;
     EXTENT_AD AllocExt;
     PALLOC_EXT_DESC NextAllocDesc;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
     EXTENT_INFO NextAllocLoc;
 
     ExtPrint(("UDFLongAllocDescToMapping: len=%x\n", AllocDescLength));
@@ -605,7 +605,7 @@ UDFExtAllocDescToMapping(
     PEXTENT_MAP Extent, Extent2, AllocMap;
     EXTENT_AD AllocExt;
     PALLOC_EXT_DESC NextAllocDesc;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
     EXTENT_INFO NextAllocLoc;
 
     ExtPrint(("UDFExtAllocDescToMapping: len=%x\n", AllocDescLength));
@@ -799,7 +799,7 @@ UDFReadMappingFromXEntry(
     }
     default : {  // case ICB_FLAG_AD_IN_ICB
         Extent = NULL;
-        *Offset = (uint32)AllocDescs - (uint32)XEntry;
+        *Offset = (uintptr_t)AllocDescs - (uintptr_t)XEntry;
         AllocLoc->Offset=0;
         AllocLoc->Length=0;
         if(AllocLoc->Mapping) MyFreePool__(AllocLoc->Mapping);
@@ -1959,8 +1959,8 @@ UDFMarkNotAllocatedAsAllocated(
     uint32 BSh = Vcb->BlockSizeBits;
     OSSTATUS status;
     EXTENT_INFO TmpExtInf;
-    uint32 aLen, sLen;
-    uint32 LBS = Vcb->LBlockSize;
+    SIZE_T aLen, sLen;
+    SIZE_T LBS = Vcb->LBlockSize;
     // I don't know what else comment can be added here.
     // Just belive that it works
     /*lba = */
@@ -2112,7 +2112,7 @@ UDFMarkAllocatedAsNotXXX(
     uint32 target_flags = Deallocate ?
                              EXTENT_NOT_RECORDED_NOT_ALLOCATED :
                              EXTENT_NOT_RECORDED_ALLOCATED;
-    uint32 LBS = Vcb->LBlockSize;
+    SIZE_T LBS = Vcb->LBlockSize;
     EXTENT_MAP DeadMapping[2];
     // I don't know what else comment can be added here.
     // Just belive that it works
@@ -2237,13 +2237,15 @@ UDFResizeExtent(
     OUT PEXTENT_INFO ExtInfo
     )
 {
-    uint32 i, flags, lba, lim;
+    uint32 i, flags, lba;
+    SIZE_T lim;
     int64 l;
     OSSTATUS status;
     EXTENT_INFO TmpExtInf;
     EXTENT_MAP  TmpMapping[2];
-    uint32 s, req_s, pe, BSh, LBS, PS;
-    LBS = Vcb->LBlockSize;
+    uint32 s, pe, BSh, PS;
+    SIZE_T req_s;
+    SIZE_T LBS = Vcb->LBlockSize;
     BSh = Vcb->BlockSizeBits;
     PS = Vcb->WriteBlockSize >> Vcb->BlockSizeBits;
     uint32 MaxGrow = (UDF_MAX_EXTENT_LENGTH & ~(LBS-1));
@@ -2920,7 +2922,8 @@ UDFIsExtentCached(
 {
     BOOLEAN retstat = FALSE;
     PEXTENT_MAP Extent = ExtInfo->Mapping;   // Extent array
-    uint32 to_read, Lba, sect_offs, flags, i;
+    SIZE_T to_read;
+    uint32 Lba, sect_offs, flags, i;
 
     WCacheStartDirect__(&(Vcb->FastCache), Vcb, TRUE/*FALSE*//*ForWrite*/);
     if(!ExtInfo || !ExtInfo->Mapping) goto EO_IsCached;
@@ -2969,14 +2972,15 @@ UDFReadExtentCached(
     IN int64 Offset,      // offset in extent
     IN uint32 Length,
     OUT int8* Buffer,
-    OUT uint32* ReadBytes
+    OUT PSIZE_T ReadBytes
     )
 {
     (*ReadBytes) = 0;
     if(!ExtInfo || !ExtInfo->Mapping) return STATUS_INVALID_PARAMETER;
 
     PEXTENT_MAP Extent = ExtInfo->Mapping;   // Extent array
-    uint32 to_read, Lba, sect_offs, flags, _ReadBytes;
+    uint32 to_read, Lba, sect_offs, flags;
+    SIZE_T _ReadBytes;
     OSSTATUS status;
     // prevent reading out of data space
     if(Offset > ExtInfo->Length) return STATUS_END_OF_FILE;
@@ -3015,27 +3019,30 @@ UDFReadExtent(
     IN PVCB Vcb,
     IN PEXTENT_INFO ExtInfo, // Extent array
     IN int64 Offset,      // offset in extent
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN BOOLEAN Direct,
     OUT int8* Buffer,
-    OUT uint32* ReadBytes
+    OUT PSIZE_T ReadBytes
     )
 {
     (*ReadBytes) = 0;
     if(!ExtInfo || !ExtInfo->Mapping) return STATUS_INVALID_PARAMETER;
-    ASSERT((uint32)Buffer > 0x1000);
+    ASSERT((uintptr_t)Buffer > 0x1000);
 
     AdPrint(("Read ExtInfo %x, Mapping %x\n", ExtInfo, ExtInfo->Mapping));
 
     PEXTENT_MAP Extent = ExtInfo->Mapping;   // Extent array
-    uint32 to_read, Lba, sect_offs, flags, _ReadBytes;
+    SIZE_T to_read, _ReadBytes;
+    uint32 Lba, sect_offs, flags;
+    uint32 index;
     OSSTATUS status;
     // prevent reading out of data space
     if(Offset > ExtInfo->Length) return STATUS_END_OF_FILE;
     if(Offset+Length > ExtInfo->Length) Length = (uint32)(ExtInfo->Length - Offset);
     Offset += ExtInfo->Offset;               // used for in-ICB data
     // read maximal possible part of each frag of extent
-    Lba = UDFExtentOffsetToLba(Vcb, Extent, Offset, &sect_offs, &to_read, &flags, &_ReadBytes);
+    Lba = UDFExtentOffsetToLba(Vcb, Extent, Offset, &sect_offs, &to_read, &flags, &index);
+    _ReadBytes = index;
     while(Length) {
         // EOF check
         if(Lba == LBA_OUT_OF_EXTENT) return STATUS_END_OF_FILE;
@@ -3057,7 +3064,8 @@ UDFReadExtent(
         ASSERT(to_read);
         Buffer += to_read;
 //        Offset += to_read;
-        Lba = UDFNextExtentToLba(Vcb, Extent, &to_read, &flags, &_ReadBytes);
+        Lba = UDFNextExtentToLba(Vcb, Extent, &to_read, &flags, &index);
+        _ReadBytes = index;
         sect_offs = 0;
     }
     return STATUS_SUCCESS;
@@ -3084,7 +3092,8 @@ UDFReadExtentLocation(
 
     PEXTENT_MAP Extent = ExtInfo->Mapping;   // Extent array
     PEXTENT_MAP SubExtInfo;
-    uint32 to_read, Lba, sect_offs, flags, Skip_MapEntries;
+    SIZE_T to_read;
+    uint32 Lba, sect_offs, flags, Skip_MapEntries;
     int32 SubExtInfoSz = *_SubExtInfoSz;
     int64 Length;
     int64 NextOffset;
@@ -3175,20 +3184,20 @@ UDFWriteExtent(
     IN PVCB Vcb,
     IN PEXTENT_INFO ExtInfo,   // Extent array
     IN int64 Offset,        // offset in extent
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN BOOLEAN Direct,         // setting this flag delays flushing of given
                                // data to indefinite term
     IN int8* Buffer,
-    OUT uint32* WrittenBytes
+    OUT PSIZE_T WrittenBytes
     )
 {
     if(!ExtInfo || !ExtInfo->Mapping)
         return STATUS_INVALID_PARAMETER;
 
     PEXTENT_MAP Extent = ExtInfo->Mapping;   // Extent array
-    uint32 to_write, Lba, sect_offs, flags;
+    uint32 Lba, sect_offs, flags;
     OSSTATUS status;
-    uint32 _WrittenBytes;
+    SIZE_T to_write, _WrittenBytes;
     BOOLEAN reread_lba;
 //    BOOLEAN already_prepared = FALSE;
 //    BOOLEAN prepare = !Buffer;
@@ -3326,21 +3335,21 @@ UDFZeroExtent(
     IN PVCB Vcb,
     IN PEXTENT_INFO ExtInfo,   // Extent array
     IN int64 Offset,           // offset in extent
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN BOOLEAN Deallocate,     // deallocate frag or just mark as unrecorded
     IN BOOLEAN Direct,         // setting this flag delays flushing of given
                                // data to indefinite term
-    OUT uint32* WrittenBytes
+    OUT PSIZE_T WrittenBytes
     )
 {
     if(!ExtInfo || !ExtInfo->Mapping)
         return STATUS_INVALID_PARAMETER;
 
     PEXTENT_MAP Extent = ExtInfo->Mapping;   // Extent array
-    uint32 to_write, Lba, sect_offs, flags;
+    uint32 Lba, sect_offs, flags;
     OSSTATUS status;
-    uint32 _WrittenBytes;
-    uint32 LBS = Vcb->LBlockSize;
+    SIZE_T to_write, _WrittenBytes;
+    SIZE_T LBS = Vcb->LBlockSize;
 
     AdPrint(("Zero ExtInfo %x, Mapping %x\n", ExtInfo, ExtInfo->Mapping));
 
index 2cbaccc..72c3329 100644 (file)
@@ -64,7 +64,7 @@ UDFPrepareXSpaceBitmap(
     lb_addr locAddr;
     int8* _XSBM;
     uint16 Ident;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
     uint32 PartNum;
 
     if(!(XSpaceBitmap->extLength)) {
@@ -202,7 +202,7 @@ UDFUpdateXSpaceBitmaps(
     uint32 USl, FSl;
     EXTENT_INFO FSBMExtInfo, USBMExtInfo;
 //    lb_addr locAddr;
-    uint32 WrittenBytes;
+    SIZE_T WrittenBytes;
 
     UDF_CHECK_BITMAP_RESOURCE(Vcb);
 
@@ -304,7 +304,7 @@ UDFUpdatePartDesc(
     PartitionDesc *p = (PartitionDesc *)Buf;
     uint32 i; // PartNdx
     tag* PTag;
-    uint32 WrittenBytes;
+    SIZE_T WrittenBytes;
 
     for(i=0; i<Vcb->PartitionMaps; i++)
     {
@@ -344,7 +344,7 @@ UDFUpdateUSpaceDesc(
     )
 {
     PUNALLOC_SPACE_DESC usd;
-    uint32 WrittenBytes;
+    SIZE_T WrittenBytes;
 
     usd = (PUNALLOC_SPACE_DESC)Buf;
     usd->numAllocDescs = 0;
@@ -365,7 +365,7 @@ UDFUpdateLogicalVolInt(
 {
     OSSTATUS    RC = STATUS_SUCCESS;
     uint32      i, len;
-    uint32      WrittenBytes;
+    SIZE_T      WrittenBytes;
 //    uint32      lvid_count = 0;
     uint32      pSize;
     tag*        PTag;
@@ -469,7 +469,7 @@ UDFUpdateSparingTable(
     OSSTATUS status2 = STATUS_SUCCESS;
     uint32 i=0, BC, BC2;
     PSPARING_TABLE SparTable;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
 //    uint32 n,m;
 //    BOOLEAN merged;
     BOOLEAN sorted;
@@ -605,7 +605,7 @@ UDFUpdateLogicalVol(
 #define CUR_IDENT_SZ (sizeof(lvd->logicalVolIdent))
     dstring CS0[CUR_IDENT_SZ];
     uint16 ident;
-    uint32 WrittenBytes;
+    SIZE_T WrittenBytes;
     OSSTATUS status = STATUS_SUCCESS;
 //    OSSTATUS status2 = STATUS_SUCCESS;
 
@@ -761,7 +761,7 @@ UDFSetDstring(
     )
 {
     uint8* CS0;
-    uint32 len = Length-1;
+    SIZE_T len = Length-1;
 
     UDFCompressUnicode(UName, &CS0, &len);
     if(!CS0)
@@ -809,7 +809,7 @@ UDFUpdateVolIdent(
     OSSTATUS status;
     dstring CS0[CUR_IDENT_SZ];
     uint16 ident;
-    uint32 WrittenBytes;
+    SIZE_T WrittenBytes;
 
     if(!pvoldesc) return STATUS_INSUFFICIENT_RESOURCES;
 
@@ -1115,7 +1115,7 @@ UDFFindVRS(
     uint32       BeginOffset = Vcb->FirstLBA;
     OSSTATUS     RC;
     int8*        buffer = (int8*)MyAllocatePool__(NonPagedPool,Vcb->BlockSize);
-    uint32       ReadBytes;
+    SIZE_T       ReadBytes;
 
     if(!buffer) return 0;
     // Relative to First LBA in Last Session
@@ -1244,7 +1244,7 @@ UDFLoadLogicalVolInt(
 {
     OSSTATUS    RC = STATUS_SUCCESS;
     uint32      len;
-    uint32      _ReadBytes;
+    SIZE_T      _ReadBytes;
     int8*       Buf = NULL;
     uint16      ident;
     LogicalVolIntegrityDescImpUse* LVID_iUse;
@@ -1580,8 +1580,8 @@ UDFAddXSpaceBitmap(
     OSSTATUS status;
     uint16 Ident;
     uint32 flags;
-    uint32 Length;
-    uint32 ReadBytes;
+    SIZE_T Length;
+    SIZE_T ReadBytes;
     BOOLEAN bit_set;
 
     UDF_CHECK_BITMAP_RESOURCE(Vcb);
@@ -1680,7 +1680,7 @@ UDFVerifyXSpaceBitmap(
     uint16 Ident;
     uint32 flags;
     uint32 Length;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
 //    BOOLEAN bit_set;
 
     UDF_CHECK_BITMAP_RESOURCE(Vcb);
@@ -1775,7 +1775,7 @@ UDFDelXSpaceBitmap(
     uint16 Ident;
     uint32 flags;
     uint32 Length;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
 
     if(!(Length = (bm->extLength & UDF_EXTENT_LENGTH_MASK))) return STATUS_SUCCESS;
     i=0;
@@ -2791,7 +2791,7 @@ UDFLoadSparingTable(
     uint32 i=0, BC, BC2;
     PSPARING_TABLE SparTable;
     uint32 TabSize, NewSize;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
     uint32 SparTableLoc;
 #ifdef UDF_TRACK_FS_STRUCTURES
     uint32 j;
@@ -2991,7 +2991,7 @@ UDFGetDiskInfoAndVerify(
     PFILE_SET_DESC  FileSetDesc = NULL;
 
     int8*           Buf = NULL;
-    uint32          ReadBytes;
+    SIZE_T          ReadBytes;
 
     UDFPrint(("UDFGetDiskInfoAndVerify\n"));
     _SEH2_TRY {
index 646f7eb..d86953a 100644 (file)
@@ -227,7 +227,7 @@ UDFVWrite(
     IN void* Buffer,     // Target buffer
     IN uint32 BCount,
     IN uint32 LBA,
-//    OUT uint32* WrittenBytes,
+//    OUT PSIZE_T WrittenBytes,
     IN uint32 Flags
     )
 {
@@ -544,11 +544,11 @@ UDFVWorkItem(
 {
     PUDF_VERIFY_REQ VerifyReq = (PUDF_VERIFY_REQ)Context;
     PVCB Vcb = VerifyReq->Vcb;
-    ULONG ReadBytes;
+    SIZE_T ReadBytes;
 //    OSSTATUS RC;
     ULONG i;
 
-    ReadBytes = (ULONG)Vcb;
+    ReadBytes = (SIZE_T)Vcb;
 #if 1
     if(Vcb->SparingCountFree) {
         WCacheStartDirect__(&(Vcb->FastCache), Vcb, TRUE);
@@ -768,7 +768,7 @@ UDFCheckArea(
 {
     uint8* buff;
     OSSTATUS RC;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
     uint32 i, d;
     BOOLEAN ext_ok = TRUE;
     EXTENT_MAP Map[2];
index 6f29d88..38576be 100644 (file)
@@ -170,7 +170,7 @@ __fastcall
 UDFDecompressUnicode(
     IN OUT PUNICODE_STRING UName,
     IN uint8* CS0,
-    IN uint32 Length,
+    IN SIZE_T Length,
     OUT uint16* valueCRC
     )
 {
@@ -240,7 +240,7 @@ __fastcall
 UDFCompressUnicode(
     IN PUNICODE_STRING UName,
     IN OUT uint8** _CS0,
-    IN OUT uint32* Length
+    IN OUT PSIZE_T Length
     )
 {
     uint8* CS0;
@@ -1115,7 +1115,8 @@ UDFBuildFileIdent(
 {
     PFILE_IDENT_DESC FileId;
     uint8* CS0;
-    uint32 Nlen, l;
+    SIZE_T Nlen;
+    uint32 l;
     // prepare filename
     UDFCompressUnicode(fn, &CS0, &Nlen);
     if(!CS0) return STATUS_INSUFFICIENT_RESOURCES;
@@ -1605,18 +1606,18 @@ UDFWriteFile__(
     IN PVCB Vcb,
     IN PUDF_FILE_INFO FileInfo,
     IN int64 Offset,
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN BOOLEAN Direct,
     IN int8* Buffer,
-    OUT uint32* WrittenBytes
+    OUT PSIZE_T WrittenBytes
     )
 {
     int64 t, elen;
     OSSTATUS status;
     int8* OldInIcb = NULL;
     ValidateFileInfo(FileInfo);
-    uint32 ReadBytes;
-    uint32 _WrittenBytes;
+    SIZE_T ReadBytes;
+    SIZE_T _WrittenBytes;
     PUDF_DATALOC_INFO Dloc;
     // unwind staff
     BOOLEAN WasInIcb = FALSE;
@@ -1689,7 +1690,7 @@ UDFWriteFile__(
         Vcb->LowFreeSpace ? "LowSpace" : ""));
     if(UDFIsADirectory(FileInfo) && !WasInIcb && !Vcb->LowFreeSpace) {
         FileInfo->Dloc->DataLoc.Flags |= EXTENT_FLAG_ALLOC_SEQUENTIAL;
-        status = UDFResizeExtent(Vcb, PartNum, (t*2+Vcb->WriteBlockSize-1) & ~(Vcb->WriteBlockSize-1), FALSE, &(Dloc->DataLoc));
+        status = UDFResizeExtent(Vcb, PartNum, (t*2+Vcb->WriteBlockSize-1) & ~(SIZE_T)(Vcb->WriteBlockSize-1), FALSE, &(Dloc->DataLoc));
         if(OS_SUCCESS(status)) {
             AdPrint(("  preallocated space for Dir\n"));
             FileInfo->Dloc->DataLoc.Flags |= EXTENT_FLAG_PREALLOCATED;
@@ -2019,7 +2020,7 @@ UDFOpenFile__(
     PDIR_INDEX_ITEM DirNdx;
     PUDF_FILE_INFO FileInfo;
     PUDF_FILE_INFO ParFileInfo;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
     *_FileInfo = NULL;
     if(!hDirNdx) return STATUS_NOT_A_DIRECTORY;
 
@@ -2597,7 +2598,7 @@ UDFCreateFile__(
     PUDF_FILE_INFO FileInfo;
     *_FileInfo = NULL;
     BOOLEAN undel = FALSE;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
 //    BOOLEAN PackDir = FALSE;
     BOOLEAN FEAllocated = FALSE;
 
@@ -2904,10 +2905,10 @@ UDFReadFile__(
     IN PVCB Vcb,
     IN PUDF_FILE_INFO FileInfo,
     IN int64 Offset,   // offset in extent
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN BOOLEAN Direct,
     OUT int8* Buffer,
-    OUT uint32* ReadBytes
+    OUT PSIZE_T ReadBytes
     )
 {
     ValidateFileInfo(FileInfo);
@@ -2925,9 +2926,9 @@ UDFZeroFile__(
     IN PVCB Vcb,
     IN PUDF_FILE_INFO FileInfo,
     IN int64 Offset,   // offset in extent
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN BOOLEAN Direct,
-    OUT uint32* ReadBytes
+    OUT PSIZE_T ReadBytes
     )
 {
     ValidateFileInfo(FileInfo);
@@ -2944,9 +2945,9 @@ UDFSparseFile__(
     IN PVCB Vcb,
     IN PUDF_FILE_INFO FileInfo,
     IN int64 Offset,   // offset in extent
-    IN uint32 Length,
+    IN SIZE_T Length,
     IN BOOLEAN Direct,
-    OUT uint32* ReadBytes
+    OUT PSIZE_T ReadBytes
     )
 {
     ValidateFileInfo(FileInfo);
@@ -2966,7 +2967,8 @@ UDFPadLastSector(
     if(!ExtInfo || !(ExtInfo->Mapping) || !(ExtInfo->Length)) return STATUS_INVALID_PARAMETER;
 
     PEXTENT_MAP Extent = ExtInfo->Mapping;   // Extent array
-    uint32 to_write, Lba, sect_offs, flags, WrittenBytes;
+    SIZE_T to_write, WrittenBytes;
+    uint32 Lba, sect_offs, flags;
     OSSTATUS status;
     // Length should not be zero
     int64 Offset = ExtInfo->Length + ExtInfo->Offset;
@@ -3201,7 +3203,7 @@ UDFRenameMoveFile__(
            (j==FileInfo->Index) ) {
             // case-only rename
             uint8* CS0;
-            uint32 Nlen, /* l, FIXME ReactOS */ IUl;
+            SIZE_T Nlen, /* l, FIXME ReactOS */ IUl;
 
             // prepare filename
             UDFCompressUnicode(fn, &CS0, &Nlen);
@@ -3390,7 +3392,7 @@ UDFRecordDirectory__(
     UDF_DATALOC_INFO Dloc;
     UNICODE_STRING PName;
     uint32 PartNum;
-    uint32 WrittenBytes;
+    SIZE_T WrittenBytes;
     PDIR_INDEX_ITEM CurDirNdx;
     uint32 lba;
 
@@ -3469,7 +3471,7 @@ UDFResizeFile__(
     IN int64 NewLength
     )
 {
-    uint32 WrittenBytes;
+    SIZE_T WrittenBytes;
     OSSTATUS status;
     uint32 PartNum;
     int8* OldInIcb = NULL;
@@ -3607,7 +3609,7 @@ UDFLoadVAT(
     PUDF_FILE_INFO VatFileInfo;
     uint32 len, i=0, j, to_read;
     uint32 Offset, hdrOffset;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
     uint32 root;
     uint16 PartNum;
 //    uint32 VatFirstLba = 0;
@@ -3867,7 +3869,7 @@ UDFFlushFE(
 {
     int8* NewAllocDescs;
     OSSTATUS status;
-    uint32 WrittenBytes;
+    SIZE_T WrittenBytes;
     uint16 AllocMode;
     uint32 lba;
 
@@ -4055,7 +4057,7 @@ UDFFlushFI(
     PUDF_FILE_INFO DirInfo = FileInfo->ParentFile;
     PDIR_INDEX_ITEM DirNdx;
     OSSTATUS status;
-    uint32 WrittenBytes;
+    SIZE_T WrittenBytes;
     // use WrittenBytes variable to store LBA of FI to be recorded
     #define lba   WrittenBytes
 
@@ -4524,7 +4526,7 @@ uint16
 __fastcall
 UDFCrc(
     IN uint8* Data, // ECX
-    IN uint32 Size  // EDX
+    IN SIZE_T Size  // EDX
     )
 {
 #if defined(_X86_) && defined(_MSC_VER) && !defined(__clang__)
@@ -4594,7 +4596,7 @@ UDFReadTagged(
 //    icbtag* Icb = (icbtag*)(Buf+1);
     uint8 checksum;
     unsigned int i;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
     int8* tb;
 
     // Read the block
@@ -4836,7 +4838,7 @@ UDFCreateRootFile__(
     LONG_AD FEicb;
     PUDF_FILE_INFO FileInfo;
     *_FileInfo = NULL;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
 
     FileInfo = (PUDF_FILE_INFO)MyAllocatePoolTag__(UDF_FILE_INFO_MT,sizeof(UDF_FILE_INFO), MEM_FINF_TAG);
     *_FileInfo = FileInfo;
@@ -5040,7 +5042,7 @@ UDFRecordVAT(
     uint32 hdrOffset, hdrOffsetNew;
     uint32 hdrLen;
     OSSTATUS status;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
     uint32 len;
     uint16 PartNdx = (uint16)Vcb->VatPartNdx;
     uint16 PartNum = UDFGetPartNumByPartNdx(Vcb, PartNdx);
@@ -5363,8 +5365,8 @@ UDFConvertFEToNonInICB(
     int8* OldInIcb = NULL;
     uint32 OldLen;
     ValidateFileInfo(FileInfo);
-    uint32 ReadBytes;
-    uint32 _WrittenBytes;
+    SIZE_T ReadBytes;
+    SIZE_T _WrittenBytes;
     PUDF_DATALOC_INFO Dloc;
 
 //    ASSERT(FileInfo->RefCount >= 1);
@@ -5462,7 +5464,7 @@ UDFConvertFEToExtended(
     PFILE_ENTRY FileEntry;
     uint32 Length, NewLength, l;
     OSSTATUS status;
-    uint32 ReadBytes;
+    SIZE_T ReadBytes;
 
     if(!FileInfo) return STATUS_INVALID_PARAMETER;
     ValidateFileInfo(FileInfo);
index c1ef022..2aeeb01 100644 (file)
@@ -24,7 +24,7 @@ UDFExtentOffsetToLba(IN PVCB Vcb,
                      IN PEXTENT_AD Extent,   // Extent array
                      IN int64 Offset,     // offset in extent
                      OUT uint32* SectorOffset,
-                     OUT uint32* AvailLength, // available data in this block
+                     OUT PSIZE_T AvailLength, // available data in this block
                      OUT uint32* Flags,
                      OUT uint32* Index);
 
@@ -44,10 +44,10 @@ UDFLocateLbaInExtent(
 OSSTATUS UDFReadExtent(IN PVCB Vcb,
                        IN PEXTENT_INFO ExtInfo, // Extent array
                        IN int64 Offset,   // offset in extent
-                       IN uint32 Length,
+                       IN SIZE_T Length,
                        IN BOOLEAN Direct,
                        OUT int8* Buffer,
-                       OUT uint32* ReadBytes);
+                       OUT PSIZE_T ReadBytes);
 // builds mapping for specified amount of data at any offset from specified extent.
 OSSTATUS
 UDFReadExtentLocation(IN PVCB Vcb,
@@ -64,7 +64,7 @@ int64 UDFGetExtentLength(IN PEXTENT_MAP Extent);  // Extent array
 void 
 __fastcall UDFDecompressUnicode(IN OUT PUNICODE_STRING UName,
                               IN uint8* CS0,
-                              IN uint32 Length,
+                              IN SIZE_T Length,
                               OUT uint16* valueCRC);
 // calculate hashes for directory search
 uint8    UDFBuildHashEntry(IN PVCB Vcb,
@@ -241,17 +241,17 @@ __fastcall UDFDOSName100(IN OUT PUNICODE_STRING DosName,
 
 // return length of bit-chain starting from Offs bit
 #ifdef _X86_
-uint32
+SIZE_T
 __stdcall
 UDFGetBitmapLen(
 #else   // NO X86 optimization , use generic C/C++
-uint32    UDFGetBitmapLen(
+SIZE_T    UDFGetBitmapLen(
 #endif // _X86_
                          uint32* Bitmap,
-                         uint32 Offs,
-                         uint32 Lim);
+                         SIZE_T Offs,
+                         SIZE_T Lim);
 // scan disc free space bitmap for minimal suitable extent
-uint32    UDFFindMinSuitableExtent(IN PVCB Vcb,
+SIZE_T    UDFFindMinSuitableExtent(IN PVCB Vcb,
                                    IN uint32 Length, // in blocks
                                    IN uint32 SearchStart,
                                    IN uint32 SearchLim,
@@ -468,7 +468,7 @@ OSSTATUS UDFLoadExtInfo(IN PVCB Vcb,
 void 
 __fastcall UDFCompressUnicode(IN PUNICODE_STRING UName,
                             IN OUT uint8** _CS0,
-                            IN OUT uint32* Length);
+                            IN OUT PSIZE_T Length);
 // build FileIdent for specified FileEntry.
 OSSTATUS UDFBuildFileIdent(IN PVCB Vcb,
                            IN PUNICODE_STRING fn,
@@ -520,21 +520,21 @@ __inline OSSTATUS UDFMarkRecordedAsAllocated(IN PVCB Vcb,
 OSSTATUS UDFWriteExtent(IN PVCB Vcb,
                         IN PEXTENT_INFO ExtInfo,   // Extent array
                         IN int64 Offset,           // offset in extent
-                        IN uint32 Length,
+                        IN SIZE_T Length,
                         IN BOOLEAN Direct,         // setting this flag delays flushing of given
                                                    // data to indefinite term
                         IN int8* Buffer,
-                        OUT uint32* WrittenBytes);
+                        OUT PSIZE_T WrittenBytes);
 
 // deallocate/zero data at any offset from specified extent.
 OSSTATUS UDFZeroExtent(IN PVCB Vcb,
                        IN PEXTENT_INFO ExtInfo,   // Extent array
                        IN int64 Offset,           // offset in extent
-                       IN uint32 Length,
+                       IN SIZE_T Length,
                        IN BOOLEAN Deallocate,     // deallocate frag or just mark as unrecorded
                        IN BOOLEAN Direct,         // setting this flag delays flushing of given
                                                   // data to indefinite term
-                       OUT uint32* WrittenBytes);
+                       OUT PSIZE_T WrittenBytes);
 
 #define UDFZeroExtent__(Vcb, Ext, Off, Len, Dir, WB) \
   UDFZeroExtent(Vcb, Ext, Off, Len, FALSE, Dir, WB)
@@ -619,10 +619,10 @@ void  UDFChangeFileCounter(IN PVCB Vcb,
 OSSTATUS UDFWriteFile__(IN PVCB Vcb,
                         IN PUDF_FILE_INFO FileInfo,
                         IN int64 Offset,
-                        IN uint32 Length,
+                        IN SIZE_T Length,
                         IN BOOLEAN Direct,
                         IN int8* Buffer,
-                        OUT uint32* WrittenBytes);
+                        OUT PSIZE_T WrittenBytes);
 // mark file as deleted & decrease file link counter.
 OSSTATUS UDFUnlinkFile__(IN PVCB Vcb,
                          IN PUDF_FILE_INFO FileInfo,
@@ -666,10 +666,10 @@ __inline
 OSSTATUS UDFReadFile__(IN PVCB Vcb,
                        IN PUDF_FILE_INFO FileInfo,
                        IN int64 Offset,   // offset in extent
-                       IN uint32 Length,
+                       IN SIZE_T Length,
                        IN BOOLEAN Direct,
                        OUT int8* Buffer,
-                       OUT uint32* ReadBytes)
+                       OUT PSIZE_T ReadBytes)
 {
     ValidateFileInfo(FileInfo);
 
@@ -862,7 +862,7 @@ __fastcall crc32(IN uint8* s,
 // calculate a 16-bit CRC checksum using ITU-T V.41 polynomial
 uint16 
 __fastcall UDFCrc(IN uint8* Data,
-                IN uint32 Size);
+                IN SIZE_T Size);
 // read the first block of a tagged descriptor & check it
 OSSTATUS UDFReadTagged(IN PVCB Vcb,
                        IN int8* Buf,
@@ -1277,7 +1277,7 @@ UDFVWrite(
     IN void* Buffer,     // Target buffer
     IN uint32 BCount,
     IN uint32 LBA,
-//    OUT uint32* WrittenBytes,
+//    OUT PSIZE_T WrittenBytes,
     IN uint32 Flags
     );
 
index 3031c1f..c8000ad 100644 (file)
@@ -516,7 +516,7 @@ typedef struct _UDF_ALLOCATION_CACHE_ITEM {
 #define UDF_MAX_LVID_CHAIN_LENGTH   1024
 #define UDF_LVID_TTL                1024
 
-#define UDF_NO_EXTENT_MAP           ((PEXTENT_MAP)0xffffffff)
+#define UDF_NO_EXTENT_MAP           ((PEXTENT_MAP)(ULONG_PTR)~0ULL)
 
 #define UDF_FLUSH_FLAGS_LITE        (0x80000000)
 
index ceaa69b..60854a7 100644 (file)
@@ -117,7 +117,7 @@ UDFCommonWrite(
     PIO_STACK_LOCATION      IrpSp = NULL;
     LARGE_INTEGER           ByteOffset;
     ULONG                   WriteLength = 0, TruncatedLength = 0;
-    ULONG                   NumberBytesWritten = 0;
+    SIZE_T                  NumberBytesWritten = 0;
     PFILE_OBJECT            FileObject = NULL;
     PtrUDFFCB               Fcb = NULL;
     PtrUDFCCB               Ccb = NULL;
@@ -158,7 +158,7 @@ UDFCommonWrite(
 
         TopIrp = IoGetTopLevelIrp();
 
-        switch((ULONG)TopIrp) {
+        switch((ULONG_PTR)TopIrp) {
         case FSRTL_FSP_TOP_LEVEL_IRP:
             UDFPrint(("  FSRTL_FSP_TOP_LEVEL_IRP\n"));
             break;
@@ -525,7 +525,7 @@ UDFCommonWrite(
 
         // Determine if we were called by the lazywriter.
         // We reuse 'IsThisADeferredWrite' here to decrease stack usage
-        IsThisADeferredWrite = (NtReqFcb->LazyWriterThreadID == (uint32)PsGetCurrentThread());
+        IsThisADeferredWrite = (NtReqFcb->LazyWriterThreadID == HandleToUlong(PsGetCurrentThreadId()));
 
         // Acquire the appropriate FCB resource
         if(PagingIo) {
@@ -576,7 +576,7 @@ UDFCommonWrite(
 
             //  This clause determines if the top level request was
             //  in the FastIo path.
-            if ((ULONG)TopIrp > FSRTL_MAX_TOP_LEVEL_IRP_FLAG) {
+            if ((ULONG_PTR)TopIrp > FSRTL_MAX_TOP_LEVEL_IRP_FLAG) {
 
                 PIO_STACK_LOCATION IrpStack;
                 ASSERT( TopIrp->Type == IO_TYPE_IRP );
@@ -846,11 +846,11 @@ UDFCommonWrite(
             }
 
 #if 1
-            if((ULONG)TopIrp == FSRTL_MOD_WRITE_TOP_LEVEL_IRP) {
+            if((ULONG_PTR)TopIrp == FSRTL_MOD_WRITE_TOP_LEVEL_IRP) {
                 UDFPrint(("FSRTL_MOD_WRITE_TOP_LEVEL_IRP => CanWait\n"));
                 CanWait = TRUE;
             } else
-            if((ULONG)TopIrp == FSRTL_CACHE_TOP_LEVEL_IRP) {
+            if((ULONG_PTR)TopIrp == FSRTL_CACHE_TOP_LEVEL_IRP) {
                 UDFPrint(("FSRTL_CACHE_TOP_LEVEL_IRP => CanWait\n"));
                 CanWait = TRUE;
             }