more changes to support the loader

svn path=/trunk/; revision=136
This commit is contained in:
Rex Jolliff 1998-12-23 02:40:01 +00:00
parent 4209cfec73
commit 6fd4505b6f
22 changed files with 520 additions and 158 deletions

View file

@ -1178,19 +1178,43 @@ IDEDispatchReadWrite(IN PDEVICE_OBJECT pDO,
// Validate operation parameters
AdjustedOffset = RtlEnlargedIntegerMultiply(DeviceExtension->Offset,
DeviceExtension->BytesPerSector);
DPRINT("Offset:%ld * BytesPerSector:%ld = AdjOffset:%ld:%ld\n",
DeviceExtension->Offset,
DeviceExtension->BytesPerSector,
(unsigned long) GET_LARGE_INTEGER_HIGH_PART(AdjustedOffset),
(unsigned long) GET_LARGE_INTEGER_LOW_PART(AdjustedOffset));
DPRINT("AdjOffset:%ld:%ld + ByteOffset:%ld:%ld = ",
(unsigned long) GET_LARGE_INTEGER_HIGH_PART(AdjustedOffset),
(unsigned long) GET_LARGE_INTEGER_LOW_PART(AdjustedOffset),
(unsigned long) GET_LARGE_INTEGER_HIGH_PART(IrpStack->Parameters.Read.ByteOffset),
(unsigned long) GET_LARGE_INTEGER_LOW_PART(IrpStack->Parameters.Read.ByteOffset));
AdjustedOffset = RtlLargeIntegerAdd(AdjustedOffset,
IrpStack->Parameters.Read.ByteOffset);
DPRINT("AdjOffset:%ld:%ld\n",
(unsigned long) GET_LARGE_INTEGER_HIGH_PART(AdjustedOffset),
(unsigned long) GET_LARGE_INTEGER_LOW_PART(AdjustedOffset));
AdjustedExtent = RtlLargeIntegerAdd(AdjustedOffset,
RtlConvertLongToLargeInteger(IrpStack->Parameters.Read.Length));
// FIXME: this assumption will fail on drives bigger than 1TB
PartitionExtent.HighPart = 0;
PartitionExtent.LowPart = DeviceExtension->Offset + DeviceExtension->Size;
DPRINT("AdjOffset:%ld:%ld + Length:%ld = AdjExtent:%ld:%ld\n",
(unsigned long) GET_LARGE_INTEGER_HIGH_PART(AdjustedOffset),
(unsigned long) GET_LARGE_INTEGER_LOW_PART(AdjustedOffset),
IrpStack->Parameters.Read.Length,
(unsigned long) GET_LARGE_INTEGER_HIGH_PART(AdjustedExtent),
(unsigned long) GET_LARGE_INTEGER_LOW_PART(AdjustedExtent));
/* FIXME: this assumption will fail on drives bigger than 1TB */
LARGE_INTEGER_QUAD_PART(PartitionExtent) = DeviceExtension->Offset + DeviceExtension->Size;
PartitionExtent = RtlExtendedIntegerMultiply(PartitionExtent,
DeviceExtension->BytesPerSector);
if (RtlLargeIntegerGreaterThan(AdjustedExtent, PartitionExtent) ||
(IrpStack->Parameters.Read.Length & (DeviceExtension->BytesPerSector - 1)))
{
DPRINT("Request failed on bad parameters\n",0);
DPRINT("AdjustedExtent=%d:%d PartitionExtent=%d:%d ReadLength=%d\n",
(unsigned int) GET_LARGE_INTEGER_HIGH_PART(AdjustedExtent),
(unsigned int) GET_LARGE_INTEGER_LOW_PART(AdjustedExtent),
(unsigned int) GET_LARGE_INTEGER_HIGH_PART(PartitionExtent),
(unsigned int) GET_LARGE_INTEGER_LOW_PART(PartitionExtent),
IrpStack->Parameters.Read.Length);
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_INVALID_PARAMETER;
@ -1202,7 +1226,7 @@ IDEDispatchReadWrite(IN PDEVICE_OBJECT pDO,
// Start the packet and insert the request in order of sector offset
assert(DeviceExtension->BytesPerSector == 512);
InsertKeyLI = RtlLargeIntegerShiftRight(IrpStack->Parameters.Read.ByteOffset, 9);
IrpInsertKey = InsertKeyLI.LowPart;
IrpInsertKey = GET_LARGE_INTEGER_LOW_PART(InsertKeyLI);
IoStartPacket(DeviceExtension->DeviceObject, Irp, &IrpInsertKey, NULL);
return STATUS_PENDING;
@ -1332,7 +1356,7 @@ IDEStartIo(IN PDEVICE_OBJECT DeviceObject,
DeviceExtension->BytesRequested = IrpStack->Parameters.Read.Length;
assert(DeviceExtension->BytesPerSector == 512);
SectorLI = RtlLargeIntegerShiftRight(IrpStack->Parameters.Read.ByteOffset, 9);
DeviceExtension->StartingSector = SectorLI.LowPart;
DeviceExtension->StartingSector = GET_LARGE_INTEGER_LOW_PART(SectorLI);
if (DeviceExtension->BytesRequested > DeviceExtension->BytesPerSector *
IDE_MAX_SECTORS_PER_XFER)
{

View file

@ -67,8 +67,8 @@ NTSTATUS Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
if ((i%512)==0)
{
DPRINT("Offset %x\n",
Stack->Parameters.Write.ByteOffset.LowPart+i);
SdWriteOffset(Stack->Parameters.Write.ByteOffset.LowPart+i);
GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Write.ByteOffset)+i);
SdWriteOffset(GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Write.ByteOffset)+i);
}
outb_p(PORT,Buffer[i]);
DbgPrint("%c",Buffer[i]);
@ -77,8 +77,8 @@ NTSTATUS Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
for (i=0;i<(Length/512);i++)
{
DPRINT("Offset %x\n",
Stack->Parameters.Write.ByteOffset.LowPart+i);
SdWriteOffset(Stack->Parameters.Write.ByteOffset.LowPart+i);
GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Write.ByteOffset)+i);
SdWriteOffset(GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Write.ByteOffset)+i);
outsb(PORT,Buffer,512);
}
status = STATUS_SUCCESS;
@ -99,8 +99,8 @@ NTSTATUS Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
if ((i%512)==0)
{
DPRINT("Offset %d\n",
Stack->Parameters.Write.ByteOffset.LowPart+i);
SdWriteOffset(Stack->Parameters.Write.ByteOffset.LowPart+i);
GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Write.ByteOffset)+i);
SdWriteOffset(GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Write.ByteOffset)+i);
}
Buffer[i]=inb_p(PORT);
}

View file

