mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Fixed LARGE_INTEGER hack.
svn path=/trunk/; revision=455
This commit is contained in:
parent
fc506149ce
commit
76691783b3
29 changed files with 135 additions and 144 deletions
|
@ -810,8 +810,8 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 if (dwFlags & DIR_BARE)
|
else if (dwFlags & DIR_BARE)
|
||||||
|
@ -841,8 +841,8 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
if (IncLine (pLine, dwFlags))
|
if (IncLine (pLine, dwFlags))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
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
|
else
|
||||||
|
@ -866,8 +866,8 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
ULARGE_INTEGER uliSize;
|
ULARGE_INTEGER uliSize;
|
||||||
|
|
||||||
uliSize.LowPart = file.nFileSizeLow;
|
uliSize.u.LowPart = file.nFileSizeLow;
|
||||||
uliSize.HighPart = file.nFileSizeHigh;
|
uliSize.u.HighPart = file.nFileSizeHigh;
|
||||||
|
|
||||||
ConvertULargeInteger (uliSize, buffer, sizeof(buffer));
|
ConvertULargeInteger (uliSize, buffer, sizeof(buffer));
|
||||||
ConOutPrintf (_T(" %20s"), buffer);
|
ConOutPrintf (_T(" %20s"), buffer);
|
||||||
|
@ -918,8 +918,8 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
ULARGE_INTEGER uliSize;
|
ULARGE_INTEGER uliSize;
|
||||||
|
|
||||||
uliSize.LowPart = file.nFileSizeLow;
|
uliSize.u.LowPart = file.nFileSizeLow;
|
||||||
uliSize.HighPart = file.nFileSizeHigh;
|
uliSize.u.HighPart = file.nFileSizeHigh;
|
||||||
ConvertULargeInteger (uliSize, buffer, sizeof(buffer));
|
ConvertULargeInteger (uliSize, buffer, sizeof(buffer));
|
||||||
ConOutPrintf (_T(" %10s "), buffer);
|
ConOutPrintf (_T(" %10s "), buffer);
|
||||||
bytecount.QuadPart += uliSize.QuadPart;
|
bytecount.QuadPart += uliSize.QuadPart;
|
||||||
|
|
|
@ -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 = InsertKeyLI.LowPart;
|
IrpInsertKey = InsertKeyLI.u.LowPart;
|
||||||
IoStartPacket(DeviceExtension->DeviceObject, Irp, &IrpInsertKey, NULL);
|
IoStartPacket(DeviceExtension->DeviceObject, Irp, &IrpInsertKey, NULL);
|
||||||
|
|
||||||
return STATUS_PENDING;
|
return STATUS_PENDING;
|
||||||
|
@ -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 = SectorLI.LowPart;
|
DeviceExtension->StartingSector = SectorLI.u.LowPart;
|
||||||
if (DeviceExtension->BytesRequested > DeviceExtension->BytesPerSector *
|
if (DeviceExtension->BytesRequested > DeviceExtension->BytesPerSector *
|
||||||
IDE_MAX_SECTORS_PER_XFER)
|
IDE_MAX_SECTORS_PER_XFER)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,8 +36,8 @@ BOOLEAN Ext2ReadSectors(IN PDEVICE_OBJECT pDeviceObject,
|
||||||
DPRINT("VFATReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
DPRINT("VFATReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
||||||
pDeviceObject,DiskSector,Buffer);
|
pDeviceObject,DiskSector,Buffer);
|
||||||
|
|
||||||
sectorNumber.HighPart = 0;
|
sectorNumber.u.HighPart = 0;
|
||||||
sectorNumber.LowPart = DiskSector * BLOCKSIZE;
|
sectorNumber.u.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,
|
||||||
|
@ -104,8 +104,8 @@ BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject,
|
||||||
DPRINT("VFATWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
DPRINT("VFATWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
||||||
pDeviceObject,DiskSector,Buffer);
|
pDeviceObject,DiskSector,Buffer);
|
||||||
|
|
||||||
sectorNumber.HighPart = 0;
|
sectorNumber.u.HighPart = 0;
|
||||||
sectorNumber.LowPart = DiskSector * BLOCKSIZE;
|
sectorNumber.u.LowPart = DiskSector * BLOCKSIZE;
|
||||||
|
|
||||||
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ NTSTATUS Ext2ReadFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
{
|
{
|
||||||
PEXT2_FCB Fcb;
|
PEXT2_FCB Fcb;
|
||||||
PVOID TempBuffer;
|
PVOID TempBuffer;
|
||||||
ULONG Offset = OffsetL.LowPart;
|
ULONG Offset = OffsetL.u.LowPart;
|
||||||
ULONG block;
|
ULONG block;
|
||||||
ULONG Delta;
|
ULONG Delta;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
|
@ -35,8 +35,8 @@ BOOLEAN MinixReadSector(IN PDEVICE_OBJECT pDeviceObject,
|
||||||
DPRINT("MinixReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
DPRINT("MinixReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
||||||
pDeviceObject,DiskSector,Buffer);
|
pDeviceObject,DiskSector,Buffer);
|
||||||
|
|
||||||
sectorNumber.HighPart = 0;
|
sectorNumber.u.HighPart = 0;
|
||||||
sectorNumber.LowPart = DiskSector * BLOCKSIZE;
|
sectorNumber.u.LowPart = DiskSector * BLOCKSIZE;
|
||||||
|
|
||||||
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
||||||
|
|
||||||
|
@ -99,8 +99,8 @@ BOOLEAN MinixWriteSector(IN PDEVICE_OBJECT pDeviceObject,
|
||||||
DPRINT("MinixWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
DPRINT("MinixWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
||||||
pDeviceObject,DiskSector,Buffer);
|
pDeviceObject,DiskSector,Buffer);
|
||||||
|
|
||||||
sectorNumber.HighPart = 0;
|
sectorNumber.u.HighPart = 0;
|
||||||
sectorNumber.LowPart = DiskSector * BLOCKSIZE;
|
sectorNumber.u.LowPart = DiskSector * BLOCKSIZE;
|
||||||
|
|
||||||
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
||||||
|
|
||||||
|
|
|
@ -45,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 = Stack->Parameters.Read.ByteOffset.LowPart;
|
Offset = Stack->Parameters.Read.ByteOffset.u.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,8 @@ BOOLEAN VFATReadSectors(IN PDEVICE_OBJECT pDeviceObject,
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
ULONG sectorSize;
|
ULONG sectorSize;
|
||||||
|
|
||||||
sectorNumber.LowPart = DiskSector << 9;
|
sectorNumber.u.LowPart = DiskSector << 9;
|
||||||
sectorNumber.HighPart = DiskSector >> 23;
|
sectorNumber.u.HighPart = DiskSector >> 23;
|
||||||
|
|
||||||
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
||||||
sectorSize = BLOCKSIZE * SectorCount;
|
sectorSize = BLOCKSIZE * SectorCount;
|
||||||
|
@ -82,8 +82,8 @@ BOOLEAN VFATReadSectors(IN PDEVICE_OBJECT pDeviceObject,
|
||||||
pDeviceObject,
|
pDeviceObject,
|
||||||
DiskSector,
|
DiskSector,
|
||||||
Buffer,
|
Buffer,
|
||||||
sectorNumber.HighPart,
|
sectorNumber.u.HighPart,
|
||||||
sectorNumber.LowPart);
|
sectorNumber.u.LowPart);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
DPRINT("Block request succeeded\n");
|
DPRINT("Block request succeeded\n");
|
||||||
|
@ -105,8 +105,8 @@ BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject,
|
||||||
DPRINT("VFATWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
DPRINT("VFATWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
||||||
pDeviceObject,DiskSector,Buffer);
|
pDeviceObject,DiskSector,Buffer);
|
||||||
|
|
||||||
sectorNumber.LowPart = DiskSector << 9;
|
sectorNumber.u.LowPart = DiskSector << 9;
|
||||||
sectorNumber.HighPart = DiskSector >> 23;
|
sectorNumber.u.HighPart = DiskSector >> 23;
|
||||||
|
|
||||||
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
||||||
|
|
||||||
|
|
|
@ -1508,7 +1508,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 = Stack->Parameters.Write.ByteOffset.LowPart;
|
Offset = Stack->Parameters.Write.ByteOffset.u.LowPart;
|
||||||
|
|
||||||
Status = FsdWriteFile(DeviceExt,FileObject,Buffer,Length,Offset);
|
Status = FsdWriteFile(DeviceExt,FileObject,Buffer,Length,Offset);
|
||||||
|
|
||||||
|
@ -1546,7 +1546,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 = Stack->Parameters.Read.ByteOffset.LowPart;
|
Offset = Stack->Parameters.Read.ByteOffset.u.LowPart;
|
||||||
|
|
||||||
Status = FsdReadFile(DeviceExt,FileObject,Buffer,Length,Offset,
|
Status = FsdReadFile(DeviceExt,FileObject,Buffer,Length,Offset,
|
||||||
&LengthRead);
|
&LengthRead);
|
||||||
|
|
|
@ -36,25 +36,22 @@ typedef union _LARGE_INTEGER
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
DWORD ULowPart;
|
DWORD LowPart;
|
||||||
LONG UHighPart;
|
LONG HighPart;
|
||||||
} u;
|
} u;
|
||||||
LONGLONG QuadPart;
|
LONGLONG QuadPart;
|
||||||
} LARGE_INTEGER, *PLARGE_INTEGER;
|
} LARGE_INTEGER, *PLARGE_INTEGER;
|
||||||
|
|
||||||
typedef union
|
typedef union _ULARGE_INTEGER
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
DWORD ULowPart;
|
DWORD LowPart;
|
||||||
DWORD UHighPart;
|
DWORD HighPart;
|
||||||
} u;
|
} u;
|
||||||
ULONGLONG QuadPart;
|
ULONGLONG QuadPart;
|
||||||
} ULARGE_INTEGER, *PULARGE_INTEGER;
|
} ULARGE_INTEGER, *PULARGE_INTEGER;
|
||||||
|
|
||||||
#define LowPart u.ULowPart
|
|
||||||
#define HighPart u.UHighPart
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _LIST_ENTRY {
|
typedef struct _LIST_ENTRY {
|
||||||
struct _LIST_ENTRY *Flink;
|
struct _LIST_ENTRY *Flink;
|
||||||
|
@ -339,15 +336,10 @@ typedef struct _KEY_EVENT_RECORD {
|
||||||
WORD wRepeatCount;
|
WORD wRepeatCount;
|
||||||
WORD wVirtualKeyCode;
|
WORD wVirtualKeyCode;
|
||||||
WORD wVirtualScanCode;
|
WORD wVirtualScanCode;
|
||||||
|
|
||||||
// char AsciiChar;
|
|
||||||
// char pad;
|
|
||||||
//#if 0
|
|
||||||
union {
|
union {
|
||||||
WCHAR UnicodeChar;
|
WCHAR UnicodeChar;
|
||||||
CHAR AsciiChar;
|
CHAR AsciiChar;
|
||||||
} uChar;
|
} uChar;
|
||||||
//#endif
|
|
||||||
DWORD dwControlKeyState;
|
DWORD dwControlKeyState;
|
||||||
} KEY_EVENT_RECORD PACKED;
|
} KEY_EVENT_RECORD PACKED;
|
||||||
|
|
||||||
|
|
|
@ -151,41 +151,41 @@ DWORD STDCALL SetFilePointer(HANDLE hFile,
|
||||||
&FilePosition,
|
&FilePosition,
|
||||||
sizeof(FILE_POSITION_INFORMATION),
|
sizeof(FILE_POSITION_INFORMATION),
|
||||||
FilePositionInformation);
|
FilePositionInformation);
|
||||||
FilePosition.CurrentByteOffset.LowPart += lDistanceToMove;
|
FilePosition.CurrentByteOffset.u.LowPart += lDistanceToMove;
|
||||||
if (lpDistanceToMoveHigh != NULL)
|
if (lpDistanceToMoveHigh != NULL)
|
||||||
{
|
{
|
||||||
FilePosition.CurrentByteOffset.HighPart =
|
FilePosition.CurrentByteOffset.u.HighPart =
|
||||||
FilePosition.CurrentByteOffset.HighPart +
|
FilePosition.CurrentByteOffset.u.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);
|
||||||
FilePosition.CurrentByteOffset.LowPart =
|
FilePosition.CurrentByteOffset.u.LowPart =
|
||||||
FileEndOfFile.EndOfFile.LowPart - lDistanceToMove;
|
FileEndOfFile.EndOfFile.u.LowPart - lDistanceToMove;
|
||||||
if ( lpDistanceToMoveHigh != NULL )
|
if ( lpDistanceToMoveHigh != NULL )
|
||||||
{
|
{
|
||||||
FilePosition.CurrentByteOffset.HighPart =
|
FilePosition.CurrentByteOffset.u.HighPart =
|
||||||
FileEndOfFile.EndOfFile.HighPart - *lpDistanceToMoveHigh;
|
FileEndOfFile.EndOfFile.u.HighPart - *lpDistanceToMoveHigh;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FilePosition.CurrentByteOffset.HighPart =
|
FilePosition.CurrentByteOffset.u.HighPart =
|
||||||
FileEndOfFile.EndOfFile.HighPart;
|
FileEndOfFile.EndOfFile.u.HighPart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( dwMoveMethod == FILE_BEGIN )
|
else if ( dwMoveMethod == FILE_BEGIN )
|
||||||
{
|
{
|
||||||
FilePosition.CurrentByteOffset.LowPart = lDistanceToMove;
|
FilePosition.CurrentByteOffset.u.LowPart = lDistanceToMove;
|
||||||
if ( lpDistanceToMoveHigh != NULL )
|
if ( lpDistanceToMoveHigh != NULL )
|
||||||
{
|
{
|
||||||
FilePosition.CurrentByteOffset.HighPart =
|
FilePosition.CurrentByteOffset.u.HighPart =
|
||||||
*lpDistanceToMoveHigh;
|
*lpDistanceToMoveHigh;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FilePosition.CurrentByteOffset.HighPart = 0;
|
FilePosition.CurrentByteOffset.u.HighPart = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,9 +202,9 @@ DWORD STDCALL SetFilePointer(HANDLE hFile,
|
||||||
|
|
||||||
if (lpDistanceToMoveHigh != NULL)
|
if (lpDistanceToMoveHigh != NULL)
|
||||||
{
|
{
|
||||||
*lpDistanceToMoveHigh = FilePosition.CurrentByteOffset.HighPart;
|
*lpDistanceToMoveHigh = FilePosition.CurrentByteOffset.u.HighPart;
|
||||||
}
|
}
|
||||||
return FilePosition.CurrentByteOffset.LowPart;
|
return FilePosition.CurrentByteOffset.u.LowPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD STDCALL GetFileType(HANDLE hFile)
|
DWORD STDCALL GetFileType(HANDLE hFile)
|
||||||
|
@ -240,10 +240,10 @@ DWORD STDCALL GetFileSize(HANDLE hFile,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( lpFileSizeHigh != NULL )
|
if ( lpFileSizeHigh != NULL )
|
||||||
*lpFileSizeHigh = FileStandard.AllocationSize.HighPart;
|
*lpFileSizeHigh = FileStandard.AllocationSize.u.HighPart;
|
||||||
|
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
return FileStandard.AllocationSize.LowPart;
|
return FileStandard.AllocationSize.u.LowPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD STDCALL GetCompressedFileSizeA(LPCSTR lpFileName,
|
DWORD STDCALL GetCompressedFileSizeA(LPCSTR lpFileName,
|
||||||
|
@ -321,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 = FileDirectory.AllocationSize.HighPart;
|
lpFileInformation->nFileSizeHigh = FileDirectory.AllocationSize.u.HighPart;
|
||||||
lpFileInformation->nFileSizeLow = FileDirectory.AllocationSize.LowPart;
|
lpFileInformation->nFileSizeLow = FileDirectory.AllocationSize.u.LowPart;
|
||||||
|
|
||||||
errCode = NtQueryInformationFile(hFile,
|
errCode = NtQueryInformationFile(hFile,
|
||||||
&IoStatusBlock,
|
&IoStatusBlock,
|
||||||
|
@ -334,8 +334,8 @@ WINBOOL STDCALL GetFileInformationByHandle(HANDLE hFile,
|
||||||
SetLastError(RtlNtStatusToDosError(errCode));
|
SetLastError(RtlNtStatusToDosError(errCode));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
lpFileInformation->nFileIndexHigh = FileInternal.IndexNumber.HighPart;
|
lpFileInformation->nFileIndexHigh = FileInternal.IndexNumber.u.HighPart;
|
||||||
lpFileInformation->nFileIndexLow = FileInternal.IndexNumber.LowPart;
|
lpFileInformation->nFileIndexLow = FileInternal.IndexNumber.u.LowPart;
|
||||||
|
|
||||||
errCode = NtQueryVolumeInformationFile(hFile,
|
errCode = NtQueryVolumeInformationFile(hFile,
|
||||||
&IoStatusBlock,
|
&IoStatusBlock,
|
||||||
|
|
|
@ -61,8 +61,8 @@ static void FileDataToWin32Data(LPWIN32_FIND_DATA lpFindFileData, PKERNEL32_FIND
|
||||||
// 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.HighPart;
|
lpFindFileData->nFileSizeHigh = IData->FileInfo.EndOfFile.u.HighPart;
|
||||||
lpFindFileData->nFileSizeLow = IData->FileInfo.EndOfFile.LowPart;
|
lpFindFileData->nFileSizeLow = IData->FileInfo.EndOfFile.u.LowPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
WINBOOL STDCALL InternalFindNextFile(HANDLE hFindFile,
|
WINBOOL STDCALL InternalFindNextFile(HANDLE hFindFile,
|
||||||
|
|
|
@ -69,8 +69,8 @@ LockFileEx(
|
||||||
|
|
||||||
lpOverlapped->Internal = STATUS_PENDING;
|
lpOverlapped->Internal = STATUS_PENDING;
|
||||||
|
|
||||||
Offset.LowPart = lpOverlapped->Offset;
|
Offset.u.LowPart = lpOverlapped->Offset;
|
||||||
Offset.HighPart = lpOverlapped->OffsetHigh;
|
Offset.u.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;
|
||||||
|
|
||||||
BytesToLock.LowPart = nNumberOfBytesToLockLow;
|
BytesToLock.u.LowPart = nNumberOfBytesToLockLow;
|
||||||
BytesToLock.HighPart = nNumberOfBytesToLockHigh;
|
BytesToLock.u.HighPart = nNumberOfBytesToLockHigh;
|
||||||
|
|
||||||
errCode = NtLockFile(hFile,
|
errCode = NtLockFile(hFile,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -151,11 +151,11 @@ UnlockFileEx(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BytesToUnLock.LowPart = nNumberOfBytesToUnLockLow;
|
BytesToUnLock.u.LowPart = nNumberOfBytesToUnLockLow;
|
||||||
BytesToUnLock.HighPart = nNumberOfBytesToUnLockHigh;
|
BytesToUnLock.u.HighPart = nNumberOfBytesToUnLockHigh;
|
||||||
|
|
||||||
StartAddress.LowPart = lpOverlapped->Offset;
|
StartAddress.u.LowPart = lpOverlapped->Offset;
|
||||||
StartAddress.HighPart = lpOverlapped->OffsetHigh;
|
StartAddress.u.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 )
|
||||||
{
|
{
|
||||||
Offset.LowPart = lpOverLapped->Offset;
|
Offset.u.LowPart = lpOverLapped->Offset;
|
||||||
Offset.HighPart = lpOverLapped->OffsetHigh;
|
Offset.u.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;
|
||||||
|
@ -88,8 +88,8 @@ WINBOOL STDCALL KERNEL32_ReadFile(HANDLE hFile,
|
||||||
|
|
||||||
if (lpOverLapped != NULL)
|
if (lpOverLapped != NULL)
|
||||||
{
|
{
|
||||||
Offset.LowPart = lpOverLapped->Offset;
|
Offset.u.LowPart = lpOverLapped->Offset;
|
||||||
Offset.HighPart = lpOverLapped->OffsetHigh;
|
Offset.u.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;
|
||||||
|
|
|
@ -197,8 +197,8 @@ GetDiskFreeSpaceW(
|
||||||
|
|
||||||
*lpBytesPerSector = FileFsSize.BytesPerSector;
|
*lpBytesPerSector = FileFsSize.BytesPerSector;
|
||||||
*lpSectorsPerCluster = FileFsSize.SectorsPerAllocationUnit;
|
*lpSectorsPerCluster = FileFsSize.SectorsPerAllocationUnit;
|
||||||
*lpNumberOfFreeClusters = FileFsSize.AvailableAllocationUnits.LowPart;
|
*lpNumberOfFreeClusters = FileFsSize.AvailableAllocationUnits.u.LowPart;
|
||||||
*lpTotalNumberOfClusters = FileFsSize.TotalAllocationUnits.LowPart;
|
*lpTotalNumberOfClusters = FileFsSize.TotalAllocationUnits.u.LowPart;
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ GetDiskFreeSpaceExW(
|
||||||
BytesPerCluster.QuadPart * FileFsSize.AvailableAllocationUnits.QuadPart;
|
BytesPerCluster.QuadPart * FileFsSize.AvailableAllocationUnits.QuadPart;
|
||||||
|
|
||||||
lpTotalNumberOfBytes->QuadPart =
|
lpTotalNumberOfBytes->QuadPart =
|
||||||
BytesPerCluster.QuadPart * FileFsSize.TotalAllocationUnits.LowPart;
|
BytesPerCluster.QuadPart * FileFsSize.TotalAllocationUnits.QuadPart;
|
||||||
lpTotalNumberOfFreeBytes->QuadPart =
|
lpTotalNumberOfFreeBytes->QuadPart =
|
||||||
BytesPerCluster.QuadPart * FileFsSize.AvailableAllocationUnits.QuadPart;
|
BytesPerCluster.QuadPart * FileFsSize.AvailableAllocationUnits.QuadPart;
|
||||||
|
|
||||||
|
|
|
@ -295,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)(dwHour.LowPart);
|
lpSystemTime->wHour= (WORD)(dwHour.u.LowPart);
|
||||||
lpSystemTime->wMinute= (WORD)(dwMinute.LowPart);
|
lpSystemTime->wMinute= (WORD)(dwMinute.u.LowPart);
|
||||||
lpSystemTime->wSecond= (WORD)(dwSecond.LowPart);
|
lpSystemTime->wSecond= (WORD)(dwSecond.u.LowPart);
|
||||||
lpSystemTime->wMilliseconds = (WORD)(dwRemSecond.LowPart/10000);
|
lpSystemTime->wMilliseconds = (WORD)(dwRemSecond.u.LowPart/10000);
|
||||||
|
|
||||||
|
|
||||||
if ( lpSystemTime->wSecond > 60 ) {
|
if ( lpSystemTime->wSecond > 60 ) {
|
||||||
|
@ -313,13 +313,13 @@ FileTimeToSystemTime(
|
||||||
|
|
||||||
if (lpSystemTime->wHour > 24 ) {
|
if (lpSystemTime->wHour > 24 ) {
|
||||||
lpSystemTime->wHour-= 24;
|
lpSystemTime->wHour-= 24;
|
||||||
dwDay.LowPart = dwDay.LowPart + 1;
|
dwDay.u.LowPart = dwDay.u.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)dwMillenium.LowPart + 100 * (LONG)dwCentury.LowPart + 4 * (LONG)dwFourYear.LowPart + (LONG)dwYear.LowPart;
|
lpSystemTime->wYear = 1601 + 1000* (LONG)dwMillenium.u.LowPart + 100 * (LONG)dwCentury.u.LowPart + 4 * (LONG)dwFourYear.u.LowPart + (LONG)dwYear.u.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;
|
||||||
|
@ -328,58 +328,58 @@ FileTimeToSystemTime(
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ( dwDay.LowPart >= 0 && dwDay.LowPart < 31 ) {
|
if ( dwDay.u.LowPart >= 0 && dwDay.u.LowPart < 31 ) {
|
||||||
lpSystemTime->wMonth = 1;
|
lpSystemTime->wMonth = 1;
|
||||||
lpSystemTime->wDay = dwDay.LowPart + 1;
|
lpSystemTime->wDay = dwDay.u.LowPart + 1;
|
||||||
}
|
}
|
||||||
else if ( dwDay.LowPart >= 31 && dwDay.LowPart < ( 59 + LeapDay )) {
|
else if ( dwDay.u.LowPart >= 31 && dwDay.u.LowPart < ( 59 + LeapDay )) {
|
||||||
lpSystemTime->wMonth = 2;
|
lpSystemTime->wMonth = 2;
|
||||||
lpSystemTime->wDay = dwDay.LowPart + 1 - 31;
|
lpSystemTime->wDay = dwDay.u.LowPart + 1 - 31;
|
||||||
}
|
}
|
||||||
else if ( dwDay.LowPart >= ( 59 + LeapDay ) && dwDay.LowPart < ( 90 + LeapDay ) ) {
|
else if ( dwDay.u.LowPart >= ( 59 + LeapDay ) && dwDay.u.LowPart < ( 90 + LeapDay ) ) {
|
||||||
lpSystemTime->wMonth = 3;
|
lpSystemTime->wMonth = 3;
|
||||||
lpSystemTime->wDay = dwDay.LowPart + 1 - ( 59 + LeapDay);
|
lpSystemTime->wDay = dwDay.u.LowPart + 1 - ( 59 + LeapDay);
|
||||||
}
|
}
|
||||||
else if ( dwDay.LowPart >= 90+ LeapDay && dwDay.LowPart < 120 + LeapDay) {
|
else if ( dwDay.u.LowPart >= 90+ LeapDay && dwDay.u.LowPart < 120 + LeapDay) {
|
||||||
lpSystemTime->wMonth = 4;
|
lpSystemTime->wMonth = 4;
|
||||||
lpSystemTime->wDay = dwDay.LowPart + 1 - (31 + LeapDay );
|
lpSystemTime->wDay = dwDay.u.LowPart + 1 - (31 + LeapDay );
|
||||||
}
|
}
|
||||||
else if ( dwDay.LowPart >= 120 + LeapDay && dwDay.LowPart < 151 + LeapDay ) {
|
else if ( dwDay.u.LowPart >= 120 + LeapDay && dwDay.u.LowPart < 151 + LeapDay ) {
|
||||||
lpSystemTime->wMonth = 5;
|
lpSystemTime->wMonth = 5;
|
||||||
lpSystemTime->wDay = dwDay.LowPart + 1 - (120 + LeapDay);
|
lpSystemTime->wDay = dwDay.u.LowPart + 1 - (120 + LeapDay);
|
||||||
}
|
}
|
||||||
else if ( dwDay.LowPart >= ( 151 + LeapDay) && dwDay.LowPart < ( 181 + LeapDay ) ) {
|
else if ( dwDay.u.LowPart >= ( 151 + LeapDay) && dwDay.u.LowPart < ( 181 + LeapDay ) ) {
|
||||||
lpSystemTime->wMonth = 6;
|
lpSystemTime->wMonth = 6;
|
||||||
lpSystemTime->wDay = dwDay.LowPart + 1 - ( 151 + LeapDay );
|
lpSystemTime->wDay = dwDay.u.LowPart + 1 - ( 151 + LeapDay );
|
||||||
}
|
}
|
||||||
else if ( dwDay.LowPart >= ( 181 + LeapDay ) && dwDay.LowPart < ( 212 + LeapDay ) ) {
|
else if ( dwDay.u.LowPart >= ( 181 + LeapDay ) && dwDay.u.LowPart < ( 212 + LeapDay ) ) {
|
||||||
lpSystemTime->wMonth = 7;
|
lpSystemTime->wMonth = 7;
|
||||||
lpSystemTime->wDay = dwDay.LowPart + 1 - ( 181 + LeapDay );
|
lpSystemTime->wDay = dwDay.u.LowPart + 1 - ( 181 + LeapDay );
|
||||||
}
|
}
|
||||||
else if ( dwDay.LowPart >= ( 212 + LeapDay ) && dwDay.LowPart < ( 243 + LeapDay ) ) {
|
else if ( dwDay.u.LowPart >= ( 212 + LeapDay ) && dwDay.u.LowPart < ( 243 + LeapDay ) ) {
|
||||||
lpSystemTime->wMonth = 8;
|
lpSystemTime->wMonth = 8;
|
||||||
lpSystemTime->wDay = dwDay.LowPart + 1 - (212 + LeapDay );
|
lpSystemTime->wDay = dwDay.u.LowPart + 1 - (212 + LeapDay );
|
||||||
}
|
}
|
||||||
else if ( dwDay.LowPart >= ( 243+ LeapDay ) && dwDay.LowPart < ( 273 + LeapDay ) ) {
|
else if ( dwDay.u.LowPart >= ( 243+ LeapDay ) && dwDay.u.LowPart < ( 273 + LeapDay ) ) {
|
||||||
lpSystemTime->wMonth = 9;
|
lpSystemTime->wMonth = 9;
|
||||||
lpSystemTime->wDay = dwDay.LowPart + 1 - ( 243 + LeapDay );
|
lpSystemTime->wDay = dwDay.u.LowPart + 1 - ( 243 + LeapDay );
|
||||||
}
|
}
|
||||||
else if ( dwDay.LowPart >= ( 273 + LeapDay ) && dwDay.LowPart < ( 304 + LeapDay ) ) {
|
else if ( dwDay.u.LowPart >= ( 273 + LeapDay ) && dwDay.u.LowPart < ( 304 + LeapDay ) ) {
|
||||||
lpSystemTime->wMonth = 10;
|
lpSystemTime->wMonth = 10;
|
||||||
lpSystemTime->wDay = dwDay.LowPart + 1 - ( 273 + LeapDay);
|
lpSystemTime->wDay = dwDay.u.LowPart + 1 - ( 273 + LeapDay);
|
||||||
}
|
}
|
||||||
else if ( dwDay.LowPart >= ( 304 + LeapDay ) && dwDay.LowPart < ( 334 + LeapDay ) ) {
|
else if ( dwDay.u.LowPart >= ( 304 + LeapDay ) && dwDay.u.LowPart < ( 334 + LeapDay ) ) {
|
||||||
lpSystemTime->wMonth = 11;
|
lpSystemTime->wMonth = 11;
|
||||||
lpSystemTime->wDay = dwDay.LowPart + 1 - ( 304 + LeapDay );
|
lpSystemTime->wDay = dwDay.u.LowPart + 1 - ( 304 + LeapDay );
|
||||||
}
|
}
|
||||||
else if ( dwDay.LowPart >= ( 334 + LeapDay ) && dwDay.LowPart < ( 365 + LeapDay )) {
|
else if ( dwDay.u.LowPart >= ( 334 + LeapDay ) && dwDay.u.LowPart < ( 365 + LeapDay )) {
|
||||||
lpSystemTime->wMonth = 12;
|
lpSystemTime->wMonth = 12;
|
||||||
lpSystemTime->wDay = dwDay.LowPart + 1 - ( 334 + LeapDay );
|
lpSystemTime->wDay = dwDay.u.LowPart + 1 - ( 334 + LeapDay );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dwDayOfWeek = RtlLargeIntegerDivide(FileTime,LIDAY,&dwRemDay);
|
dwDayOfWeek = RtlLargeIntegerDivide(FileTime,LIDAY,&dwRemDay);
|
||||||
lpSystemTime->wDayOfWeek = 1 + dwDayOfWeek.LowPart % 7;
|
lpSystemTime->wDayOfWeek = 1 + dwDayOfWeek.u.LowPart % 7;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -303,8 +303,8 @@ HANDLE KERNEL32_MapFile(LPCWSTR lpApplicationName,
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileOffset.HighPart = 0;
|
FileOffset.u.LowPart = DosHeader->e_lfanew;
|
||||||
FileOffset.LowPart = DosHeader->e_lfanew;
|
FileOffset.u.HighPart = 0;
|
||||||
|
|
||||||
Status = NtReadFile(hFile,
|
Status = NtReadFile(hFile,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -235,8 +235,7 @@ SleepEx(
|
||||||
TIME Interval;
|
TIME Interval;
|
||||||
NTSTATUS errCode;
|
NTSTATUS errCode;
|
||||||
|
|
||||||
Interval.LowPart = dwMilliseconds * 1000;
|
Interval.QuadPart = dwMilliseconds * 1000;
|
||||||
Interval.HighPart = 0;
|
|
||||||
|
|
||||||
errCode = NtDelayExecution(bAlertable,&Interval);
|
errCode = NtDelayExecution(bAlertable,&Interval);
|
||||||
if ( !NT_SUCCESS(errCode) ) {
|
if ( !NT_SUCCESS(errCode) ) {
|
||||||
|
|
|
@ -182,8 +182,8 @@ DWORD STDCALL WaitForSingleObjectEx(HANDLE hHandle,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Time.LowPart = dwMilliseconds;
|
Time.u.LowPart = dwMilliseconds;
|
||||||
Time.HighPart = 0;
|
Time.u.HighPart = 0;
|
||||||
TimePtr = &Time;
|
TimePtr = &Time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,8 +222,8 @@ WaitForMultipleObjectsEx(
|
||||||
LARGE_INTEGER Time;
|
LARGE_INTEGER Time;
|
||||||
DWORD retCode;
|
DWORD retCode;
|
||||||
|
|
||||||
Time.LowPart = dwMilliseconds;
|
Time.u.LowPart = dwMilliseconds;
|
||||||
Time.HighPart = 0;
|
Time.u.HighPart = 0;
|
||||||
|
|
||||||
errCode = NtWaitForMultipleObjects (
|
errCode = NtWaitForMultipleObjects (
|
||||||
nCount,
|
nCount,
|
||||||
|
|
|
@ -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);
|
||||||
Offset.HighPart = 0;
|
Offset.u.LowPart = Sections[i].PointerToRawData;
|
||||||
Offset.LowPart = Sections[i].PointerToRawData;
|
Offset.u.HighPart = 0;
|
||||||
Status = ZwMapViewOfSection(SectionHandle,
|
Status = ZwMapViewOfSection(SectionHandle,
|
||||||
ProcessHandle,
|
ProcessHandle,
|
||||||
(PVOID *)&Base,
|
(PVOID *)&Base,
|
||||||
|
|
|
@ -170,8 +170,8 @@ static NTSTATUS CbReadBlock(PDCCB Dccb, PCCB Ccb)
|
||||||
Ccb->Buffer=ExAllocatePool(NonPagedPool,Dccb->SectorSize);
|
Ccb->Buffer=ExAllocatePool(NonPagedPool,Dccb->SectorSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset.LowPart = Ccb->BlockNr * Dccb->SectorSize;
|
Offset.u.LowPart = Ccb->BlockNr * Dccb->SectorSize;
|
||||||
Offset.HighPart = 0;
|
Offset.u.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;
|
||||||
|
|
||||||
Offset.LowPart = Ccb->BlockNr * Dccb->SectorSize;
|
Offset.u.LowPart = Ccb->BlockNr * Dccb->SectorSize;
|
||||||
Offset.HighPart = 0;
|
Offset.u.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,7 +84,7 @@ NTSTATUS MmCopyMmInfo(PEPROCESS Src, PEPROCESS Dest)
|
||||||
{
|
{
|
||||||
return(STATUS_UNSUCCESSFUL);
|
return(STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
PhysPageDirectory = (PULONG)(MmGetPhysicalAddress(PageDirectory)).LowPart;
|
PhysPageDirectory = (PULONG)(MmGetPhysicalAddress(PageDirectory)).u.LowPart;
|
||||||
KProcess->PageTableDirectory = PhysPageDirectory;
|
KProcess->PageTableDirectory = PhysPageDirectory;
|
||||||
CurrentPageDirectory = (PULONG)PAGEDIRECTORY_MAP;
|
CurrentPageDirectory = (PULONG)PAGEDIRECTORY_MAP;
|
||||||
|
|
||||||
|
@ -256,8 +256,8 @@ PHYSICAL_ADDRESS MmGetPhysicalAddress(PVOID vaddr)
|
||||||
|
|
||||||
DPRINT("MmGetPhysicalAddress(vaddr %x)\n", vaddr);
|
DPRINT("MmGetPhysicalAddress(vaddr %x)\n", vaddr);
|
||||||
|
|
||||||
p.LowPart = PAGE_MASK(*MmGetPageEntry(vaddr));
|
p.u.LowPart = PAGE_MASK(*MmGetPageEntry(vaddr));
|
||||||
p.HighPart = 0;
|
p.u.HighPart = 0;
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,8 +112,8 @@ VOID IoReadWriteCompletion(PDEVICE_OBJECT DeviceObject,
|
||||||
}
|
}
|
||||||
if (FileObject != NULL)
|
if (FileObject != NULL)
|
||||||
{
|
{
|
||||||
FileObject->CurrentByteOffset.LowPart =
|
FileObject->CurrentByteOffset.u.LowPart =
|
||||||
FileObject->CurrentByteOffset.LowPart +
|
FileObject->CurrentByteOffset.u.LowPart +
|
||||||
Irp->IoStatus.Information;
|
Irp->IoStatus.Information;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
Offset.HighPart = 0;
|
Offset.u.LowPart = Sections[i].PointerToRawData;
|
||||||
Offset.LowPart = Sections[i].PointerToRawData;
|
Offset.u.HighPart = 0;
|
||||||
Status = ZwMapViewOfSection(NTDllSectionHandle,
|
Status = ZwMapViewOfSection(NTDllSectionHandle,
|
||||||
ProcessHandle,
|
ProcessHandle,
|
||||||
(PVOID *)&Base,
|
(PVOID *)&Base,
|
||||||
|
|
|
@ -166,7 +166,7 @@ LdrLoadDriver(PUNICODE_STRING Filename)
|
||||||
|
|
||||||
/* Allocate nonpageable memory for driver */
|
/* Allocate nonpageable memory for driver */
|
||||||
ModuleLoadBase = ExAllocatePool(NonPagedPool,
|
ModuleLoadBase = ExAllocatePool(NonPagedPool,
|
||||||
FileStdInfo.EndOfFile.LowPart);
|
FileStdInfo.EndOfFile.u.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,
|
||||||
FileStdInfo.EndOfFile.LowPart,
|
FileStdInfo.EndOfFile.u.LowPart,
|
||||||
0, 0);
|
0, 0);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
|
@ -415,7 +415,7 @@ NTSTATUS MmFreeMemoryArea(PEPROCESS Process,
|
||||||
{
|
{
|
||||||
PhysicalAddr = MmGetPhysicalAddress(MemoryArea->BaseAddress +
|
PhysicalAddr = MmGetPhysicalAddress(MemoryArea->BaseAddress +
|
||||||
(i*PAGESIZE));
|
(i*PAGESIZE));
|
||||||
MmFreePage((PVOID)(ULONG)(PhysicalAddr.LowPart), 1);
|
MmFreePage((PVOID)(ULONG)(PhysicalAddr.u.LowPart), 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] = (MmGetPhysicalAddress(Address)).LowPart;
|
mdl_pages[i] = (MmGetPhysicalAddress(Address)).u.LowPart;
|
||||||
DPRINT("mdl_pages[i] %x\n",mdl_pages[i]);
|
DPRINT("mdl_pages[i] %x\n",mdl_pages[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ VOID MmBuildMdlForNonPagedPool(PMDL Mdl)
|
||||||
for (va=0; va<Mdl->Size; va++)
|
for (va=0; va<Mdl->Size; va++)
|
||||||
{
|
{
|
||||||
((PULONG)(Mdl + 1))[va] =
|
((PULONG)(Mdl + 1))[va] =
|
||||||
(MmGetPhysicalAddress(Mdl->StartVa + (va * PAGESIZE))).LowPart;
|
(MmGetPhysicalAddress(Mdl->StartVa + (va * PAGESIZE))).u.LowPart;
|
||||||
}
|
}
|
||||||
Mdl->MappedSystemVa = Mdl->StartVa;
|
Mdl->MappedSystemVa = Mdl->StartVa;
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,9 +332,9 @@ NTSTATUS STDCALL ZwMapViewOfSection(HANDLE SectionHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("ViewSize %x\n",ViewSize);
|
DPRINT("ViewSize %x\n",ViewSize);
|
||||||
if ((*ViewSize) > Section->MaximumSize.LowPart)
|
if ((*ViewSize) > Section->MaximumSize.u.LowPart)
|
||||||
{
|
{
|
||||||
(*ViewSize) = Section->MaximumSize.LowPart;
|
(*ViewSize) = Section->MaximumSize.u.LowPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = MmCreateMemoryArea(UserMode,
|
Status = MmCreateMemoryArea(UserMode,
|
||||||
|
@ -361,7 +361,7 @@ NTSTATUS STDCALL ZwMapViewOfSection(HANDLE SectionHandle,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Result->Data.SectionData.ViewOffset = SectionOffset->LowPart;
|
Result->Data.SectionData.ViewOffset = SectionOffset->u.LowPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
PhysicalAddress.LowPart +
|
PhysicalAddress.u.LowPart +
|
||||||
(i * PAGESIZE));
|
(i * PAGESIZE));
|
||||||
}
|
}
|
||||||
return((PVOID)Result);
|
return((PVOID)Result);
|
||||||
|
|
|
@ -180,7 +180,7 @@ VOID PsDispatchThread(VOID)
|
||||||
{
|
{
|
||||||
DPRINT("Scheduling current thread\n");
|
DPRINT("Scheduling current thread\n");
|
||||||
KeQueryTickCount(&TickCount);
|
KeQueryTickCount(&TickCount);
|
||||||
CurrentThread->Tcb.LastTick = TickCount.LowPart;
|
CurrentThread->Tcb.LastTick = TickCount.u.LowPart;
|
||||||
CurrentThread->Tcb.ThreadState = THREAD_STATE_RUNNING;
|
CurrentThread->Tcb.ThreadState = THREAD_STATE_RUNNING;
|
||||||
KeReleaseSpinLock(&ThreadListLock,irql);
|
KeReleaseSpinLock(&ThreadListLock,irql);
|
||||||
return;
|
return;
|
||||||
|
@ -192,7 +192,7 @@ VOID PsDispatchThread(VOID)
|
||||||
Candidate->Tcb.ThreadState = THREAD_STATE_RUNNING;
|
Candidate->Tcb.ThreadState = THREAD_STATE_RUNNING;
|
||||||
|
|
||||||
KeQueryTickCount(&TickCount);
|
KeQueryTickCount(&TickCount);
|
||||||
CurrentThread->Tcb.LastTick = TickCount.LowPart;
|
CurrentThread->Tcb.LastTick = TickCount.u.LowPart;
|
||||||
|
|
||||||
CurrentThread = Candidate;
|
CurrentThread = Candidate;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue