Fixed LARGE_INTEGER handling

svn path=/trunk/; revision=415
This commit is contained in:
Eric Kohl 1999-04-27 14:15:56 +00:00
parent cee2ad3925
commit 56461438cb
45 changed files with 322 additions and 509 deletions

View file

@ -123,10 +123,6 @@
#include "cmd.h"
#ifdef __REACTOS__
#include <kernel32/li.h>
#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))
{

View file

@ -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)
{

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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;
@ -96,11 +96,11 @@ BOOLEAN MinixWriteSector(IN PDEVICE_OBJECT pDeviceObject,
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);

View file

@ -10,6 +10,7 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <string.h>
#define NDEBUG
#include <internal/debug.h>
@ -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);

View file

@ -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);

View file

@ -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++)

View file

@ -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;

View file

@ -20,8 +20,6 @@ extern "C"
#include <windows.h>
#include <ddk/li.h>
#include <internal/id.h>
#include <ddk/status.h>
#include <ddk/ntdef.h>

View file

@ -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

View file

@ -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;
#else
typedef struct _LARGE_INTEGER {
DWORD LowPart;
LONG HighPart;
typedef union _LARGE_INTEGER
{
struct
{
DWORD ULowPart;
LONG UHighPart;
} u;
LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;
typedef struct _ULARGE_INTEGER {
DWORD LowPart;
DWORD HighPart;
typedef union
{
struct
{
DWORD ULowPart;
DWORD UHighPart;
} u;
ULONGLONG QuadPart;
} ULARGE_INTEGER, *PULARGE_INTEGER;
#endif
#define LowPart u.ULowPart
#define HighPart u.UHighPart
typedef struct _LIST_ENTRY {
struct _LIST_ENTRY *Flink;

View file

@ -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,

View file

@ -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,

View file

@ -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);

View file

@ -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,

View file

@ -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;

View file

@ -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;
}

View file

@ -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,

View file

@ -10,6 +10,7 @@
*/
#include <windows.h>
#include <ddk/ntddk.h>
#include <string.h>
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;

View file

@ -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;
}

View file

@ -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));

View file

@ -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;
}

View file

@ -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,

View file

@ -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;
}

View file

@ -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,

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}
}

View file

@ -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);

View file

@ -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)

View file

@ -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,

View file

@ -166,7 +166,7 @@ LdrLoadDriver(PUNICODE_STRING Filename)
/* Allocate nonpageable memory for driver */
ModuleLoadBase = ExAllocatePool(NonPagedPool,
GET_LARGE_INTEGER_LOW_PART(FileStdInfo.EndOfFile));
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))
{

View file

@ -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++)

View file

@ -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; va<Mdl->Size; 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;
}

View file

@ -18,6 +18,7 @@
#include <internal/ntoskrnl.h>
#include <internal/bitops.h>
#include <internal/string.h>
#include <internal/io.h>
#include <internal/mmhal.h>
@ -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",

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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;
}

View file

@ -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

View file

@ -123,10 +123,6 @@
#include "cmd.h"
#ifdef __REACTOS__
#include <kernel32/li.h>
#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))
{