From 56461438cb070cfd680d781cd812d98cdc33aabb Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Tue, 27 Apr 1999 14:15:56 +0000 Subject: [PATCH] Fixed LARGE_INTEGER handling svn path=/trunk/; revision=415 --- reactos/apps/utils/cmd/dir.c | 97 ++++----------------------- reactos/drivers/dd/ide/ide.c | 40 +++++------ reactos/drivers/dd/sdisk/sdisk.c | 12 ++-- reactos/drivers/fs/ext2/blockdev.c | 27 ++++---- reactos/drivers/fs/ext2/dir.c | 4 +- reactos/drivers/fs/ext2/rw.c | 2 +- reactos/drivers/fs/ext2/super.c | 2 +- reactos/drivers/fs/minix/blockdev.c | 20 +++--- reactos/drivers/fs/minix/rw.c | 3 +- reactos/drivers/fs/vfat/blockdev.c | 21 +++--- reactos/drivers/fs/vfat/dir.c | 6 +- reactos/drivers/fs/vfat/iface.c | 13 ++-- reactos/include/ddk/ntddk.h | 2 - reactos/include/ddk/types.h | 4 ++ reactos/include/structs.h | 36 ++++++---- reactos/lib/kernel32/file/copy.c | 3 +- reactos/lib/kernel32/file/file.c | 51 ++++++-------- reactos/lib/kernel32/file/find.c | 5 +- reactos/lib/kernel32/file/lock.c | 16 ++--- reactos/lib/kernel32/file/rw.c | 10 +-- reactos/lib/kernel32/file/volume.c | 23 ++----- reactos/lib/kernel32/mem/section.c | 8 +-- reactos/lib/kernel32/misc/time.c | 89 ++++++++++++------------ reactos/lib/kernel32/process/create.c | 7 +- reactos/lib/kernel32/process/proc.c | 5 +- reactos/lib/kernel32/synch/wait.c | 6 +- reactos/lib/ntdll/ldr/utils.c | 4 +- reactos/lib/ntdll/rtl/largeint.c | 57 +++++++--------- reactos/ntoskrnl/cc/block.c | 8 +-- reactos/ntoskrnl/hal/x86/page.c | 13 ++-- reactos/ntoskrnl/io/buildirp.c | 13 +--- reactos/ntoskrnl/io/cleanup.c | 6 +- reactos/ntoskrnl/io/rw.c | 2 +- reactos/ntoskrnl/ke/timer.c | 6 +- reactos/ntoskrnl/ldr/init.c | 4 +- reactos/ntoskrnl/ldr/loader.c | 6 +- reactos/ntoskrnl/mm/marea.c | 3 +- reactos/ntoskrnl/mm/mdl.c | 6 +- reactos/ntoskrnl/mm/mm.c | 3 +- reactos/ntoskrnl/mm/section.c | 9 ++- reactos/ntoskrnl/mm/special.c | 2 +- reactos/ntoskrnl/ps/thread.c | 4 +- reactos/ntoskrnl/rtl/largeint.c | 74 ++++++++------------ reactos/rules.mak | 2 +- rosapps/cmd/dir.c | 97 ++++----------------------- 45 files changed, 322 insertions(+), 509 deletions(-) diff --git a/reactos/apps/utils/cmd/dir.c b/reactos/apps/utils/cmd/dir.c index c9d90b071f7..4641ccdac76 100644 --- a/reactos/apps/utils/cmd/dir.c +++ b/reactos/apps/utils/cmd/dir.c @@ -123,10 +123,6 @@ #include "cmd.h" -#ifdef __REACTOS__ -#include -#endif - /* flag definitions */ @@ -584,11 +580,7 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len) INT c = 0; INT n = 0; -#ifndef __REACTOS__ if (num.QuadPart == 0) -#else - if (num == 0) -#endif { des[0] = _T('0'); des[1] = _T('\0'); @@ -597,21 +589,12 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len) else { temp[31] = 0; -#ifndef __REACTOS__ while (num.QuadPart > 0) -#else - while (num > 0) -#endif { if (((c + 1) % (nNumberGroups + 1)) == 0) temp[30 - c++] = cThousandSeparator; -#ifndef __REACTOS__ temp[30 - c++] = (TCHAR)(num.QuadPart % 10) + _T('0'); num.QuadPart /= 10; -#else - temp[30 - c++] = (TCHAR)(num % 10) + _T('0'); - num /= 10; -#endif } for (n = 0; n <= c; n++) @@ -685,13 +668,8 @@ PrintSummary (LPTSTR szPath, ULONG ulFiles, ULONG ulDirs, ULARGE_INTEGER bytes, buffer, ulFiles == 1 ? _T(' ') : _T('s')); ConvertULargeInteger (bytes, buffer, sizeof(buffer)); -#ifndef __REACTOS__ ConOutPrintf (_T(" %15s byte%c\n"), buffer, bytes.QuadPart == 1 ? _T(' ') : _T('s')); -#else - ConOutPrintf (_T(" %15s byte%c\n"), - buffer, bytes == 1 ? _T(' ') : _T('s')); -#endif if (IncLine (pLine, dwFlags)) return 1; @@ -713,11 +691,7 @@ PrintSummary (LPTSTR szPath, ULONG ulFiles, ULONG ulDirs, ULARGE_INTEGER bytes, szRoot[0] = szPath[0]; GetDiskFreeSpace (szRoot, &dwSecPerCl, &dwBytPerSec, &dwFreeCl, &dwTotCl); -#ifndef __REACTOS__ uliFree.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl; -#else - uliFree = dwSecPerCl * dwBytPerSec * dwFreeCl; -#endif ConvertULargeInteger (uliFree, buffer, sizeof(buffer)); ConOutPrintf (_T(" %15s bytes free\n"), buffer); } @@ -748,11 +722,7 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags) ULONG dircount = 0; INT count; -#ifndef __REACTOS__ bytecount.QuadPart = 0; -#else - bytecount = 0; -#endif _tcscpy (szFullPath, szPath); if (szFullPath[_tcslen(szFullPath) - 1] != _T('\\')) @@ -840,15 +810,9 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags) count = 0; } -#ifndef __REACTOS__ - uliSize.u.LowPart = file.nFileSizeLow; - uliSize.u.HighPart = file.nFileSizeHigh; + uliSize.LowPart = file.nFileSizeLow; + uliSize.HighPart = file.nFileSizeHigh; bytecount.QuadPart += uliSize.QuadPart; -#else - SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow); - SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh); - bytecount += uliSize; -#endif } else if (dwFlags & DIR_BARE) { @@ -877,15 +841,9 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags) if (IncLine (pLine, dwFlags)) return 1; -#ifndef __REACTOS__ - uliSize.u.LowPart = file.nFileSizeLow; - uliSize.u.HighPart = file.nFileSizeHigh; + uliSize.LowPart = file.nFileSizeLow; + uliSize.HighPart = file.nFileSizeHigh; bytecount.QuadPart += uliSize.QuadPart; -#else - SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow); - SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh); - bytecount += uliSize; -#endif } else { @@ -908,22 +866,13 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags) { ULARGE_INTEGER uliSize; -#ifndef __REACTOS__ - uliSize.u.LowPart = file.nFileSizeLow; - uliSize.u.HighPart = file.nFileSizeHigh; -#else - SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow); - SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh); -#endif + uliSize.LowPart = file.nFileSizeLow; + uliSize.HighPart = file.nFileSizeHigh; ConvertULargeInteger (uliSize, buffer, sizeof(buffer)); ConOutPrintf (_T(" %20s"), buffer); -#ifndef __REACTOS__ bytecount.QuadPart += uliSize.QuadPart; -#else - bytecount += uliSize; -#endif filecount++; } @@ -969,21 +918,11 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags) { ULARGE_INTEGER uliSize; -#ifndef __REACTOS__ - uliSize.u.LowPart = file.nFileSizeLow; - uliSize.u.HighPart = file.nFileSizeHigh; -#else - SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow); - SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh); -#endif - - ConvertULargeInteger (uliSize, buffer, sizeof(buffer)); + uliSize.LowPart = file.nFileSizeLow; + uliSize.HighPart = file.nFileSizeHigh; + ConvertULargeInteger (uliSize, buffer, sizeof(buffer)); ConOutPrintf (_T(" %10s "), buffer); -#ifndef __REACTOS__ bytecount.QuadPart += uliSize.QuadPart; -#else - bytecount += uliSize; -#endif filecount++; } @@ -1018,11 +957,7 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags) { recurse_dir_cnt += dircount; recurse_file_cnt += filecount; -#ifndef __REACTOS__ recurse_bytes.QuadPart += bytecount.QuadPart; -#else - recurse_bytes += bytecount; -#endif /* print_summary */ if (PrintSummary (szPath, filecount, dircount, bytecount, pLine, dwFlags)) @@ -1101,14 +1036,6 @@ DirRead (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags) static INT DirRecurse (LPTSTR szPath, LPTSTR szSpec, LPINT pLine, DWORD dwFlags) { - recurse_dir_cnt = 0L; - recurse_file_cnt = 0L; -#ifdef __REACTOS__ - recurse_bytes = 0; -#else - recurse_bytes.QuadPart = 0; -#endif - if (!PrintDirectoryHeader (szPath, pLine, dwFlags)) return 1; @@ -1131,7 +1058,7 @@ DirRecurse (LPTSTR szPath, LPTSTR szSpec, LPINT pLine, DWORD dwFlags) dwFlags &= ~DIR_RECURSE; if (PrintSummary (szPath, recurse_file_cnt, - recurse_dir_cnt, recurse_bytes, pLine, dwFlags)) + recurse_dir_cnt, recurse_bytes, pLine, dwFlags)) return 1; if ((dwFlags & DIR_BARE) == 0) @@ -1160,6 +1087,10 @@ INT cmd_dir (LPTSTR first, LPTSTR rest) INT nLine = 0; + recurse_dir_cnt = 0L; + recurse_file_cnt = 0L; + recurse_bytes.QuadPart = 0; + /* read the parameters from the DIRCMD environment variable */ if (GetEnvironmentVariable (_T("DIRCMD"), dircmd, 256)) { diff --git a/reactos/drivers/dd/ide/ide.c b/reactos/drivers/dd/ide/ide.c index 17a38093afb..b25d1c455b9 100644 --- a/reactos/drivers/dd/ide/ide.c +++ b/reactos/drivers/dd/ide/ide.c @@ -1185,28 +1185,28 @@ IDEDispatchReadWrite(IN PDEVICE_OBJECT pDO, DPRINT("Offset:%ld * BytesPerSector:%ld = AdjOffset:%ld:%ld\n", DeviceExtension->Offset, DeviceExtension->BytesPerSector, - (unsigned long) GET_LARGE_INTEGER_HIGH_PART(AdjustedOffset), - (unsigned long) GET_LARGE_INTEGER_LOW_PART(AdjustedOffset)); + (unsigned long) AdjustedOffset.HighPart, + (unsigned long) AdjustedOffset.LowPart); DPRINT("AdjOffset:%ld:%ld + ByteOffset:%ld:%ld = ", - (unsigned long) GET_LARGE_INTEGER_HIGH_PART(AdjustedOffset), - (unsigned long) GET_LARGE_INTEGER_LOW_PART(AdjustedOffset), - (unsigned long) GET_LARGE_INTEGER_HIGH_PART(IrpStack->Parameters.Read.ByteOffset), - (unsigned long) GET_LARGE_INTEGER_LOW_PART(IrpStack->Parameters.Read.ByteOffset)); + (unsigned long) AdjustedOffset.HighPart, + (unsigned long) AdjustedOffset.LowPart, + (unsigned long) IrpStack->Parameters.Read.ByteOffset.HighPart, + (unsigned long) IrpStack->Parameters.Read.ByteOffset.LowPart); AdjustedOffset = RtlLargeIntegerAdd(AdjustedOffset, IrpStack->Parameters.Read.ByteOffset); DPRINT("AdjOffset:%ld:%ld\n", - (unsigned long) GET_LARGE_INTEGER_HIGH_PART(AdjustedOffset), - (unsigned long) GET_LARGE_INTEGER_LOW_PART(AdjustedOffset)); + (unsigned long) AdjustedOffset.HighPart, + (unsigned long) AdjustedOffset.LowPart); AdjustedExtent = RtlLargeIntegerAdd(AdjustedOffset, RtlConvertLongToLargeInteger(IrpStack->Parameters.Read.Length)); DPRINT("AdjOffset:%ld:%ld + Length:%ld = AdjExtent:%ld:%ld\n", - (unsigned long) GET_LARGE_INTEGER_HIGH_PART(AdjustedOffset), - (unsigned long) GET_LARGE_INTEGER_LOW_PART(AdjustedOffset), + (unsigned long) AdjustedOffset.HighPart, + (unsigned long) AdjustedOffset.LowPart, IrpStack->Parameters.Read.Length, - (unsigned long) GET_LARGE_INTEGER_HIGH_PART(AdjustedExtent), - (unsigned long) GET_LARGE_INTEGER_LOW_PART(AdjustedExtent)); + (unsigned long) AdjustedExtent.HighPart, + (unsigned long) AdjustedExtent.LowPart); /* FIXME: this assumption will fail on drives bigger than 1TB */ - LARGE_INTEGER_QUAD_PART(PartitionExtent) = DeviceExtension->Offset + DeviceExtension->Size; + PartitionExtent.QuadPart = DeviceExtension->Offset + DeviceExtension->Size; PartitionExtent = RtlExtendedIntegerMultiply(PartitionExtent, DeviceExtension->BytesPerSector); if (RtlLargeIntegerGreaterThan(AdjustedExtent, PartitionExtent) || @@ -1214,10 +1214,10 @@ DPRINT("AdjOffset:%ld:%ld + Length:%ld = AdjExtent:%ld:%ld\n", { DPRINT("Request failed on bad parameters\n",0); DPRINT("AdjustedExtent=%d:%d PartitionExtent=%d:%d ReadLength=%d\n", - (unsigned int) GET_LARGE_INTEGER_HIGH_PART(AdjustedExtent), - (unsigned int) GET_LARGE_INTEGER_LOW_PART(AdjustedExtent), - (unsigned int) GET_LARGE_INTEGER_HIGH_PART(PartitionExtent), - (unsigned int) GET_LARGE_INTEGER_LOW_PART(PartitionExtent), + (unsigned int) AdjustedExtent.HighPart, + (unsigned int) AdjustedExtent.LowPart, + (unsigned int) PartitionExtent.HighPart, + (unsigned int) PartitionExtent.LowPart, IrpStack->Parameters.Read.Length); Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; IoCompleteRequest(Irp, IO_NO_INCREMENT); @@ -1230,7 +1230,7 @@ DPRINT("AdjOffset:%ld:%ld + Length:%ld = AdjExtent:%ld:%ld\n", // Start the packet and insert the request in order of sector offset assert(DeviceExtension->BytesPerSector == 512); InsertKeyLI = RtlLargeIntegerShiftRight(IrpStack->Parameters.Read.ByteOffset, 9); - IrpInsertKey = GET_LARGE_INTEGER_LOW_PART(InsertKeyLI); + IrpInsertKey = InsertKeyLI.LowPart; IoStartPacket(DeviceExtension->DeviceObject, Irp, &IrpInsertKey, NULL); return STATUS_PENDING; @@ -1282,7 +1282,7 @@ IDEDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, Geometry = (PDISK_GEOMETRY) Irp->AssociatedIrp.SystemBuffer; Geometry->MediaType = FixedMedia; // FIXME: should report for RawDevice even on partition - QUAD_PART(Geometry->Cylinders) = DeviceExtension->Size / + Geometry->Cylinders.QuadPart = DeviceExtension->Size / DeviceExtension->SectorsPerLogCyl; Geometry->TracksPerCylinder = DeviceExtension->SectorsPerLogTrk / DeviceExtension->SectorsPerLogCyl; @@ -1360,7 +1360,7 @@ IDEStartIo(IN PDEVICE_OBJECT DeviceObject, DeviceExtension->BytesRequested = IrpStack->Parameters.Read.Length; assert(DeviceExtension->BytesPerSector == 512); SectorLI = RtlLargeIntegerShiftRight(IrpStack->Parameters.Read.ByteOffset, 9); - DeviceExtension->StartingSector = GET_LARGE_INTEGER_LOW_PART(SectorLI); + DeviceExtension->StartingSector = SectorLI.LowPart; if (DeviceExtension->BytesRequested > DeviceExtension->BytesPerSector * IDE_MAX_SECTORS_PER_XFER) { diff --git a/reactos/drivers/dd/sdisk/sdisk.c b/reactos/drivers/dd/sdisk/sdisk.c index ed6c2f21831..c077f2dfa70 100644 --- a/reactos/drivers/dd/sdisk/sdisk.c +++ b/reactos/drivers/dd/sdisk/sdisk.c @@ -67,8 +67,8 @@ NTSTATUS Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) if ((i%512)==0) { DPRINT("Offset %x\n", - GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Write.ByteOffset)+i); - SdWriteOffset(GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Write.ByteOffset)+i); + Stack->Parameters.Write.ByteOffset.LowPart+i); + SdWriteOffset(Stack->Parameters.Write.ByteOffset.LowPart+i); } outb_p(PORT,Buffer[i]); DbgPrint("%c",Buffer[i]); @@ -77,8 +77,8 @@ NTSTATUS Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) for (i=0;i<(Length/512);i++) { DPRINT("Offset %x\n", - GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Write.ByteOffset)+i); - SdWriteOffset(GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Write.ByteOffset)+i); + Stack->Parameters.Write.ByteOffset.LowPart+i); + SdWriteOffset(Stack->Parameters.Write.ByteOffset.LowPart+i); outsb(PORT,Buffer,512); } status = STATUS_SUCCESS; @@ -99,8 +99,8 @@ NTSTATUS Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) if ((i%512)==0) { DPRINT("Offset %d\n", - GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Write.ByteOffset)+i); - SdWriteOffset(GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Write.ByteOffset)+i); + Stack->Parameters.Write.ByteOffset.LowPart+i); + SdWriteOffset(Stack->Parameters.Write.ByteOffset.LowPart+i); } Buffer[i]=inb_p(PORT); } diff --git a/reactos/drivers/fs/ext2/blockdev.c b/reactos/drivers/fs/ext2/blockdev.c index 1eba63fa213..9687ed29a0f 100644 --- a/reactos/drivers/fs/ext2/blockdev.c +++ b/reactos/drivers/fs/ext2/blockdev.c @@ -33,17 +33,17 @@ BOOLEAN Ext2ReadSectors(IN PDEVICE_OBJECT pDeviceObject, ULONG sectorSize; int j; - DPRINT("VFATReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n", - pDeviceObject,DiskSector,Buffer); + DPRINT("VFATReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n", + pDeviceObject,DiskSector,Buffer); - SET_LARGE_INTEGER_HIGH_PART(sectorNumber, 0); - SET_LARGE_INTEGER_LOW_PART(sectorNumber, DiskSector * BLOCKSIZE); + sectorNumber.HighPart = 0; + sectorNumber.LowPart = DiskSector * BLOCKSIZE; -DPRINT("DiskSector:%ld BLKSZ:%ld sectorNumber:%ld:%ld\n", - (unsigned long) DiskSector, - (unsigned long) BLOCKSIZE, - (unsigned long) GET_LARGE_INTEGER_HIGH_PART(sectorNumber), - (unsigned long) GET_LARGE_INTEGER_LOW_PART(sectorNumber)); + DPRINT("DiskSector:%ld BLKSZ:%ld sectorNumber:%ld:%ld\n", + (unsigned long) DiskSector, + (unsigned long) BLOCKSIZE, + (unsigned long) sectorNumber.HighPart, + (unsigned long) sectorNumber.LowPart); KeInitializeEvent(&event, NotificationEvent, FALSE); @@ -101,11 +101,11 @@ BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject, PULONG mbr; int j; - DPRINT("VFATWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n", - pDeviceObject,DiskSector,Buffer); + DPRINT("VFATWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n", + pDeviceObject,DiskSector,Buffer); - SET_LARGE_INTEGER_HIGH_PART(sectorNumber, 0); - SET_LARGE_INTEGER_LOW_PART(sectorNumber, DiskSector * BLOCKSIZE); + sectorNumber.HighPart = 0; + sectorNumber.LowPart = DiskSector * BLOCKSIZE; KeInitializeEvent(&event, NotificationEvent, FALSE); @@ -152,4 +152,3 @@ BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject, return TRUE; } - diff --git a/reactos/drivers/fs/ext2/dir.c b/reactos/drivers/fs/ext2/dir.c index 68485e50894..7b2ad1a61a3 100644 --- a/reactos/drivers/fs/ext2/dir.c +++ b/reactos/drivers/fs/ext2/dir.c @@ -73,7 +73,7 @@ PVOID Ext2ProcessDirEntry(PDEVICE_EXTENSION DeviceExt, // FDI->LastAccessTime = 0; // FDI->LastWriteTime = 0; // FDI->ChangeTime = 0; - FDI->AllocationSize = FDI->EndOfFile = inode.i_size; + FDI->AllocationSize.QuadPart = FDI->EndOfFile.QuadPart = inode.i_size; FDI->FileAttributes = 0; FDI->FileNameLength = dir_entry->name_len; Ext2ConvertName(FDI->FileName, dir_entry->name, dir_entry->name_len); @@ -85,7 +85,7 @@ PVOID Ext2ProcessDirEntry(PDEVICE_EXTENSION DeviceExt, FBI->NextEntryOffset = sizeof(FileBothDirectoryInformation) + dir_entry->name_len + 1; FBI->FileIndex = FileIndex; - FBI->AllocationSize = FBI->EndOfFile = inode.i_size; + FBI->AllocationSize.QuadPart = FBI->EndOfFile.QuadPart = inode.i_size; FBI->FileAttributes = 0; FBI->FileNameLength = dir_entry->name_len; Ext2ConvertName(FBI->FileName, dir_entry->name, dir_entry->name_len); diff --git a/reactos/drivers/fs/ext2/rw.c b/reactos/drivers/fs/ext2/rw.c index da92da738e0..35e0029da28 100644 --- a/reactos/drivers/fs/ext2/rw.c +++ b/reactos/drivers/fs/ext2/rw.c @@ -29,7 +29,7 @@ NTSTATUS Ext2ReadFile(PDEVICE_EXTENSION DeviceExt, { PEXT2_FCB Fcb; PVOID TempBuffer; - ULONG Offset = OffsetL; + ULONG Offset = OffsetL.LowPart; ULONG block; ULONG Delta; ULONG i; diff --git a/reactos/drivers/fs/ext2/super.c b/reactos/drivers/fs/ext2/super.c index 8d23a756129..a9bac494387 100644 --- a/reactos/drivers/fs/ext2/super.c +++ b/reactos/drivers/fs/ext2/super.c @@ -57,7 +57,7 @@ NTSTATUS Ext2Read(PDEVICE_OBJECT DeviceObject, PIRP Irp) { ULONG Length; PVOID Buffer; - ULONG Offset; + LARGE_INTEGER Offset; PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); PFILE_OBJECT FileObject = Stack->FileObject; PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension; diff --git a/reactos/drivers/fs/minix/blockdev.c b/reactos/drivers/fs/minix/blockdev.c index cf591efb7cf..28a87d16ea7 100644 --- a/reactos/drivers/fs/minix/blockdev.c +++ b/reactos/drivers/fs/minix/blockdev.c @@ -32,11 +32,11 @@ BOOLEAN MinixReadSector(IN PDEVICE_OBJECT pDeviceObject, ULONG sectorSize; PULONG mbr; - DPRINT("MinixReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n", - pDeviceObject,DiskSector,Buffer); + DPRINT("MinixReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n", + pDeviceObject,DiskSector,Buffer); - SET_LARGE_INTEGER_HIGH_PART(sectorNumber, 0); - SET_LARGE_INTEGER_LOW_PART(sectorNumber, DiskSector * BLOCKSIZE); + sectorNumber.HighPart = 0; + sectorNumber.LowPart = DiskSector * BLOCKSIZE; KeInitializeEvent(&event, NotificationEvent, FALSE); @@ -79,7 +79,7 @@ BOOLEAN MinixReadSector(IN PDEVICE_OBJECT pDeviceObject, return FALSE; } - RtlCopyMemory(Buffer,mbr,sectorSize); + RtlCopyMemory(Buffer,mbr,sectorSize); ExFreePool(mbr); return TRUE; @@ -95,12 +95,12 @@ BOOLEAN MinixWriteSector(IN PDEVICE_OBJECT pDeviceObject, KEVENT event; NTSTATUS status; ULONG sectorSize; + + DPRINT("MinixWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n", + pDeviceObject,DiskSector,Buffer); - DPRINT("MinixWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n", - pDeviceObject,DiskSector,Buffer); - - SET_LARGE_INTEGER_HIGH_PART(sectorNumber, 0); - SET_LARGE_INTEGER_LOW_PART(sectorNumber, DiskSector * BLOCKSIZE); + sectorNumber.HighPart = 0; + sectorNumber.LowPart = DiskSector * BLOCKSIZE; KeInitializeEvent(&event, NotificationEvent, FALSE); diff --git a/reactos/drivers/fs/minix/rw.c b/reactos/drivers/fs/minix/rw.c index df5b317fca1..a879e6f57cd 100644 --- a/reactos/drivers/fs/minix/rw.c +++ b/reactos/drivers/fs/minix/rw.c @@ -10,6 +10,7 @@ /* INCLUDES *****************************************************************/ #include +#include #define NDEBUG #include @@ -44,7 +45,7 @@ NTSTATUS MinixRead(PDEVICE_OBJECT DeviceObject, PIRP Irp) Length = Stack->Parameters.Read.Length; Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress); - Offset = GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Read.ByteOffset); + Offset = Stack->Parameters.Read.ByteOffset.LowPart; DPRINT("Length %d Buffer %x Offset %x\n",Length,Buffer,Offset); diff --git a/reactos/drivers/fs/vfat/blockdev.c b/reactos/drivers/fs/vfat/blockdev.c index d468372b819..ad6178db498 100644 --- a/reactos/drivers/fs/vfat/blockdev.c +++ b/reactos/drivers/fs/vfat/blockdev.c @@ -30,8 +30,9 @@ BOOLEAN VFATReadSectors(IN PDEVICE_OBJECT pDeviceObject, NTSTATUS status; ULONG sectorSize; - SET_LARGE_INTEGER_LOW_PART(sectorNumber, DiskSector << 9); - SET_LARGE_INTEGER_HIGH_PART(sectorNumber, DiskSector >> 23); + sectorNumber.LowPart = DiskSector << 9; + sectorNumber.HighPart = DiskSector >> 23; + KeInitializeEvent(&event, NotificationEvent, FALSE); sectorSize = BLOCKSIZE * SectorCount; @@ -41,8 +42,8 @@ BOOLEAN VFATReadSectors(IN PDEVICE_OBJECT pDeviceObject, DiskSector, Buffer); DPRINT("sectorNumber %08lx:%08lx sectorSize %ld\n", - (unsigned long int)GET_LARGE_INTEGER_HIGH_PART(sectorNumber), - (unsigned long int)GET_LARGE_INTEGER_LOW_PART(sectorNumber), + (unsigned long int)sectorNumber.LowPart, + (unsigned long int)sectorNumber.HighPart, sectorSize); @@ -81,8 +82,8 @@ BOOLEAN VFATReadSectors(IN PDEVICE_OBJECT pDeviceObject, pDeviceObject, DiskSector, Buffer, - GET_LARGE_INTEGER_HIGH_PART(sectorNumber), - GET_LARGE_INTEGER_LOW_PART(sectorNumber)); + sectorNumber.HighPart, + sectorNumber.LowPart); return FALSE; } DPRINT("Block request succeeded\n"); @@ -101,11 +102,11 @@ BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject, NTSTATUS status; ULONG sectorSize; - DPRINT("VFATWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n", - pDeviceObject,DiskSector,Buffer); + DPRINT("VFATWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n", + pDeviceObject,DiskSector,Buffer); - SET_LARGE_INTEGER_LOW_PART(sectorNumber, DiskSector << 9); - SET_LARGE_INTEGER_HIGH_PART(sectorNumber, DiskSector >> 23); + sectorNumber.LowPart = DiskSector << 9; + sectorNumber.HighPart = DiskSector >> 23; KeInitializeEvent(&event, NotificationEvent, FALSE); diff --git a/reactos/drivers/fs/vfat/dir.c b/reactos/drivers/fs/vfat/dir.c index da0a384a0fd..e2ad09846b5 100644 --- a/reactos/drivers/fs/vfat/dir.c +++ b/reactos/drivers/fs/vfat/dir.c @@ -121,7 +121,7 @@ NTSTATUS FsdGetFileDirectoryInformation(PVfatFCB pFcb, AllocSize = ((pFcb->entry.FileSize + DeviceExt->BytesPerCluster - 1) / DeviceExt->BytesPerCluster) * DeviceExt->BytesPerCluster; - LARGE_INTEGER_QUAD_PART(pInfo->AllocationSize) = AllocSize; + pInfo->AllocationSize.QuadPart = AllocSize; pInfo->FileAttributes=pFcb->entry.Attrib; return STATUS_SUCCESS; @@ -154,7 +154,7 @@ NTSTATUS FsdGetFileFullDirectoryInformation(PVfatFCB pFcb, AllocSize = ((pFcb->entry.FileSize + DeviceExt->BytesPerCluster - 1) / DeviceExt->BytesPerCluster) * DeviceExt->BytesPerCluster; - LARGE_INTEGER_QUAD_PART(pInfo->AllocationSize) = AllocSize; + pInfo->AllocationSize.QuadPart = AllocSize; pInfo->FileAttributes=pFcb->entry.Attrib; // pInfo->EaSize=; return STATUS_SUCCESS; @@ -188,7 +188,7 @@ NTSTATUS FsdGetFileBothInformation(PVfatFCB pFcb, AllocSize = ((pFcb->entry.FileSize + DeviceExt->BytesPerCluster - 1) / DeviceExt->BytesPerCluster) * DeviceExt->BytesPerCluster; - LARGE_INTEGER_QUAD_PART(pInfo->AllocationSize) = AllocSize; + pInfo->AllocationSize.QuadPart = AllocSize; pInfo->FileAttributes=pFcb->entry.Attrib; // pInfo->EaSize=; for (i=0;i<8 && (pFcb->entry.Filename[i]!=' ') ;i++) diff --git a/reactos/drivers/fs/vfat/iface.c b/reactos/drivers/fs/vfat/iface.c index 8b0a148e8cc..57ada8cf4a1 100644 --- a/reactos/drivers/fs/vfat/iface.c +++ b/reactos/drivers/fs/vfat/iface.c @@ -1435,7 +1435,7 @@ NTSTATUS FsdWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp) Length = Stack->Parameters.Write.Length; Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress); - Offset = GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Write.ByteOffset); + Offset = Stack->Parameters.Write.ByteOffset.LowPart; Status = FsdWriteFile(DeviceExt,FileObject,Buffer,Length,Offset); @@ -1473,7 +1473,7 @@ NTSTATUS FsdRead(PDEVICE_OBJECT DeviceObject, PIRP Irp) Length = Stack->Parameters.Read.Length; Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress); - Offset = GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Read.ByteOffset); + Offset = Stack->Parameters.Read.ByteOffset.LowPart; Status = FsdReadFile(DeviceExt,FileObject,Buffer,Length,Offset, &LengthRead); @@ -1588,8 +1588,7 @@ NTSTATUS FsdSetPositionInformation(PFILE_OBJECT FileObject, DPRINT("FsdSetPositionInformation()\n"); DPRINT("PositionInfo %x\n", PositionInfo); - DPRINT("Setting position %d\n",GET_LARGE_INTEGER_LOW_PART( - PositionInfo->CurrentByteOffset)); + DPRINT("Setting position %d\n", PositionInfo->CurrentByteOffset.LowPart); memcpy(&FileObject->CurrentByteOffset,&PositionInfo->CurrentByteOffset, sizeof(LARGE_INTEGER)); @@ -1605,8 +1604,7 @@ NTSTATUS FsdGetPositionInformation(PFILE_OBJECT FileObject, memcpy(&PositionInfo->CurrentByteOffset, &FileObject->CurrentByteOffset, sizeof(LARGE_INTEGER)); - DPRINT("Getting position %x\n",GET_LARGE_INTEGER_LOW_PART( - PositionInfo->CurrentByteOffset)); + DPRINT("Getting position %x\n", PositionInfo->CurrentByteOffset.LowPart); return(STATUS_SUCCESS); } @@ -1760,8 +1758,7 @@ NTSTATUS FsdGetFsVolumeInformation(PFILE_OBJECT FileObject, return(STATUS_SUCCESS); /* dummy entries */ - FsVolumeInfo->VolumeCreationTime.LowPart = 0; - FsVolumeInfo->VolumeCreationTime.HighPart = 0; + FsVolumeInfo->VolumeCreationTime.QuadPart = 0; FsVolumeInfo->VolumeSerialNumber = 0x01234567; FsVolumeInfo->SupportsObjects = FALSE; FsVolumeInfo->VolumeLabelLength = 5; diff --git a/reactos/include/ddk/ntddk.h b/reactos/include/ddk/ntddk.h index 20f0b208911..6a06b3fed97 100644 --- a/reactos/include/ddk/ntddk.h +++ b/reactos/include/ddk/ntddk.h @@ -20,8 +20,6 @@ extern "C" #include -#include - #include #include #include diff --git a/reactos/include/ddk/types.h b/reactos/include/ddk/types.h index ac63b3be0ac..df3ec825020 100644 --- a/reactos/include/ddk/types.h +++ b/reactos/include/ddk/types.h @@ -107,9 +107,13 @@ typedef ULONG WAIT_TYPE; typedef USHORT CSHORT; +#if 0 typedef struct _TIME { DWORD LowPart; LONG HighPart; } TIME; +#endif + +typedef ULARGE_INTEGER TIME; #endif diff --git a/reactos/include/structs.h b/reactos/include/structs.h index e252bf9dc6e..f0cd8425d85 100644 --- a/reactos/include/structs.h +++ b/reactos/include/structs.h @@ -32,24 +32,32 @@ #ifndef _GNU_H_WINDOWS32_STRUCTURES #define _GNU_H_WINDOWS32_STRUCTURES -#ifdef COMPILER_LARGE_INTEGERS +typedef long long int LONGLONG, *PLONGLONG; +typedef unsigned long long int ULONGLONG, *PULONGLONG; -typedef long long int LARGE_INTEGER, *PLARGE_INTEGER; -typedef unsigned long long int ULARGE_INTEGER, *PULARGE_INTEGER; +typedef union _LARGE_INTEGER +{ + struct + { + DWORD ULowPart; + LONG UHighPart; + } u; + LONGLONG QuadPart; +} LARGE_INTEGER, *PLARGE_INTEGER; -#else +typedef union +{ + struct + { + DWORD ULowPart; + DWORD UHighPart; + } u; + ULONGLONG QuadPart; +} ULARGE_INTEGER, *PULARGE_INTEGER; -typedef struct _LARGE_INTEGER { - DWORD LowPart; - LONG HighPart; -} LARGE_INTEGER, *PLARGE_INTEGER; +#define LowPart u.ULowPart +#define HighPart u.UHighPart -typedef struct _ULARGE_INTEGER { - DWORD LowPart; - DWORD HighPart; -} ULARGE_INTEGER, *PULARGE_INTEGER; - -#endif typedef struct _LIST_ENTRY { struct _LIST_ENTRY *Flink; diff --git a/reactos/lib/kernel32/file/copy.c b/reactos/lib/kernel32/file/copy.c index ebe5d465ad9..501fe9f044d 100644 --- a/reactos/lib/kernel32/file/copy.c +++ b/reactos/lib/kernel32/file/copy.c @@ -87,8 +87,7 @@ WINBOOL STDCALL CopyFileExW(LPCWSTR lpExistingFileName, return(FALSE); } - SET_LARGE_INTEGER_LOW_PART(FilePosition.CurrentByteOffset, 0); - SET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset, 0); + FilePosition.CurrentByteOffset.QuadPart = 0; errCode = NtSetInformationFile(FileHandleSource, &IoStatusBlock, diff --git a/reactos/lib/kernel32/file/file.c b/reactos/lib/kernel32/file/file.c index 7b087c0af62..dd2161efed6 100644 --- a/reactos/lib/kernel32/file/file.c +++ b/reactos/lib/kernel32/file/file.c @@ -151,47 +151,41 @@ DWORD STDCALL SetFilePointer(HANDLE hFile, &FilePosition, sizeof(FILE_POSITION_INFORMATION), FilePositionInformation); - SET_LARGE_INTEGER_LOW_PART(FilePosition.CurrentByteOffset, - GET_LARGE_INTEGER_LOW_PART(FilePosition.CurrentByteOffset) + - lDistanceToMove); + FilePosition.CurrentByteOffset.LowPart += lDistanceToMove; if (lpDistanceToMoveHigh != NULL) { - SET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset, - GET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset) + - *lpDistanceToMoveHigh); + FilePosition.CurrentByteOffset.HighPart = + FilePosition.CurrentByteOffset.HighPart + + *lpDistanceToMoveHigh; } } else if (dwMoveMethod == FILE_END) { NtQueryInformationFile(hFile,&IoStatusBlock,&FileEndOfFile, sizeof(FILE_END_OF_FILE_INFORMATION),FileEndOfFileInformation); - SET_LARGE_INTEGER_LOW_PART(FilePosition.CurrentByteOffset, - GET_LARGE_INTEGER_LOW_PART(FileEndOfFile.EndOfFile) - - lDistanceToMove); + FilePosition.CurrentByteOffset.LowPart = + FileEndOfFile.EndOfFile.LowPart - lDistanceToMove; if ( lpDistanceToMoveHigh != NULL ) { - SET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset, - GET_LARGE_INTEGER_HIGH_PART(FileEndOfFile.EndOfFile) - - *lpDistanceToMoveHigh); + FilePosition.CurrentByteOffset.HighPart = + FileEndOfFile.EndOfFile.HighPart - *lpDistanceToMoveHigh; } else { - SET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset, - GET_LARGE_INTEGER_HIGH_PART(FileEndOfFile.EndOfFile)); + FilePosition.CurrentByteOffset.HighPart = + FileEndOfFile.EndOfFile.HighPart; } } else if ( dwMoveMethod == FILE_BEGIN ) { - SET_LARGE_INTEGER_LOW_PART(FilePosition.CurrentByteOffset, - lDistanceToMove); + FilePosition.CurrentByteOffset.LowPart = lDistanceToMove; if ( lpDistanceToMoveHigh != NULL ) { - SET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset, - *lpDistanceToMoveHigh); + FilePosition.CurrentByteOffset.HighPart = + *lpDistanceToMoveHigh; } else { - SET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset, - 0); + FilePosition.CurrentByteOffset.HighPart = 0; } } @@ -208,10 +202,9 @@ DWORD STDCALL SetFilePointer(HANDLE hFile, if (lpDistanceToMoveHigh != NULL) { - *lpDistanceToMoveHigh = GET_LARGE_INTEGER_HIGH_PART( - FilePosition.CurrentByteOffset); + *lpDistanceToMoveHigh = FilePosition.CurrentByteOffset.HighPart; } - return GET_LARGE_INTEGER_LOW_PART(FilePosition.CurrentByteOffset); + return FilePosition.CurrentByteOffset.LowPart; } DWORD STDCALL GetFileType(HANDLE hFile) @@ -247,10 +240,10 @@ DWORD STDCALL GetFileSize(HANDLE hFile, } } if ( lpFileSizeHigh != NULL ) - *lpFileSizeHigh = GET_LARGE_INTEGER_HIGH_PART(FileStandard.AllocationSize); + *lpFileSizeHigh = FileStandard.AllocationSize.HighPart; CloseHandle(hFile); - return GET_LARGE_INTEGER_LOW_PART(FileStandard.AllocationSize); + return FileStandard.AllocationSize.LowPart; } DWORD STDCALL GetCompressedFileSizeA(LPCSTR lpFileName, @@ -328,8 +321,8 @@ WINBOOL STDCALL GetFileInformationByHandle(HANDLE hFile, memcpy(&lpFileInformation->ftCreationTime,&FileDirectory.CreationTime,sizeof(LARGE_INTEGER)); memcpy(&lpFileInformation->ftLastAccessTime,&FileDirectory.LastAccessTime,sizeof(LARGE_INTEGER)); memcpy(&lpFileInformation->ftLastWriteTime, &FileDirectory.LastWriteTime,sizeof(LARGE_INTEGER)); - lpFileInformation->nFileSizeHigh = GET_LARGE_INTEGER_HIGH_PART(FileDirectory.AllocationSize); - lpFileInformation->nFileSizeLow = GET_LARGE_INTEGER_LOW_PART(FileDirectory.AllocationSize); + lpFileInformation->nFileSizeHigh = FileDirectory.AllocationSize.HighPart; + lpFileInformation->nFileSizeLow = FileDirectory.AllocationSize.LowPart; errCode = NtQueryInformationFile(hFile, &IoStatusBlock, @@ -341,8 +334,8 @@ WINBOOL STDCALL GetFileInformationByHandle(HANDLE hFile, SetLastError(RtlNtStatusToDosError(errCode)); return FALSE; } - lpFileInformation->nFileIndexHigh = GET_LARGE_INTEGER_HIGH_PART(FileInternal.IndexNumber); - lpFileInformation->nFileIndexLow = GET_LARGE_INTEGER_LOW_PART(FileInternal.IndexNumber); + lpFileInformation->nFileIndexHigh = FileInternal.IndexNumber.HighPart; + lpFileInformation->nFileIndexLow = FileInternal.IndexNumber.LowPart; errCode = NtQueryVolumeInformationFile(hFile, &IoStatusBlock, diff --git a/reactos/lib/kernel32/file/find.c b/reactos/lib/kernel32/file/find.c index 7e925268119..a63821775c9 100644 --- a/reactos/lib/kernel32/file/find.c +++ b/reactos/lib/kernel32/file/find.c @@ -96,8 +96,8 @@ static FileDataToWin32Data(LPWIN32_FIND_DATA lpFindFileData, PKERNEL32_FIND_FILE // memcpy(&lpFindFileData->ftCreationTime,&IData->FileInfo.CreationTime,sizeof(FILETIME)); // memcpy(&lpFindFileData->ftLastAccessTime,&IData->FileInfo.LastAccessTime,sizeof(FILETIME)); // memcpy(&lpFindFileData->ftLastWriteTime,&IData->FileInfo.LastWriteTime,sizeof(FILETIME)); - lpFindFileData->nFileSizeHigh = IData->FileInfo.EndOfFile>>32; - lpFindFileData->nFileSizeLow = IData->FileInfo.EndOfFile; + lpFindFileData->nFileSizeHigh = IData->FileInfo.EndOfFile.HighPart; + lpFindFileData->nFileSizeLow = IData->FileInfo.EndOfFile.LowPart; } @@ -112,7 +112,6 @@ HANDLE STDCALL InternalFindFirstFile(LPCWSTR lpFileName, OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING DirectoryNameStr; IO_STATUS_BLOCK IoStatusBlock; -// DWORD Len = 0; DPRINT("FindFirstFileW(lpFileName %w, lpFindFileData %x)\n", lpFileName, lpFindFileData); diff --git a/reactos/lib/kernel32/file/lock.c b/reactos/lib/kernel32/file/lock.c index 0bc68596ee3..bf4cd8364f8 100644 --- a/reactos/lib/kernel32/file/lock.c +++ b/reactos/lib/kernel32/file/lock.c @@ -69,8 +69,8 @@ LockFileEx( lpOverlapped->Internal = STATUS_PENDING; - SET_LARGE_INTEGER_LOW_PART(Offset, lpOverlapped->Offset); - SET_LARGE_INTEGER_HIGH_PART(Offset, lpOverlapped->OffsetHigh); + Offset.LowPart = lpOverlapped->Offset; + Offset.HighPart = lpOverlapped->OffsetHigh; if ( (dwFlags & LOCKFILE_FAIL_IMMEDIATELY) == LOCKFILE_FAIL_IMMEDIATELY ) LockImmediate = TRUE; @@ -82,8 +82,8 @@ LockFileEx( else LockExclusive = FALSE; - SET_LARGE_INTEGER_LOW_PART(BytesToLock, nNumberOfBytesToLockLow); - SET_LARGE_INTEGER_HIGH_PART(BytesToLock, nNumberOfBytesToLockHigh); + BytesToLock.LowPart = nNumberOfBytesToLockLow; + BytesToLock.HighPart = nNumberOfBytesToLockHigh; errCode = NtLockFile(hFile, NULL, @@ -151,11 +151,11 @@ UnlockFileEx( return FALSE; } - SET_LARGE_INTEGER_LOW_PART(BytesToUnLock, nNumberOfBytesToUnLockLow); - SET_LARGE_INTEGER_HIGH_PART(BytesToUnLock, nNumberOfBytesToUnLockHigh); + BytesToUnLock.LowPart = nNumberOfBytesToUnLockLow; + BytesToUnLock.HighPart = nNumberOfBytesToUnLockHigh; - SET_LARGE_INTEGER_LOW_PART(StartAddress, lpOverlapped->Offset); - SET_LARGE_INTEGER_HIGH_PART(StartAddress, lpOverlapped->OffsetHigh); + StartAddress.LowPart = lpOverlapped->Offset; + StartAddress.HighPart = lpOverlapped->OffsetHigh; errCode = NtUnlockFile(hFile, (PIO_STATUS_BLOCK)lpOverlapped, diff --git a/reactos/lib/kernel32/file/rw.c b/reactos/lib/kernel32/file/rw.c index dc76169497b..b17de4ba30e 100644 --- a/reactos/lib/kernel32/file/rw.c +++ b/reactos/lib/kernel32/file/rw.c @@ -37,8 +37,8 @@ WINBOOL STDCALL WriteFile(HANDLE hFile, if (lpOverLapped != NULL ) { - SET_LARGE_INTEGER_LOW_PART(Offset, lpOverLapped->Offset); - SET_LARGE_INTEGER_HIGH_PART(Offset, lpOverLapped->OffsetHigh); + Offset.LowPart = lpOverLapped->Offset; + Offset.HighPart = lpOverLapped->OffsetHigh; lpOverLapped->Internal = STATUS_PENDING; hEvent= lpOverLapped->hEvent; IoStatusBlock = (PIO_STATUS_BLOCK)lpOverLapped; @@ -46,7 +46,7 @@ WINBOOL STDCALL WriteFile(HANDLE hFile, else { IoStatusBlock = &IIosb; - Offset = NULL; + Offset.QuadPart = 0; } errCode = NtWriteFile(hFile, hEvent, @@ -88,8 +88,8 @@ WINBOOL STDCALL KERNEL32_ReadFile(HANDLE hFile, if (lpOverLapped != NULL) { - SET_LARGE_INTEGER_LOW_PART(Offset, lpOverLapped->Offset); - SET_LARGE_INTEGER_HIGH_PART(Offset, lpOverLapped->OffsetHigh); + Offset.LowPart = lpOverLapped->Offset; + Offset.HighPart = lpOverLapped->OffsetHigh; lpOverLapped->Internal = STATUS_PENDING; hEvent = lpOverLapped->hEvent; IoStatusBlock = (PIO_STATUS_BLOCK)lpOverLapped; diff --git a/reactos/lib/kernel32/file/volume.c b/reactos/lib/kernel32/file/volume.c index 2ca5215f8fc..8e16324f570 100644 --- a/reactos/lib/kernel32/file/volume.c +++ b/reactos/lib/kernel32/file/volume.c @@ -178,8 +178,8 @@ GetDiskFreeSpaceW( *lpBytesPerSector = FileFsSize.BytesPerSector; *lpSectorsPerCluster = FileFsSize.SectorsPerAllocationUnit; - *lpNumberOfFreeClusters = GET_LARGE_INTEGER_LOW_PART(FileFsSize.AvailableAllocationUnits); - *lpTotalNumberOfClusters = GET_LARGE_INTEGER_LOW_PART(FileFsSize.TotalAllocationUnits); + *lpNumberOfFreeClusters = FileFsSize.AvailableAllocationUnits.LowPart; + *lpTotalNumberOfClusters = FileFsSize.TotalAllocationUnits.LowPart; CloseHandle(hFile); return TRUE; } @@ -322,7 +322,6 @@ GetVolumeInformationW( DPRINT("FileFsVolume %p\n", FileFsVolume); DPRINT("FileFsAttribute %p\n", FileFsAttribute); -CHECKPOINT; hFile = CreateFileW(lpRootPathName, FILE_READ_ATTRIBUTES, FILE_SHARE_READ|FILE_SHARE_WRITE, @@ -337,42 +336,34 @@ CHECKPOINT; FileFsVolume, FS_VOLUME_BUFFER_SIZE, FileFsVolumeInformation); -CHECKPOINT; if ( !NT_SUCCESS(errCode) ) { DPRINT("Status: %x\n", errCode); CloseHandle(hFile); SetLastError(RtlNtStatusToDosError(errCode)); return FALSE; } -CHECKPOINT; + if (lpVolumeSerialNumber) *lpVolumeSerialNumber = FileFsVolume->VolumeSerialNumber; -CHECKPOINT; + if (lpVolumeNameBuffer) wcsncpy(lpVolumeNameBuffer, FileFsVolume->VolumeLabel,min(nVolumeNameSize,MAX_PATH)); -// memcpy(lpVolumeNameBuffer, FileFsVolume->VolumeLabel,min(nVolumeNameSize,MAX_PATH)); -CHECKPOINT; + errCode = NtQueryVolumeInformationFile(hFile,&IoStatusBlock,FileFsAttribute, FS_ATTRIBUTE_BUFFER_SIZE,FileFsAttributeInformation); -CHECKPOINT; if ( !NT_SUCCESS(errCode) ) { DPRINT("Status: %x\n", errCode); CloseHandle(hFile); SetLastError(RtlNtStatusToDosError(errCode)); return FALSE; } -CHECKPOINT; + if (lpFileSystemFlags) *lpFileSystemFlags = FileFsAttribute->FileSystemAttributes; -// memcpy(lpFileSystemFlags,&FileFsAttribute->FileSystemAttributes,sizeof(DWORD)); -CHECKPOINT; if (lpMaximumComponentLength) *lpMaximumComponentLength = FileFsAttribute->MaximumComponentNameLength; -// memcpy(lpMaximumComponentLength, &FileFsAttribute->MaximumComponentNameLength, sizeof(DWORD)); -CHECKPOINT; if (lpFileSystemNameBuffer) wcsncpy(lpFileSystemNameBuffer, FileFsAttribute->FileSystemName,min(nFileSystemNameSize,MAX_PATH)); -// memcpy(lpFileSystemNameBuffer, FileFsAttribute->FileSystemName,min(nFileSystemNameSize,MAX_PATH)); -CHECKPOINT; + CloseHandle(hFile); return TRUE; } diff --git a/reactos/lib/kernel32/mem/section.c b/reactos/lib/kernel32/mem/section.c index f02a598cd1e..f8fdafbb6c4 100644 --- a/reactos/lib/kernel32/mem/section.c +++ b/reactos/lib/kernel32/mem/section.c @@ -27,8 +27,8 @@ HANDLE CreationFileMappingA(HANDLE hFile, ANSI_STRING AnsiName; UNICODE_STRING UnicodeName; - SET_LARGE_INTEGER_LOW_PART(MaximumSize, dwMaximumSizeLow); - SET_LARGE_INTEGER_HIGH_PART(MaximumSize, dwMaximumSizeHigh); + MaximumSize.LowPart = dwMaximumSizeLow; + MaximumSize.HighPart = dwMaximumSizeHigh; RtlInitAnsiString(&AnsiString, lpName); RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE); InitializeObjectAttributes(&ObjectAttributes, @@ -63,8 +63,8 @@ HANDLE CreationFileMappingW(HANDLE hFile, OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING UnicodeName; - SET_LARGE_INTEGER_LOW_PART(MaximumSize, dwMaximumSizeLow); - SET_LARGE_INTEGER_HIGH_PART(MaximumSize, dwMaximumSizeHigh); + MaximumSize.LowPart = dwMaximumSizeLow; + MaximumSize.HighPart = dwMaximumSizeHigh; RtlInitUnicodeString(&UnicodeString, lpName); InitializeObjectAttributes(&ObjectAttributes, &UnicodeName, diff --git a/reactos/lib/kernel32/misc/time.c b/reactos/lib/kernel32/misc/time.c index c9dd19d3a72..83fa1212a64 100644 --- a/reactos/lib/kernel32/misc/time.c +++ b/reactos/lib/kernel32/misc/time.c @@ -10,6 +10,7 @@ */ #include #include +#include typedef struct __DOSTIME { @@ -138,13 +139,13 @@ CompareFileTime( if ( lpFileTime2 == NULL ) return 0; /* - if ((GET_LARGE_INTEGER_HIGH_PART(lpFileTime1)) > (GET_LARGE_INTEGER_HIGH_PART(lpFileTime2)) ) + if (lpFileTime1.HighPart > lpFileTime2.HighPart) return 1; - else if ((GET_LARGE_INTEGER_HIGH_PART(lpFileTime1)) < (GET_LARGE_INTEGER_HIGH_PART(lpFileTime2))) + else if (lpFileTime1.HighPart < lpFileTime2.HighPart) return -1; - else if ((GET_LARGE_INTEGER_LOW_PART(lpFileTime1)) > (GET_LARGE_INTEGER_LOW_PART(lpFileTime2))) + else if (lpFileTime1.LowPart > lpFileTime2.LowPart) return 1; - else if ((GET_LARGE_INTEGER_LOW_PART(lpFileTime1)) < (GET_LARGE_INTEGER_LOW_PART(lpFileTime2))) + else if (lpFileTime1.LowPart < lpFileTime2.LowPart) return -1; else return 0; @@ -172,8 +173,6 @@ SystemTimeToFileTime( ) { - - LARGE_INTEGER FileTime; LARGE_INTEGER Year; LARGE_INTEGER Month; @@ -225,16 +224,16 @@ SystemTimeToFileTime( Milliseconds = RtlEnlargedIntegerMultiply(lpSystemTime->wMilliseconds,10000); - FileTime += RtlLargeIntegerAdd(FileTime,Year); - FileTime += RtlLargeIntegerAdd(FileTime,Month); - FileTime += RtlLargeIntegerAdd(FileTime,Day); - FileTime += RtlLargeIntegerAdd(FileTime,Hour); - FileTime += RtlLargeIntegerAdd(FileTime,Minute); - FileTime += RtlLargeIntegerAdd(FileTime,Second); + FileTime = RtlLargeIntegerAdd(FileTime,Year); + FileTime = RtlLargeIntegerAdd(FileTime,Month); + FileTime = RtlLargeIntegerAdd(FileTime,Day); + FileTime = RtlLargeIntegerAdd(FileTime,Hour); + FileTime = RtlLargeIntegerAdd(FileTime,Minute); + FileTime = RtlLargeIntegerAdd(FileTime,Second); - FileTime = RtlExtendedIntegerMultiply(FileTime,NSPERSEC); + FileTime = RtlExtendedIntegerMultiply(FileTime,NSPERSEC); - FileTime = RtlLargeIntegerAdd(FileTime,Milliseconds); + FileTime = RtlLargeIntegerAdd(FileTime,Milliseconds); memcpy(lpFileTime,&FileTime,sizeof(FILETIME)); @@ -296,10 +295,10 @@ FileTimeToSystemTime( dwMinute = RtlLargeIntegerDivide(dwRemHour,LIMINUTE,&dwRemMinute); dwSecond = RtlLargeIntegerDivide(dwRemMinute,LISECOND,&dwRemSecond); - lpSystemTime->wHour= (WORD) GET_LARGE_INTEGER_LOW_PART(dwHour); - lpSystemTime->wMinute= (WORD)GET_LARGE_INTEGER_LOW_PART(dwMinute); - lpSystemTime->wSecond= (WORD)GET_LARGE_INTEGER_LOW_PART(dwSecond); - lpSystemTime->wMilliseconds = (WORD)(GET_LARGE_INTEGER_LOW_PART(dwRemSecond)/10000); + lpSystemTime->wHour= (WORD)(dwHour.LowPart); + lpSystemTime->wMinute= (WORD)(dwMinute.LowPart); + lpSystemTime->wSecond= (WORD)(dwSecond.LowPart); + lpSystemTime->wMilliseconds = (WORD)(dwRemSecond.LowPart/10000); if ( lpSystemTime->wSecond > 60 ) { @@ -314,13 +313,13 @@ FileTimeToSystemTime( if (lpSystemTime->wHour > 24 ) { lpSystemTime->wHour-= 24; - SET_LARGE_INTEGER_LOW_PART(dwDay,GET_LARGE_INTEGER_LOW_PART(dwDay)+1); + dwDay.LowPart = dwDay.LowPart + 1; } //FIXME since 1972 some years have a leap second [ aprox 15 out of 20 ] // if leap year - lpSystemTime->wYear= 1601 + 1000* (LONG)GET_LARGE_INTEGER_LOW_PART(dwMillenium) + 100 * (LONG)GET_LARGE_INTEGER_LOW_PART(dwCentury) + 4*(LONG)GET_LARGE_INTEGER_LOW_PART(dwFourYear) + (LONG)GET_LARGE_INTEGER_LOW_PART(dwYear); + lpSystemTime->wYear = 1601 + 1000* (LONG)dwMillenium.LowPart + 100 * (LONG)dwCentury.LowPart + 4 * (LONG)dwFourYear.LowPart + (LONG)dwYear.LowPart; if ( (lpSystemTime->wYear % 4 == 0 && lpSystemTime->wYear % 100 != 0) || lpSystemTime->wYear % 400 == 0) LeapDay = 1; @@ -329,58 +328,58 @@ FileTimeToSystemTime( - if ( GET_LARGE_INTEGER_LOW_PART(dwDay) >= 0 && GET_LARGE_INTEGER_LOW_PART(dwDay) < 31 ) { + if ( dwDay.LowPart >= 0 && dwDay.LowPart < 31 ) { lpSystemTime->wMonth = 1; - lpSystemTime->wDay = GET_LARGE_INTEGER_LOW_PART(dwDay) + 1; + lpSystemTime->wDay = dwDay.LowPart + 1; } - else if ( GET_LARGE_INTEGER_LOW_PART(dwDay) >= 31 && GET_LARGE_INTEGER_LOW_PART(dwDay) < ( 59 + LeapDay )) { + else if ( dwDay.LowPart >= 31 && dwDay.LowPart < ( 59 + LeapDay )) { lpSystemTime->wMonth = 2; - lpSystemTime->wDay = GET_LARGE_INTEGER_LOW_PART(dwDay) + 1 - 31; + lpSystemTime->wDay = dwDay.LowPart + 1 - 31; } - else if ( GET_LARGE_INTEGER_LOW_PART(dwDay) >= ( 59 + LeapDay ) && GET_LARGE_INTEGER_LOW_PART(dwDay) < ( 90 + LeapDay ) ) { + else if ( dwDay.LowPart >= ( 59 + LeapDay ) && dwDay.LowPart < ( 90 + LeapDay ) ) { lpSystemTime->wMonth = 3; - lpSystemTime->wDay = GET_LARGE_INTEGER_LOW_PART(dwDay) + 1 - ( 59 + LeapDay); + lpSystemTime->wDay = dwDay.LowPart + 1 - ( 59 + LeapDay); } - else if ( GET_LARGE_INTEGER_LOW_PART(dwDay) >= 90+ LeapDay && GET_LARGE_INTEGER_LOW_PART(dwDay) < 120 + LeapDay) { + else if ( dwDay.LowPart >= 90+ LeapDay && dwDay.LowPart < 120 + LeapDay) { lpSystemTime->wMonth = 4; - lpSystemTime->wDay = GET_LARGE_INTEGER_LOW_PART(dwDay) + 1 - (31 + LeapDay ); + lpSystemTime->wDay = dwDay.LowPart + 1 - (31 + LeapDay ); } - else if ( GET_LARGE_INTEGER_LOW_PART(dwDay) >= 120 + LeapDay && GET_LARGE_INTEGER_LOW_PART(dwDay) < 151 + LeapDay ) { + else if ( dwDay.LowPart >= 120 + LeapDay && dwDay.LowPart < 151 + LeapDay ) { lpSystemTime->wMonth = 5; - lpSystemTime->wDay = GET_LARGE_INTEGER_LOW_PART(dwDay) + 1 - (120 + LeapDay); + lpSystemTime->wDay = dwDay.LowPart + 1 - (120 + LeapDay); } - else if ( GET_LARGE_INTEGER_LOW_PART(dwDay) >= ( 151 + LeapDay) && GET_LARGE_INTEGER_LOW_PART(dwDay) < ( 181 + LeapDay ) ) { + else if ( dwDay.LowPart >= ( 151 + LeapDay) && dwDay.LowPart < ( 181 + LeapDay ) ) { lpSystemTime->wMonth = 6; - lpSystemTime->wDay = GET_LARGE_INTEGER_LOW_PART(dwDay) + 1 - ( 151 + LeapDay ); + lpSystemTime->wDay = dwDay.LowPart + 1 - ( 151 + LeapDay ); } - else if ( GET_LARGE_INTEGER_LOW_PART(dwDay) >= ( 181 + LeapDay ) && GET_LARGE_INTEGER_LOW_PART(dwDay) < ( 212 + LeapDay ) ) { + else if ( dwDay.LowPart >= ( 181 + LeapDay ) && dwDay.LowPart < ( 212 + LeapDay ) ) { lpSystemTime->wMonth = 7; - lpSystemTime->wDay = GET_LARGE_INTEGER_LOW_PART(dwDay) + 1 - ( 181 + LeapDay ); + lpSystemTime->wDay = dwDay.LowPart + 1 - ( 181 + LeapDay ); } - else if ( GET_LARGE_INTEGER_LOW_PART(dwDay) >= ( 212 + LeapDay ) && GET_LARGE_INTEGER_LOW_PART(dwDay) < ( 243 + LeapDay ) ) { + else if ( dwDay.LowPart >= ( 212 + LeapDay ) && dwDay.LowPart < ( 243 + LeapDay ) ) { lpSystemTime->wMonth = 8; - lpSystemTime->wDay = GET_LARGE_INTEGER_LOW_PART(dwDay) + 1 - (212 + LeapDay ); + lpSystemTime->wDay = dwDay.LowPart + 1 - (212 + LeapDay ); } - else if ( GET_LARGE_INTEGER_LOW_PART(dwDay) >= ( 243+ LeapDay ) && GET_LARGE_INTEGER_LOW_PART(dwDay) < ( 273 + LeapDay ) ) { + else if ( dwDay.LowPart >= ( 243+ LeapDay ) && dwDay.LowPart < ( 273 + LeapDay ) ) { lpSystemTime->wMonth = 9; - lpSystemTime->wDay = GET_LARGE_INTEGER_LOW_PART(dwDay) + 1 - ( 243 + LeapDay ); + lpSystemTime->wDay = dwDay.LowPart + 1 - ( 243 + LeapDay ); } - else if ( GET_LARGE_INTEGER_LOW_PART(dwDay) >= ( 273 + LeapDay ) && GET_LARGE_INTEGER_LOW_PART(dwDay) < ( 304 + LeapDay ) ) { + else if ( dwDay.LowPart >= ( 273 + LeapDay ) && dwDay.LowPart < ( 304 + LeapDay ) ) { lpSystemTime->wMonth = 10; - lpSystemTime->wDay = GET_LARGE_INTEGER_LOW_PART(dwDay) + 1 - ( 273 + LeapDay); + lpSystemTime->wDay = dwDay.LowPart + 1 - ( 273 + LeapDay); } - else if ( GET_LARGE_INTEGER_LOW_PART(dwDay) >= ( 304 + LeapDay ) && GET_LARGE_INTEGER_LOW_PART(dwDay) < ( 334 + LeapDay ) ) { + else if ( dwDay.LowPart >= ( 304 + LeapDay ) && dwDay.LowPart < ( 334 + LeapDay ) ) { lpSystemTime->wMonth = 11; - lpSystemTime->wDay = GET_LARGE_INTEGER_LOW_PART(dwDay) + 1 - ( 304 + LeapDay ); + lpSystemTime->wDay = dwDay.LowPart + 1 - ( 304 + LeapDay ); } - else if ( GET_LARGE_INTEGER_LOW_PART(dwDay) >= ( 334 + LeapDay ) && GET_LARGE_INTEGER_LOW_PART(dwDay) < ( 365 + LeapDay )) { + else if ( dwDay.LowPart >= ( 334 + LeapDay ) && dwDay.LowPart < ( 365 + LeapDay )) { lpSystemTime->wMonth = 12; - lpSystemTime->wDay = GET_LARGE_INTEGER_LOW_PART(dwDay) + 1 - ( 334 + LeapDay ); + lpSystemTime->wDay = dwDay.LowPart + 1 - ( 334 + LeapDay ); } dwDayOfWeek = RtlLargeIntegerDivide(FileTime,LIDAY,&dwRemDay); - lpSystemTime->wDayOfWeek = 1 + GET_LARGE_INTEGER_LOW_PART(dwDayOfWeek) % 7; + lpSystemTime->wDayOfWeek = 1 + dwDayOfWeek.LowPart % 7; diff --git a/reactos/lib/kernel32/process/create.c b/reactos/lib/kernel32/process/create.c index 4805625ff16..547b7ffd81e 100644 --- a/reactos/lib/kernel32/process/create.c +++ b/reactos/lib/kernel32/process/create.c @@ -303,8 +303,8 @@ HANDLE KERNEL32_MapFile(LPCWSTR lpApplicationName, return(NULL); } - SET_LARGE_INTEGER_HIGH_PART(FileOffset, 0); - SET_LARGE_INTEGER_LOW_PART(FileOffset, DosHeader->e_lfanew); + FileOffset.HighPart = 0; + FileOffset.LowPart = DosHeader->e_lfanew; Status = NtReadFile(hFile, NULL, @@ -461,7 +461,7 @@ WINBOOL STDCALL CreateProcessW(LPCWSTR lpApplicationName, + sizeof(IMAGE_SECTION_HEADER) * Headers.FileHeader.NumberOfSections; BaseAddress = (PVOID)Headers.OptionalHeader.ImageBase; - LARGE_INTEGER_QUAD_PART(SectionOffset) = 0; + SectionOffset.QuadPart = 0; Status = NtMapViewOfSection(hSection, hProcess, &BaseAddress, @@ -510,4 +510,3 @@ WINBOOL STDCALL CreateProcessW(LPCWSTR lpApplicationName, return TRUE; } - diff --git a/reactos/lib/kernel32/process/proc.c b/reactos/lib/kernel32/process/proc.c index b78a87c4941..4e3bbecbda4 100644 --- a/reactos/lib/kernel32/process/proc.c +++ b/reactos/lib/kernel32/process/proc.c @@ -235,8 +235,9 @@ SleepEx( TIME Interval; NTSTATUS errCode; - Interval.LowPart = dwMilliseconds * 1000; - Interval.HighPart = 0; + Interval.LowPart = dwMilliseconds * 1000; + Interval.HighPart = 0; + errCode = NtDelayExecution(bAlertable,&Interval); if ( !NT_SUCCESS(errCode) ) { SetLastError(RtlNtStatusToDosError(errCode)); diff --git a/reactos/lib/kernel32/synch/wait.c b/reactos/lib/kernel32/synch/wait.c index 50bc8bb0842..03ef3618a8e 100644 --- a/reactos/lib/kernel32/synch/wait.c +++ b/reactos/lib/kernel32/synch/wait.c @@ -187,7 +187,7 @@ DWORD STDCALL WaitForSingleObjectEx(HANDLE hHandle, } else { - SET_LARGE_INTEGER_LOW_PART(Time,dwMilliseconds); + Time.LowPart = dwMilliseconds; TimePtr = &Time; } @@ -226,7 +226,7 @@ WaitForMultipleObjectsEx( LARGE_INTEGER Time; DWORD retCode; - SET_LARGE_INTEGER_LOW_PART(Time,dwMilliseconds); + Time.LowPart = dwMilliseconds; errCode = NtWaitForMultipleObjects ( @@ -240,6 +240,4 @@ WaitForMultipleObjectsEx( retCode = RtlNtStatusToDosError(errCode); SetLastError(retCode); return retCode; - - } diff --git a/reactos/lib/ntdll/ldr/utils.c b/reactos/lib/ntdll/ldr/utils.c index 62613b81cff..79ba543b70e 100644 --- a/reactos/lib/ntdll/ldr/utils.c +++ b/reactos/lib/ntdll/ldr/utils.c @@ -198,8 +198,8 @@ NTSTATUS LdrMapSections(HANDLE ProcessHandle, Sections = (PIMAGE_SECTION_HEADER)SECHDROFFSET(ImageBase); Base = (ULONG)(Sections[i].VirtualAddress + ImageBase); - SET_LARGE_INTEGER_HIGH_PART(Offset,0); - SET_LARGE_INTEGER_LOW_PART(Offset,Sections[i].PointerToRawData); + Offset.HighPart = 0; + Offset.LowPart = Sections[i].PointerToRawData; Status = ZwMapViewOfSection(SectionHandle, ProcessHandle, (PVOID *)&Base, diff --git a/reactos/lib/ntdll/rtl/largeint.c b/reactos/lib/ntdll/rtl/largeint.c index bae9a82ce18..74afc100277 100644 --- a/reactos/lib/ntdll/rtl/largeint.c +++ b/reactos/lib/ntdll/rtl/largeint.c @@ -37,7 +37,7 @@ RtlConvertLongToLargeInteger(LONG SignedInteger) { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = SignedInteger; + RC.QuadPart = SignedInteger; return RC; } @@ -47,7 +47,7 @@ RtlConvertUlongToLargeInteger(ULONG UnsignedInteger) { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = UnsignedInteger; + RC.QuadPart = UnsignedInteger; return RC; } @@ -58,7 +58,7 @@ RtlEnlargedIntegerMultiply(LONG Multiplicand, { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = (LONGLONG) Multiplicand * Multiplier; + RC.QuadPart = (LONGLONG) Multiplicand * Multiplier; return RC; } @@ -68,7 +68,7 @@ LARGE_INTEGER RtlEnlargedUnsignedMultiply(ULONG Multiplicand, { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = (ULONGLONG) Multiplicand * Multiplier; + RC.QuadPart = (ULONGLONG) Multiplicand * Multiplier; return RC; } @@ -79,8 +79,7 @@ RtlExtendedIntegerMultiply(LARGE_INTEGER Multiplicand, { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = LARGE_INTEGER_QUAD_PART(Multiplicand) * - Multiplier; + RC.QuadPart = Multiplicand.QuadPart * Multiplier; return RC; } @@ -91,8 +90,7 @@ RtlLargeIntegerAdd(LARGE_INTEGER Addend1, { LARGE_INTEGER RC; - RC = LARGE_INTEGER_QUAD_PART(Addend1) + - LARGE_INTEGER_QUAD_PART(Addend2); + RC.QuadPart = Addend1.QuadPart + Addend2.QuadPart; return RC; } @@ -101,16 +99,14 @@ VOID RtlLargeIntegerAnd(PLARGE_INTEGER Result, LARGE_INTEGER Source, LARGE_INTEGER Mask) { - LARGE_INTEGER_QUAD_PART(*Result) = LARGE_INTEGER_QUAD_PART(Source) & - LARGE_INTEGER_QUAD_PART(Mask); + Result->QuadPart = Source.QuadPart & Mask.QuadPart; } BOOLEAN RtlLargeIntegerEqualTo(LARGE_INTEGER Operand1, LARGE_INTEGER Operand2) { - return LARGE_INTEGER_QUAD_PART(Operand1) == - LARGE_INTEGER_QUAD_PART(Operand2); + return Operand1.QuadPart == Operand2.QuadPart; #if 0 return Operand1.HighPart == Operand2.HighPart && Operand1.LowPart == Operand2.LowPart; @@ -120,15 +116,14 @@ RtlLargeIntegerEqualTo(LARGE_INTEGER Operand1, BOOLEAN RtlLargeIntegerEqualToZero(LARGE_INTEGER Operand) { - return LARGE_INTEGER_QUAD_PART(Operand) == 0 ; + return Operand.QuadPart == 0 ; } BOOLEAN RtlLargeIntegerGreaterThan(LARGE_INTEGER Operand1, LARGE_INTEGER Operand2) { - return LARGE_INTEGER_QUAD_PART(Operand1) > - LARGE_INTEGER_QUAD_PART(Operand2); + return Operand1.QuadPart > Operand2.QuadPart; #if 0 return Operand1.HighPart > Operand2.HighPart || (Operand1.HighPart == Operand2.HighPart && @@ -140,8 +135,7 @@ BOOLEAN RtlLargeIntegerGreaterThanOrEqualTo(LARGE_INTEGER Operand1, LARGE_INTEGER Operand2) { - return LARGE_INTEGER_QUAD_PART(Operand1) >= - LARGE_INTEGER_QUAD_PART(Operand2); + return Operand1.QuadPart >= Operand2.QuadPart; #if 0 return Operand1.HighPart > Operand2.HighPart || (Operand1.HighPart == Operand2.HighPart && @@ -152,7 +146,7 @@ RtlLargeIntegerGreaterThanOrEqualTo(LARGE_INTEGER Operand1, BOOLEAN RtlLargeIntegerGreaterThanOrEqualToZero(LARGE_INTEGER Operand1) { - return LARGE_INTEGER_QUAD_PART(Operand1) > 0; + return Operand1.QuadPart > 0; #if 0 return Operand1.HighPart >= 0; #endif @@ -161,7 +155,7 @@ RtlLargeIntegerGreaterThanOrEqualToZero(LARGE_INTEGER Operand1) BOOLEAN RtlLargeIntegerGreaterThanZero(LARGE_INTEGER Operand1) { - return LARGE_INTEGER_QUAD_PART(Operand1) >= 0; + return Operand1.QuadPart >= 0; #if 0 return Operand1.HighPart > 0 || (Operand1.HighPart == 0 && Operand1.LowPart > 0); @@ -172,8 +166,7 @@ BOOLEAN RtlLargeIntegerLessThan(LARGE_INTEGER Operand1, LARGE_INTEGER Operand2) { - return LARGE_INTEGER_QUAD_PART(Operand1) < - LARGE_INTEGER_QUAD_PART(Operand2); + return Operand1.QuadPart < Operand2.QuadPart; #if 0 return Operand1.HighPart < Operand2.HighPart || (Operand1.HighPart == Operand2.HighPart && @@ -185,8 +178,7 @@ BOOLEAN RtlLargeIntegerLessThanOrEqualTo(LARGE_INTEGER Operand1, LARGE_INTEGER Operand2) { - return LARGE_INTEGER_QUAD_PART(Operand1) <= - LARGE_INTEGER_QUAD_PART(Operand2); + return Operand1.QuadPart <= Operand2.QuadPart; #if 0 return Operand1.HighPart < Operand2.HighPart || (Operand1.HighPart == Operand2.HighPart && @@ -197,7 +189,7 @@ RtlLargeIntegerLessThanOrEqualTo(LARGE_INTEGER Operand1, BOOLEAN RtlLargeIntegerLessThanOrEqualToZero(LARGE_INTEGER Operand) { - return LARGE_INTEGER_QUAD_PART(Operand) <= 0; + return Operand.QuadPart <= 0; #if 0 return Operand.HighPart < 0 || (Operand.HighPart == 0 && Operand.LowPart == 0); @@ -207,7 +199,7 @@ RtlLargeIntegerLessThanOrEqualToZero(LARGE_INTEGER Operand) BOOLEAN RtlLargeIntegerLessThanZero(LARGE_INTEGER Operand) { - return LARGE_INTEGER_QUAD_PART(Operand) < 0; + return Operand.QuadPart < 0; #if 0 return Operand.HighPart < 0; #endif @@ -217,7 +209,7 @@ LARGE_INTEGER RtlLargeIntegerNegate(LARGE_INTEGER Subtrahend) { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = - LARGE_INTEGER_QUAD_PART(Subtrahend); + RC.QuadPart = - Subtrahend.QuadPart; return RC; } @@ -226,8 +218,7 @@ BOOLEAN RtlLargeIntegerNotEqualTo(LARGE_INTEGER Operand1, LARGE_INTEGER Operand2) { - return LARGE_INTEGER_QUAD_PART(Operand1) != - LARGE_INTEGER_QUAD_PART(Operand2); + return Operand1.QuadPart != Operand2.QuadPart; #if 0 return Operand1.LowPart != Operand2.LowPart || Operand1.HighPart != Operand2.HighPart; @@ -237,7 +228,7 @@ RtlLargeIntegerNotEqualTo(LARGE_INTEGER Operand1, BOOLEAN RtlLargeIntegerNotEqualToZero(LARGE_INTEGER Operand) { - return LARGE_INTEGER_QUAD_PART(Operand) != 0; + return Operand.QuadPart != 0; #if 0 return Operand.LowPart != 0 || Operand.HighPart != 0; #endif @@ -248,8 +239,7 @@ LARGE_INTEGER RtlLargeIntegerShiftLeft(LARGE_INTEGER LargeInteger, { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = LARGE_INTEGER_QUAD_PART(LargeInteger) << - ShiftCount; + RC.QuadPart = LargeInteger.QuadPart << ShiftCount; return RC; } @@ -259,8 +249,7 @@ LARGE_INTEGER RtlLargeIntegerShiftRight(LARGE_INTEGER LargeInteger, { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = LARGE_INTEGER_QUAD_PART(LargeInteger) >> - ShiftCount; + RC.QuadPart = LargeInteger.QuadPart >> ShiftCount; return RC; } @@ -270,7 +259,7 @@ LARGE_INTEGER RtlLargeIntegerSubtract(LARGE_INTEGER Minuend, { LARGE_INTEGER RC; - RC = LARGE_INTEGER_QUAD_PART(Minuend) - LARGE_INTEGER_QUAD_PART(Subtrahend); + RC.QuadPart = Minuend.QuadPart - Subtrahend.QuadPart; return RC; } diff --git a/reactos/ntoskrnl/cc/block.c b/reactos/ntoskrnl/cc/block.c index bf593c0837f..dc653a780a2 100644 --- a/reactos/ntoskrnl/cc/block.c +++ b/reactos/ntoskrnl/cc/block.c @@ -170,8 +170,8 @@ static NTSTATUS CbReadBlock(PDCCB Dccb, PCCB Ccb) Ccb->Buffer=ExAllocatePool(NonPagedPool,Dccb->SectorSize); } - SET_LARGE_INTEGER_HIGH_PART(Offset, 0); - SET_LARGE_INTEGER_LOW_PART(Offset, Ccb->BlockNr * Dccb->SectorSize); + Offset.LowPart = Ccb->BlockNr * Dccb->SectorSize; + Offset.HighPart = 0; KeInitializeEvent(&Event,NotificationEvent,FALSE); Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ, Dccb->DeviceObject, @@ -211,8 +211,8 @@ static NTSTATUS CbWriteBlock(PDCCB Dccb, PCCB Ccb) NTSTATUS Status; KEVENT Event; - SET_LARGE_INTEGER_HIGH_PART(Offset, 0); - SET_LARGE_INTEGER_LOW_PART(Offset, Ccb->BlockNr * Dccb->SectorSize); + Offset.LowPart = Ccb->BlockNr * Dccb->SectorSize; + Offset.HighPart = 0; KeInitializeEvent(&Event,NotificationEvent,FALSE); Irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE, Dccb->DeviceObject, diff --git a/reactos/ntoskrnl/hal/x86/page.c b/reactos/ntoskrnl/hal/x86/page.c index 5944ea9b71e..ab82c0173d0 100644 --- a/reactos/ntoskrnl/hal/x86/page.c +++ b/reactos/ntoskrnl/hal/x86/page.c @@ -84,8 +84,7 @@ NTSTATUS MmCopyMmInfo(PEPROCESS Src, PEPROCESS Dest) { return(STATUS_UNSUCCESSFUL); } - PhysPageDirectory = (PULONG) - GET_LARGE_INTEGER_LOW_PART(MmGetPhysicalAddress(PageDirectory)); + PhysPageDirectory = (PULONG)(MmGetPhysicalAddress(PageDirectory)).LowPart; KProcess->PageTableDirectory = PhysPageDirectory; CurrentPageDirectory = (PULONG)PAGEDIRECTORY_MAP; @@ -158,7 +157,7 @@ VOID MmDeletePageEntry(PEPROCESS Process, PVOID Address, BOOL FreePage) page_tlb = ADDR_TO_PTE(Address); if (FreePage && PAGE_MASK(*page_tlb) != 0) { - MmFreePage(PAGE_MASK(*page_tlb),1); + MmFreePage((PVOID)PAGE_MASK(*page_tlb),1); } *page_tlb = 0; if (Process != NULL && Process != CurrentProcess) @@ -251,12 +250,14 @@ PHYSICAL_ADDRESS MmGetPhysicalAddress(PVOID vaddr) * FUNCTION: Returns the physical address corresponding to a virtual address */ { - PHYSICAL_ADDRESS p = INITIALIZE_LARGE_INTEGER; + PHYSICAL_ADDRESS p; + + p.QuadPart = 0; DPRINT("MmGetPhysicalAddress(vaddr %x)\n", vaddr); - SET_LARGE_INTEGER_HIGH_PART(p, 0); - SET_LARGE_INTEGER_LOW_PART(p, PAGE_MASK(*MmGetPageEntry(vaddr))); + p.LowPart = PAGE_MASK(*MmGetPageEntry(vaddr)); + p.HighPart = 0; return p; } diff --git a/reactos/ntoskrnl/io/buildirp.c b/reactos/ntoskrnl/io/buildirp.c index c82063942c7..6b01632a75a 100644 --- a/reactos/ntoskrnl/io/buildirp.c +++ b/reactos/ntoskrnl/io/buildirp.c @@ -191,8 +191,7 @@ PIRP IoBuildAsynchronousFsdRequest(ULONG MajorFunction, } else { - SET_LARGE_INTEGER_LOW_PART(StackPtr->Parameters.Write.ByteOffset, 0); - SET_LARGE_INTEGER_HIGH_PART(StackPtr->Parameters.Write.ByteOffset, 0); + StackPtr->Parameters.Write.ByteOffset.QuadPart = 0; } } @@ -424,10 +423,7 @@ PIRP IoBuildSynchronousFsdRequest(ULONG MajorFunction, } else { - SET_LARGE_INTEGER_LOW_PART(StackPtr->Parameters.Read.ByteOffset, - 0); - SET_LARGE_INTEGER_HIGH_PART(StackPtr->Parameters.Read.ByteOffset, - 0); + StackPtr->Parameters.Read.ByteOffset.QuadPart = 0; } StackPtr->Parameters.Read.Length = Length; } @@ -439,10 +435,7 @@ PIRP IoBuildSynchronousFsdRequest(ULONG MajorFunction, } else { - SET_LARGE_INTEGER_LOW_PART(StackPtr->Parameters.Write.ByteOffset, - 0); - SET_LARGE_INTEGER_HIGH_PART(StackPtr->Parameters.Write.ByteOffset, - 0); + StackPtr->Parameters.Write.ByteOffset.QuadPart = 0; } StackPtr->Parameters.Write.Length = Length; } diff --git a/reactos/ntoskrnl/io/cleanup.c b/reactos/ntoskrnl/io/cleanup.c index 8cc459b2320..88f5755c8e2 100644 --- a/reactos/ntoskrnl/io/cleanup.c +++ b/reactos/ntoskrnl/io/cleanup.c @@ -112,9 +112,9 @@ VOID IoReadWriteCompletion(PDEVICE_OBJECT DeviceObject, } if (FileObject != NULL) { - SET_LARGE_INTEGER_LOW_PART(FileObject->CurrentByteOffset, - GET_LARGE_INTEGER_LOW_PART(FileObject->CurrentByteOffset) + - Irp->IoStatus.Information); + FileObject->CurrentByteOffset.LowPart = + FileObject->CurrentByteOffset.LowPart + + Irp->IoStatus.Information; } } diff --git a/reactos/ntoskrnl/io/rw.c b/reactos/ntoskrnl/io/rw.c index 968c81deaf4..29f8cc4eb70 100644 --- a/reactos/ntoskrnl/io/rw.c +++ b/reactos/ntoskrnl/io/rw.c @@ -79,7 +79,7 @@ NTSTATUS ZwReadFile(HANDLE FileHandle, DPRINT("ByteOffset %x FileObject->CurrentByteOffset %d\n", ByteOffset, - GET_LARGE_INTEGER_LOW_PART(FileObject->CurrentByteOffset)); + FileObject->CurrentByteOffset.LowPart); if (ByteOffset==NULL) { ByteOffset = &(FileObject->CurrentByteOffset); diff --git a/reactos/ntoskrnl/ke/timer.c b/reactos/ntoskrnl/ke/timer.c index 2f7795840fc..a44a901b52b 100644 --- a/reactos/ntoskrnl/ke/timer.c +++ b/reactos/ntoskrnl/ke/timer.c @@ -278,7 +278,7 @@ LARGE_INTEGER KeQueryPerformanceCounter(PLARGE_INTEGER PerformanceFreq) { if (PerformanceFreq != NULL) { - LARGE_INTEGER_QUAD_PART(*PerformanceFreq) = 0; + PerformanceFreq->QuadPart = 0; } return *PerformanceFreq; @@ -303,7 +303,7 @@ VOID KeQuerySystemTime(PLARGE_INTEGER CurrentTime) * 1st of January, 1601. */ { - LARGE_INTEGER_QUAD_PART(*CurrentTime) = system_time; + CurrentTime->QuadPart = system_time; } NTSTATUS STDCALL NtGetTickCount(PULONG UpTime) @@ -449,7 +449,7 @@ VOID KeQueryTickCount(PLARGE_INTEGER TickCount) * TickCount (OUT) = Points to storage for the number of ticks */ { - LARGE_INTEGER_QUAD_PART(*TickCount) = KiTimerTicks; + TickCount->QuadPart = KiTimerTicks; } static void HandleExpiredTimer(PKTIMER current) diff --git a/reactos/ntoskrnl/ldr/init.c b/reactos/ntoskrnl/ldr/init.c index ebe3434d80e..c663a1766b7 100644 --- a/reactos/ntoskrnl/ldr/init.c +++ b/reactos/ntoskrnl/ldr/init.c @@ -197,8 +197,8 @@ NTSTATUS LdrLoadImage(HANDLE ProcessHandle, PUNICODE_STRING Filename) Sections = (PIMAGE_SECTION_HEADER)SECHDROFFSET(BlockBuffer); Base = Sections[i].VirtualAddress + ImageBase; - SET_LARGE_INTEGER_HIGH_PART(Offset,0); - SET_LARGE_INTEGER_LOW_PART(Offset,Sections[i].PointerToRawData); + Offset.HighPart = 0; + Offset.LowPart = Sections[i].PointerToRawData; Status = ZwMapViewOfSection(NTDllSectionHandle, ProcessHandle, (PVOID *)&Base, diff --git a/reactos/ntoskrnl/ldr/loader.c b/reactos/ntoskrnl/ldr/loader.c index 9c57fc41811..b4c95434b7c 100644 --- a/reactos/ntoskrnl/ldr/loader.c +++ b/reactos/ntoskrnl/ldr/loader.c @@ -165,8 +165,8 @@ LdrLoadDriver(PUNICODE_STRING Filename) CHECKPOINT; /* Allocate nonpageable memory for driver */ - ModuleLoadBase = ExAllocatePool(NonPagedPool, - GET_LARGE_INTEGER_LOW_PART(FileStdInfo.EndOfFile)); + ModuleLoadBase = ExAllocatePool(NonPagedPool, + FileStdInfo.EndOfFile.LowPart); if (ModuleLoadBase == NULL) { return STATUS_INSUFFICIENT_RESOURCES; @@ -177,7 +177,7 @@ LdrLoadDriver(PUNICODE_STRING Filename) Status = ZwReadFile(FileHandle, 0, 0, 0, 0, ModuleLoadBase, - GET_LARGE_INTEGER_LOW_PART(FileStdInfo.EndOfFile), + FileStdInfo.EndOfFile.LowPart, 0, 0); if (!NT_SUCCESS(Status)) { diff --git a/reactos/ntoskrnl/mm/marea.c b/reactos/ntoskrnl/mm/marea.c index 8df7400789e..ecde845d3a8 100644 --- a/reactos/ntoskrnl/mm/marea.c +++ b/reactos/ntoskrnl/mm/marea.c @@ -415,8 +415,7 @@ NTSTATUS MmFreeMemoryArea(PEPROCESS Process, { PhysicalAddr = MmGetPhysicalAddress(MemoryArea->BaseAddress + (i*PAGESIZE)); - MmFreePage((PVOID)(ULONG) - (GET_LARGE_INTEGER_LOW_PART(PhysicalAddr)), 1); + MmFreePage((PVOID)(ULONG)(PhysicalAddr.LowPart), 1); } } for (i=0; i<=(MemoryArea->Length/PAGESIZE); i++) diff --git a/reactos/ntoskrnl/mm/mdl.c b/reactos/ntoskrnl/mm/mdl.c index c347ea980e4..5599e5a0981 100644 --- a/reactos/ntoskrnl/mm/mdl.c +++ b/reactos/ntoskrnl/mm/mdl.c @@ -147,7 +147,7 @@ VOID MmProbeAndLockPages(PMDL Mdl, KPROCESSOR_MODE AccessMode, for (i=0;i<(PAGE_ROUND_UP(Mdl->ByteOffset+Mdl->ByteCount)/PAGESIZE);i++) { Address = Mdl->StartVa + (i*PAGESIZE); - mdl_pages[i] = GET_LARGE_INTEGER_LOW_PART(MmGetPhysicalAddress(Address)); + mdl_pages[i] = (MmGetPhysicalAddress(Address)).LowPart; DPRINT("mdl_pages[i] %x\n",mdl_pages[i]); } } @@ -224,8 +224,8 @@ VOID MmBuildMdlForNonPagedPool(PMDL Mdl) Mdl->MdlFlags = Mdl->MdlFlags | MDL_SOURCE_IS_NONPAGED_POOL; for (va=0; vaSize; va++) { - ((PULONG)(Mdl + 1))[va] = GET_LARGE_INTEGER_LOW_PART( - MmGetPhysicalAddress(Mdl->StartVa + (va * PAGESIZE))); + ((PULONG)(Mdl + 1))[va] = + (MmGetPhysicalAddress(Mdl->StartVa + (va * PAGESIZE))).LowPart; } Mdl->MappedSystemVa = Mdl->StartVa; } diff --git a/reactos/ntoskrnl/mm/mm.c b/reactos/ntoskrnl/mm/mm.c index 7c09180d5c3..5096bf14f77 100644 --- a/reactos/ntoskrnl/mm/mm.c +++ b/reactos/ntoskrnl/mm/mm.c @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -130,7 +131,7 @@ NTSTATUS MmSectionHandleFault(MEMORY_AREA* MemoryArea, PVOID Address) MemoryArea->Attributes, (ULONG)MmAllocPage()); - LARGE_INTEGER_QUAD_PART(Offset) = (Address - MemoryArea->BaseAddress) + + Offset.QuadPart = (Address - MemoryArea->BaseAddress) + MemoryArea->Data.SectionData.ViewOffset; DPRINT("MemoryArea->Data.SectionData.Section->FileObject %x\n", diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index 8dbea1364d5..a48fe57a1f9 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -162,7 +162,7 @@ NTSTATUS STDCALL ZwCreateSection(OUT PHANDLE SectionHandle, } else { - LARGE_INTEGER_QUAD_PART(Section->MaximumSize) = 0xffffffff; + Section->MaximumSize.QuadPart = 0xffffffff; } Section->SectionPageProtection = SectionPageProtection; Section->AllocateAttributes = AllocationAttributes; @@ -332,9 +332,9 @@ NTSTATUS STDCALL ZwMapViewOfSection(HANDLE SectionHandle, } DPRINT("ViewSize %x\n",ViewSize); - if ((*ViewSize) > GET_LARGE_INTEGER_LOW_PART(Section->MaximumSize)) + if ((*ViewSize) > Section->MaximumSize.LowPart) { - (*ViewSize) = GET_LARGE_INTEGER_LOW_PART(Section->MaximumSize); + (*ViewSize) = Section->MaximumSize.LowPart; } Status = MmCreateMemoryArea(UserMode, @@ -361,8 +361,7 @@ NTSTATUS STDCALL ZwMapViewOfSection(HANDLE SectionHandle, } else { - Result->Data.SectionData.ViewOffset = - GET_LARGE_INTEGER_LOW_PART(*SectionOffset); + Result->Data.SectionData.ViewOffset = SectionOffset->LowPart; } DPRINT("*BaseAddress %x\n",*BaseAddress); diff --git a/reactos/ntoskrnl/mm/special.c b/reactos/ntoskrnl/mm/special.c index 6c87b1b284b..de7a4060e7c 100644 --- a/reactos/ntoskrnl/mm/special.c +++ b/reactos/ntoskrnl/mm/special.c @@ -93,7 +93,7 @@ PVOID MmMapIoSpace(PHYSICAL_ADDRESS PhysicalAddress, MmSetPage(NULL, Result + (i * PAGESIZE), PAGE_READWRITE, - GET_LARGE_INTEGER_LOW_PART(PhysicalAddress) + + PhysicalAddress.LowPart + (i * PAGESIZE)); } return((PVOID)Result); diff --git a/reactos/ntoskrnl/ps/thread.c b/reactos/ntoskrnl/ps/thread.c index a89cffed5aa..fb4d452120b 100644 --- a/reactos/ntoskrnl/ps/thread.c +++ b/reactos/ntoskrnl/ps/thread.c @@ -181,7 +181,7 @@ VOID PsDispatchThread(VOID) { DPRINT("Scheduling current thread\n"); KeQueryTickCount(&TickCount); - CurrentThread->Tcb.LastTick = GET_LARGE_INTEGER_LOW_PART(TickCount); + CurrentThread->Tcb.LastTick = TickCount.LowPart; CurrentThread->Tcb.ThreadState = THREAD_STATE_RUNNING; KeReleaseSpinLock(&ThreadListLock,irql); return; @@ -193,7 +193,7 @@ VOID PsDispatchThread(VOID) Candidate->Tcb.ThreadState = THREAD_STATE_RUNNING; KeQueryTickCount(&TickCount); - CurrentThread->Tcb.LastTick = GET_LARGE_INTEGER_LOW_PART(TickCount); + CurrentThread->Tcb.LastTick = TickCount.LowPart; CurrentThread = Candidate; diff --git a/reactos/ntoskrnl/rtl/largeint.c b/reactos/ntoskrnl/rtl/largeint.c index ca46ab07a17..f55c49d03ef 100644 --- a/reactos/ntoskrnl/rtl/largeint.c +++ b/reactos/ntoskrnl/rtl/largeint.c @@ -31,7 +31,7 @@ RtlConvertLongToLargeInteger(LONG SignedInteger) { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = SignedInteger; + RC.QuadPart = SignedInteger; return RC; } @@ -41,7 +41,7 @@ RtlConvertUlongToLargeInteger(ULONG UnsignedInteger) { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = UnsignedInteger; + RC.QuadPart = UnsignedInteger; return RC; } @@ -52,7 +52,7 @@ RtlEnlargedIntegerMultiply(LONG Multiplicand, { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = (LONGLONG) Multiplicand * Multiplier; + RC.QuadPart = (LONGLONG) Multiplicand * Multiplier; return RC; } @@ -69,7 +69,7 @@ LARGE_INTEGER RtlEnlargedUnsignedMultiply(ULONG Multiplicand, { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = (ULONGLONG) Multiplicand * Multiplier; + RC.QuadPart = (ULONGLONG) Multiplicand * Multiplier; return RC; } @@ -80,8 +80,7 @@ RtlExtendedIntegerMultiply(LARGE_INTEGER Multiplicand, { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = LARGE_INTEGER_QUAD_PART(Multiplicand) * - Multiplier; + RC.QuadPart = Multiplicand.QuadPart * Multiplier; return RC; } @@ -113,8 +112,7 @@ RtlLargeIntegerAdd(LARGE_INTEGER Addend1, { LARGE_INTEGER RC; - RC = LARGE_INTEGER_QUAD_PART(Addend1) + - LARGE_INTEGER_QUAD_PART(Addend2); + RC.QuadPart = Addend1.QuadPart + Addend2.QuadPart; return RC; } @@ -123,8 +121,7 @@ VOID RtlLargeIntegerAnd(PLARGE_INTEGER Result, LARGE_INTEGER Source, LARGE_INTEGER Mask) { - LARGE_INTEGER_QUAD_PART(*Result) = LARGE_INTEGER_QUAD_PART(Source) & - LARGE_INTEGER_QUAD_PART(Mask); + Result->QuadPart = Source.QuadPart & Mask.QuadPart; } LARGE_INTEGER RtlLargeIntegerArithmeticShift(LARGE_INTEGER LargeInteger, @@ -135,7 +132,7 @@ LARGE_INTEGER RtlLargeIntegerArithmeticShift(LARGE_INTEGER LargeInteger, LARGE_INTEGER RC; - RC = LARGE_INTEGER_QUAD_PART(LargeInteger) >> ShiftCount; + RC.QuadPart = LargeInteger.QuadPart >> ShiftCount; asm ("movb %2, %%cl\n\t" "andb $0x3f, %%cl\n\t" "movl %3, %%eax\n\t" @@ -144,11 +141,11 @@ LARGE_INTEGER RtlLargeIntegerArithmeticShift(LARGE_INTEGER LargeInteger, "sarl %%cl, %%edx\n\t" "movl %%eax, %0\n\t" "movl %%edx, %1\n\t" - : "=m" (GET_LARGE_INTEGER_LOW_PART(LargeInteger)), - "=m" (GET_LARGE_INTEGER_HIGH_PART(LargeInteger)) + : "=m" (LargeInteger.LowPart), + "=m" (LargeInteger.HighPart) : "m" (ShiftCount), - "0" (GET_LARGE_INTEGER_LOW_PART(LargeInteger)), - "1" (GET_LARGE_INTEGER_HIGH_PART(LargeInteger)) + "0" (LargeInteger.LowPart), + "1" (LargeInteger.HighPart) : "eax", "ecx", "edx" ); @@ -167,8 +164,7 @@ BOOLEAN RtlLargeIntegerEqualTo(LARGE_INTEGER Operand1, LARGE_INTEGER Operand2) { - return LARGE_INTEGER_QUAD_PART(Operand1) == - LARGE_INTEGER_QUAD_PART(Operand2); + return Operand1.QuadPart == Operand2.QuadPart; #if 0 return Operand1.HighPart == Operand2.HighPart && Operand1.LowPart == Operand2.LowPart; @@ -178,15 +174,14 @@ RtlLargeIntegerEqualTo(LARGE_INTEGER Operand1, BOOLEAN RtlLargeIntegerEqualToZero(LARGE_INTEGER Operand) { - return LARGE_INTEGER_QUAD_PART(Operand) == 0 ; + return Operand.QuadPart == 0 ; } BOOLEAN RtlLargeIntegerGreaterThan(LARGE_INTEGER Operand1, LARGE_INTEGER Operand2) { - return LARGE_INTEGER_QUAD_PART(Operand1) > - LARGE_INTEGER_QUAD_PART(Operand2); + return Operand1.QuadPart > Operand2.QuadPart; #if 0 return Operand1.HighPart > Operand2.HighPart || (Operand1.HighPart == Operand2.HighPart && @@ -198,8 +193,7 @@ BOOLEAN RtlLargeIntegerGreaterThanOrEqualTo(LARGE_INTEGER Operand1, LARGE_INTEGER Operand2) { - return LARGE_INTEGER_QUAD_PART(Operand1) >= - LARGE_INTEGER_QUAD_PART(Operand2); + return Operand1.QuadPart >= Operand2.QuadPart; #if 0 return Operand1.HighPart > Operand2.HighPart || (Operand1.HighPart == Operand2.HighPart && @@ -210,7 +204,7 @@ RtlLargeIntegerGreaterThanOrEqualTo(LARGE_INTEGER Operand1, BOOLEAN RtlLargeIntegerGreaterThanOrEqualToZero(LARGE_INTEGER Operand1) { - return LARGE_INTEGER_QUAD_PART(Operand1) > 0; + return Operand1.QuadPart >= 0; #if 0 return Operand1.HighPart >= 0; #endif @@ -219,7 +213,7 @@ RtlLargeIntegerGreaterThanOrEqualToZero(LARGE_INTEGER Operand1) BOOLEAN RtlLargeIntegerGreaterThanZero(LARGE_INTEGER Operand1) { - return LARGE_INTEGER_QUAD_PART(Operand1) >= 0; + return Operand1.QuadPart > 0; #if 0 return Operand1.HighPart > 0 || (Operand1.HighPart == 0 && Operand1.LowPart > 0); @@ -230,8 +224,7 @@ BOOLEAN RtlLargeIntegerLessThan(LARGE_INTEGER Operand1, LARGE_INTEGER Operand2) { - return LARGE_INTEGER_QUAD_PART(Operand1) < - LARGE_INTEGER_QUAD_PART(Operand2); + return Operand1.QuadPart < Operand2.QuadPart; #if 0 return Operand1.HighPart < Operand2.HighPart || (Operand1.HighPart == Operand2.HighPart && @@ -243,8 +236,7 @@ BOOLEAN RtlLargeIntegerLessThanOrEqualTo(LARGE_INTEGER Operand1, LARGE_INTEGER Operand2) { - return LARGE_INTEGER_QUAD_PART(Operand1) <= - LARGE_INTEGER_QUAD_PART(Operand2); + return Operand1.QuadPart <= Operand2.QuadPart; #if 0 return Operand1.HighPart < Operand2.HighPart || (Operand1.HighPart == Operand2.HighPart && @@ -255,7 +247,7 @@ RtlLargeIntegerLessThanOrEqualTo(LARGE_INTEGER Operand1, BOOLEAN RtlLargeIntegerLessThanOrEqualToZero(LARGE_INTEGER Operand) { - return LARGE_INTEGER_QUAD_PART(Operand) <= 0; + return Operand.QuadPart <= 0; #if 0 return Operand.HighPart < 0 || (Operand.HighPart == 0 && Operand.LowPart == 0); @@ -265,7 +257,7 @@ RtlLargeIntegerLessThanOrEqualToZero(LARGE_INTEGER Operand) BOOLEAN RtlLargeIntegerLessThanZero(LARGE_INTEGER Operand) { - return LARGE_INTEGER_QUAD_PART(Operand) < 0; + return Operand.QuadPart < 0; #if 0 return Operand.HighPart < 0; #endif @@ -275,7 +267,7 @@ LARGE_INTEGER RtlLargeIntegerNegate(LARGE_INTEGER Subtrahend) { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = - LARGE_INTEGER_QUAD_PART(Subtrahend); + RC.QuadPart = - Subtrahend.QuadPart; return RC; } @@ -284,21 +276,13 @@ BOOLEAN RtlLargeIntegerNotEqualTo(LARGE_INTEGER Operand1, LARGE_INTEGER Operand2) { - return LARGE_INTEGER_QUAD_PART(Operand1) != - LARGE_INTEGER_QUAD_PART(Operand2); -#if 0 - return Operand1.LowPart != Operand2.LowPart || - Operand1.HighPart != Operand2.HighPart; -#endif + return Operand1.QuadPart != Operand2.QuadPart; } BOOLEAN RtlLargeIntegerNotEqualToZero(LARGE_INTEGER Operand) { - return LARGE_INTEGER_QUAD_PART(Operand) != 0; -#if 0 - return Operand.LowPart != 0 || Operand.HighPart != 0; -#endif + return Operand.QuadPart != 0; } LARGE_INTEGER RtlLargeIntegerShiftLeft(LARGE_INTEGER LargeInteger, @@ -306,8 +290,7 @@ LARGE_INTEGER RtlLargeIntegerShiftLeft(LARGE_INTEGER LargeInteger, { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = LARGE_INTEGER_QUAD_PART(LargeInteger) << - ShiftCount; + RC.QuadPart = LargeInteger.QuadPart << ShiftCount; return RC; } @@ -317,8 +300,7 @@ LARGE_INTEGER RtlLargeIntegerShiftRight(LARGE_INTEGER LargeInteger, { LARGE_INTEGER RC; - LARGE_INTEGER_QUAD_PART(RC) = LARGE_INTEGER_QUAD_PART(LargeInteger) >> - ShiftCount; + RC.QuadPart = LargeInteger.QuadPart >> ShiftCount; return RC; } @@ -328,7 +310,7 @@ LARGE_INTEGER RtlLargeIntegerSubtract(LARGE_INTEGER Minuend, { LARGE_INTEGER RC; - RC = LARGE_INTEGER_QUAD_PART(Minuend) - LARGE_INTEGER_QUAD_PART(Subtrahend); + RC.QuadPart = Minuend.QuadPart - Subtrahend.QuadPart; return RC; } diff --git a/reactos/rules.mak b/reactos/rules.mak index fbc3fd59c8e..1c06b98a997 100644 --- a/reactos/rules.mak +++ b/reactos/rules.mak @@ -45,7 +45,7 @@ ifeq ($(WARNINGS_ARE_ERRORS),yes) EXTRA_CFLAGS = -Werror endif -DEFINES = -DDBG -DCOMPILER_LARGE_INTEGERS +DEFINES = -DDBG ifeq ($(WIN32_LEAN_AND_MEAN),yes) LEAN_AND_MEAN_DEFINE = -DWIN32_LEAN_AND_MEAN diff --git a/rosapps/cmd/dir.c b/rosapps/cmd/dir.c index c9d90b071f7..4641ccdac76 100644 --- a/rosapps/cmd/dir.c +++ b/rosapps/cmd/dir.c @@ -123,10 +123,6 @@ #include "cmd.h" -#ifdef __REACTOS__ -#include -#endif - /* flag definitions */ @@ -584,11 +580,7 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len) INT c = 0; INT n = 0; -#ifndef __REACTOS__ if (num.QuadPart == 0) -#else - if (num == 0) -#endif { des[0] = _T('0'); des[1] = _T('\0'); @@ -597,21 +589,12 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len) else { temp[31] = 0; -#ifndef __REACTOS__ while (num.QuadPart > 0) -#else - while (num > 0) -#endif { if (((c + 1) % (nNumberGroups + 1)) == 0) temp[30 - c++] = cThousandSeparator; -#ifndef __REACTOS__ temp[30 - c++] = (TCHAR)(num.QuadPart % 10) + _T('0'); num.QuadPart /= 10; -#else - temp[30 - c++] = (TCHAR)(num % 10) + _T('0'); - num /= 10; -#endif } for (n = 0; n <= c; n++) @@ -685,13 +668,8 @@ PrintSummary (LPTSTR szPath, ULONG ulFiles, ULONG ulDirs, ULARGE_INTEGER bytes, buffer, ulFiles == 1 ? _T(' ') : _T('s')); ConvertULargeInteger (bytes, buffer, sizeof(buffer)); -#ifndef __REACTOS__ ConOutPrintf (_T(" %15s byte%c\n"), buffer, bytes.QuadPart == 1 ? _T(' ') : _T('s')); -#else - ConOutPrintf (_T(" %15s byte%c\n"), - buffer, bytes == 1 ? _T(' ') : _T('s')); -#endif if (IncLine (pLine, dwFlags)) return 1; @@ -713,11 +691,7 @@ PrintSummary (LPTSTR szPath, ULONG ulFiles, ULONG ulDirs, ULARGE_INTEGER bytes, szRoot[0] = szPath[0]; GetDiskFreeSpace (szRoot, &dwSecPerCl, &dwBytPerSec, &dwFreeCl, &dwTotCl); -#ifndef __REACTOS__ uliFree.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl; -#else - uliFree = dwSecPerCl * dwBytPerSec * dwFreeCl; -#endif ConvertULargeInteger (uliFree, buffer, sizeof(buffer)); ConOutPrintf (_T(" %15s bytes free\n"), buffer); } @@ -748,11 +722,7 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags) ULONG dircount = 0; INT count; -#ifndef __REACTOS__ bytecount.QuadPart = 0; -#else - bytecount = 0; -#endif _tcscpy (szFullPath, szPath); if (szFullPath[_tcslen(szFullPath) - 1] != _T('\\')) @@ -840,15 +810,9 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags) count = 0; } -#ifndef __REACTOS__ - uliSize.u.LowPart = file.nFileSizeLow; - uliSize.u.HighPart = file.nFileSizeHigh; + uliSize.LowPart = file.nFileSizeLow; + uliSize.HighPart = file.nFileSizeHigh; bytecount.QuadPart += uliSize.QuadPart; -#else - SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow); - SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh); - bytecount += uliSize; -#endif } else if (dwFlags & DIR_BARE) { @@ -877,15 +841,9 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags) if (IncLine (pLine, dwFlags)) return 1; -#ifndef __REACTOS__ - uliSize.u.LowPart = file.nFileSizeLow; - uliSize.u.HighPart = file.nFileSizeHigh; + uliSize.LowPart = file.nFileSizeLow; + uliSize.HighPart = file.nFileSizeHigh; bytecount.QuadPart += uliSize.QuadPart; -#else - SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow); - SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh); - bytecount += uliSize; -#endif } else { @@ -908,22 +866,13 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags) { ULARGE_INTEGER uliSize; -#ifndef __REACTOS__ - uliSize.u.LowPart = file.nFileSizeLow; - uliSize.u.HighPart = file.nFileSizeHigh; -#else - SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow); - SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh); -#endif + uliSize.LowPart = file.nFileSizeLow; + uliSize.HighPart = file.nFileSizeHigh; ConvertULargeInteger (uliSize, buffer, sizeof(buffer)); ConOutPrintf (_T(" %20s"), buffer); -#ifndef __REACTOS__ bytecount.QuadPart += uliSize.QuadPart; -#else - bytecount += uliSize; -#endif filecount++; } @@ -969,21 +918,11 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags) { ULARGE_INTEGER uliSize; -#ifndef __REACTOS__ - uliSize.u.LowPart = file.nFileSizeLow; - uliSize.u.HighPart = file.nFileSizeHigh; -#else - SET_LARGE_INTEGER_LOW_PART(uliSize, file.nFileSizeLow); - SET_LARGE_INTEGER_HIGH_PART(uliSize, file.nFileSizeHigh); -#endif - - ConvertULargeInteger (uliSize, buffer, sizeof(buffer)); + uliSize.LowPart = file.nFileSizeLow; + uliSize.HighPart = file.nFileSizeHigh; + ConvertULargeInteger (uliSize, buffer, sizeof(buffer)); ConOutPrintf (_T(" %10s "), buffer); -#ifndef __REACTOS__ bytecount.QuadPart += uliSize.QuadPart; -#else - bytecount += uliSize; -#endif filecount++; } @@ -1018,11 +957,7 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags) { recurse_dir_cnt += dircount; recurse_file_cnt += filecount; -#ifndef __REACTOS__ recurse_bytes.QuadPart += bytecount.QuadPart; -#else - recurse_bytes += bytecount; -#endif /* print_summary */ if (PrintSummary (szPath, filecount, dircount, bytecount, pLine, dwFlags)) @@ -1101,14 +1036,6 @@ DirRead (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags) static INT DirRecurse (LPTSTR szPath, LPTSTR szSpec, LPINT pLine, DWORD dwFlags) { - recurse_dir_cnt = 0L; - recurse_file_cnt = 0L; -#ifdef __REACTOS__ - recurse_bytes = 0; -#else - recurse_bytes.QuadPart = 0; -#endif - if (!PrintDirectoryHeader (szPath, pLine, dwFlags)) return 1; @@ -1131,7 +1058,7 @@ DirRecurse (LPTSTR szPath, LPTSTR szSpec, LPINT pLine, DWORD dwFlags) dwFlags &= ~DIR_RECURSE; if (PrintSummary (szPath, recurse_file_cnt, - recurse_dir_cnt, recurse_bytes, pLine, dwFlags)) + recurse_dir_cnt, recurse_bytes, pLine, dwFlags)) return 1; if ((dwFlags & DIR_BARE) == 0) @@ -1160,6 +1087,10 @@ INT cmd_dir (LPTSTR first, LPTSTR rest) INT nLine = 0; + recurse_dir_cnt = 0L; + recurse_file_cnt = 0L; + recurse_bytes.QuadPart = 0; + /* read the parameters from the DIRCMD environment variable */ if (GetEnvironmentVariable (_T("DIRCMD"), dircmd, 256)) {