@ -34,8 +34,8 @@ BOOLEAN MinixReadSector(IN PDEVICE_OBJECT pDeviceObject,
DPRINT("MinixReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
pDeviceObject,DiskSector,Buffer);
sectorNumber.HighPart = 0;
sectorNumber.LowPart = DiskSector * BLOCKSIZE;
SET_LARGE_INTEGER_HIGH_PART(sectorNumber, 0);
SET_LARGE_INTEGER_LOW_PART(sectorNumber, DiskSector * BLOCKSIZE);
KeInitializeEvent(&event, NotificationEvent, FALSE);
@ -98,7 +98,8 @@ BOOLEAN MinixWriteSector(IN PDEVICE_OBJECT pDeviceObject,
DPRINT("MinixWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
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);

View file

@ -46,7 +46,7 @@ NTSTATUS MinixRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Length = Stack->Parameters.Read.Length;
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
Offset = Stack->Parameters.Read.ByteOffset.LowPart;
Offset = GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Read.ByteOffset);
DPRINT("Length %d Buffer %x Offset %x\n",Length,Buffer,Offset);

View file

@ -36,8 +36,14 @@ BOOLEAN VFATReadSectors(IN PDEVICE_OBJECT pDeviceObject,
DPRINT("VFATReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
pDeviceObject,DiskSector,Buffer);
sectorNumber.HighPart = 0;
sectorNumber.LowPart = DiskSector * BLOCKSIZE;
SET_LARGE_INTEGER_HIGH_PART(sectorNumber, 0);
SET_LARGE_INTEGER_LOW_PART(sectorNumber, DiskSector * BLOCKSIZE);
DPRINT("DiskSector:%ld BLKSZ:%ld sectorNumber:%ld:%ld\n",
(unsigned long) DiskSector,
(unsigned long) BLOCKSIZE,
(unsigned long) GET_LARGE_INTEGER_HIGH_PART(sectorNumber),
(unsigned long) GET_LARGE_INTEGER_LOW_PART(sectorNumber));
KeInitializeEvent(&event, NotificationEvent, FALSE);
@ -81,7 +87,7 @@ BOOLEAN VFATReadSectors(IN PDEVICE_OBJECT pDeviceObject,
}
if (!NT_SUCCESS(status)) {
DbgPrint("IO failed!!! Error code: %d\n", status);
DbgPrint("IO failed!!! Error code: %d(%x)\n", status, status);
ExFreePool(mbr);
return FALSE;
}
@ -111,8 +117,8 @@ BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject,
DPRINT("VFATWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
pDeviceObject,DiskSector,Buffer);
sectorNumber.HighPart = 0;
sectorNumber.LowPart = DiskSector * BLOCKSIZE;
SET_LARGE_INTEGER_HIGH_PART(sectorNumber, 0);
SET_LARGE_INTEGER_LOW_PART(sectorNumber, DiskSector * BLOCKSIZE);
KeInitializeEvent(&event, NotificationEvent, FALSE);
@ -156,7 +162,7 @@ BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject,
}
if (!NT_SUCCESS(status)) {
DbgPrint("IO failed!!! Error code: %d\n", status);
DbgPrint("IO failed!!! Error code: %d(%x)\n", status, status);
ExFreePool(mbr);
return FALSE;
}

View file

@ -998,7 +998,7 @@ NTSTATUS FsdWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Length = Stack->Parameters.Write.Length;
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
Offset = Stack->Parameters.Write.ByteOffset.LowPart;
Offset = GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Write.ByteOffset);
Status = FsdWriteFile(DeviceExt,FileObject,Buffer,Length,Offset);
@ -1024,7 +1024,7 @@ NTSTATUS FsdRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Length = Stack->Parameters.Read.Length;
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
Offset = Stack->Parameters.Read.ByteOffset.LowPart;
Offset = GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Read.ByteOffset);
Status = FsdReadFile(DeviceExt,FileObject,Buffer,Length,Offset,
&LengthRead);
@ -1136,6 +1136,9 @@ NTSTATUS FsdQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
case FileStandardInformation:
RC = FsdGetStandardInformation(FCB, DeviceObject, SystemBuffer);
break;
default:
RC = STATUS_NOT_IMPLEMENTED;
}
return RC;

View file

