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