[UDFS] Fix 64 bit issues

This commit is contained in:
Timo Kreuzer 2018-08-20 19:02:00 +02:00
parent be97da34ac
commit c334c17d69
23 changed files with 257 additions and 246 deletions

View file

@ -245,7 +245,7 @@ UDFFileDirInfoToNT(
UDFPrint(("@=%#x, FileDirNdx %x\n", &Vcb, FileDirNdx)); UDFPrint(("@=%#x, FileDirNdx %x\n", &Vcb, FileDirNdx));
ASSERT((ULONG)NTFileInfo > 0x1000); ASSERT((ULONG_PTR)NTFileInfo > 0x1000);
RtlZeroMemory(NTFileInfo, sizeof(FILE_BOTH_DIR_INFORMATION)); RtlZeroMemory(NTFileInfo, sizeof(FILE_BOTH_DIR_INFORMATION));
DosName.Buffer = (PWCHAR)&(NTFileInfo->ShortName); DosName.Buffer = (PWCHAR)&(NTFileInfo->ShortName);

View file

@ -94,20 +94,20 @@ __fastcall
UDFTIOVerify( UDFTIOVerify(
IN void* _Vcb, IN void* _Vcb,
IN void* Buffer, // Target buffer IN void* Buffer, // Target buffer
IN uint32 Length, IN SIZE_T Length,
IN uint32 LBA, IN uint32 LBA,
OUT uint32* IOBytes, OUT PSIZE_T IOBytes,
IN uint32 Flags IN uint32 Flags
) )
{ {
OSSTATUS RC = STATUS_SUCCESS; OSSTATUS RC = STATUS_SUCCESS;
uint32 i, j; uint32 i, j;
uint32 mask; SIZE_T mask;
uint32 lba0, len, lba1; uint32 lba0, len, lba1;
PUCHAR tmp_buff; PUCHAR tmp_buff;
PUCHAR p; PUCHAR p;
PCHAR cached_block; PCHAR cached_block;
uint32 tmp_wb; SIZE_T tmp_wb;
BOOLEAN need_remap; BOOLEAN need_remap;
OSSTATUS final_RC = STATUS_SUCCESS; OSSTATUS final_RC = STATUS_SUCCESS;
BOOLEAN zero; BOOLEAN zero;
@ -127,7 +127,7 @@ UDFTIOVerify(
UDFAcquireResourceExclusive(&(Vcb->IoResource), TRUE); UDFAcquireResourceExclusive(&(Vcb->IoResource), TRUE);
Flags |= PH_IO_LOCKED; Flags |= PH_IO_LOCKED;
tmp_wb = (uint32)_Vcb; tmp_wb = (SIZE_T)_Vcb;
if(Flags & PH_EX_WRITE) { if(Flags & PH_EX_WRITE) {
UDFPrint(("IO-Write-Verify\n")); UDFPrint(("IO-Write-Verify\n"));
RC = UDFTWrite(_Vcb, Buffer, Length, LBA, &tmp_wb, Flags | PH_VCB_IN_RETLEN); RC = UDFTWrite(_Vcb, Buffer, Length, LBA, &tmp_wb, Flags | PH_VCB_IN_RETLEN);
@ -248,7 +248,7 @@ UDFTIOVerify(
packet_ok = FALSE; packet_ok = FALSE;
if(!single_packet) { if(!single_packet) {
// try to read entire packet, this returs error more often then sequential reading of all blocks one by one // 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, RC = UDFTRead(_Vcb, p, Vcb->SparingBlockSize << Vcb->BlockSizeBits, lba0+i, &tmp_wb,
Flags | PH_READ_VERIFY_CACHE | PH_TMP_BUFFER | PH_VCB_IN_RETLEN); Flags | PH_READ_VERIFY_CACHE | PH_TMP_BUFFER | PH_VCB_IN_RETLEN);
} else { } else {
@ -271,7 +271,7 @@ UDFTIOVerify(
// even if block is cached, we have to verify if it is readable // even if block is cached, we have to verify if it is readable
if(!packet_ok && !UDFVIsStored(Vcb, lba0+i)) { 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, 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); Flags | PH_FORGET_VERIFIED | PH_READ_VERIFY_CACHE | PH_TMP_BUFFER | PH_VCB_IN_RETLEN);
if(!OS_SUCCESS(RC)) { if(!OS_SUCCESS(RC)) {
@ -297,7 +297,7 @@ UDFTIOVerify(
} else { } else {
if(!UDFVIsStored(Vcb, lba0+i)) { if(!UDFVIsStored(Vcb, lba0+i)) {
tmp_wb = (uint32)_Vcb; tmp_wb = (SIZE_T)_Vcb;
RC = UDFTRead(_Vcb, p, Vcb->BlockSize, lba0+i, &tmp_wb, 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); Flags | PH_FORGET_VERIFIED | PH_READ_VERIFY_CACHE | PH_TMP_BUFFER | PH_VCB_IN_RETLEN);
} else { } else {
@ -363,7 +363,7 @@ do_remap:
UDFPrint((" remap status %x\n", RC)); UDFPrint((" remap status %x\n", RC));
if(OS_SUCCESS(RC)) { if(OS_SUCCESS(RC)) {
// write to remapped area // 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, 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); Flags | PH_FORGET_VERIFIED | PH_READ_VERIFY_CACHE | PH_TMP_BUFFER | PH_VCB_IN_RETLEN);
UDFPrint((" write status %x\n", RC)); UDFPrint((" write status %x\n", RC));
@ -397,7 +397,7 @@ do_remap:
DbgFreePool(tmp_buff); DbgFreePool(tmp_buff);
} }
tmp_wb = (uint32)_Vcb; tmp_wb = (SIZE_T)_Vcb;
if(Flags & PH_EX_WRITE) { if(Flags & PH_EX_WRITE) {
UDFPrint(("IO-Write-Verify (2)\n")); UDFPrint(("IO-Write-Verify (2)\n"));
//RC = UDFTWrite(_Vcb, Buffer, Length, LBA, &tmp_wb, Flags | PH_FORGET_VERIFIED | PH_VCB_IN_RETLEN); //RC = UDFTWrite(_Vcb, Buffer, Length, LBA, &tmp_wb, Flags | PH_FORGET_VERIFIED | PH_VCB_IN_RETLEN);
@ -420,9 +420,9 @@ OSSTATUS
UDFTWriteVerify( UDFTWriteVerify(
IN void* _Vcb, IN void* _Vcb,
IN void* Buffer, // Target buffer IN void* Buffer, // Target buffer
IN uint32 Length, IN SIZE_T Length,
IN uint32 LBA, IN uint32 LBA,
OUT uint32* WrittenBytes, OUT PSIZE_T WrittenBytes,
IN uint32 Flags IN uint32 Flags
) )
{ {
@ -433,9 +433,9 @@ OSSTATUS
UDFTReadVerify( UDFTReadVerify(
IN void* _Vcb, IN void* _Vcb,
IN void* Buffer, // Target buffer IN void* Buffer, // Target buffer
IN uint32 Length, IN SIZE_T Length,
IN uint32 LBA, IN uint32 LBA,
OUT uint32* ReadBytes, OUT PSIZE_T ReadBytes,
IN uint32 Flags IN uint32 Flags
) )
{ {
@ -453,9 +453,9 @@ OSSTATUS
UDFTWrite( UDFTWrite(
IN void* _Vcb, IN void* _Vcb,
IN void* Buffer, // Target buffer IN void* Buffer, // Target buffer
IN uint32 Length, IN SIZE_T Length,
IN uint32 LBA, IN uint32 LBA,
OUT uint32* WrittenBytes, OUT PSIZE_T WrittenBytes,
IN uint32 Flags IN uint32 Flags
) )
{ {
@ -526,7 +526,7 @@ retry_1:
try_return(RC); try_return(RC);
} }
if(Flags & PH_VCB_IN_RETLEN) { if(Flags & PH_VCB_IN_RETLEN) {
(*WrittenBytes) = (ULONG)Vcb; (*WrittenBytes) = (ULONG_PTR)Vcb;
} }
RC = UDFPhWriteVerifySynchronous(Vcb->TargetDeviceObject, Buffer, Length, RC = UDFPhWriteVerifySynchronous(Vcb->TargetDeviceObject, Buffer, Length,
((uint64)rLba) << Vcb->BlockSizeBits, WrittenBytes, Flags); ((uint64)rLba) << Vcb->BlockSizeBits, WrittenBytes, Flags);
@ -543,7 +543,7 @@ retry_1:
// write according to relocation table // write according to relocation table
RelocExtent_saved = RelocExtent; RelocExtent_saved = RelocExtent;
for(i=0; RelocExtent->extLength; i++, RelocExtent++) { for(i=0; RelocExtent->extLength; i++, RelocExtent++) {
uint32 _WrittenBytes; SIZE_T _WrittenBytes;
rLba = RelocExtent->extLocation; rLba = RelocExtent->extLocation;
BCount = RelocExtent->extLength>>Vcb->BlockSizeBits; BCount = RelocExtent->extLength>>Vcb->BlockSizeBits;
retry = UDF_WRITE_MAX_RETRY; retry = UDF_WRITE_MAX_RETRY;
@ -554,7 +554,7 @@ retry_2:
break; break;
} }
if(Flags & PH_VCB_IN_RETLEN) { if(Flags & PH_VCB_IN_RETLEN) {
_WrittenBytes = (ULONG)Vcb; _WrittenBytes = (ULONG_PTR)Vcb;
} }
RC = UDFPhWriteVerifySynchronous(Vcb->TargetDeviceObject, Buffer, RelocExtent->extLength, RC = UDFPhWriteVerifySynchronous(Vcb->TargetDeviceObject, Buffer, RelocExtent->extLength,
((uint64)rLba) << Vcb->BlockSizeBits, &_WrittenBytes, Flags); ((uint64)rLba) << Vcb->BlockSizeBits, &_WrittenBytes, Flags);
@ -596,9 +596,9 @@ OSSTATUS
UDFTRead( UDFTRead(
IN void* _Vcb, IN void* _Vcb,
IN void* Buffer, // Target buffer IN void* Buffer, // Target buffer
IN uint32 Length, IN SIZE_T Length,
IN uint32 LBA, IN uint32 LBA,
OUT uint32* ReadBytes, OUT PSIZE_T ReadBytes,
IN uint32 Flags IN uint32 Flags
) )
{ {
@ -651,7 +651,7 @@ retry_1:
if(!OS_SUCCESS(RC)) return RC; // this is for !_BROWSE_UDF only if(!OS_SUCCESS(RC)) return RC; // this is for !_BROWSE_UDF only
#endif //_BROWSE_UDF_ #endif //_BROWSE_UDF_
if(Flags & PH_VCB_IN_RETLEN) { if(Flags & PH_VCB_IN_RETLEN) {
(*ReadBytes) = (ULONG)Vcb; (*ReadBytes) = (SIZE_T)Vcb;
} }
RC = UDFPhReadSynchronous(Vcb->TargetDeviceObject, Buffer, Length, RC = UDFPhReadSynchronous(Vcb->TargetDeviceObject, Buffer, Length,
((uint64)rLba) << Vcb->BlockSizeBits, ReadBytes, Flags); ((uint64)rLba) << Vcb->BlockSizeBits, ReadBytes, Flags);
@ -674,7 +674,7 @@ retry_1:
// read according to relocation table // read according to relocation table
RelocExtent_saved = RelocExtent; RelocExtent_saved = RelocExtent;
for(i=0; RelocExtent->extLength; i++, RelocExtent++) { for(i=0; RelocExtent->extLength; i++, RelocExtent++) {
uint32 _ReadBytes; SIZE_T _ReadBytes;
rLba = RelocExtent->extLocation; rLba = RelocExtent->extLocation;
if(rLba >= (Vcb->CDR_Mode ? Vcb->NWA : Vcb->LastLBA + 1)) { if(rLba >= (Vcb->CDR_Mode ? Vcb->NWA : Vcb->LastLBA + 1)) {
RtlZeroMemory(Buffer, _ReadBytes = RelocExtent->extLength); RtlZeroMemory(Buffer, _ReadBytes = RelocExtent->extLength);
@ -688,7 +688,7 @@ retry_2:
if(!OS_SUCCESS(RC)) break; if(!OS_SUCCESS(RC)) break;
rLba = UDFFixFPAddress(Vcb, rLba); rLba = UDFFixFPAddress(Vcb, rLba);
if(Flags & PH_VCB_IN_RETLEN) { if(Flags & PH_VCB_IN_RETLEN) {
_ReadBytes = (ULONG)Vcb; _ReadBytes = (SIZE_T)Vcb;
} }
RC = UDFPhReadSynchronous(Vcb->TargetDeviceObject, Buffer, RelocExtent->extLength, RC = UDFPhReadSynchronous(Vcb->TargetDeviceObject, Buffer, RelocExtent->extLength,
((uint64)rLba) << Vcb->BlockSizeBits, &_ReadBytes, Flags); ((uint64)rLba) << Vcb->BlockSizeBits, &_ReadBytes, Flags);
@ -731,9 +731,9 @@ UDFTReadAsync(
IN void* _Vcb, IN void* _Vcb,
IN void* _WContext, IN void* _WContext,
IN void* Buffer, // Target buffer IN void* Buffer, // Target buffer
IN uint32 Length, IN SIZE_T Length,
IN uint32 LBA, IN uint32 LBA,
OUT uint32* ReadBytes OUT PSIZE_T ReadBytes
) )
{ {
PEXTENT_MAP RelocExtent; PEXTENT_MAP RelocExtent;
@ -774,7 +774,7 @@ retry_1:
// read according to relocation table // read according to relocation table
RelocExtent_saved = RelocExtent; RelocExtent_saved = RelocExtent;
for(uint32 i=0; RelocExtent->extLength; i++, RelocExtent++) { for(uint32 i=0; RelocExtent->extLength; i++, RelocExtent++) {
uint32 _ReadBytes; SIZE_T _ReadBytes;
rLba = RelocExtent->extLocation; rLba = RelocExtent->extLocation;
if(rLba >= (Vcb->CDR_Mode ? Vcb->NWA : Vcb->LastLBA + 1)) { if(rLba >= (Vcb->CDR_Mode ? Vcb->NWA : Vcb->LastLBA + 1)) {
RtlZeroMemory(Buffer, _ReadBytes = RelocExtent->extLength); RtlZeroMemory(Buffer, _ReadBytes = RelocExtent->extLength);
@ -1157,7 +1157,7 @@ check_dvd_bg_format:
&& (Lba > Vcb->LastLBA)) { && (Lba > Vcb->LastLBA)) {
ULONG fLba; ULONG fLba;
ULONG WrittenBytes; SIZE_T WrittenBytes;
ULONG PSz = BCount << Vcb->BlockSizeBits; ULONG PSz = BCount << Vcb->BlockSizeBits;
#ifdef _BROWSE_UDF_ #ifdef _BROWSE_UDF_
ULONG retry; ULONG retry;
@ -2151,7 +2151,7 @@ MRWRetry_label:
} else } else
if(Vcb->MRWStatus) { if(Vcb->MRWStatus) {
uint8* buff; uint8* buff;
uint32 ReadBytes; SIZE_T ReadBytes;
UDFPrint((" MRW state %x\n", Vcb->MRWStatus)); UDFPrint((" MRW state %x\n", Vcb->MRWStatus));
@ -2397,7 +2397,7 @@ UDFUseStandard(
#ifdef _BROWSE_UDF_ #ifdef _BROWSE_UDF_
uint32 OldTrkNum; uint32 OldTrkNum;
uint32 TrkNum; uint32 TrkNum;
uint32 ReadBytes, i, len; SIZE_T ReadBytes, i, len;
#endif //_BROWSE_UDF_ #endif //_BROWSE_UDF_
#ifdef UDF_FORMAT_MEDIA #ifdef UDF_FORMAT_MEDIA
PUDFFmtState fms = Vcb->fms; PUDFFmtState fms = Vcb->fms;
@ -2879,7 +2879,7 @@ UDFCheckTrackFPAddressing(
uint32 lba=0; uint32 lba=0;
uint32 i; uint32 i;
uint8* Buffer; uint8* Buffer;
// uint32 ReadBytes; // SIZE_T ReadBytes;
uint8 user_data; uint8 user_data;
@ -3682,7 +3682,7 @@ UDFPrepareForReadOperation(
#ifdef _BROWSE_UDF_ #ifdef _BROWSE_UDF_
PUCHAR tmp; PUCHAR tmp;
OSSTATUS RC; OSSTATUS RC;
ULONG ReadBytes; SIZE_T ReadBytes;
#endif //_BROWSE_UDF_ #endif //_BROWSE_UDF_
#ifdef _UDF_STRUCTURES_H_ #ifdef _UDF_STRUCTURES_H_
@ -3887,7 +3887,7 @@ UDFReadSectors(
IN uint32 Lba, IN uint32 Lba,
IN uint32 BCount, IN uint32 BCount,
OUT int8* Buffer, OUT int8* Buffer,
OUT uint32* ReadBytes OUT PSIZE_T ReadBytes
) )
{ {
@ -3911,12 +3911,12 @@ UDFReadInSector(
IN uint32 l, // transfer length IN uint32 l, // transfer length
IN BOOLEAN Direct, // Disable access to non-cached data IN BOOLEAN Direct, // Disable access to non-cached data
OUT int8* Buffer, OUT int8* Buffer,
OUT uint32* ReadBytes OUT PSIZE_T ReadBytes
) )
{ {
int8* tmp_buff; int8* tmp_buff;
OSSTATUS status; OSSTATUS status;
uint32 _ReadBytes; SIZE_T _ReadBytes;
(*ReadBytes) = 0; (*ReadBytes) = 0;
if(WCacheIsInitialized__(&(Vcb->FastCache)) && (KeGetCurrentIrql() < DISPATCH_LEVEL)) { if(WCacheIsInitialized__(&(Vcb->FastCache)) && (KeGetCurrentIrql() < DISPATCH_LEVEL)) {
@ -3953,13 +3953,13 @@ UDFReadData(
IN uint32 Length, IN uint32 Length,
IN BOOLEAN Direct, // Disable access to non-cached data IN BOOLEAN Direct, // Disable access to non-cached data
OUT int8* Buffer, OUT int8* Buffer,
OUT uint32* ReadBytes OUT PSIZE_T ReadBytes
) )
{ {
uint32 i, l, Lba, BS=Vcb->BlockSize; uint32 i, l, Lba, BS=Vcb->BlockSize;
uint32 BSh=Vcb->BlockSizeBits; uint32 BSh=Vcb->BlockSizeBits;
OSSTATUS status; OSSTATUS status;
uint32 _ReadBytes = 0; SIZE_T _ReadBytes = 0;
Vcb->VCBFlags |= UDF_VCB_SKIP_EJECT_CHECK; Vcb->VCBFlags |= UDF_VCB_SKIP_EJECT_CHECK;
uint32 to_read; uint32 to_read;
@ -4016,7 +4016,7 @@ UDFWriteSectors(
IN uint32 BCount, IN uint32 BCount,
IN BOOLEAN Direct, // Disable access to non-cached data IN BOOLEAN Direct, // Disable access to non-cached data
IN int8* Buffer, IN int8* Buffer,
OUT uint32* WrittenBytes OUT PSIZE_T WrittenBytes
) )
{ {
OSSTATUS status; OSSTATUS status;
@ -4045,7 +4045,7 @@ UDFWriteSectors(
} }
/* void* buffer; /* void* buffer;
OSSTATUS status; OSSTATUS status;
uint32 _ReadBytes; SIZE_T _ReadBytes;
(*WrittenBytes) = 0; (*WrittenBytes) = 0;
buffer = DbgAllocatePool(NonPagedPool, Vcb->WriteBlockSize); buffer = DbgAllocatePool(NonPagedPool, Vcb->WriteBlockSize);
if(!buffer) return STATUS_INSUFFICIENT_RESOURCES; if(!buffer) return STATUS_INSUFFICIENT_RESOURCES;
@ -4068,14 +4068,14 @@ UDFWriteInSector(
IN uint32 l, // transfer length IN uint32 l, // transfer length
IN BOOLEAN Direct, // Disable access to non-cached data IN BOOLEAN Direct, // Disable access to non-cached data
OUT int8* Buffer, OUT int8* Buffer,
OUT uint32* WrittenBytes OUT PSIZE_T WrittenBytes
) )
{ {
int8* tmp_buff; int8* tmp_buff;
OSSTATUS status; OSSTATUS status;
#ifdef _BROWSE_UDF_ #ifdef _BROWSE_UDF_
uint32 _WrittenBytes; SIZE_T _WrittenBytes;
uint32 ReadBytes; SIZE_T ReadBytes;
if(!Vcb->Modified) { if(!Vcb->Modified) {
UDFSetModified(Vcb); UDFSetModified(Vcb);
@ -4142,17 +4142,17 @@ UDFWriteData(
IN PVCB Vcb, IN PVCB Vcb,
IN BOOLEAN Translate, // Translate Logical to Physical IN BOOLEAN Translate, // Translate Logical to Physical
IN int64 Offset, IN int64 Offset,
IN uint32 Length, IN SIZE_T Length,
IN BOOLEAN Direct, // setting this flag delays flushing of given IN BOOLEAN Direct, // setting this flag delays flushing of given
// data to indefinite term // data to indefinite term
IN int8* Buffer, IN int8* Buffer,
OUT uint32* WrittenBytes OUT PSIZE_T WrittenBytes
) )
{ {
uint32 i, l, Lba, BS=Vcb->BlockSize; uint32 i, l, Lba, BS=Vcb->BlockSize;
uint32 BSh=Vcb->BlockSizeBits; uint32 BSh=Vcb->BlockSizeBits;
OSSTATUS status; OSSTATUS status;
uint32 _WrittenBytes; SIZE_T _WrittenBytes;
Vcb->VCBFlags |= UDF_VCB_SKIP_EJECT_CHECK; Vcb->VCBFlags |= UDF_VCB_SKIP_EJECT_CHECK;
(*WrittenBytes) = 0; (*WrittenBytes) = 0;

View file

@ -22,9 +22,9 @@ __fastcall
UDFTIOVerify( UDFTIOVerify(
IN void* _Vcb, IN void* _Vcb,
IN void* Buffer, // Target buffer IN void* Buffer, // Target buffer
IN uint32 Length, IN SIZE_T Length,
IN uint32 LBA, IN uint32 LBA,
OUT uint32* IOBytes, OUT PSIZE_T IOBytes,
IN uint32 Flags IN uint32 Flags
); );
@ -32,9 +32,9 @@ extern OSSTATUS
UDFTWriteVerify( UDFTWriteVerify(
IN void* _Vcb, IN void* _Vcb,
IN void* Buffer, // Target buffer IN void* Buffer, // Target buffer
IN uint32 Length, IN SIZE_T Length,
IN uint32 LBA, IN uint32 LBA,
OUT uint32* WrittenBytes, OUT PSIZE_T WrittenBytes,
IN uint32 Flags IN uint32 Flags
); );
@ -42,24 +42,24 @@ extern OSSTATUS
UDFTReadVerify( UDFTReadVerify(
IN void* _Vcb, IN void* _Vcb,
IN void* Buffer, // Target buffer IN void* Buffer, // Target buffer
IN uint32 Length, IN SIZE_T Length,
IN uint32 LBA, IN uint32 LBA,
OUT uint32* ReadBytes, OUT PSIZE_T ReadBytes,
IN uint32 Flags IN uint32 Flags
); );
extern OSSTATUS UDFTRead(PVOID _Vcb, extern OSSTATUS UDFTRead(PVOID _Vcb,
PVOID Buffer, // Target buffer PVOID Buffer, // Target buffer
ULONG Length, SIZE_T Length,
ULONG LBA, ULONG LBA,
PULONG ReadBytes, PSIZE_T ReadBytes,
ULONG Flags = 0); ULONG Flags = 0);
extern OSSTATUS UDFTWrite(IN PVOID _Vcb, extern OSSTATUS UDFTWrite(IN PVOID _Vcb,
IN PVOID Buffer, // Target buffer IN PVOID Buffer, // Target buffer
IN ULONG Length, IN SIZE_T Length,
IN ULONG LBA, IN ULONG LBA,
OUT PULONG WrittenBytes, OUT PSIZE_T WrittenBytes,
IN ULONG Flags = 0); IN ULONG Flags = 0);
#define PH_TMP_BUFFER 1 #define PH_TMP_BUFFER 1
@ -126,7 +126,7 @@ extern OSSTATUS UDFDoDismountSequence(IN PVCB Vcb,
#define UDFReadSectors(Vcb, Translate, Lba, BCount, Direct, Buffer, ReadBytes) \ #define UDFReadSectors(Vcb, Translate, Lba, BCount, Direct, Buffer, ReadBytes) \
(( WCacheIsInitialized__(&((Vcb)->FastCache)) && (KeGetCurrentIrql() < DISPATCH_LEVEL)) ? \ (( WCacheIsInitialized__(&((Vcb)->FastCache)) && (KeGetCurrentIrql() < DISPATCH_LEVEL)) ? \
(WCacheReadBlocks__(&((Vcb)->FastCache), Vcb, Buffer, Lba, BCount, ReadBytes, Direct)) : \ (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 // read data inside physical sector
@ -137,7 +137,7 @@ extern OSSTATUS UDFReadInSector(IN PVCB Vcb,
IN ULONG l, // transfer length IN ULONG l, // transfer length
IN BOOLEAN Direct, IN BOOLEAN Direct,
OUT PCHAR Buffer, OUT PCHAR Buffer,
OUT PULONG ReadBytes); OUT PSIZE_T ReadBytes);
// read unaligned data // read unaligned data
extern OSSTATUS UDFReadData(IN PVCB Vcb, extern OSSTATUS UDFReadData(IN PVCB Vcb,
IN BOOLEAN Translate, // Translate Logical to Physical IN BOOLEAN Translate, // Translate Logical to Physical
@ -145,7 +145,7 @@ extern OSSTATUS UDFReadData(IN PVCB Vcb,
IN ULONG Length, IN ULONG Length,
IN BOOLEAN Direct, IN BOOLEAN Direct,
OUT PCHAR Buffer, OUT PCHAR Buffer,
OUT PULONG ReadBytes); OUT PSIZE_T ReadBytes);
#ifndef UDF_READ_ONLY_BUILD #ifndef UDF_READ_ONLY_BUILD
// write physical sectors // write physical sectors
@ -156,7 +156,7 @@ OSSTATUS UDFWriteSectors(IN PVCB Vcb,
IN BOOLEAN Direct, // setting this flag delays flushing of given IN BOOLEAN Direct, // setting this flag delays flushing of given
// data to indefinite term // data to indefinite term
IN PCHAR Buffer, IN PCHAR Buffer,
OUT PULONG WrittenBytes); OUT PSIZE_T WrittenBytes);
// write directly to cached sector // write directly to cached sector
OSSTATUS UDFWriteInSector(IN PVCB Vcb, OSSTATUS UDFWriteInSector(IN PVCB Vcb,
IN BOOLEAN Translate, // Translate Logical to Physical IN BOOLEAN Translate, // Translate Logical to Physical
@ -165,16 +165,16 @@ OSSTATUS UDFWriteInSector(IN PVCB Vcb,
IN ULONG l, // transfer length IN ULONG l, // transfer length
IN BOOLEAN Direct, IN BOOLEAN Direct,
OUT PCHAR Buffer, OUT PCHAR Buffer,
OUT PULONG WrittenBytes); OUT PSIZE_T WrittenBytes);
// write data at unaligned offset & length // write data at unaligned offset & length
OSSTATUS UDFWriteData(IN PVCB Vcb, OSSTATUS UDFWriteData(IN PVCB Vcb,
IN BOOLEAN Translate, // Translate Logical to Physical IN BOOLEAN Translate, // Translate Logical to Physical
IN LONGLONG Offset, IN LONGLONG Offset,
IN ULONG Length, IN SIZE_T Length,
IN BOOLEAN Direct, // setting this flag delays flushing of given IN BOOLEAN Direct, // setting this flag delays flushing of given
// data to indefinite term // data to indefinite term
IN PCHAR Buffer, IN PCHAR Buffer,
OUT PULONG WrittenBytes); OUT PSIZE_T WrittenBytes);
#endif //UDF_READ_ONLY_BUILD #endif //UDF_READ_ONLY_BUILD
OSSTATUS UDFResetDeviceDriver(IN PVCB Vcb, OSSTATUS UDFResetDeviceDriver(IN PVCB Vcb,

View file

@ -70,7 +70,7 @@ typedef struct _W_CACHE_ASYNC {
PW_CACHE Cache; PW_CACHE Cache;
PVOID Buffer; PVOID Buffer;
PVOID Buffer2; PVOID Buffer2;
ULONG TransferredBytes; SIZE_T TransferredBytes;
ULONG BCount; ULONG BCount;
lba_t Lba; lba_t Lba;
struct _W_CACHE_ASYNC* NextWContext; struct _W_CACHE_ASYNC* NextWContext;
@ -119,7 +119,7 @@ WCacheInit__(
// simultaneously // simultaneously
IN ULONG MaxBlocks, // maximum number of Blocks to be kept in memory IN ULONG MaxBlocks, // maximum number of Blocks to be kept in memory
// simultaneously // 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) IN ULONG PacketSizeSh, // number of blocks in packet (bit shift)
// Packes size = 2^PacketSizeSh // Packes size = 2^PacketSizeSh
IN ULONG BlockSizeSh, // Block size (bit shift) IN ULONG BlockSizeSh, // Block size (bit shift)
@ -756,7 +756,7 @@ WCacheInitFrame(
//Cache->FrameList[frame].AccessCount = 0; //Cache->FrameList[frame].AccessCount = 0;
if(block_array) { if(block_array) {
ASSERT((ULONG)block_array > 0x1000); ASSERT((ULONG_PTR)block_array > 0x1000);
WCacheInsertItemToList(Cache->CachedFramesList, &(Cache->FrameCount), frame); WCacheInsertItemToList(Cache->CachedFramesList, &(Cache->FrameCount), frame);
RtlZeroMemory(block_array, l); RtlZeroMemory(block_array, l);
} else { } else {
@ -862,7 +862,7 @@ WCacheRemoveFrame(
Internal routine Internal routine
*/ */
#define WCacheSectorAddr(block_array, i) \ #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 WCacheFreeSector() releases memory block containing cached
@ -996,7 +996,7 @@ WCacheUpdatePacket(
IN ULONG BS, // Block size (bytes) IN ULONG BS, // Block size (bytes)
IN ULONG PS, // Packet size (bytes) IN ULONG PS, // Packet size (bytes)
IN ULONG PSs, // Packet size (sectors) 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 BOOLEAN PrefereWrite, // allow physical write (flush) of modified packet
IN ULONG State // callers state IN ULONG State // callers state
) )
@ -1379,7 +1379,7 @@ WCacheCheckLimitsRW(
ULONG try_count = 0; ULONG try_count = 0;
PW_CACHE_ENTRY block_array; PW_CACHE_ENTRY block_array;
OSSTATUS status; OSSTATUS status;
ULONG ReadBytes; SIZE_T ReadBytes;
ULONG FreeFrameCount = 0; ULONG FreeFrameCount = 0;
// PVOID addr; // PVOID addr;
PW_CACHE_ASYNC FirstWContext = NULL; PW_CACHE_ASYNC FirstWContext = NULL;
@ -1553,7 +1553,7 @@ WCacheFlushBlocksRAM(
ULONG BS = Cache->BlockSize; ULONG BS = Cache->BlockSize;
// ULONG PS = BS << Cache->PacketSizeSh; // packet size (bytes) // ULONG PS = BS << Cache->PacketSizeSh; // packet size (bytes)
ULONG PSs = Cache->PacketSize; ULONG PSs = Cache->PacketSize;
ULONG _WrittenBytes; SIZE_T _WrittenBytes;
OSSTATUS status = STATUS_SUCCESS; OSSTATUS status = STATUS_SUCCESS;
frame = List[firstPos] >> Cache->BlocksPerFrameSh; frame = List[firstPos] >> Cache->BlocksPerFrameSh;
@ -1864,7 +1864,7 @@ WCachePreReadPacket__(
ULONG BSh = Cache->BlockSizeSh; ULONG BSh = Cache->BlockSizeSh;
ULONG BS = Cache->BlockSize; ULONG BS = Cache->BlockSize;
PCHAR addr; PCHAR addr;
ULONG _ReadBytes; SIZE_T _ReadBytes;
ULONG PS = Cache->PacketSize; // (in blocks) ULONG PS = Cache->PacketSize; // (in blocks)
ULONG BCount = PS; ULONG BCount = PS;
ULONG i, n, err_count; ULONG i, n, err_count;
@ -2014,7 +2014,7 @@ WCacheReadBlocks__(
IN PCHAR Buffer, // user-supplied buffer for read blocks IN PCHAR Buffer, // user-supplied buffer for read blocks
IN lba_t Lba, // LBA to start read from IN lba_t Lba, // LBA to start read from
IN ULONG BCount, // number of blocks to be read 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 // recieve number of actually read bytes
IN BOOLEAN CachedOnly // specifies that cache is already locked IN BOOLEAN CachedOnly // specifies that cache is already locked
) )
@ -2024,11 +2024,11 @@ WCacheReadBlocks__(
OSSTATUS status = STATUS_SUCCESS; OSSTATUS status = STATUS_SUCCESS;
PW_CACHE_ENTRY block_array; PW_CACHE_ENTRY block_array;
ULONG BSh = Cache->BlockSizeSh; ULONG BSh = Cache->BlockSizeSh;
ULONG BS = Cache->BlockSize; SIZE_T BS = Cache->BlockSize;
PCHAR addr; PCHAR addr;
ULONG to_read, saved_to_read; ULONG to_read, saved_to_read;
// PCHAR saved_buff = Buffer; // PCHAR saved_buff = Buffer;
ULONG _ReadBytes; SIZE_T _ReadBytes;
ULONG PS = Cache->PacketSize; ULONG PS = Cache->PacketSize;
ULONG MaxR = Cache->MaxBytesToRead; ULONG MaxR = Cache->MaxBytesToRead;
ULONG PacketMask = PS-1; // here we assume that Packet Size value is 2^n 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 PCHAR Buffer, // user-supplied buffer containing data to be written
IN lba_t Lba, // LBA to start write from IN lba_t Lba, // LBA to start write from
IN ULONG BCount, // number of blocks to be written 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 // recieve number of actually written bytes
IN BOOLEAN CachedOnly // specifies that cache is already locked IN BOOLEAN CachedOnly // specifies that cache is already locked
) )
@ -2296,7 +2296,7 @@ WCacheWriteBlocks__(
ULONG BS = Cache->BlockSize; ULONG BS = Cache->BlockSize;
PCHAR addr; PCHAR addr;
// PCHAR saved_buff = Buffer; // PCHAR saved_buff = Buffer;
ULONG _WrittenBytes; SIZE_T _WrittenBytes;
ULONG PS = Cache->PacketSize; ULONG PS = Cache->PacketSize;
ULONG PacketMask = PS-1; // here we assume that Packet Size value is 2^n ULONG PacketMask = PS-1; // here we assume that Packet Size value is 2^n
ULONG block_type; ULONG block_type;
@ -2634,7 +2634,7 @@ WCachePurgeAllRW(
ULONG PSs = Cache->PacketSize; ULONG PSs = Cache->PacketSize;
PW_CACHE_ENTRY block_array; PW_CACHE_ENTRY block_array;
// OSSTATUS status; // OSSTATUS status;
ULONG ReadBytes; SIZE_T ReadBytes;
PW_CACHE_ASYNC FirstWContext = NULL; PW_CACHE_ASYNC FirstWContext = NULL;
PW_CACHE_ASYNC PrevWContext = NULL; PW_CACHE_ASYNC PrevWContext = NULL;
ULONG chain_count = 0; ULONG chain_count = 0;
@ -2702,7 +2702,7 @@ WCacheFlushAllRW(
ULONG BFs = Cache->BlocksPerFrameSh; ULONG BFs = Cache->BlocksPerFrameSh;
PW_CACHE_ENTRY block_array; PW_CACHE_ENTRY block_array;
// OSSTATUS status; // OSSTATUS status;
ULONG ReadBytes; SIZE_T ReadBytes;
PW_CACHE_ASYNC FirstWContext = NULL; PW_CACHE_ASYNC FirstWContext = NULL;
PW_CACHE_ASYNC PrevWContext = NULL; PW_CACHE_ASYNC PrevWContext = NULL;
ULONG i; ULONG i;
@ -2841,7 +2841,7 @@ WCacheFlushBlocksRW(
ULONG BFs = Cache->BlocksPerFrameSh; ULONG BFs = Cache->BlocksPerFrameSh;
PW_CACHE_ENTRY block_array; PW_CACHE_ENTRY block_array;
// OSSTATUS status; // OSSTATUS status;
ULONG ReadBytes; SIZE_T ReadBytes;
PW_CACHE_ASYNC FirstWContext = NULL; PW_CACHE_ASYNC FirstWContext = NULL;
PW_CACHE_ASYNC PrevWContext = NULL; PW_CACHE_ASYNC PrevWContext = NULL;
ULONG i; ULONG i;
@ -2960,7 +2960,7 @@ WCacheDirect__(
PW_CACHE_ENTRY block_array; PW_CACHE_ENTRY block_array;
ULONG BS = Cache->BlockSize; ULONG BS = Cache->BlockSize;
PCHAR addr; PCHAR addr;
ULONG _ReadBytes; SIZE_T _ReadBytes;
ULONG block_type; ULONG block_type;
WcPrint(("WC:%sD %x (1)\n", Modified ? "W" : "R", Lba)); WcPrint(("WC:%sD %x (1)\n", Modified ? "W" : "R", Lba));
@ -3206,7 +3206,7 @@ WCacheCheckLimitsR(
PW_CACHE_ENTRY block_array; PW_CACHE_ENTRY block_array;
BOOLEAN mod; BOOLEAN mod;
OSSTATUS status; OSSTATUS status;
ULONG ReadBytes; SIZE_T ReadBytes;
ULONG MaxReloc = Cache->PacketSize; ULONG MaxReloc = Cache->PacketSize;
PULONG reloc_tab = Cache->reloc_tab; PULONG reloc_tab = Cache->reloc_tab;
@ -3324,7 +3324,7 @@ WCachePurgeAllR(
PW_CACHE_ENTRY block_array; PW_CACHE_ENTRY block_array;
BOOLEAN mod; BOOLEAN mod;
OSSTATUS status; OSSTATUS status;
ULONG ReadBytes; SIZE_T ReadBytes;
ULONG MaxReloc = Cache->PacketSize; ULONG MaxReloc = Cache->PacketSize;
PULONG reloc_tab = Cache->reloc_tab; PULONG reloc_tab = Cache->reloc_tab;
ULONG RelocCount = 0; ULONG RelocCount = 0;

View file

@ -21,32 +21,32 @@ extern "C" {
typedef OSSTATUS (*PWRITE_BLOCK) (IN PVOID Context, typedef OSSTATUS (*PWRITE_BLOCK) (IN PVOID Context,
IN PVOID Buffer, // Target buffer IN PVOID Buffer, // Target buffer
IN ULONG Length, IN SIZE_T Length,
IN lba_t Lba, IN lba_t Lba,
OUT PULONG WrittenBytes, OUT PSIZE_T WrittenBytes,
IN uint32 Flags); IN uint32 Flags);
typedef OSSTATUS (*PREAD_BLOCK) (IN PVOID Context, typedef OSSTATUS (*PREAD_BLOCK) (IN PVOID Context,
IN PVOID Buffer, // Target buffer IN PVOID Buffer, // Target buffer
IN ULONG Length, IN SIZE_T Length,
IN lba_t Lba, IN lba_t Lba,
OUT PULONG ReadBytes, OUT PSIZE_T ReadBytes,
IN uint32 Flags); IN uint32 Flags);
typedef OSSTATUS (*PWRITE_BLOCK_ASYNC) (IN PVOID Context, typedef OSSTATUS (*PWRITE_BLOCK_ASYNC) (IN PVOID Context,
IN PVOID WContext, IN PVOID WContext,
IN PVOID Buffer, // Target buffer IN PVOID Buffer, // Target buffer
IN ULONG Length, IN SIZE_T Length,
IN lba_t Lba, IN lba_t Lba,
OUT PULONG WrittenBytes, OUT PSIZE_T WrittenBytes,
IN BOOLEAN FreeBuffer); IN BOOLEAN FreeBuffer);
typedef OSSTATUS (*PREAD_BLOCK_ASYNC) (IN PVOID Context, typedef OSSTATUS (*PREAD_BLOCK_ASYNC) (IN PVOID Context,
IN PVOID WContext, IN PVOID WContext,
IN PVOID Buffer, // Source buffer IN PVOID Buffer, // Source buffer
IN ULONG Length, IN SIZE_T Length,
IN lba_t Lba, IN lba_t Lba,
OUT PULONG ReadBytes); OUT PSIZE_T ReadBytes);
/*typedef BOOLEAN (*PCHECK_BLOCK) (IN PVOID Context, /*typedef BOOLEAN (*PCHECK_BLOCK) (IN PVOID Context,
IN lba_t Lba);*/ IN lba_t Lba);*/
@ -208,7 +208,7 @@ typedef struct _W_CACHE {
OSSTATUS WCacheInit__(IN PW_CACHE Cache, OSSTATUS WCacheInit__(IN PW_CACHE Cache,
IN ULONG MaxFrames, IN ULONG MaxFrames,
IN ULONG MaxBlocks, IN ULONG MaxBlocks,
IN ULONG MaxBytesToRead, IN SIZE_T MaxBytesToRead,
IN ULONG PacketSizeSh, // number of blocks in packet (bit shift) IN ULONG PacketSizeSh, // number of blocks in packet (bit shift)
IN ULONG BlockSizeSh, // bit shift IN ULONG BlockSizeSh, // bit shift
IN ULONG BlocksPerFrameSh,// bit shift IN ULONG BlocksPerFrameSh,// bit shift
@ -230,7 +230,7 @@ OSSTATUS WCacheWriteBlocks__(IN PW_CACHE Cache,
IN PCHAR Buffer, IN PCHAR Buffer,
IN lba_t Lba, IN lba_t Lba,
IN ULONG BCount, IN ULONG BCount,
OUT PULONG WrittenBytes, OUT PSIZE_T WrittenBytes,
IN BOOLEAN CachedOnly); IN BOOLEAN CachedOnly);
// read cached // read cached
OSSTATUS WCacheReadBlocks__(IN PW_CACHE Cache, OSSTATUS WCacheReadBlocks__(IN PW_CACHE Cache,
@ -238,7 +238,7 @@ OSSTATUS WCacheReadBlocks__(IN PW_CACHE Cache,
IN PCHAR Buffer, IN PCHAR Buffer,
IN lba_t Lba, IN lba_t Lba,
IN ULONG BCount, IN ULONG BCount,
OUT PULONG ReadBytes, OUT PSIZE_T ReadBytes,
IN BOOLEAN CachedOnly); IN BOOLEAN CachedOnly);
// flush blocks // flush blocks
OSSTATUS WCacheFlushBlocks__(IN PW_CACHE Cache, OSSTATUS WCacheFlushBlocks__(IN PW_CACHE Cache,

View file

@ -1007,7 +1007,7 @@ UDFCloseAllXXXDelayedInDir(
if(CurFileInfo && if(CurFileInfo &&
(Fcb = CurFileInfo->Fcb)) { (Fcb = CurFileInfo->Fcb)) {
NtReqFcb = Fcb->NTRequiredFCB; NtReqFcb = Fcb->NTRequiredFCB;
ASSERT((ULONG)NtReqFcb > 0x1000); ASSERT((ULONG_PTR)NtReqFcb > 0x1000);
// ASSERT((ULONG)(NtReqFcb->SectionObject) > 0x1000); // ASSERT((ULONG)(NtReqFcb->SectionObject) > 0x1000);
if(!(NtReqFcb->NtReqFCBFlags & UDF_NTREQ_FCB_DELETED) && if(!(NtReqFcb->NtReqFCBFlags & UDF_NTREQ_FCB_DELETED) &&
(NtReqFcb->NtReqFCBFlags & UDF_NTREQ_FCB_MODIFIED)) { (NtReqFcb->NtReqFCBFlags & UDF_NTREQ_FCB_MODIFIED)) {

View file

@ -1116,7 +1116,7 @@ op_vol_accs_dnd:
// get next path part... // get next path part...
TmpBuffer = TailName.Buffer; TmpBuffer = TailName.Buffer;
TailName.Buffer = UDFDissectName(TailName.Buffer,&(CurName.Length) ); 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.Buffer = TailName.Buffer - CurName.Length;
CurName.Length *= sizeof(WCHAR); CurName.Length *= sizeof(WCHAR);
CurName.MaximumLength = CurName.Length + sizeof(WCHAR); CurName.MaximumLength = CurName.Length + sizeof(WCHAR);

View file

@ -130,9 +130,9 @@ NTAPI
UDFPhReadSynchronous( UDFPhReadSynchronous(
PDEVICE_OBJECT DeviceObject, // the physical device object PDEVICE_OBJECT DeviceObject, // the physical device object
PVOID Buffer, PVOID Buffer,
ULONG Length, SIZE_T Length,
LONGLONG Offset, LONGLONG Offset,
PULONG ReadBytes, PSIZE_T ReadBytes,
ULONG Flags ULONG Flags
) )
{ {
@ -276,9 +276,9 @@ NTAPI
UDFPhWriteSynchronous( UDFPhWriteSynchronous(
PDEVICE_OBJECT DeviceObject, // the physical device object PDEVICE_OBJECT DeviceObject, // the physical device object
PVOID Buffer, PVOID Buffer,
ULONG Length, SIZE_T Length,
LONGLONG Offset, LONGLONG Offset,
PULONG WrittenBytes, PSIZE_T WrittenBytes,
ULONG Flags ULONG Flags
) )
{ {
@ -422,9 +422,9 @@ NTSTATUS
UDFPhWriteVerifySynchronous( UDFPhWriteVerifySynchronous(
PDEVICE_OBJECT DeviceObject, // the physical device object PDEVICE_OBJECT DeviceObject, // the physical device object
PVOID Buffer, PVOID Buffer,
ULONG Length, SIZE_T Length,
LONGLONG Offset, LONGLONG Offset,
PULONG WrittenBytes, PSIZE_T WrittenBytes,
ULONG Flags ULONG Flags
) )
{ {

View file

@ -22,25 +22,25 @@
extern NTSTATUS NTAPI UDFPhReadSynchronous( extern NTSTATUS NTAPI UDFPhReadSynchronous(
PDEVICE_OBJECT DeviceObject, PDEVICE_OBJECT DeviceObject,
PVOID Buffer, PVOID Buffer,
ULONG Length, SIZE_T Length,
LONGLONG Offset, LONGLONG Offset,
PULONG ReadBytes, PSIZE_T ReadBytes,
ULONG Flags); ULONG Flags);
extern NTSTATUS NTAPI UDFPhWriteSynchronous( extern NTSTATUS NTAPI UDFPhWriteSynchronous(
PDEVICE_OBJECT DeviceObject, // the physical device object PDEVICE_OBJECT DeviceObject, // the physical device object
PVOID Buffer, PVOID Buffer,
ULONG Length, SIZE_T Length,
LONGLONG Offset, LONGLONG Offset,
PULONG WrittenBytes, PSIZE_T WrittenBytes,
ULONG Flags); ULONG Flags);
/* /*
extern NTSTATUS UDFPhWriteVerifySynchronous( extern NTSTATUS UDFPhWriteVerifySynchronous(
PDEVICE_OBJECT DeviceObject, // the physical device object PDEVICE_OBJECT DeviceObject, // the physical device object
PVOID Buffer, PVOID Buffer,
ULONG Length, SIZE_T Length,
LONGLONG Offset, LONGLONG Offset,
PULONG WrittenBytes, PSIZE_T WrittenBytes,
ULONG Flags); ULONG Flags);
*/ */
#define UDFPhWriteVerifySynchronous UDFPhWriteSynchronous #define UDFPhWriteVerifySynchronous UDFPhWriteSynchronous
@ -122,7 +122,7 @@ __inline VOID UDFNotifyFullReportChange(
} }
#define CollectStatisticsEx(VCB, Field, a) { \ #define CollectStatisticsEx(VCB, Field, a) { \
((VCB)->Statistics[KeGetCurrentProcessorNumber()].Common.##Field) += a; \ ((VCB)->Statistics[KeGetCurrentProcessorNumber()].Common.##Field) += (ULONG)a; \
} }
#define CollectStatistics2(VCB, Field) { \ #define CollectStatistics2(VCB, Field) { \
@ -149,7 +149,7 @@ NTSTATUS NTAPI UDFSyncCompletionRoutine2(IN PDEVICE_OBJECT DeviceObject,
#define OSGetCurrentThread() PsGetCurrentThread() #define OSGetCurrentThread() PsGetCurrentThread()
#define GetCurrentPID() ((ULONG)PsGetCurrentProcessId()) #define GetCurrentPID() HandleToUlong(PsGetCurrentProcessId())
#endif // _UDF_ENV_SPEC_H_ #endif // _UDF_ENV_SPEC_H_

View file

@ -440,7 +440,7 @@ BOOLEAN NTAPI UDFAcqLazyWrite(
// Now, set the lazy-writer thread id. // Now, set the lazy-writer thread id.
ASSERT(!(NtReqFcb->LazyWriterThreadID)); ASSERT(!(NtReqFcb->LazyWriterThreadID));
NtReqFcb->LazyWriterThreadID = (unsigned int)(PsGetCurrentThread()); NtReqFcb->LazyWriterThreadID = HandleToUlong(PsGetCurrentThreadId());
ASSERT(IoGetTopLevelIrp() == NULL); ASSERT(IoGetTopLevelIrp() == NULL);
IoSetTopLevelIrp((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP); IoSetTopLevelIrp((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
@ -481,7 +481,7 @@ UDFRelLazyWrite(
// Remove the current thread-id from the NT_REQ_FCB // Remove the current thread-id from the NT_REQ_FCB
// and release the MainResource. // and release the MainResource.
ASSERT((NtReqFcb->LazyWriterThreadID) == (unsigned int)PsGetCurrentThread()); ASSERT((NtReqFcb->LazyWriterThreadID) == HandleToUlong(PsGetCurrentThreadId()));
NtReqFcb->LazyWriterThreadID = 0; NtReqFcb->LazyWriterThreadID = 0;
// Release the acquired resource. // Release the acquired resource.

View file

@ -137,7 +137,7 @@ UDFCommonFileInfo(
TmPrint(("UDFCommonFileInfo: irp %x\n", Irp)); TmPrint(("UDFCommonFileInfo: irp %x\n", Irp));
TopIrp = IoGetTopLevelIrp(); TopIrp = IoGetTopLevelIrp();
switch((ULONG)TopIrp) { switch((ULONG_PTR)TopIrp) {
case FSRTL_FSP_TOP_LEVEL_IRP: case FSRTL_FSP_TOP_LEVEL_IRP:
UDFPrint((" FSRTL_FSP_TOP_LEVEL_IRP\n")); UDFPrint((" FSRTL_FSP_TOP_LEVEL_IRP\n"));
break; break;

View file

@ -1111,7 +1111,7 @@ unwind_3:
if(NT_SUCCESS(RC)) { if(NT_SUCCESS(RC)) {
int8* buff; int8* buff;
uint32 len; SIZE_T len;
PUDF_FILE_INFO CfgFileInfo = NULL; PUDF_FILE_INFO CfgFileInfo = NULL;
RC = UDFOpenFile__(Vcb, FALSE, TRUE, &LocalPath, RootFcb->FileInfo, &CfgFileInfo, NULL); RC = UDFOpenFile__(Vcb, FALSE, TRUE, &LocalPath, RootFcb->FileInfo, &CfgFileInfo, NULL);
@ -1686,7 +1686,7 @@ UDFIsPathnameValid(
// get next path part... // get next path part...
TmpBuffer = PathName.Buffer; TmpBuffer = PathName.Buffer;
PathName.Buffer = UDFDissectName(PathName.Buffer,&(CurName.Length) ); 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.Buffer = PathName.Buffer - CurName.Length;
CurName.Length *= sizeof(WCHAR); CurName.Length *= sizeof(WCHAR);
CurName.MaximumLength -= CurName.Length; CurName.MaximumLength -= CurName.Length;

View file

@ -784,7 +784,7 @@ extern OSSTATUS UDFDoDismountSequence(IN PVCB Vcb,
#define UDFReadSectors(Vcb, Translate, Lba, BCount, Direct, Buffer, ReadBytes) \ #define UDFReadSectors(Vcb, Translate, Lba, BCount, Direct, Buffer, ReadBytes) \
(( WCacheIsInitialized__(&((Vcb)->FastCache)) && (KeGetCurrentIrql() < DISPATCH_LEVEL)) ? \ (( WCacheIsInitialized__(&((Vcb)->FastCache)) && (KeGetCurrentIrql() < DISPATCH_LEVEL)) ? \
(WCacheReadBlocks__(&((Vcb)->FastCache), Vcb, Buffer, Lba, BCount, ReadBytes, Direct)) : \ (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 // read data inside physical sector

View file

@ -235,7 +235,7 @@ UDFCommonRead(
PIO_STACK_LOCATION IrpSp = NULL; PIO_STACK_LOCATION IrpSp = NULL;
LARGE_INTEGER ByteOffset; LARGE_INTEGER ByteOffset;
ULONG ReadLength = 0, TruncatedLength = 0; ULONG ReadLength = 0, TruncatedLength = 0;
ULONG NumberBytesRead = 0; SIZE_T NumberBytesRead = 0;
PFILE_OBJECT FileObject = NULL; PFILE_OBJECT FileObject = NULL;
PtrUDFFCB Fcb = NULL; PtrUDFFCB Fcb = NULL;
PtrUDFCCB Ccb = NULL; PtrUDFCCB Ccb = NULL;
@ -262,7 +262,7 @@ UDFCommonRead(
_SEH2_TRY { _SEH2_TRY {
TopIrp = IoGetTopLevelIrp(); TopIrp = IoGetTopLevelIrp();
switch((ULONG)TopIrp) { switch((ULONG_PTR)TopIrp) {
case FSRTL_FSP_TOP_LEVEL_IRP: case FSRTL_FSP_TOP_LEVEL_IRP:
UDFPrint((" FSRTL_FSP_TOP_LEVEL_IRP\n")); UDFPrint((" FSRTL_FSP_TOP_LEVEL_IRP\n"));
break; break;
@ -684,11 +684,11 @@ UDFCommonRead(
MmPrint((" Read NonBufferedIo\n")); MmPrint((" Read NonBufferedIo\n"));
#if 1 #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")); UDFPrint(("FSRTL_MOD_WRITE_TOP_LEVEL_IRP => CanWait\n"));
CanWait = TRUE; CanWait = TRUE;
} else } 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")); UDFPrint(("FSRTL_CACHE_TOP_LEVEL_IRP => CanWait\n"));
CanWait = TRUE; CanWait = TRUE;
} }

View file

@ -324,12 +324,12 @@ EO_gpl:
#if defined (_X86_) && defined (_MSC_VER) #if defined (_X86_) && defined (_MSC_VER)
__declspec (naked) __declspec (naked)
uint32 SIZE_T
__stdcall __stdcall
UDFGetBitmapLen( UDFGetBitmapLen(
uint32* Bitmap, uint32* Bitmap,
uint32 Offs, SIZE_T Offs,
uint32 Lim // NOT included SIZE_T Lim // NOT included
) )
{ {
_asm { _asm {
@ -491,12 +491,12 @@ exit_count:
#else // NO X86 optimization , use generic C/C++ #else // NO X86 optimization , use generic C/C++
uint32 SIZE_T
__stdcall __stdcall
UDFGetBitmapLen( UDFGetBitmapLen(
uint32* Bitmap, uint32* Bitmap,
uint32 Offs, SIZE_T Offs,
uint32 Lim // NOT included SIZE_T Lim // NOT included
) )
{ {
ASSERT(Offs <= Lim); ASSERT(Offs <= Lim);
@ -505,8 +505,8 @@ UDFGetBitmapLen(
} }
BOOLEAN bit = UDFGetBit(Bitmap, Offs); BOOLEAN bit = UDFGetBit(Bitmap, Offs);
uint32 i=Offs>>5; SIZE_T i=Offs>>5;
uint32 len=0; SIZE_T len=0;
uint8 j=(uint8)(Offs&31); uint8 j=(uint8)(Offs&31);
uint8 lLim=(uint8)(Lim&31); uint8 lLim=(uint8)(Lim&31);
@ -552,7 +552,7 @@ While_3:
This routine scans disc free space Bitmap for minimal suitable extent. This routine scans disc free space Bitmap for minimal suitable extent.
It returns maximal available extent if no long enough extents found. It returns maximal available extent if no long enough extents found.
*/ */
uint32 SIZE_T
UDFFindMinSuitableExtent( UDFFindMinSuitableExtent(
IN PVCB Vcb, IN PVCB Vcb,
IN uint32 Length, // in blocks IN uint32 Length, // in blocks
@ -562,14 +562,14 @@ UDFFindMinSuitableExtent(
IN uint8 AllocFlags IN uint8 AllocFlags
) )
{ {
uint32 i, len; SIZE_T i, len;
uint32* cur; uint32* cur;
uint32 best_lba=0; SIZE_T best_lba=0;
uint32 best_len=0; SIZE_T best_len=0;
uint32 max_lba=0; SIZE_T max_lba=0;
uint32 max_len=0; SIZE_T max_len=0;
BOOLEAN align = FALSE; BOOLEAN align = FALSE;
uint32 PS = Vcb->WriteBlockSize >> Vcb->BlockSizeBits; SIZE_T PS = Vcb->WriteBlockSize >> Vcb->BlockSizeBits;
UDF_CHECK_BITMAP_RESOURCE(Vcb); UDF_CHECK_BITMAP_RESOURCE(Vcb);

View file

@ -519,7 +519,7 @@ UDFIndexDirectory(
int8* buff; int8* buff;
PEXTENT_INFO ExtInfo; // Extent array for directory PEXTENT_INFO ExtInfo; // Extent array for directory
uint16 PartNum; uint16 PartNum;
uint32 ReadBytes; SIZE_T ReadBytes;
uint16 valueCRC; uint16 valueCRC;
if(!FileInfo) return STATUS_INVALID_PARAMETER; if(!FileInfo) return STATUS_INVALID_PARAMETER;
@ -753,7 +753,7 @@ UDFPackDirectory__(
uint32 Offset, curOffset; uint32 Offset, curOffset;
int8* Buf; int8* Buf;
OSSTATUS status; OSSTATUS status;
uint32 ReadBytes; SIZE_T ReadBytes;
int8* storedFI; int8* storedFI;
PUDF_FILE_INFO curFileInfo; PUDF_FILE_INFO curFileInfo;
PDIR_INDEX_ITEM DirNdx, DirNdx2; PDIR_INDEX_ITEM DirNdx, DirNdx2;
@ -901,7 +901,7 @@ UDFReTagDirectory(
uint32 Offset; uint32 Offset;
int8* Buf; int8* Buf;
OSSTATUS status; OSSTATUS status;
uint32 ReadBytes; SIZE_T ReadBytes;
PUDF_FILE_INFO curFileInfo; PUDF_FILE_INFO curFileInfo;
PDIR_INDEX_ITEM DirNdx; PDIR_INDEX_ITEM DirNdx;
UDF_DIR_SCAN_CONTEXT ScanContext; UDF_DIR_SCAN_CONTEXT ScanContext;

View file

@ -30,7 +30,7 @@ UDFExtentOffsetToLba(
IN PEXTENT_MAP Extent, // Extent array IN PEXTENT_MAP Extent, // Extent array
IN int64 Offset, // offset in extent IN int64 Offset, // offset in extent
OUT uint32* SectorOffset, 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* Flags,
OUT uint32* Index OUT uint32* Index
) )
@ -79,7 +79,7 @@ uint32
UDFNextExtentToLba( UDFNextExtentToLba(
IN PVCB Vcb, IN PVCB Vcb,
IN PEXTENT_MAP Extent, // Extent array 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* Flags,
OUT uint32* Index OUT uint32* Index
) )
@ -306,7 +306,7 @@ UDFShortAllocDescToMapping(
EXTENT_AD AllocExt; EXTENT_AD AllocExt;
PALLOC_EXT_DESC NextAllocDesc; PALLOC_EXT_DESC NextAllocDesc;
lb_addr locAddr; lb_addr locAddr;
uint32 ReadBytes; SIZE_T ReadBytes;
EXTENT_INFO NextAllocLoc; EXTENT_INFO NextAllocLoc;
BOOLEAN w2k_compat = FALSE; BOOLEAN w2k_compat = FALSE;
@ -467,7 +467,7 @@ UDFLongAllocDescToMapping(
PEXTENT_MAP Extent, Extent2, AllocMap; PEXTENT_MAP Extent, Extent2, AllocMap;
EXTENT_AD AllocExt; EXTENT_AD AllocExt;
PALLOC_EXT_DESC NextAllocDesc; PALLOC_EXT_DESC NextAllocDesc;
uint32 ReadBytes; SIZE_T ReadBytes;
EXTENT_INFO NextAllocLoc; EXTENT_INFO NextAllocLoc;
ExtPrint(("UDFLongAllocDescToMapping: len=%x\n", AllocDescLength)); ExtPrint(("UDFLongAllocDescToMapping: len=%x\n", AllocDescLength));
@ -605,7 +605,7 @@ UDFExtAllocDescToMapping(
PEXTENT_MAP Extent, Extent2, AllocMap; PEXTENT_MAP Extent, Extent2, AllocMap;
EXTENT_AD AllocExt; EXTENT_AD AllocExt;
PALLOC_EXT_DESC NextAllocDesc; PALLOC_EXT_DESC NextAllocDesc;
uint32 ReadBytes; SIZE_T ReadBytes;
EXTENT_INFO NextAllocLoc; EXTENT_INFO NextAllocLoc;
ExtPrint(("UDFExtAllocDescToMapping: len=%x\n", AllocDescLength)); ExtPrint(("UDFExtAllocDescToMapping: len=%x\n", AllocDescLength));
@ -799,7 +799,7 @@ UDFReadMappingFromXEntry(
} }
default : { // case ICB_FLAG_AD_IN_ICB default : { // case ICB_FLAG_AD_IN_ICB
Extent = NULL; Extent = NULL;
*Offset = (uint32)AllocDescs - (uint32)XEntry; *Offset = (uintptr_t)AllocDescs - (uintptr_t)XEntry;
AllocLoc->Offset=0; AllocLoc->Offset=0;
AllocLoc->Length=0; AllocLoc->Length=0;
if(AllocLoc->Mapping) MyFreePool__(AllocLoc->Mapping); if(AllocLoc->Mapping) MyFreePool__(AllocLoc->Mapping);
@ -1959,8 +1959,8 @@ UDFMarkNotAllocatedAsAllocated(
uint32 BSh = Vcb->BlockSizeBits; uint32 BSh = Vcb->BlockSizeBits;
OSSTATUS status; OSSTATUS status;
EXTENT_INFO TmpExtInf; EXTENT_INFO TmpExtInf;
uint32 aLen, sLen; SIZE_T aLen, sLen;
uint32 LBS = Vcb->LBlockSize; SIZE_T LBS = Vcb->LBlockSize;
// I don't know what else comment can be added here. // I don't know what else comment can be added here.
// Just belive that it works // Just belive that it works
/*lba = */ /*lba = */
@ -2112,7 +2112,7 @@ UDFMarkAllocatedAsNotXXX(
uint32 target_flags = Deallocate ? uint32 target_flags = Deallocate ?
EXTENT_NOT_RECORDED_NOT_ALLOCATED : EXTENT_NOT_RECORDED_NOT_ALLOCATED :
EXTENT_NOT_RECORDED_ALLOCATED; EXTENT_NOT_RECORDED_ALLOCATED;
uint32 LBS = Vcb->LBlockSize; SIZE_T LBS = Vcb->LBlockSize;
EXTENT_MAP DeadMapping[2]; EXTENT_MAP DeadMapping[2];
// I don't know what else comment can be added here. // I don't know what else comment can be added here.
// Just belive that it works // Just belive that it works
@ -2237,13 +2237,15 @@ UDFResizeExtent(
OUT PEXTENT_INFO ExtInfo OUT PEXTENT_INFO ExtInfo
) )
{ {
uint32 i, flags, lba, lim; uint32 i, flags, lba;
SIZE_T lim;
int64 l; int64 l;
OSSTATUS status; OSSTATUS status;
EXTENT_INFO TmpExtInf; EXTENT_INFO TmpExtInf;
EXTENT_MAP TmpMapping[2]; EXTENT_MAP TmpMapping[2];
uint32 s, req_s, pe, BSh, LBS, PS; uint32 s, pe, BSh, PS;
LBS = Vcb->LBlockSize; SIZE_T req_s;
SIZE_T LBS = Vcb->LBlockSize;
BSh = Vcb->BlockSizeBits; BSh = Vcb->BlockSizeBits;
PS = Vcb->WriteBlockSize >> Vcb->BlockSizeBits; PS = Vcb->WriteBlockSize >> Vcb->BlockSizeBits;
uint32 MaxGrow = (UDF_MAX_EXTENT_LENGTH & ~(LBS-1)); uint32 MaxGrow = (UDF_MAX_EXTENT_LENGTH & ~(LBS-1));
@ -2920,7 +2922,8 @@ UDFIsExtentCached(
{ {
BOOLEAN retstat = FALSE; BOOLEAN retstat = FALSE;
PEXTENT_MAP Extent = ExtInfo->Mapping; // Extent array 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*/); WCacheStartDirect__(&(Vcb->FastCache), Vcb, TRUE/*FALSE*//*ForWrite*/);
if(!ExtInfo || !ExtInfo->Mapping) goto EO_IsCached; if(!ExtInfo || !ExtInfo->Mapping) goto EO_IsCached;
@ -2969,14 +2972,15 @@ UDFReadExtentCached(
IN int64 Offset, // offset in extent IN int64 Offset, // offset in extent
IN uint32 Length, IN uint32 Length,
OUT int8* Buffer, OUT int8* Buffer,
OUT uint32* ReadBytes OUT PSIZE_T ReadBytes
) )
{ {
(*ReadBytes) = 0; (*ReadBytes) = 0;
if(!ExtInfo || !ExtInfo->Mapping) return STATUS_INVALID_PARAMETER; if(!ExtInfo || !ExtInfo->Mapping) return STATUS_INVALID_PARAMETER;
PEXTENT_MAP Extent = ExtInfo->Mapping; // Extent array 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; OSSTATUS status;
// prevent reading out of data space // prevent reading out of data space
if(Offset > ExtInfo->Length) return STATUS_END_OF_FILE; if(Offset > ExtInfo->Length) return STATUS_END_OF_FILE;
@ -3015,27 +3019,30 @@ UDFReadExtent(
IN PVCB Vcb, IN PVCB Vcb,
IN PEXTENT_INFO ExtInfo, // Extent array IN PEXTENT_INFO ExtInfo, // Extent array
IN int64 Offset, // offset in extent IN int64 Offset, // offset in extent
IN uint32 Length, IN SIZE_T Length,
IN BOOLEAN Direct, IN BOOLEAN Direct,
OUT int8* Buffer, OUT int8* Buffer,
OUT uint32* ReadBytes OUT PSIZE_T ReadBytes
) )
{ {
(*ReadBytes) = 0; (*ReadBytes) = 0;
if(!ExtInfo || !ExtInfo->Mapping) return STATUS_INVALID_PARAMETER; 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)); AdPrint(("Read ExtInfo %x, Mapping %x\n", ExtInfo, ExtInfo->Mapping));
PEXTENT_MAP Extent = ExtInfo->Mapping; // Extent array 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; OSSTATUS status;
// prevent reading out of data space // prevent reading out of data space
if(Offset > ExtInfo->Length) return STATUS_END_OF_FILE; if(Offset > ExtInfo->Length) return STATUS_END_OF_FILE;
if(Offset+Length > ExtInfo->Length) Length = (uint32)(ExtInfo->Length - Offset); if(Offset+Length > ExtInfo->Length) Length = (uint32)(ExtInfo->Length - Offset);
Offset += ExtInfo->Offset; // used for in-ICB data Offset += ExtInfo->Offset; // used for in-ICB data
// read maximal possible part of each frag of extent // 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) { while(Length) {
// EOF check // EOF check
if(Lba == LBA_OUT_OF_EXTENT) return STATUS_END_OF_FILE; if(Lba == LBA_OUT_OF_EXTENT) return STATUS_END_OF_FILE;
@ -3057,7 +3064,8 @@ UDFReadExtent(
ASSERT(to_read); ASSERT(to_read);
Buffer += to_read; Buffer += to_read;
// Offset += 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; sect_offs = 0;
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
@ -3084,7 +3092,8 @@ UDFReadExtentLocation(
PEXTENT_MAP Extent = ExtInfo->Mapping; // Extent array PEXTENT_MAP Extent = ExtInfo->Mapping; // Extent array
PEXTENT_MAP SubExtInfo; 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; int32 SubExtInfoSz = *_SubExtInfoSz;
int64 Length; int64 Length;
int64 NextOffset; int64 NextOffset;
@ -3175,20 +3184,20 @@ UDFWriteExtent(
IN PVCB Vcb, IN PVCB Vcb,
IN PEXTENT_INFO ExtInfo, // Extent array IN PEXTENT_INFO ExtInfo, // Extent array
IN int64 Offset, // offset in extent IN int64 Offset, // offset in extent
IN uint32 Length, IN SIZE_T Length,
IN BOOLEAN Direct, // setting this flag delays flushing of given IN BOOLEAN Direct, // setting this flag delays flushing of given
// data to indefinite term // data to indefinite term
IN int8* Buffer, IN int8* Buffer,
OUT uint32* WrittenBytes OUT PSIZE_T WrittenBytes
) )
{ {
if(!ExtInfo || !ExtInfo->Mapping) if(!ExtInfo || !ExtInfo->Mapping)
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
PEXTENT_MAP Extent = ExtInfo->Mapping; // Extent array PEXTENT_MAP Extent = ExtInfo->Mapping; // Extent array
uint32 to_write, Lba, sect_offs, flags; uint32 Lba, sect_offs, flags;
OSSTATUS status; OSSTATUS status;
uint32 _WrittenBytes; SIZE_T to_write, _WrittenBytes;
BOOLEAN reread_lba; BOOLEAN reread_lba;
// BOOLEAN already_prepared = FALSE; // BOOLEAN already_prepared = FALSE;
// BOOLEAN prepare = !Buffer; // BOOLEAN prepare = !Buffer;
@ -3326,21 +3335,21 @@ UDFZeroExtent(
IN PVCB Vcb, IN PVCB Vcb,
IN PEXTENT_INFO ExtInfo, // Extent array IN PEXTENT_INFO ExtInfo, // Extent array
IN int64 Offset, // offset in extent 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 Deallocate, // deallocate frag or just mark as unrecorded
IN BOOLEAN Direct, // setting this flag delays flushing of given IN BOOLEAN Direct, // setting this flag delays flushing of given
// data to indefinite term // data to indefinite term
OUT uint32* WrittenBytes OUT PSIZE_T WrittenBytes
) )
{ {
if(!ExtInfo || !ExtInfo->Mapping) if(!ExtInfo || !ExtInfo->Mapping)
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
PEXTENT_MAP Extent = ExtInfo->Mapping; // Extent array PEXTENT_MAP Extent = ExtInfo->Mapping; // Extent array
uint32 to_write, Lba, sect_offs, flags; uint32 Lba, sect_offs, flags;
OSSTATUS status; OSSTATUS status;
uint32 _WrittenBytes; SIZE_T to_write, _WrittenBytes;
uint32 LBS = Vcb->LBlockSize; SIZE_T LBS = Vcb->LBlockSize;
AdPrint(("Zero ExtInfo %x, Mapping %x\n", ExtInfo, ExtInfo->Mapping)); AdPrint(("Zero ExtInfo %x, Mapping %x\n", ExtInfo, ExtInfo->Mapping));

View file

@ -64,7 +64,7 @@ UDFPrepareXSpaceBitmap(
lb_addr locAddr; lb_addr locAddr;
int8* _XSBM; int8* _XSBM;
uint16 Ident; uint16 Ident;
uint32 ReadBytes; SIZE_T ReadBytes;
uint32 PartNum; uint32 PartNum;
if(!(XSpaceBitmap->extLength)) { if(!(XSpaceBitmap->extLength)) {
@ -202,7 +202,7 @@ UDFUpdateXSpaceBitmaps(
uint32 USl, FSl; uint32 USl, FSl;
EXTENT_INFO FSBMExtInfo, USBMExtInfo; EXTENT_INFO FSBMExtInfo, USBMExtInfo;
// lb_addr locAddr; // lb_addr locAddr;
uint32 WrittenBytes; SIZE_T WrittenBytes;
UDF_CHECK_BITMAP_RESOURCE(Vcb); UDF_CHECK_BITMAP_RESOURCE(Vcb);
@ -304,7 +304,7 @@ UDFUpdatePartDesc(
PartitionDesc *p = (PartitionDesc *)Buf; PartitionDesc *p = (PartitionDesc *)Buf;
uint32 i; // PartNdx uint32 i; // PartNdx
tag* PTag; tag* PTag;
uint32 WrittenBytes; SIZE_T WrittenBytes;
for(i=0; i<Vcb->PartitionMaps; i++) for(i=0; i<Vcb->PartitionMaps; i++)
{ {
@ -344,7 +344,7 @@ UDFUpdateUSpaceDesc(
) )
{ {
PUNALLOC_SPACE_DESC usd; PUNALLOC_SPACE_DESC usd;
uint32 WrittenBytes; SIZE_T WrittenBytes;
usd = (PUNALLOC_SPACE_DESC)Buf; usd = (PUNALLOC_SPACE_DESC)Buf;
usd->numAllocDescs = 0; usd->numAllocDescs = 0;
@ -365,7 +365,7 @@ UDFUpdateLogicalVolInt(
{ {
OSSTATUS RC = STATUS_SUCCESS; OSSTATUS RC = STATUS_SUCCESS;
uint32 i, len; uint32 i, len;
uint32 WrittenBytes; SIZE_T WrittenBytes;
// uint32 lvid_count = 0; // uint32 lvid_count = 0;
uint32 pSize; uint32 pSize;
tag* PTag; tag* PTag;
@ -469,7 +469,7 @@ UDFUpdateSparingTable(
OSSTATUS status2 = STATUS_SUCCESS; OSSTATUS status2 = STATUS_SUCCESS;
uint32 i=0, BC, BC2; uint32 i=0, BC, BC2;
PSPARING_TABLE SparTable; PSPARING_TABLE SparTable;
uint32 ReadBytes; SIZE_T ReadBytes;
// uint32 n,m; // uint32 n,m;
// BOOLEAN merged; // BOOLEAN merged;
BOOLEAN sorted; BOOLEAN sorted;
@ -605,7 +605,7 @@ UDFUpdateLogicalVol(
#define CUR_IDENT_SZ (sizeof(lvd->logicalVolIdent)) #define CUR_IDENT_SZ (sizeof(lvd->logicalVolIdent))
dstring CS0[CUR_IDENT_SZ]; dstring CS0[CUR_IDENT_SZ];
uint16 ident; uint16 ident;
uint32 WrittenBytes; SIZE_T WrittenBytes;
OSSTATUS status = STATUS_SUCCESS; OSSTATUS status = STATUS_SUCCESS;
// OSSTATUS status2 = STATUS_SUCCESS; // OSSTATUS status2 = STATUS_SUCCESS;
@ -761,7 +761,7 @@ UDFSetDstring(
) )
{ {
uint8* CS0; uint8* CS0;
uint32 len = Length-1; SIZE_T len = Length-1;
UDFCompressUnicode(UName, &CS0, &len); UDFCompressUnicode(UName, &CS0, &len);
if(!CS0) if(!CS0)
@ -809,7 +809,7 @@ UDFUpdateVolIdent(
OSSTATUS status; OSSTATUS status;
dstring CS0[CUR_IDENT_SZ]; dstring CS0[CUR_IDENT_SZ];
uint16 ident; uint16 ident;
uint32 WrittenBytes; SIZE_T WrittenBytes;
if(!pvoldesc) return STATUS_INSUFFICIENT_RESOURCES; if(!pvoldesc) return STATUS_INSUFFICIENT_RESOURCES;
@ -1115,7 +1115,7 @@ UDFFindVRS(
uint32 BeginOffset = Vcb->FirstLBA; uint32 BeginOffset = Vcb->FirstLBA;
OSSTATUS RC; OSSTATUS RC;
int8* buffer = (int8*)MyAllocatePool__(NonPagedPool,Vcb->BlockSize); int8* buffer = (int8*)MyAllocatePool__(NonPagedPool,Vcb->BlockSize);
uint32 ReadBytes; SIZE_T ReadBytes;
if(!buffer) return 0; if(!buffer) return 0;
// Relative to First LBA in Last Session // Relative to First LBA in Last Session
@ -1244,7 +1244,7 @@ UDFLoadLogicalVolInt(
{ {
OSSTATUS RC = STATUS_SUCCESS; OSSTATUS RC = STATUS_SUCCESS;
uint32 len; uint32 len;
uint32 _ReadBytes; SIZE_T _ReadBytes;
int8* Buf = NULL; int8* Buf = NULL;
uint16 ident; uint16 ident;
LogicalVolIntegrityDescImpUse* LVID_iUse; LogicalVolIntegrityDescImpUse* LVID_iUse;
@ -1580,8 +1580,8 @@ UDFAddXSpaceBitmap(
OSSTATUS status; OSSTATUS status;
uint16 Ident; uint16 Ident;
uint32 flags; uint32 flags;
uint32 Length; SIZE_T Length;
uint32 ReadBytes; SIZE_T ReadBytes;
BOOLEAN bit_set; BOOLEAN bit_set;
UDF_CHECK_BITMAP_RESOURCE(Vcb); UDF_CHECK_BITMAP_RESOURCE(Vcb);
@ -1680,7 +1680,7 @@ UDFVerifyXSpaceBitmap(
uint16 Ident; uint16 Ident;
uint32 flags; uint32 flags;
uint32 Length; uint32 Length;
uint32 ReadBytes; SIZE_T ReadBytes;
// BOOLEAN bit_set; // BOOLEAN bit_set;
UDF_CHECK_BITMAP_RESOURCE(Vcb); UDF_CHECK_BITMAP_RESOURCE(Vcb);
@ -1775,7 +1775,7 @@ UDFDelXSpaceBitmap(
uint16 Ident; uint16 Ident;
uint32 flags; uint32 flags;
uint32 Length; uint32 Length;
uint32 ReadBytes; SIZE_T ReadBytes;
if(!(Length = (bm->extLength & UDF_EXTENT_LENGTH_MASK))) return STATUS_SUCCESS; if(!(Length = (bm->extLength & UDF_EXTENT_LENGTH_MASK))) return STATUS_SUCCESS;
i=0; i=0;
@ -2791,7 +2791,7 @@ UDFLoadSparingTable(
uint32 i=0, BC, BC2; uint32 i=0, BC, BC2;
PSPARING_TABLE SparTable; PSPARING_TABLE SparTable;
uint32 TabSize, NewSize; uint32 TabSize, NewSize;
uint32 ReadBytes; SIZE_T ReadBytes;
uint32 SparTableLoc; uint32 SparTableLoc;
#ifdef UDF_TRACK_FS_STRUCTURES #ifdef UDF_TRACK_FS_STRUCTURES
uint32 j; uint32 j;
@ -2991,7 +2991,7 @@ UDFGetDiskInfoAndVerify(
PFILE_SET_DESC FileSetDesc = NULL; PFILE_SET_DESC FileSetDesc = NULL;
int8* Buf = NULL; int8* Buf = NULL;
uint32 ReadBytes; SIZE_T ReadBytes;
UDFPrint(("UDFGetDiskInfoAndVerify\n")); UDFPrint(("UDFGetDiskInfoAndVerify\n"));
_SEH2_TRY { _SEH2_TRY {

View file

@ -227,7 +227,7 @@ UDFVWrite(
IN void* Buffer, // Target buffer IN void* Buffer, // Target buffer
IN uint32 BCount, IN uint32 BCount,
IN uint32 LBA, IN uint32 LBA,
// OUT uint32* WrittenBytes, // OUT PSIZE_T WrittenBytes,
IN uint32 Flags IN uint32 Flags
) )
{ {
@ -544,11 +544,11 @@ UDFVWorkItem(
{ {
PUDF_VERIFY_REQ VerifyReq = (PUDF_VERIFY_REQ)Context; PUDF_VERIFY_REQ VerifyReq = (PUDF_VERIFY_REQ)Context;
PVCB Vcb = VerifyReq->Vcb; PVCB Vcb = VerifyReq->Vcb;
ULONG ReadBytes; SIZE_T ReadBytes;
// OSSTATUS RC; // OSSTATUS RC;
ULONG i; ULONG i;
ReadBytes = (ULONG)Vcb; ReadBytes = (SIZE_T)Vcb;
#if 1 #if 1
if(Vcb->SparingCountFree) { if(Vcb->SparingCountFree) {
WCacheStartDirect__(&(Vcb->FastCache), Vcb, TRUE); WCacheStartDirect__(&(Vcb->FastCache), Vcb, TRUE);
@ -768,7 +768,7 @@ UDFCheckArea(
{ {
uint8* buff; uint8* buff;
OSSTATUS RC; OSSTATUS RC;
uint32 ReadBytes; SIZE_T ReadBytes;
uint32 i, d; uint32 i, d;
BOOLEAN ext_ok = TRUE; BOOLEAN ext_ok = TRUE;
EXTENT_MAP Map[2]; EXTENT_MAP Map[2];

View file

@ -170,7 +170,7 @@ __fastcall
UDFDecompressUnicode( UDFDecompressUnicode(
IN OUT PUNICODE_STRING UName, IN OUT PUNICODE_STRING UName,
IN uint8* CS0, IN uint8* CS0,
IN uint32 Length, IN SIZE_T Length,
OUT uint16* valueCRC OUT uint16* valueCRC
) )
{ {
@ -240,7 +240,7 @@ __fastcall
UDFCompressUnicode( UDFCompressUnicode(
IN PUNICODE_STRING UName, IN PUNICODE_STRING UName,
IN OUT uint8** _CS0, IN OUT uint8** _CS0,
IN OUT uint32* Length IN OUT PSIZE_T Length
) )
{ {
uint8* CS0; uint8* CS0;
@ -1115,7 +1115,8 @@ UDFBuildFileIdent(
{ {
PFILE_IDENT_DESC FileId; PFILE_IDENT_DESC FileId;
uint8* CS0; uint8* CS0;
uint32 Nlen, l; SIZE_T Nlen;
uint32 l;
// prepare filename // prepare filename
UDFCompressUnicode(fn, &CS0, &Nlen); UDFCompressUnicode(fn, &CS0, &Nlen);
if(!CS0) return STATUS_INSUFFICIENT_RESOURCES; if(!CS0) return STATUS_INSUFFICIENT_RESOURCES;
@ -1605,18 +1606,18 @@ UDFWriteFile__(
IN PVCB Vcb, IN PVCB Vcb,
IN PUDF_FILE_INFO FileInfo, IN PUDF_FILE_INFO FileInfo,
IN int64 Offset, IN int64 Offset,
IN uint32 Length, IN SIZE_T Length,
IN BOOLEAN Direct, IN BOOLEAN Direct,
IN int8* Buffer, IN int8* Buffer,
OUT uint32* WrittenBytes OUT PSIZE_T WrittenBytes
) )
{ {
int64 t, elen; int64 t, elen;
OSSTATUS status; OSSTATUS status;
int8* OldInIcb = NULL; int8* OldInIcb = NULL;
ValidateFileInfo(FileInfo); ValidateFileInfo(FileInfo);
uint32 ReadBytes; SIZE_T ReadBytes;
uint32 _WrittenBytes; SIZE_T _WrittenBytes;
PUDF_DATALOC_INFO Dloc; PUDF_DATALOC_INFO Dloc;
// unwind staff // unwind staff
BOOLEAN WasInIcb = FALSE; BOOLEAN WasInIcb = FALSE;
@ -1689,7 +1690,7 @@ UDFWriteFile__(
Vcb->LowFreeSpace ? "LowSpace" : "")); Vcb->LowFreeSpace ? "LowSpace" : ""));
if(UDFIsADirectory(FileInfo) && !WasInIcb && !Vcb->LowFreeSpace) { if(UDFIsADirectory(FileInfo) && !WasInIcb && !Vcb->LowFreeSpace) {
FileInfo->Dloc->DataLoc.Flags |= EXTENT_FLAG_ALLOC_SEQUENTIAL; 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)) { if(OS_SUCCESS(status)) {
AdPrint((" preallocated space for Dir\n")); AdPrint((" preallocated space for Dir\n"));
FileInfo->Dloc->DataLoc.Flags |= EXTENT_FLAG_PREALLOCATED; FileInfo->Dloc->DataLoc.Flags |= EXTENT_FLAG_PREALLOCATED;
@ -2019,7 +2020,7 @@ UDFOpenFile__(
PDIR_INDEX_ITEM DirNdx; PDIR_INDEX_ITEM DirNdx;
PUDF_FILE_INFO FileInfo; PUDF_FILE_INFO FileInfo;
PUDF_FILE_INFO ParFileInfo; PUDF_FILE_INFO ParFileInfo;
uint32 ReadBytes; SIZE_T ReadBytes;
*_FileInfo = NULL; *_FileInfo = NULL;
if(!hDirNdx) return STATUS_NOT_A_DIRECTORY; if(!hDirNdx) return STATUS_NOT_A_DIRECTORY;
@ -2597,7 +2598,7 @@ UDFCreateFile__(
PUDF_FILE_INFO FileInfo; PUDF_FILE_INFO FileInfo;
*_FileInfo = NULL; *_FileInfo = NULL;
BOOLEAN undel = FALSE; BOOLEAN undel = FALSE;
uint32 ReadBytes; SIZE_T ReadBytes;
// BOOLEAN PackDir = FALSE; // BOOLEAN PackDir = FALSE;
BOOLEAN FEAllocated = FALSE; BOOLEAN FEAllocated = FALSE;
@ -2904,10 +2905,10 @@ UDFReadFile__(
IN PVCB Vcb, IN PVCB Vcb,
IN PUDF_FILE_INFO FileInfo, IN PUDF_FILE_INFO FileInfo,
IN int64 Offset, // offset in extent IN int64 Offset, // offset in extent
IN uint32 Length, IN SIZE_T Length,
IN BOOLEAN Direct, IN BOOLEAN Direct,
OUT int8* Buffer, OUT int8* Buffer,
OUT uint32* ReadBytes OUT PSIZE_T ReadBytes
) )
{ {
ValidateFileInfo(FileInfo); ValidateFileInfo(FileInfo);
@ -2925,9 +2926,9 @@ UDFZeroFile__(
IN PVCB Vcb, IN PVCB Vcb,
IN PUDF_FILE_INFO FileInfo, IN PUDF_FILE_INFO FileInfo,
IN int64 Offset, // offset in extent IN int64 Offset, // offset in extent
IN uint32 Length, IN SIZE_T Length,
IN BOOLEAN Direct, IN BOOLEAN Direct,
OUT uint32* ReadBytes OUT PSIZE_T ReadBytes
) )
{ {
ValidateFileInfo(FileInfo); ValidateFileInfo(FileInfo);
@ -2944,9 +2945,9 @@ UDFSparseFile__(
IN PVCB Vcb, IN PVCB Vcb,
IN PUDF_FILE_INFO FileInfo, IN PUDF_FILE_INFO FileInfo,
IN int64 Offset, // offset in extent IN int64 Offset, // offset in extent
IN uint32 Length, IN SIZE_T Length,
IN BOOLEAN Direct, IN BOOLEAN Direct,
OUT uint32* ReadBytes OUT PSIZE_T ReadBytes
) )
{ {
ValidateFileInfo(FileInfo); ValidateFileInfo(FileInfo);
@ -2966,7 +2967,8 @@ UDFPadLastSector(
if(!ExtInfo || !(ExtInfo->Mapping) || !(ExtInfo->Length)) return STATUS_INVALID_PARAMETER; if(!ExtInfo || !(ExtInfo->Mapping) || !(ExtInfo->Length)) return STATUS_INVALID_PARAMETER;
PEXTENT_MAP Extent = ExtInfo->Mapping; // Extent array 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; OSSTATUS status;
// Length should not be zero // Length should not be zero
int64 Offset = ExtInfo->Length + ExtInfo->Offset; int64 Offset = ExtInfo->Length + ExtInfo->Offset;
@ -3201,7 +3203,7 @@ UDFRenameMoveFile__(
(j==FileInfo->Index) ) { (j==FileInfo->Index) ) {
// case-only rename // case-only rename
uint8* CS0; uint8* CS0;
uint32 Nlen, /* l, FIXME ReactOS */ IUl; SIZE_T Nlen, /* l, FIXME ReactOS */ IUl;
// prepare filename // prepare filename
UDFCompressUnicode(fn, &CS0, &Nlen); UDFCompressUnicode(fn, &CS0, &Nlen);
@ -3390,7 +3392,7 @@ UDFRecordDirectory__(
UDF_DATALOC_INFO Dloc; UDF_DATALOC_INFO Dloc;
UNICODE_STRING PName; UNICODE_STRING PName;
uint32 PartNum; uint32 PartNum;
uint32 WrittenBytes; SIZE_T WrittenBytes;
PDIR_INDEX_ITEM CurDirNdx; PDIR_INDEX_ITEM CurDirNdx;
uint32 lba; uint32 lba;
@ -3469,7 +3471,7 @@ UDFResizeFile__(
IN int64 NewLength IN int64 NewLength
) )
{ {
uint32 WrittenBytes; SIZE_T WrittenBytes;
OSSTATUS status; OSSTATUS status;
uint32 PartNum; uint32 PartNum;
int8* OldInIcb = NULL; int8* OldInIcb = NULL;
@ -3607,7 +3609,7 @@ UDFLoadVAT(
PUDF_FILE_INFO VatFileInfo; PUDF_FILE_INFO VatFileInfo;
uint32 len, i=0, j, to_read; uint32 len, i=0, j, to_read;
uint32 Offset, hdrOffset; uint32 Offset, hdrOffset;
uint32 ReadBytes; SIZE_T ReadBytes;
uint32 root; uint32 root;
uint16 PartNum; uint16 PartNum;
// uint32 VatFirstLba = 0; // uint32 VatFirstLba = 0;
@ -3867,7 +3869,7 @@ UDFFlushFE(
{ {
int8* NewAllocDescs; int8* NewAllocDescs;
OSSTATUS status; OSSTATUS status;
uint32 WrittenBytes; SIZE_T WrittenBytes;
uint16 AllocMode; uint16 AllocMode;
uint32 lba; uint32 lba;
@ -4055,7 +4057,7 @@ UDFFlushFI(
PUDF_FILE_INFO DirInfo = FileInfo->ParentFile; PUDF_FILE_INFO DirInfo = FileInfo->ParentFile;
PDIR_INDEX_ITEM DirNdx; PDIR_INDEX_ITEM DirNdx;
OSSTATUS status; OSSTATUS status;
uint32 WrittenBytes; SIZE_T WrittenBytes;
// use WrittenBytes variable to store LBA of FI to be recorded // use WrittenBytes variable to store LBA of FI to be recorded
#define lba WrittenBytes #define lba WrittenBytes
@ -4524,7 +4526,7 @@ uint16
__fastcall __fastcall
UDFCrc( UDFCrc(
IN uint8* Data, // ECX IN uint8* Data, // ECX
IN uint32 Size // EDX IN SIZE_T Size // EDX
) )
{ {
#if defined(_X86_) && defined(_MSC_VER) && !defined(__clang__) #if defined(_X86_) && defined(_MSC_VER) && !defined(__clang__)
@ -4594,7 +4596,7 @@ UDFReadTagged(
// icbtag* Icb = (icbtag*)(Buf+1); // icbtag* Icb = (icbtag*)(Buf+1);
uint8 checksum; uint8 checksum;
unsigned int i; unsigned int i;
uint32 ReadBytes; SIZE_T ReadBytes;
int8* tb; int8* tb;
// Read the block // Read the block
@ -4836,7 +4838,7 @@ UDFCreateRootFile__(
LONG_AD FEicb; LONG_AD FEicb;
PUDF_FILE_INFO FileInfo; PUDF_FILE_INFO FileInfo;
*_FileInfo = NULL; *_FileInfo = NULL;
uint32 ReadBytes; SIZE_T ReadBytes;
FileInfo = (PUDF_FILE_INFO)MyAllocatePoolTag__(UDF_FILE_INFO_MT,sizeof(UDF_FILE_INFO), MEM_FINF_TAG); FileInfo = (PUDF_FILE_INFO)MyAllocatePoolTag__(UDF_FILE_INFO_MT,sizeof(UDF_FILE_INFO), MEM_FINF_TAG);
*_FileInfo = FileInfo; *_FileInfo = FileInfo;
@ -5040,7 +5042,7 @@ UDFRecordVAT(
uint32 hdrOffset, hdrOffsetNew; uint32 hdrOffset, hdrOffsetNew;
uint32 hdrLen; uint32 hdrLen;
OSSTATUS status; OSSTATUS status;
uint32 ReadBytes; SIZE_T ReadBytes;
uint32 len; uint32 len;
uint16 PartNdx = (uint16)Vcb->VatPartNdx; uint16 PartNdx = (uint16)Vcb->VatPartNdx;
uint16 PartNum = UDFGetPartNumByPartNdx(Vcb, PartNdx); uint16 PartNum = UDFGetPartNumByPartNdx(Vcb, PartNdx);
@ -5363,8 +5365,8 @@ UDFConvertFEToNonInICB(
int8* OldInIcb = NULL; int8* OldInIcb = NULL;
uint32 OldLen; uint32 OldLen;
ValidateFileInfo(FileInfo); ValidateFileInfo(FileInfo);
uint32 ReadBytes; SIZE_T ReadBytes;
uint32 _WrittenBytes; SIZE_T _WrittenBytes;
PUDF_DATALOC_INFO Dloc; PUDF_DATALOC_INFO Dloc;
// ASSERT(FileInfo->RefCount >= 1); // ASSERT(FileInfo->RefCount >= 1);
@ -5462,7 +5464,7 @@ UDFConvertFEToExtended(
PFILE_ENTRY FileEntry; PFILE_ENTRY FileEntry;
uint32 Length, NewLength, l; uint32 Length, NewLength, l;
OSSTATUS status; OSSTATUS status;
uint32 ReadBytes; SIZE_T ReadBytes;
if(!FileInfo) return STATUS_INVALID_PARAMETER; if(!FileInfo) return STATUS_INVALID_PARAMETER;
ValidateFileInfo(FileInfo); ValidateFileInfo(FileInfo);

View file

@ -24,7 +24,7 @@ UDFExtentOffsetToLba(IN PVCB Vcb,
IN PEXTENT_AD Extent, // Extent array IN PEXTENT_AD Extent, // Extent array
IN int64 Offset, // offset in extent IN int64 Offset, // offset in extent
OUT uint32* SectorOffset, 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* Flags,
OUT uint32* Index); OUT uint32* Index);
@ -44,10 +44,10 @@ UDFLocateLbaInExtent(
OSSTATUS UDFReadExtent(IN PVCB Vcb, OSSTATUS UDFReadExtent(IN PVCB Vcb,
IN PEXTENT_INFO ExtInfo, // Extent array IN PEXTENT_INFO ExtInfo, // Extent array
IN int64 Offset, // offset in extent IN int64 Offset, // offset in extent
IN uint32 Length, IN SIZE_T Length,
IN BOOLEAN Direct, IN BOOLEAN Direct,
OUT int8* Buffer, OUT int8* Buffer,
OUT uint32* ReadBytes); OUT PSIZE_T ReadBytes);
// builds mapping for specified amount of data at any offset from specified extent. // builds mapping for specified amount of data at any offset from specified extent.
OSSTATUS OSSTATUS
UDFReadExtentLocation(IN PVCB Vcb, UDFReadExtentLocation(IN PVCB Vcb,
@ -64,7 +64,7 @@ int64 UDFGetExtentLength(IN PEXTENT_MAP Extent); // Extent array
void void
__fastcall UDFDecompressUnicode(IN OUT PUNICODE_STRING UName, __fastcall UDFDecompressUnicode(IN OUT PUNICODE_STRING UName,
IN uint8* CS0, IN uint8* CS0,
IN uint32 Length, IN SIZE_T Length,
OUT uint16* valueCRC); OUT uint16* valueCRC);
// calculate hashes for directory search // calculate hashes for directory search
uint8 UDFBuildHashEntry(IN PVCB Vcb, 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 // return length of bit-chain starting from Offs bit
#ifdef _X86_ #ifdef _X86_
uint32 SIZE_T
__stdcall __stdcall
UDFGetBitmapLen( UDFGetBitmapLen(
#else // NO X86 optimization , use generic C/C++ #else // NO X86 optimization , use generic C/C++
uint32 UDFGetBitmapLen( SIZE_T UDFGetBitmapLen(
#endif // _X86_ #endif // _X86_
uint32* Bitmap, uint32* Bitmap,
uint32 Offs, SIZE_T Offs,
uint32 Lim); SIZE_T Lim);
// scan disc free space bitmap for minimal suitable extent // 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 Length, // in blocks
IN uint32 SearchStart, IN uint32 SearchStart,
IN uint32 SearchLim, IN uint32 SearchLim,
@ -468,7 +468,7 @@ OSSTATUS UDFLoadExtInfo(IN PVCB Vcb,
void void
__fastcall UDFCompressUnicode(IN PUNICODE_STRING UName, __fastcall UDFCompressUnicode(IN PUNICODE_STRING UName,
IN OUT uint8** _CS0, IN OUT uint8** _CS0,
IN OUT uint32* Length); IN OUT PSIZE_T Length);
// build FileIdent for specified FileEntry. // build FileIdent for specified FileEntry.
OSSTATUS UDFBuildFileIdent(IN PVCB Vcb, OSSTATUS UDFBuildFileIdent(IN PVCB Vcb,
IN PUNICODE_STRING fn, IN PUNICODE_STRING fn,
@ -520,21 +520,21 @@ __inline OSSTATUS UDFMarkRecordedAsAllocated(IN PVCB Vcb,
OSSTATUS UDFWriteExtent(IN PVCB Vcb, OSSTATUS UDFWriteExtent(IN PVCB Vcb,
IN PEXTENT_INFO ExtInfo, // Extent array IN PEXTENT_INFO ExtInfo, // Extent array
IN int64 Offset, // offset in extent IN int64 Offset, // offset in extent
IN uint32 Length, IN SIZE_T Length,
IN BOOLEAN Direct, // setting this flag delays flushing of given IN BOOLEAN Direct, // setting this flag delays flushing of given
// data to indefinite term // data to indefinite term
IN int8* Buffer, IN int8* Buffer,
OUT uint32* WrittenBytes); OUT PSIZE_T WrittenBytes);
// deallocate/zero data at any offset from specified extent. // deallocate/zero data at any offset from specified extent.
OSSTATUS UDFZeroExtent(IN PVCB Vcb, OSSTATUS UDFZeroExtent(IN PVCB Vcb,
IN PEXTENT_INFO ExtInfo, // Extent array IN PEXTENT_INFO ExtInfo, // Extent array
IN int64 Offset, // offset in extent 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 Deallocate, // deallocate frag or just mark as unrecorded
IN BOOLEAN Direct, // setting this flag delays flushing of given IN BOOLEAN Direct, // setting this flag delays flushing of given
// data to indefinite term // data to indefinite term
OUT uint32* WrittenBytes); OUT PSIZE_T WrittenBytes);
#define UDFZeroExtent__(Vcb, Ext, Off, Len, Dir, WB) \ #define UDFZeroExtent__(Vcb, Ext, Off, Len, Dir, WB) \
UDFZeroExtent(Vcb, Ext, Off, Len, FALSE, Dir, WB) UDFZeroExtent(Vcb, Ext, Off, Len, FALSE, Dir, WB)
@ -619,10 +619,10 @@ void UDFChangeFileCounter(IN PVCB Vcb,
OSSTATUS UDFWriteFile__(IN PVCB Vcb, OSSTATUS UDFWriteFile__(IN PVCB Vcb,
IN PUDF_FILE_INFO FileInfo, IN PUDF_FILE_INFO FileInfo,
IN int64 Offset, IN int64 Offset,
IN uint32 Length, IN SIZE_T Length,
IN BOOLEAN Direct, IN BOOLEAN Direct,
IN int8* Buffer, IN int8* Buffer,
OUT uint32* WrittenBytes); OUT PSIZE_T WrittenBytes);
// mark file as deleted & decrease file link counter. // mark file as deleted & decrease file link counter.
OSSTATUS UDFUnlinkFile__(IN PVCB Vcb, OSSTATUS UDFUnlinkFile__(IN PVCB Vcb,
IN PUDF_FILE_INFO FileInfo, IN PUDF_FILE_INFO FileInfo,
@ -666,10 +666,10 @@ __inline
OSSTATUS UDFReadFile__(IN PVCB Vcb, OSSTATUS UDFReadFile__(IN PVCB Vcb,
IN PUDF_FILE_INFO FileInfo, IN PUDF_FILE_INFO FileInfo,
IN int64 Offset, // offset in extent IN int64 Offset, // offset in extent
IN uint32 Length, IN SIZE_T Length,
IN BOOLEAN Direct, IN BOOLEAN Direct,
OUT int8* Buffer, OUT int8* Buffer,
OUT uint32* ReadBytes) OUT PSIZE_T ReadBytes)
{ {
ValidateFileInfo(FileInfo); ValidateFileInfo(FileInfo);
@ -862,7 +862,7 @@ __fastcall crc32(IN uint8* s,
// calculate a 16-bit CRC checksum using ITU-T V.41 polynomial // calculate a 16-bit CRC checksum using ITU-T V.41 polynomial
uint16 uint16
__fastcall UDFCrc(IN uint8* Data, __fastcall UDFCrc(IN uint8* Data,
IN uint32 Size); IN SIZE_T Size);
// read the first block of a tagged descriptor & check it // read the first block of a tagged descriptor & check it
OSSTATUS UDFReadTagged(IN PVCB Vcb, OSSTATUS UDFReadTagged(IN PVCB Vcb,
IN int8* Buf, IN int8* Buf,
@ -1277,7 +1277,7 @@ UDFVWrite(
IN void* Buffer, // Target buffer IN void* Buffer, // Target buffer
IN uint32 BCount, IN uint32 BCount,
IN uint32 LBA, IN uint32 LBA,
// OUT uint32* WrittenBytes, // OUT PSIZE_T WrittenBytes,
IN uint32 Flags IN uint32 Flags
); );

View file

@ -516,7 +516,7 @@ typedef struct _UDF_ALLOCATION_CACHE_ITEM {
#define UDF_MAX_LVID_CHAIN_LENGTH 1024 #define UDF_MAX_LVID_CHAIN_LENGTH 1024
#define UDF_LVID_TTL 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) #define UDF_FLUSH_FLAGS_LITE (0x80000000)

View file

@ -117,7 +117,7 @@ UDFCommonWrite(
PIO_STACK_LOCATION IrpSp = NULL; PIO_STACK_LOCATION IrpSp = NULL;
LARGE_INTEGER ByteOffset; LARGE_INTEGER ByteOffset;
ULONG WriteLength = 0, TruncatedLength = 0; ULONG WriteLength = 0, TruncatedLength = 0;
ULONG NumberBytesWritten = 0; SIZE_T NumberBytesWritten = 0;
PFILE_OBJECT FileObject = NULL; PFILE_OBJECT FileObject = NULL;
PtrUDFFCB Fcb = NULL; PtrUDFFCB Fcb = NULL;
PtrUDFCCB Ccb = NULL; PtrUDFCCB Ccb = NULL;
@ -158,7 +158,7 @@ UDFCommonWrite(
TopIrp = IoGetTopLevelIrp(); TopIrp = IoGetTopLevelIrp();
switch((ULONG)TopIrp) { switch((ULONG_PTR)TopIrp) {
case FSRTL_FSP_TOP_LEVEL_IRP: case FSRTL_FSP_TOP_LEVEL_IRP:
UDFPrint((" FSRTL_FSP_TOP_LEVEL_IRP\n")); UDFPrint((" FSRTL_FSP_TOP_LEVEL_IRP\n"));
break; break;
@ -525,7 +525,7 @@ UDFCommonWrite(
// Determine if we were called by the lazywriter. // Determine if we were called by the lazywriter.
// We reuse 'IsThisADeferredWrite' here to decrease stack usage // We reuse 'IsThisADeferredWrite' here to decrease stack usage
IsThisADeferredWrite = (NtReqFcb->LazyWriterThreadID == (uint32)PsGetCurrentThread()); IsThisADeferredWrite = (NtReqFcb->LazyWriterThreadID == HandleToUlong(PsGetCurrentThreadId()));
// Acquire the appropriate FCB resource // Acquire the appropriate FCB resource
if(PagingIo) { if(PagingIo) {
@ -576,7 +576,7 @@ UDFCommonWrite(
// This clause determines if the top level request was // This clause determines if the top level request was
// in the FastIo path. // 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; PIO_STACK_LOCATION IrpStack;
ASSERT( TopIrp->Type == IO_TYPE_IRP ); ASSERT( TopIrp->Type == IO_TYPE_IRP );
@ -846,11 +846,11 @@ UDFCommonWrite(
} }
#if 1 #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")); UDFPrint(("FSRTL_MOD_WRITE_TOP_LEVEL_IRP => CanWait\n"));
CanWait = TRUE; CanWait = TRUE;
} else } 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")); UDFPrint(("FSRTL_CACHE_TOP_LEVEL_IRP => CanWait\n"));
CanWait = TRUE; CanWait = TRUE;
} }