minor fixes

svn path=/trunk/; revision=13240
This commit is contained in:
Thomas Bluemel 2005-01-24 00:43:39 +00:00
parent b1f6601134
commit 1796f01382
2 changed files with 25 additions and 21 deletions

View file

@ -180,6 +180,10 @@ NtSetSystemTime(IN PLARGE_INTEGER SystemTime,
return Status; return Status;
} }
} }
else
{
NewSystemTime = *SystemTime;
}
if(!SeSinglePrivilegeCheck(SeSystemtimePrivilege, if(!SeSinglePrivilegeCheck(SeSystemtimePrivilege,
PreviousMode)) PreviousMode))

View file

@ -739,9 +739,9 @@ MmInitializeCrashDump(HANDLE PageFileHandle, ULONG PageFileNum)
} }
NTSTATUS STDCALL NTSTATUS STDCALL
NtCreatePagingFile(IN PUNICODE_STRING FileNameUnsafe, NtCreatePagingFile(IN PUNICODE_STRING FileName,
IN PLARGE_INTEGER InitialSizeUnsafe, IN PLARGE_INTEGER InitialSize,
IN PLARGE_INTEGER MaximumSizeUnsafe, IN PLARGE_INTEGER MaximumSize,
IN ULONG Reserved) IN ULONG Reserved)
{ {
NTSTATUS Status; NTSTATUS Status;
@ -763,8 +763,8 @@ NtCreatePagingFile(IN PUNICODE_STRING FileNameUnsafe,
ULONG Count; ULONG Count;
ULONG Size; ULONG Size;
KPROCESSOR_MODE PreviousMode; KPROCESSOR_MODE PreviousMode;
UNICODE_STRING FileName; UNICODE_STRING CapturedFileName;
LARGE_INTEGER InitialSize, MaximumSize; LARGE_INTEGER SafeInitialSize, SafeMaximumSize;
DPRINT("NtCreatePagingFile(FileName %wZ, InitialSize %I64d)\n", DPRINT("NtCreatePagingFile(FileName %wZ, InitialSize %I64d)\n",
FileName, InitialSize->QuadPart); FileName, InitialSize->QuadPart);
@ -775,11 +775,11 @@ NtCreatePagingFile(IN PUNICODE_STRING FileNameUnsafe,
} }
PreviousMode = ExGetPreviousMode(); PreviousMode = ExGetPreviousMode();
Status = RtlCaptureUnicodeString(&FileName, Status = RtlCaptureUnicodeString(&CapturedFileName,
PreviousMode, PreviousMode,
PagedPool, PagedPool,
FALSE, FALSE,
FileNameUnsafe); FileName);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return(Status); return(Status);
@ -788,14 +788,14 @@ NtCreatePagingFile(IN PUNICODE_STRING FileNameUnsafe,
{ {
_SEH_TRY _SEH_TRY
{ {
ProbeForRead(InitialSizeUnsafe, ProbeForRead(InitialSize,
sizeof(LARGE_INTEGER), sizeof(LARGE_INTEGER),
sizeof(ULONG)); sizeof(ULONG));
InitialSize = *InitialSizeUnsafe; SafeInitialSize = *InitialSize;
ProbeForRead(MaximumSizeUnsafe, ProbeForRead(MaximumSize,
sizeof(LARGE_INTEGER), sizeof(LARGE_INTEGER),
sizeof(ULONG)); sizeof(ULONG));
MaximumSize = *MaximumSizeUnsafe; SafeMaximumSize = *MaximumSize;
} }
_SEH_HANDLE _SEH_HANDLE
{ {
@ -810,12 +810,12 @@ NtCreatePagingFile(IN PUNICODE_STRING FileNameUnsafe,
} }
else else
{ {
InitialSize = *InitialSizeUnsafe; SafeInitialSize = *InitialSize;
MaximumSize = *MaximumSizeUnsafe; SafeMaximumSize = *MaximumSize;
} }
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&FileName, &CapturedFileName,
0, 0,
NULL, NULL,
NULL); NULL);
@ -834,7 +834,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileNameUnsafe,
CreateFileTypeNone, CreateFileTypeNone,
NULL, NULL,
SL_OPEN_PAGING_FILE); SL_OPEN_PAGING_FILE);
RtlReleaseCapturedUnicodeString(&FileName, RtlReleaseCapturedUnicodeString(&CapturedFileName,
PreviousMode, PreviousMode,
FALSE); FALSE);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -862,7 +862,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileNameUnsafe,
Status = ZwSetInformationFile(FileHandle, Status = ZwSetInformationFile(FileHandle,
&IoStatus, &IoStatus,
&InitialSize, &SafeInitialSize,
sizeof(LARGE_INTEGER), sizeof(LARGE_INTEGER),
FileAllocationInformation); FileAllocationInformation);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -874,7 +874,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileNameUnsafe,
Status = ObReferenceObjectByHandle(FileHandle, Status = ObReferenceObjectByHandle(FileHandle,
FILE_ALL_ACCESS, FILE_ALL_ACCESS,
IoFileObjectType, IoFileObjectType,
UserMode, PreviousMode,
(PVOID*)&FileObject, (PVOID*)&FileObject,
NULL); NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -900,7 +900,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileNameUnsafe,
#endif #endif
ExtentCount = 0; ExtentCount = 0;
MaxVcn = (ULONG)((InitialSize.QuadPart + BytesPerAllocationUnit - 1) / BytesPerAllocationUnit); MaxVcn = (ULONG)((SafeInitialSize.QuadPart + BytesPerAllocationUnit - 1) / BytesPerAllocationUnit);
while(1) while(1)
{ {
Status = ZwFsControlFile(FileHandle, Status = ZwFsControlFile(FileHandle,
@ -967,9 +967,9 @@ NtCreatePagingFile(IN PUNICODE_STRING FileNameUnsafe,
RtlZeroMemory(PagingFile, sizeof(*PagingFile)); RtlZeroMemory(PagingFile, sizeof(*PagingFile));
PagingFile->FileObject = FileObject; PagingFile->FileObject = FileObject;
PagingFile->MaximumSize.QuadPart = MaximumSize.QuadPart; PagingFile->MaximumSize.QuadPart = SafeMaximumSize.QuadPart;
PagingFile->CurrentSize.QuadPart = InitialSize.QuadPart; PagingFile->CurrentSize.QuadPart = SafeInitialSize.QuadPart;
PagingFile->FreePages = (ULONG)(InitialSize.QuadPart / PAGE_SIZE); PagingFile->FreePages = (ULONG)(SafeInitialSize.QuadPart / PAGE_SIZE);
PagingFile->UsedPages = 0; PagingFile->UsedPages = 0;
KeInitializeSpinLock(&PagingFile->AllocMapLock); KeInitializeSpinLock(&PagingFile->AllocMapLock);