@ -134,8 +134,6 @@ typedef char *LPTSTR;
typedef long *PLONG;
typedef unsigned short *PWCHAR;
typedef char *LPSTR;
//typedef double LONGLONG, *PLONGLONG;
typedef long long LONGLONG, *PLONGLONG;
typedef enum _MEDIA_TYPE {
Unknown,

View file

@ -1,3 +1,11 @@
VOID DbgBreakPoint(VOID);
ULONG DbgPrint(PCH Format,...);
#define DBG_GET_SHOW_FACILITY 0x0001
#define DBG_GET_SHOW_SEVERITY 0x0002
#define DBG_GET_SHOW_ERRCODE 0x0004
#define DBG_GET_SHOW_ERRTEXT 0x0008
VOID DbgGetErrorText(NTSTATUS ErrorCode, PUNICODE_STRING ErrorText, ULONG Flags);
VOID DbgPrintErrorMessage(NTSTATUS ErrorCode);

View file

@ -6,13 +6,16 @@
#ifdef COMPILER_LARGE_INTEGERS
#define GET_LARGE_INTEGER_HIGH_PART(LargeInteger) ( ( LargeInteger >> 32) )
#define GET_LARGE_INTEGER_LOW_PART(LargeInteger) ( (LargeInteger & 0xFFFFFFFF) )
#define SET_LARGE_INTEGER_HIGH_PART(LargeInteger,Signed_Long) \
( LargeInteger |= ( ((LARGE_INTEGER)Signed_Long) << 32 ) )
#define SET_LARGE_INTEGER_LOW_PART(LargeInteger,Unsigned_Long) \
( LargeInteger |= Unsigned_Long )
#define LARGE_INTEGER_QUAD_PART(LargeInteger) (LargeInteger)
#define GET_LARGE_INTEGER_HIGH_PART(LI) ( ( (LI) >> 32) )
#define GET_LARGE_INTEGER_LOW_PART(LI) ( ((LI) & 0xFFFFFFFF) )
#define SET_LARGE_INTEGER_HIGH_PART(LI, HP) \
( (LI) = ((LI) & 0xFFFFFFFFL) | ( ((LARGE_INTEGER)(HP)) << 32 ) )
#define SET_LARGE_INTEGER_LOW_PART(LI, LP) \
( (LI) = ((LI) & 0xFFFFFFFF00000000L) | (LP) )
#define LARGE_INTEGER_QUAD_PART(LI) (LI)
typedef long long int LONGLONG, *PLONGLONG;
typedef unsigned long long int ULONGLONG, *PULONGLONG;
#else
@ -24,6 +27,9 @@
((LargeInteger).LowPart = (Unsigned_Long))
#define LARGE_INTEGER_QUAD_PART(LI) (*(LONGLONG *)(&(LI)))
typedef double LONGLONG, *PLONGLONG;
typedef double ULONGLONG, *PULONGLONG;
#endif
#endif

View file

@ -1,6 +1,15 @@
#ifndef __INCLUDE_DDK_STATUS_H
#define __INCLUDE_DDK_STATUS_H
#define NTSTAT_SEVERITY_SHIFT 30
#define NTSTAT_SEVERITY_MASK 0x00000003
#define NTSTAT_FACILITY_SHIFT 16
#define NTSTAT_FACILITY_MASK 0x00000FFF
#define NTSTAT_CUSTOMER_MASK 0x20000000
#define NT_SEVERITY(StatCode) (((StatCode) >> NTSTAT_SEVERITY_SHIFT) & NTSTAT_SEVERITY_MASK)
#define NT_FACILITY(StatCode) (((StatCode) >> NTSTAT_FACILITY_SHIFT) & NTSTAT_FACILITY_MASK)
#define NT_CUSTOMER(StatCode) ((StatCode) & NTSTAT_CUSTOMER_MASK)
#define NT_SUCCESS(StatCode) ((NTSTATUS)(StatCode) >= 0)
/*
@ -136,6 +145,7 @@ enum
// STATUS_OBJECT_NAME_COLLISION,
STATUS_OBJECT_PATH_INVALID,
STATUS_OBJECT_PATH_NOT_FOUND,
// 80000070
STATUS_DFS_EXIT_PATH_FOUND,
STATUS_OBJECT_PATH_SYNTAX_BAD,
STATUS_DATA_OVERRUN,
@ -153,6 +163,7 @@ enum
STATUS_IO_TIMEOUT,
STATUS_MEDIA_WRITE_PROTECTED,
STATUS_NO_MEDIA_IN_DRIVE,
// 80000080
STATUS_VERIFY_REQUIRED,
STATUS_UNRECOGNIZED_MEDIA,
STATUS_UNRECOGNIZED_VOLUME,

View file

@ -25,8 +25,6 @@ enum
DIRECTORY_ALL_ACCESS,
};
typedef unsigned long long ULONGLONG;
/*
* General type for status information
*/
@ -39,11 +37,6 @@ typedef struct _UNICODE_STRING
PWSTR Buffer;
} UNICODE_STRING, *PUNICODE_STRING;
#define INIT_UNICODE_STRING(us, str) \
((us).Length = strlen((str)), \
(us).MaximumLength = (us).Length, \
(us).Buffer = (str), (us))
typedef enum _SECTION_INHERIT {
ViewShare = 1,
ViewUnmap = 2

View file

@ -9,7 +9,7 @@
* Created 01/11/98
*/
/* FIXME: the large integer manipulations in this file dont handle overflow */
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
@ -94,8 +94,8 @@ WINBOOL STDCALL WriteFile(HANDLE hFile,
if (lpOverLapped != NULL )
{
Offset.LowPart = lpOverLapped->Offset;
Offset.HighPart = lpOverLapped->OffsetHigh;
SET_LARGE_INTEGER_LOW_PART(Offset, lpOverLapped->Offset);
SET_LARGE_INTEGER_HIGH_PART(Offset, lpOverLapped->OffsetHigh);
lpOverLapped->Internal = STATUS_PENDING;
hEvent= lpOverLapped->hEvent;
}
@ -131,8 +131,8 @@ WINBOOL STDCALL ReadFile(HANDLE hFile,
if ( lpOverLapped != NULL )
{
ByteOffset.LowPart = lpOverLapped->Offset;
ByteOffset.HighPart = lpOverLapped->OffsetHigh;
SET_LARGE_INTEGER_LOW_PART(ByteOffset, lpOverLapped->Offset);
SET_LARGE_INTEGER_HIGH_PART(ByteOffset, lpOverLapped->OffsetHigh);
Offset = &ByteOffset;
lpOverLapped->Internal = STATUS_PENDING;
hEvent = lpOverLapped->hEvent;
@ -179,15 +179,15 @@ ReadFileEx(
if ( lpOverLapped != NULL ) {
Offset.LowPart = lpOverLapped->Offset;
Offset.HighPart = lpOverLapped->OffsetHigh;
SET_LARGE_INTEGER_LOW_PART(Offset, lpOverLapped->Offset);
SET_LARGE_INTEGER_HIGH_PART(Offset, lpOverLapped->OffsetHigh);
lpOverLapped->Internal = STATUS_PENDING;
hEvent = lpOverLapped->hEvent;
IoStatusBlock = (PIO_STATUS_BLOCK)lpOverLapped;
}
else {
Offset.LowPart = 0;
Offset.HighPart = 0;
SET_LARGE_INTEGER_LOW_PART(Offset, 0);
SET_LARGE_INTEGER_HIGH_PART(Offset, 0);
IoStatusBlock = &IIosb;
}
@ -257,8 +257,8 @@ LockFileEx(
lpOverlapped->Internal = STATUS_PENDING;
Offset.LowPart = lpOverlapped->Offset;
Offset.HighPart = lpOverlapped->OffsetHigh;
SET_LARGE_INTEGER_LOW_PART(Offset, lpOverlapped->Offset);
SET_LARGE_INTEGER_HIGH_PART(Offset, lpOverlapped->OffsetHigh);
if ( (dwFlags & LOCKFILE_FAIL_IMMEDIATELY) == LOCKFILE_FAIL_IMMEDIATELY )
LockImmediate = TRUE;
@ -270,8 +270,8 @@ LockFileEx(
else
LockExclusive = FALSE;
BytesToLock.LowPart = nNumberOfBytesToLockLow;
BytesToLock.HighPart = nNumberOfBytesToLockHigh;
SET_LARGE_INTEGER_LOW_PART(BytesToLock, nNumberOfBytesToLockLow);
SET_LARGE_INTEGER_HIGH_PART(BytesToLock, nNumberOfBytesToLockHigh);
errCode = NtLockFile(hFile,
NULL,
@ -339,11 +339,11 @@ UnlockFileEx(
return FALSE;
}
BytesToUnLock.LowPart = nNumberOfBytesToUnLockLow;
BytesToUnLock.HighPart = nNumberOfBytesToUnLockHigh;
SET_LARGE_INTEGER_LOW_PART(BytesToUnLock, nNumberOfBytesToUnLockLow);
SET_LARGE_INTEGER_HIGH_PART(BytesToUnLock, nNumberOfBytesToUnLockHigh);
StartAddress.LowPart = lpOverlapped->Offset;
StartAddress.HighPart = lpOverlapped->OffsetHigh;
SET_LARGE_INTEGER_LOW_PART(StartAddress, lpOverlapped->Offset);
SET_LARGE_INTEGER_HIGH_PART(StartAddress, lpOverlapped->OffsetHigh);
errCode = NtUnlockFile(hFile,
(PIO_STATUS_BLOCK)lpOverlapped,
@ -519,8 +519,8 @@ CopyFileExW(
FilePosition.CurrentByteOffset.LowPart = 0;
FilePosition.CurrentByteOffset.HighPart = 0;
SET_LARGE_INTEGER_LOW_PART(FilePosition.CurrentByteOffset, 0);
SET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset, 0);
errCode = NtSetInformationFile(FileHandleSource,
&IoStatusBlock,&FilePosition, sizeof(FILE_POSITION_INFORMATION),
@ -927,24 +927,39 @@ SetFilePointer(
IO_STATUS_BLOCK IoStatusBlock;
if ( dwMoveMethod == FILE_CURRENT ) {
NtQueryInformationFile(hFile,&IoStatusBlock,&FilePosition, sizeof(FILE_POSITION_INFORMATION),FilePositionInformation);
FilePosition.CurrentByteOffset.LowPart += lDistanceToMove;
if ( lpDistanceToMoveHigh != NULL )
FilePosition.CurrentByteOffset.HighPart += *lpDistanceToMoveHigh;
SET_LARGE_INTEGER_LOW_PART(FilePosition.CurrentByteOffset,
GET_LARGE_INTEGER_LOW_PART(FilePosition.CurrentByteOffset) +
lDistanceToMove);
if ( lpDistanceToMoveHigh != NULL ) {
SET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset,
GET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset) +
*lpDistanceToMoveHigh);
}
}
else if ( dwMoveMethod == FILE_END ) {
NtQueryInformationFile(hFile,&IoStatusBlock,&FileEndOfFile, sizeof(FILE_END_OF_FILE_INFORMATION),FileEndOfFileInformation);
FilePosition.CurrentByteOffset.LowPart = FileEndOfFile.EndOfFile.LowPart - lDistanceToMove;
if ( lpDistanceToMoveHigh != NULL )
FilePosition.CurrentByteOffset.HighPart = FileEndOfFile.EndOfFile.HighPart - *lpDistanceToMoveHigh;
else
FilePosition.CurrentByteOffset.HighPart = FileEndOfFile.EndOfFile.HighPart;
SET_LARGE_INTEGER_LOW_PART(FilePosition.CurrentByteOffset,
GET_LARGE_INTEGER_LOW_PART(FileEndOfFile.EndOfFile) -
lDistanceToMove);
if ( lpDistanceToMoveHigh != NULL ) {
SET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset,
GET_LARGE_INTEGER_HIGH_PART(FileEndOfFile.EndOfFile) -
*lpDistanceToMoveHigh);
} else {
SET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset,
GET_LARGE_INTEGER_HIGH_PART(FileEndOfFile.EndOfFile));
}
}
else if ( dwMoveMethod == FILE_CURRENT ) {
FilePosition.CurrentByteOffset.LowPart = lDistanceToMove;
if ( lpDistanceToMoveHigh != NULL )
FilePosition.CurrentByteOffset.HighPart = *lpDistanceToMoveHigh;
else
FilePosition.CurrentByteOffset.HighPart = 0;
SET_LARGE_INTEGER_LOW_PART(FilePosition.CurrentByteOffset,
lDistanceToMove);
if ( lpDistanceToMoveHigh != NULL ) {
SET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset,
*lpDistanceToMoveHigh);
} else {
SET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset,
0);
}
}
errCode = NtSetInformationFile(hFile,&IoStatusBlock,&FilePosition, sizeof(FILE_POSITION_INFORMATION),FilePositionInformation);
@ -953,9 +968,10 @@ SetFilePointer(
return -1;
}
if ( lpDistanceToMoveHigh != NULL )
lpDistanceToMoveHigh = &FilePosition.CurrentByteOffset.HighPart ;
return FilePosition.CurrentByteOffset.LowPart;
if ( lpDistanceToMoveHigh != NULL ) {
*lpDistanceToMoveHigh = GET_LARGE_INTEGER_HIGH_PART(FilePosition.CurrentByteOffset);
}
return GET_LARGE_INTEGER_LOW_PART(FilePosition.CurrentByteOffset);
}
DWORD
@ -993,10 +1009,10 @@ GetFileSize(
return 0;
}
if ( lpFileSizeHigh != NULL )
*lpFileSizeHigh = FileStandard.AllocationSize.HighPart;
*lpFileSizeHigh = GET_LARGE_INTEGER_HIGH_PART(FileStandard.AllocationSize);
CloseHandle(hFile);
return FileStandard.AllocationSize.LowPart;
return GET_LARGE_INTEGER_LOW_PART(FileStandard.AllocationSize);
}
DWORD
@ -1082,8 +1098,8 @@ GetFileInformationByHandle(
memcpy(&lpFileInformation->ftCreationTime,&FileDirectory.CreationTime,sizeof(LARGE_INTEGER));
memcpy(&lpFileInformation->ftLastAccessTime,&FileDirectory.LastAccessTime,sizeof(LARGE_INTEGER));
memcpy(&lpFileInformation->ftLastWriteTime, &FileDirectory.LastWriteTime,sizeof(LARGE_INTEGER));
lpFileInformation->nFileSizeHigh = FileDirectory.AllocationSize.HighPart;
lpFileInformation->nFileSizeLow = FileDirectory.AllocationSize.LowPart;
lpFileInformation->nFileSizeHigh = GET_LARGE_INTEGER_HIGH_PART(FileDirectory.AllocationSize);
lpFileInformation->nFileSizeLow = GET_LARGE_INTEGER_LOW_PART(FileDirectory.AllocationSize);
@ -1092,8 +1108,8 @@ GetFileInformationByHandle(
SetLastError(RtlNtStatusToDosError(errCode));
return FALSE;
}
lpFileInformation->nFileIndexHigh = FileInternal.IndexNumber.HighPart;
lpFileInformation->nFileIndexLow = FileInternal.IndexNumber.LowPart;
lpFileInformation->nFileIndexHigh = GET_LARGE_INTEGER_HIGH_PART(FileInternal.IndexNumber);
lpFileInformation->nFileIndexLow = GET_LARGE_INTEGER_LOW_PART(FileInternal.IndexNumber);
errCode = NtQueryVolumeInformationFile(hFile,&IoStatusBlock,&FileFsVolume, sizeof(FILE_FS_VOLUME_INFORMATION),FileFsVolumeInformation);

View file

@ -94,10 +94,10 @@ GetDiskFreeSpaceW(
return FALSE;
}
memcpy(lpBytesPerSector,&FileFsSize.BytesPerSector,sizeof(DWORD));;
memcpy(lpSectorsPerCluster,&FileFsSize.SectorsPerAllocationUnit,sizeof(DWORD));
memcpy(lpNumberOfFreeClusters,&GET_LARGE_INTEGER_LOW_PART(FileFsSize.AvailableAllocationUnits),sizeof(DWORD));
memcpy(lpTotalNumberOfClusters,&GET_LARGE_INTEGER_LOW_PART(FileFsSize.TotalAllocationUnits),sizeof(DWORD));
*lpBytesPerSector = FileFsSize.BytesPerSector;
*lpSectorsPerCluster = FileFsSize.SectorsPerAllocationUnit;
*lpNumberOfFreeClusters = GET_LARGE_INTEGER_LOW_PART(FileFsSize.AvailableAllocationUnits);
*lpTotalNumberOfClusters = GET_LARGE_INTEGER_LOW_PART(FileFsSize.TotalAllocationUnits);
CloseHandle(hFile);
return TRUE;
}

View file

@ -422,8 +422,9 @@ SleepEx(
{
TIME Interval;
NTSTATUS errCode;
SET_LARGE_INTEGER_LOW_PART(Interval,dwMilliseconds*1000);
Interval.LowPart = dwMilliseconds * 1000;
Interval.HighPart = 0;
errCode = NtDelayExecution(bAlertable,&Interval);
if ( !NT_SUCCESS(errCode) ) {
SetLastError(RtlNtStatusToDosError(errCode));

View file

@ -0,0 +1,261 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/dbg/brkpoints.c
* PURPOSE: Handles breakpoints
* PROGRAMMER: David Welch (welch@mcmail.com)
* UPDATE HISTORY:
* Created 22/05/98
*/
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/debug.h>
#include <internal/string.h>
#include <internal/ntoskrnl.h> /* for sprintf */
static PCHAR SeverityCodes[] = {"SUC", "INF", "ERR", "WRN"};
static struct _FACLIST
{
ULONG Code;
PCHAR Name;
} FacList[] =
{
{0, "KERNEL"},
{0, NULL}
};
static struct _ERRLIST
{
NTSTATUS Code;
PCHAR Name;
PCHAR Text;
} ErrList[] =
{
{STATUS_SUCCESS, "SUCCESS", NULL},
{STATUS_INSUFFICIENT_RESOURCES, "INSUFFICIENT_RESOURCES", NULL},
{STATUS_OBJECT_NAME_EXISTS, "OBJECT_NAME_EXISTS", NULL},
{STATUS_OBJECT_NAME_COLLISION, "OBJECT_NAME_COLLISION", NULL},
{STATUS_CTL_FILE_NOT_SUPPORTED, "CTL_FILE_NOT_SUPPORTED", NULL},
{STATUS_PORT_ALREADY_SET, "PORT_ALREADY_SET", NULL},
{STATUS_SECTION_NOT_IMAGE, "SECTION_NOT_IMAGE", NULL},
{STATUS_BAD_WORKING_SET_LIMIT, "BAD_WORKING_SET_LIMIT", NULL},
{STATUS_INCOMPATIBLE_FILE_MAP, "INCOMPATIBLE_FILE_MAP", NULL},
{STATUS_HANDLE_NOT_WAITABLE, "HANDLE_NOT_WAITABLE", NULL},
{STATUS_PORT_DISCONNECTED, "PORT_DISCONNECTED", NULL},
{STATUS_NOT_LOCKED, "NOT_LOCKED", NULL},
{STATUS_NOT_MAPPED_VIEW, "NOT_MAPPED_VIEW", NULL},
{STATUS_UNABLE_TO_FREE_VM, "UNABLE_TO_FREE_VM", NULL},
{STATUS_UNABLE_TO_DELETE_SECTION, "UNABLE_TO_DELETE_SECTION", NULL},
{STATUS_MORE_PROCESSING_REQUIRED, "MORE_PROCESSING_REQUIRED", NULL},
{STATUS_INVALID_CID, "INVALID_CID", NULL},
{STATUS_BAD_INITIAL_STACK, "BAD_INITIAL_STACK", NULL},
{STATUS_INVALID_VOLUME_LABEL, "INVALID_VOLUME_LABEL", NULL},
{STATUS_SECTION_NOT_EXTENDED, "SECTION_NOT_EXTENDED", NULL},
{STATUS_NOT_MAPPED_DATA, "NOT_MAPPED_DATA", NULL},
{STATUS_INFO_LENGTH_MISMATCH, "INFO_LENGTH_MISMATCH", NULL},
{STATUS_INVALID_INFO_CLASS, "INVALID_INFO_CLASS", NULL},
{STATUS_SUSPEND_COUNT_EXCEEDED, "SUSPEND_COUNT_EXCEEDED", NULL},
{STATUS_NOTIFY_ENUM_DIR, "NOTIFY_ENUM_DIR", NULL},
{STATUS_REGISTRY_RECOVERED, "REGISTRY_RECOVERED", NULL},
{STATUS_REGISTRY_IO_FAILED, "REGISTRY_IO_FAILED", NULL},
{STATUS_KEY_DELETED, "KEY_DELETED", NULL},
{STATUS_NO_LOG_SPACE, "NO_LOG_SPACE", NULL},
{STATUS_KEY_HAS_CHILDREN, "KEY_HAS_CHILDREN", NULL},
{STATUS_CHILD_MUST_BE_VOLATILE, "CHILD_MUST_BE_VOLATILE", NULL},
{STATUS_REGISTRY_CORRUPT, "REGISTRY_CORRUPT", NULL},
{STATUS_DLL_NOT_FOUND, "DLL_NOT_FOUND", NULL},
{STATUS_DLL_INIT_FAILED, "DLL_INIT_FAILED", NULL},
{STATUS_ORDINAL_NOT_FOUND, "ORDINAL_NOT_FOUND", NULL},
{STATUS_ENTRYPOINT_NOT_FOUND, "ENTRYPOINT_NOT_FOUND", NULL},
{STATUS_MORE_ENTRIES, "MORE_ENTRIES", NULL},
{STATUS_BUFFER_OVERFLOW, "BUFFER_OVERFLOW", NULL},
{STATUS_NO_MORE_FILES, "NO_MORE_FILES", NULL},
{STATUS_NO_INHERITANCE, "NO_INHERITANCE", NULL},
{STATUS_NO_MORE_EAS, "NO_MORE_EAS", NULL},
{STATUS_NO_MORE_ENTRIES, "NO_MORE_ENTRIES", NULL},
{STATUS_GUIDS_EXHAUSTED, "GUIDS_EXHAUSTED", NULL},
{STATUS_AGENTS_EXHAUSTED, "AGENTS_EXHAUSTED", NULL},
{STATUS_UNSUCCESSFUL, "UNSUCCESSFUL", NULL},
{STATUS_NOT_IMPLEMENTED, "NOT_IMPLEMENTED", NULL},
{STATUS_ILLEGAL_FUNCTION, "ILLEGAL_FUNCTION", NULL},
{STATUS_PAGEFILE_QUOTA, "PAGEFILE_QUOTA", NULL},
{STATUS_COMMITMENT_LIMIT, "COMMITMENT_LIMIT", NULL},
{STATUS_SECTION_TOO_BIG, "SECTION_TOO_BIG", NULL},
{RPC_NT_SS_IN_NULL_CONTEXT, "RPC_NT_SS_IN_NULL_CONTEXT", NULL},
{RPC_NT_INVALID_BINDING, "RPC_NT_INVALID_BINDING", NULL},
{STATUS_OBJECT_FILE_MISMATCH, "OBJECT_FILE_MISMATCH", NULL},
{STATUS_FILE_CLOSED, "FILE_CLOSED", NULL},
{STATUS_INVALID_PORT_HANDLE, "INVALID_PORT_HANDLE", NULL},
{STATUS_NOT_COMMITTED, "NOT_COMMITTED", NULL},
{STATUS_INVALID_PARAMETER, "INVALID_PARAMETER", NULL},
{STATUS_INVALID_PARAMETER_1, "INVALID_PARAMETER_1", NULL},
{STATUS_INVALID_PARAMETER_2, "INVALID_PARAMETER_2", NULL},
{STATUS_INVALID_PARAMETER_3, "INVALID_PARAMETER_3", NULL},
{STATUS_INVALID_PARAMETER_4, "INVALID_PARAMETER_4", NULL},
{STATUS_INVALID_PARAMETER_5, "INVALID_PARAMETER_5", NULL},
{STATUS_INVALID_PARAMETER_6, "INVALID_PARAMETER_6", NULL},
{STATUS_INVALID_PARAMETER_7, "INVALID_PARAMETER_7", NULL},
{STATUS_INVALID_PARAMETER_8, "INVALID_PARAMETER_8", NULL},
{STATUS_INVALID_PARAMETER_9, "INVALID_PARAMETER_9", NULL},
{STATUS_INVALID_PARAMETER_10, "INVALID_PARAMETER_10", NULL},
{STATUS_INVALID_PARAMETER_11, "INVALID_PARAMETER_11", NULL},
{STATUS_INVALID_PARAMETER_12, "INVALID_PARAMETER_12", NULL},
{STATUS_INVALID_PARAMETER_MAX, "INVALID_PARAMETER_MAX", NULL},
{STATUS_INVALID_PAGE_PROTECTION, "INVALID_PAGE_PROTECTION", NULL},
{STATUS_RESOURCE_DATA_NOT_FOUND, "RESOURCE_DATA_NOT_FOUND", NULL},
{STATUS_RESOURCE_TYPE_NOT_FOUND, "RESOURCE_TYPE_NOT_FOUND", NULL},
{STATUS_RESOURCE_NAME_NOT_FOUND, "RESOURCE_NAME_NOT_FOUND", NULL},
{STATUS_RESOURCE_LANG_NOT_FOUND, "RESOURCE_LANG_NOT_FOUND", NULL},
{STATUS_NO_SUCH_DEVICE, "NO_SUCH_DEVICE", NULL},
{STATUS_NO_SUCH_FILE, "NO_SUCH_FILE", NULL},
{STATUS_INVALID_DEVICE_REQUEST, "INVALID_DEVICE_REQUEST", NULL},
{STATUS_END_OF_FILE, "END_OF_FILE", NULL},
{STATUS_FILE_FORCED_CLOSED, "FILE_FORCED_CLOSED", NULL},
{STATUS_WRONG_VOLUME, "WRONG_VOLUME", NULL},
{STATUS_NO_MEDIA, "NO_MEDIA", NULL},
{STATUS_NO_MEDIA_IN_DEVICE, "NO_MEDIA_IN_DEVICE", NULL},
{STATUS_NONEXISTENT_SECTOR, "NONEXISTENT_SECTOR", NULL},
{STATUS_WORKING_SET_QUOTA, "WORKING_SET_QUOTA", NULL},
{STATUS_CONFLICTING_ADDRESS, "CONFLICTING_ADDRESS", NULL},
{STATUS_INVALID_SYSTEM_SERVICE, "INVALID_SYSTEM_SERVICE", NULL},
{STATUS_THREAD_IS_TERMINATING, "THREAD_IS_TERMINATING", NULL},
{STATUS_PROCESS_IS_TERMINATING, "PROCESS_IS_TERMINATING", NULL},
{STATUS_INVALID_LOCK_SEQUENCE, "INVALID_LOCK_SEQUENCE", NULL},
{STATUS_INVALID_VIEW_SIZE, "INVALID_VIEW_SIZE", NULL},
{STATUS_ALREADY_COMMITTED, "ALREADY_COMMITTED", NULL},
{STATUS_ACCESS_DENIED, "ACCESS_DENIED", NULL},
{STATUS_FILE_IS_A_DIRECTORY, "FILE_IS_A_DIRECTORY", NULL},
{STATUS_CANNOT_DELETE, "CANNOT_DELETE", NULL},
{STATUS_INVALID_COMPUTER_NAME, "INVALID_COMPUTER_NAME", NULL},
{STATUS_FILE_DELETED, "FILE_DELETED", NULL},
{STATUS_DELETE_PENDING, "DELETE_PENDING", NULL},
{STATUS_PORT_CONNECTION_REFUSED, "PORT_CONNECTION_REFUSED", NULL},
{STATUS_NO_SUCH_PRIVILEGE, "NO_SUCH_PRIVILEGE", NULL},
{STATUS_PRIVILEGE_NOT_HELD, "PRIVILEGE_NOT_HELD", NULL},
{STATUS_CANNOT_IMPERSONATE, "CANNOT_IMPERSONATE", NULL},
{STATUS_LOGON_FAILURE, "LOGON_FAILURE", NULL},
{STATUS_ACCOUNT_RESTRICTION, "ACCOUNT_RESTRICTION", NULL},
{STATUS_INVALID_LOGON_HOURS, "INVALID_LOGON_HOURS", NULL},
{STATUS_INVALID_WORKSTATION, "INVALID_WORKSTATION", NULL},
{STATUS_BUFFER_TOO_SMALL, "BUFFER_TOO_SMALL", NULL},
{STATUS_UNABLE_TO_DECOMMIT_VM, "UNABLE_TO_DECOMMIT_VM", NULL},
{STATUS_DISK_CORRUPT_ERROR, "DISK_CORRUPT_ERROR", NULL},
{STATUS_OBJECT_NAME_INVALID, "OBJECT_NAME_INVALID", NULL},
{STATUS_OBJECT_NAME_NOT_FOUND, "OBJECT_NAME_NOT_FOUND", NULL},
{STATUS_OBJECT_PATH_INVALID, "OBJECT_PATH_INVALID", NULL},
{STATUS_OBJECT_PATH_NOT_FOUND, "OBJECT_PATH_NOT_FOUND", NULL},
{STATUS_DFS_EXIT_PATH_FOUND, "DFS_EXIT_PATH_FOUND", NULL},
{STATUS_OBJECT_PATH_SYNTAX_BAD, "OBJECT_PATH_SYNTAX_BAD", NULL},
{STATUS_DATA_OVERRUN, "DATA_OVERRUN", NULL},
{STATUS_DATA_LATE_ERROR, "DATA_LATE_ERROR", NULL},
{STATUS_DATA_ERROR, "DATA_ERROR", NULL},
{STATUS_CRC_ERROR, "CRC_ERROR", NULL},
{STATUS_SHARING_VIOLATION, "SHARING_VIOLATION", NULL},
{STATUS_QUOTA_EXCEEDED, "QUOTA_EXCEEDED", NULL},
{STATUS_MUTANT_NOT_OWNED, "MUTANT_NOT_OWNED", NULL},
{STATUS_SEMAPHORE_LIMIT_EXCEEDED, "SEMAPHORE_LIMIT_EXCEEDED", NULL},
{STATUS_DISK_FULL, "DISK_FULL", NULL},
{STATUS_LOCK_NOT_GRANTED, "LOCK_NOT_GRANTED", NULL},
{STATUS_DEVICE_NOT_READY, "DEVICE_NOT_READY", NULL},
{STATUS_IO_TIMEOUT, "IO_TIMEOUT", NULL},
{STATUS_MEDIA_WRITE_PROTECTED, "MEDIA_WRITE_PROTECTED", NULL},
{STATUS_NO_MEDIA_IN_DRIVE, "NO_MEDIA_IN_DRIVE", NULL},
{STATUS_VERIFY_REQUIRED, "VERIFY_REQUIRED", NULL},
{STATUS_UNRECOGNIZED_MEDIA, "UNRECOGNIZED_MEDIA", NULL},
{STATUS_UNRECOGNIZED_VOLUME, "UNRECOGNIZED_VOLUME", NULL},
{STATUS_FS_DRIVER_REQUIRED, "FS_DRIVER_REQUIRED", NULL},
{STATUS_NOT_SUPPORTED, "NOT_SUPPORTED", NULL},
{STATUS_DISK_OPERATION_FAILED, "DISK_OPERATION_FAILED", NULL},
{STATUS_FS_QUERY_REQUIRED, "FS_QUERY_REQUIRED", NULL},
{0, NULL, NULL}
};
VOID DbgGetErrorText(NTSTATUS ErrorCode, PUNICODE_STRING ErrorText, ULONG Flags)
{
int i;
char TempBuf[255], NumBuf[32];
ANSI_STRING AnsiString;
TempBuf[0] = '\0';
if (Flags & DBG_GET_SHOW_FACILITY)
{
if (NT_CUSTOMER(ErrorCode))
{
sprintf(TempBuf,
"%%CUST-%s-",
SeverityCodes[NT_SEVERITY(ErrorCode)]);
}
else
{
for (i = 0; FacList[i].Name != NULL; i++)
{
if (FacList[i].Code == NT_FACILITY(ErrorCode))
{
break;
}
}
if (FacList[i].Name != NULL)
{
sprintf(TempBuf, "%%%s-%s-",
FacList[i].Name,
SeverityCodes[NT_SEVERITY(ErrorCode)]);
}
else
{
sprintf(TempBuf, "%%UNKNOWN-%s-",
SeverityCodes[NT_SEVERITY(ErrorCode)]);
}
}
}
for (i = 0; ErrList[i].Name != NULL; i++)
{
if (ErrorCode == ErrList[i].Code)
{
break;
}
}
if (ErrList[i].Name != NULL)
{
if (Flags & DBG_GET_SHOW_FACILITY)
{
strcat(TempBuf, ErrList[i].Name);
strcat(TempBuf, " ");
}
if (ErrList[i].Text != NULL)
{
strcat(TempBuf, ErrList[i].Text);
}
else
{
strcat(TempBuf, ErrList[i].Name);
}
}
else
{
if (Flags & DBG_GET_SHOW_FACILITY)
{
sprintf(NumBuf, "%08lx", ErrorCode);
strcat(TempBuf, NumBuf);
strcat(TempBuf, " ");
}
sprintf(NumBuf, "Unknown Message #%08lx", ErrorCode);
strcat(TempBuf, NumBuf);
}
RtlInitAnsiString(&AnsiString, TempBuf);
RtlAnsiStringToUnicodeString(ErrorText, &AnsiString, TRUE);
}
VOID DbgPrintErrorMessage(NTSTATUS ErrorCode)
{
UNICODE_STRING ErrorText;
DbgGetErrorText(ErrorCode, &ErrorText, 0xf);
DbgPrint("%W\n", &ErrorText);
RtlFreeUnicodeString(&ErrorText);
}

View file

@ -281,6 +281,9 @@ PIRP IoBuildSynchronousFsdRequest(ULONG MajorFunction,
{
if (StartingOffset != NULL)
{
DPRINT("StartingOffset:%ld:%ld\n",
GET_LARGE_INTEGER_HIGH_PART(*StartingOffset),
GET_LARGE_INTEGER_LOW_PART(*StartingOffset));
StackPtr->Parameters.Read.ByteOffset = *StartingOffset;
}
else

View file

@ -729,8 +729,6 @@ NTSTATUS LdrLoadLibrary(HANDLE ProcessHandle,
UNIMPLEMENTED;
}
/* LdrLoadImage
* FUNCTION:
* Loads a module into the specified process
@ -747,7 +745,6 @@ LdrLoadImage(HANDLE ProcessHandle,
PHANDLE ModuleHandle,
PUNICODE_STRING Filename)
{
#if 0
char BlockBuffer[1024];
NTSTATUS Status;
OBJECT_ATTRIBUTES FileObjectAttributes;
@ -824,11 +821,8 @@ LdrLoadImage(HANDLE ProcessHandle,
ZwClose(FileHandle);
return Status;
#endif
UNIMPLEMENTED;
}
#if 0
static NTSTATUS
LdrProcessMZImage(HANDLE ProcessHandle,
HANDLE ModuleHandle,
@ -1255,4 +1249,4 @@ LdrProcessBinImage(HANDLE ProcessHandle,
return STATUS_SUCCESS;
}
#endif

View file

@ -47,7 +47,7 @@ CM_OBJECTS = cm/registry.o
TST_OBJECTS = tst/test.o tst/sshell.o tst/readline.o
DBG_OBJECTS = dbg/brkpoint.o
DBG_OBJECTS = dbg/brkpoint.o dbg/errinfo.o
LDR_OBJECTS = ldr/loader.o

View file

@ -29,32 +29,32 @@ typedef unsigned long long int ULLI, *PULLI;
LARGE_INTEGER
RtlConvertLongToLargeInteger(LONG SignedInteger)
{
LLI RC;
LARGE_INTEGER RC;
RC = SignedInteger;
LARGE_INTEGER_QUAD_PART(RC) = SignedInteger;
return LIFromLLI(RC);
return RC;
}
LARGE_INTEGER
RtlConvertUlongToLargeInteger(ULONG UnsignedInteger)
{
LLI RC;
LARGE_INTEGER RC;
RC = UnsignedInteger;
LARGE_INTEGER_QUAD_PART(RC) = UnsignedInteger;
return LIFromLLI(RC);
return RC;
}
LARGE_INTEGER
RtlEnlargedIntegerMultiply(LONG Multiplicand,
LONG Multiplier)
{
LLI RC;
LARGE_INTEGER RC;
RC = (LLI) Multiplicand * Multiplier;
LARGE_INTEGER_QUAD_PART(RC) = (LONGLONG) Multiplicand * Multiplier;
return LIFromLLI(RC);
return RC;
}
ULONG RtlEnlargedUnsignedDivide(ULARGE_INTEGER Dividend,
@ -67,23 +67,23 @@ ULONG RtlEnlargedUnsignedDivide(ULARGE_INTEGER Dividend,
LARGE_INTEGER RtlEnlargedUnsignedMultiply(ULONG Multiplicand,
ULONG Multiplier)
{
LLI RC;
LARGE_INTEGER RC;
RC = (ULLI) Multiplicand * Multiplier;
LARGE_INTEGER_QUAD_PART(RC) = (ULONGLONG) Multiplicand * Multiplier;
return LIFromLLI(RC);
return RC;
}
LARGE_INTEGER
RtlExtendedIntegerMultiply(LARGE_INTEGER Multiplicand,
LONG Multiplier)
{
LLI M1, RC;
LARGE_INTEGER RC;
M1 = LLIFromLI(Multiplicand);
RC = M1 * Multiplier;
LARGE_INTEGER_QUAD_PART(RC) = LARGE_INTEGER_QUAD_PART(Multiplicand) *
Multiplier;
return LIFromLLI(RC);
return RC;
}
LARGE_INTEGER RtlExtendedLargeIntegerDivide(LARGE_INTEGER Dividend,
@ -111,35 +111,31 @@ LARGE_INTEGER
RtlLargeIntegerAdd(LARGE_INTEGER Addend1,
LARGE_INTEGER Addend2)
{
LLI RC, A1, A2;
LARGE_INTEGER RC;
DPRINT("Addend1.LowPart %d Addend1.HighPart %d\n",
Addend1.LowPart,Addend1.HighPart);
DPRINT("Addend2.LowPart %d Addend2.HighPart %d\n",
Addend2.LowPart,Addend2.HighPart);
RC = LARGE_INTEGER_QUAD_PART(Addend1) +
LARGE_INTEGER_QUAD_PART(Addend2);
A1 = LLIFromLI(Addend1);
A2 = LLIFromLI(Addend2);
RC = A1 + A2;
DPRINT("RC %d\n",(unsigned int)RC);
return LIFromLLI(RC);
return RC;
}
VOID RtlLargeIntegerAnd(PLARGE_INTEGER Result,
LARGE_INTEGER Source,
LARGE_INTEGER Mask)
{
Result->HighPart = Source.HighPart & Mask.HighPart;
Result->LowPart = Source.LowPart & Mask.LowPart;
LARGE_INTEGER_QUAD_PART(*Result) = LARGE_INTEGER_QUAD_PART(Source) &
LARGE_INTEGER_QUAD_PART(Mask);
}
LARGE_INTEGER RtlLargeIntegerArithmeticShift(LARGE_INTEGER LargeInteger,
CCHAR ShiftCount)
{
UNIMPLEMENTED;
#if 0
LARGE_INTEGER RC;
RC = LARGE_INTEGER_QUAD_PART(LargeInteger) >> ShiftCount;
asm ("movb %2, %%cl\n\t"
"andb $0x3f, %%cl\n\t"
"movl %3, %%eax\n\t"
@ -148,12 +144,16 @@ LARGE_INTEGER RtlLargeIntegerArithmeticShift(LARGE_INTEGER LargeInteger,
"sarl %%cl, %%edx\n\t"
"movl %%eax, %0\n\t"
"movl %%edx, %1\n\t"
: "=m" (LargeInteger.LowPart), "=m" (LargeInteger.HighPart)
: "m" (ShiftCount), "0" (LargeInteger.LowPart), "1" (LargeInteger.HighPart)
: "=m" (GET_LARGE_INTEGER_LOW_PART(LargeInteger)),
"=m" (GET_LARGE_INTEGER_HIGH_PART(LargeInteger))
: "m" (ShiftCount),
"0" (GET_LARGE_INTEGER_LOW_PART(LargeInteger)),
"1" (GET_LARGE_INTEGER_HIGH_PART(LargeInteger))
: "eax", "ecx", "edx"
);
return RC;
#endif
}
LARGE_INTEGER RtlLargeIntegerDivide(LARGE_INTEGER Dividend,
@ -167,132 +167,169 @@ BOOLEAN
RtlLargeIntegerEqualTo(LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2)
{
return LARGE_INTEGER_QUAD_PART(Operand1) ==
LARGE_INTEGER_QUAD_PART(Operand2);
#if 0
return Operand1.HighPart == Operand2.HighPart &&
Operand1.LowPart == Operand2.LowPart;
#endif
}
BOOLEAN
RtlLargeIntegerEqualToZero(LARGE_INTEGER Operand)
{
return Operand.LowPart == 0 && Operand.HighPart == 0;
return LARGE_INTEGER_QUAD_PART(Operand) == 0 ;
}
BOOLEAN
RtlLargeIntegerGreaterThan(LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2)
{
return LARGE_INTEGER_QUAD_PART(Operand1) >
LARGE_INTEGER_QUAD_PART(Operand2);
#if 0
return Operand1.HighPart > Operand2.HighPart ||
(Operand1.HighPart == Operand2.HighPart &&
Operand1.LowPart > Operand2.LowPart);
#endif
}
BOOLEAN
RtlLargeIntegerGreaterThanOrEqualTo(LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2)
{
return LARGE_INTEGER_QUAD_PART(Operand1) >=
LARGE_INTEGER_QUAD_PART(Operand2);
#if 0
return Operand1.HighPart > Operand2.HighPart ||
(Operand1.HighPart == Operand2.HighPart &&
Operand1.LowPart >= Operand2.LowPart);
#endif
}
BOOLEAN
RtlLargeIntegerGreaterThanOrEqualToZero(LARGE_INTEGER Operand1)
{
return LARGE_INTEGER_QUAD_PART(Operand1) > 0;
#if 0
return Operand1.HighPart >= 0;
#endif
}
BOOLEAN
RtlLargeIntegerGreaterThanZero(LARGE_INTEGER Operand1)
{
return LARGE_INTEGER_QUAD_PART(Operand1) >= 0;
#if 0
return Operand1.HighPart > 0 ||
(Operand1.HighPart == 0 && Operand1.LowPart > 0);
#endif
}
BOOLEAN
RtlLargeIntegerLessThan(LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2)
{
return LARGE_INTEGER_QUAD_PART(Operand1) <
LARGE_INTEGER_QUAD_PART(Operand2);
#if 0
return Operand1.HighPart < Operand2.HighPart ||
(Operand1.HighPart == Operand2.HighPart &&
Operand1.LowPart < Operand2.LowPart);
#endif
}
BOOLEAN
RtlLargeIntegerLessThanOrEqualTo(LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2)
{
return LARGE_INTEGER_QUAD_PART(Operand1) <=
LARGE_INTEGER_QUAD_PART(Operand2);
#if 0
return Operand1.HighPart < Operand2.HighPart ||
(Operand1.HighPart == Operand2.HighPart &&
Operand1.LowPart <= Operand2.LowPart);
#endif
}
BOOLEAN
RtlLargeIntegerLessThanOrEqualToZero(LARGE_INTEGER Operand)
{
return LARGE_INTEGER_QUAD_PART(Operand) <= 0;
#if 0
return Operand.HighPart < 0 ||
(Operand.HighPart == 0 && Operand.LowPart == 0);
#endif
}
BOOLEAN
RtlLargeIntegerLessThanZero(LARGE_INTEGER Operand)
{
return LARGE_INTEGER_QUAD_PART(Operand) < 0;
#if 0
return Operand.HighPart < 0;
#endif
}
LARGE_INTEGER RtlLargeIntegerNegate(LARGE_INTEGER Subtrahend)
{
LLI RC;
LARGE_INTEGER RC;
RC = - LLIFromLI(Subtrahend);
LARGE_INTEGER_QUAD_PART(RC) = - LARGE_INTEGER_QUAD_PART(Subtrahend);
return LIFromLLI(RC);
return RC;
}
BOOLEAN
RtlLargeIntegerNotEqualTo(LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2)
{
return LARGE_INTEGER_QUAD_PART(Operand1) !=
LARGE_INTEGER_QUAD_PART(Operand2);
#if 0
return Operand1.LowPart != Operand2.LowPart ||
Operand1.HighPart != Operand2.HighPart;
#endif
}
BOOLEAN
RtlLargeIntegerNotEqualToZero(LARGE_INTEGER Operand)
{
return LARGE_INTEGER_QUAD_PART(Operand) != 0;
#if 0
return Operand.LowPart != 0 || Operand.HighPart != 0;
#endif
}
LARGE_INTEGER RtlLargeIntegerShiftLeft(LARGE_INTEGER LargeInteger,
CCHAR ShiftCount)
{
LLI RC;
LARGE_INTEGER RC;
RC = LLIFromLI(LargeInteger);
RC = RC << ShiftCount;
LARGE_INTEGER_QUAD_PART(RC) = LARGE_INTEGER_QUAD_PART(LargeInteger) <<
ShiftCount;
return LIFromLLI(RC);
return RC;
}
LARGE_INTEGER RtlLargeIntegerShiftRight(LARGE_INTEGER LargeInteger,
CCHAR ShiftCount)
{
LLI RC;
LARGE_INTEGER RC;
RC = LLIFromLI(LargeInteger);
RC = RC >> ShiftCount;
LARGE_INTEGER_QUAD_PART(RC) = LARGE_INTEGER_QUAD_PART(LargeInteger) >>
ShiftCount;
return LIFromLLI(RC);
return RC;
}
LARGE_INTEGER RtlLargeIntegerSubtract(LARGE_INTEGER Minuend,
LARGE_INTEGER Subtrahend)
{
LLI S1, S2, RC;
LARGE_INTEGER RC;
S1 = LLIFromLI(Minuend);
S2 = LLIFromLI(Subtrahend);
RC = S1 - S2;
RC = LARGE_INTEGER_QUAD_PART(Minuend) - LARGE_INTEGER_QUAD_PART(Subtrahend);
return LIFromLLI(RC);
return RC;
}

View file

@ -249,7 +249,7 @@ int vsprintf(char *buf, const char *fmt, va_list args)
case 'W':
pus = va_arg(args, PUNICODE_STRING);
if (pus == NULL || pus->Length > pus->MaximumLength)
if (pus == NULL)
{
s = "<NULL>";
while ((*s) != 0)
@ -259,7 +259,7 @@ int vsprintf(char *buf, const char *fmt, va_list args)
}
else
{
for (i = 0; i < pus->Length; i++)
for (i = 0; pus->Buffer[i] && i < pus->Length; i++)
{
*str++ = (char)(pus->Buffer[i]);
}

View file

@ -128,8 +128,7 @@ VOID ExExecuteShell(VOID)
hfile);
BaseAddress = (PVOID)0x10000;
SectionOffset.HighPart = 0;
SectionOffset.LowPart = 0;
LARGE_INTEGER_QUAD_PART(SectionOffset) = 0;
Size = 0x10000;
ZwMapViewOfSection(SectionHandle,
ShellHandle,
@ -308,10 +307,10 @@ void TstIDERead(void)
if (!TestFailed)
{
DbgPrint("Reading rootdir block from Partition1\n");
BlockOffset.HighPart = 0;
BlockOffset.LowPart = BootBlock->BootParameters.ReservedSectorCount * 512 +
BootBlock->BootParameters.FATCount *
BootBlock->BootParameters.SectorsPerFAT * 512;
LARGE_INTEGER_QUAD_PART(BlockOffset) =
BootBlock->BootParameters.ReservedSectorCount * 512 +
BootBlock->BootParameters.FATCount *
BootBlock->BootParameters.SectorsPerFAT * 512;
Status = ZwReadFile(FileHandle,
NULL,
NULL,
@ -384,8 +383,7 @@ void TstIDERead(void)
{
DbgPrint("Reading data from blocks 10000-4 from Partition1\n");
RtlFillMemory(SectorBuffer, BufferSize, 0xea);
BlockOffset.HighPart = 0;
BlockOffset.LowPart = 10000 * IDE_SECTOR_SZ;
LARGE_INTEGER_QUAD_PART(BlockOffset) = 10000 * IDE_SECTOR_SZ;
Status = ZwReadFile(FileHandle,
NULL,
NULL,
@ -531,24 +529,26 @@ TstTimer(void)
}
#if 0
void TstDriverLoad(void)
{
NTSTATUS Status;
ANSI_STRING AnsiDriverName;
UNICODE_STRING DriverName;
INIT_UNICODE_STRING(DriverName, "C:\\reactos\\system\\keyboard.o");
Status = LdrLoadDriver(DriverName);
RtlInitAnsiString(&AnsiDriverName,"\\??\\C:\\reactos\\system\\keyboard.o");
RtlAnsiStringToUnicodeString(&DriverName, &AnsiDriverName, TRUE);
Status = LdrLoadDriver(&DriverName);
RtlFreeUnicodeString(&DriverName);
if (!NT_SUCCESS(Status))
{
DbgPrint("driver load failed, status;%d(%x)\n", Status, Status);
DbgPrintErrorMessage(Status);
}
}
#endif
void TstBegin()
{
// TstDriverLoad();
TstDriverLoad();
ExExecuteShell();
// TstFileRead();
// TstGeneralWrite();

View file

@ -63,7 +63,7 @@ else
DEBUGGING_CFLAGS =
endif
DEFINES = -DDBG -DCHECKED # -DCOMPILER_LARGE_INTEGERS
DEFINES = -DDBG -DCHECKED -DCOMPILER_LARGE_INTEGERS
ifeq ($(WIN32_LEAN_AND_MEAN),yes)
LEAN_AND_MEAN_DEFINE = -DWIN32_LEAN_AND_MEAN