mirror of
https://github.com/reactos/reactos.git
synced 2025-05-31 06:58:10 +00:00
mmfuncs.h: add MmGetSystemAddressForMdlSafe/MmMapLockedPagesSpecifyCache defs.
matherr.c: remove _exception struct since its already in math.h path: simply file exsitence check iomgr: simplify/use standard generic file mappings flags misc. svn path=/trunk/; revision=14396
This commit is contained in:
parent
5b6820630a
commit
7df5d3e7e1
10 changed files with 121 additions and 88 deletions
|
@ -279,6 +279,19 @@ MmGetPhysicalMemoryRanges (
|
|||
(((Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA | MDL_SOURCE_IS_NONPAGED_POOL)) ? \
|
||||
((Mdl)->MappedSystemVa):(MmMapLockedPages((Mdl),KernelMode)))
|
||||
|
||||
/*
|
||||
* PVOID
|
||||
* MmGetSystemAddressForMdlSafe(
|
||||
* IN PMDL Mdl,
|
||||
* IN MM_PAGE_PRIORITY Priority)
|
||||
*/
|
||||
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority) \
|
||||
((_Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA \
|
||||
| MDL_SOURCE_IS_NONPAGED_POOL)) ? \
|
||||
(_Mdl)->MappedSystemVa : \
|
||||
(PVOID) MmMapLockedPagesSpecifyCache((_Mdl), \
|
||||
KernelMode, MmCached, NULL, FALSE, _Priority)
|
||||
|
||||
PVOID
|
||||
STDCALL
|
||||
MmGetSystemRoutineAddress (
|
||||
|
@ -425,6 +438,13 @@ MmMapLockedPages (
|
|||
PMDL MemoryDescriptorList,
|
||||
KPROCESSOR_MODE AccessMode
|
||||
);
|
||||
PVOID STDCALL
|
||||
MmMapLockedPagesSpecifyCache ( IN PMDL Mdl,
|
||||
IN KPROCESSOR_MODE AccessMode,
|
||||
IN MEMORY_CACHING_TYPE CacheType,
|
||||
IN PVOID BaseAddress,
|
||||
IN ULONG BugCheckOnFailure,
|
||||
IN MM_PAGE_PRIORITY Priority);
|
||||
VOID
|
||||
STDCALL
|
||||
MmMapMemoryDumpMdl (
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
#include "precomp.h"
|
||||
#include <math.h>
|
||||
#include <ntos/except.h>
|
||||
|
||||
|
||||
struct _exception {
|
||||
int type;
|
||||
char* name;
|
||||
double arg1;
|
||||
double arg2;
|
||||
double retval;
|
||||
} ;
|
||||
|
||||
|
||||
int _matherr(struct _exception* e)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
@ -19,6 +19,13 @@
|
|||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
KPROCESSOR_MODE
|
||||
RtlpGetMode()
|
||||
{
|
||||
return UserMode;
|
||||
}
|
||||
|
||||
|
||||
PVOID
|
||||
STDCALL
|
||||
ExAllocatePool(
|
||||
|
|
|
@ -948,13 +948,10 @@ RtlDoesFileExists_U(IN PWSTR FileName)
|
|||
{
|
||||
UNICODE_STRING NtFileName;
|
||||
OBJECT_ATTRIBUTES Attr;
|
||||
FILE_BASIC_INFORMATION Info;
|
||||
NTSTATUS Status;
|
||||
CURDIR CurDir;
|
||||
PWSTR Buffer;
|
||||
|
||||
/* only used by replacement code */
|
||||
HANDLE FileHandle;
|
||||
IO_STATUS_BLOCK StatusBlock;
|
||||
|
||||
if (!RtlDosPathNameToNtPathName_U (FileName,
|
||||
&NtFileName,
|
||||
|
@ -962,9 +959,6 @@ RtlDoesFileExists_U(IN PWSTR FileName)
|
|||
&CurDir))
|
||||
return FALSE;
|
||||
|
||||
/* don't forget to free it! */
|
||||
Buffer = NtFileName.Buffer;
|
||||
|
||||
if (CurDir.DosPath.Length)
|
||||
NtFileName = CurDir.DosPath;
|
||||
else
|
||||
|
@ -976,24 +970,11 @@ RtlDoesFileExists_U(IN PWSTR FileName)
|
|||
CurDir.Handle,
|
||||
NULL);
|
||||
|
||||
/* FIXME: not implemented yet */
|
||||
// Status = NtQueryAttributesFile (&Attr, NULL);
|
||||
|
||||
/* REPLACEMENT start */
|
||||
Status = NtOpenFile (&FileHandle,
|
||||
0x10001,
|
||||
&Attr,
|
||||
&StatusBlock,
|
||||
1,
|
||||
FILE_SYNCHRONOUS_IO_NONALERT);
|
||||
if (NT_SUCCESS(Status))
|
||||
NtClose (FileHandle);
|
||||
/* REPLACEMENT end */
|
||||
|
||||
RtlFreeHeap (RtlGetProcessHeap (),
|
||||
0,
|
||||
Buffer);
|
||||
Status = NtQueryAttributesFile (&Attr, &Info);
|
||||
|
||||
RtlFreeUnicodeString(&NtFileName);
|
||||
|
||||
|
||||
if (NT_SUCCESS(Status) ||
|
||||
Status == STATUS_SHARING_VIOLATION ||
|
||||
Status == STATUS_ACCESS_DENIED)
|
||||
|
|
|
@ -2256,6 +2256,8 @@ RtlCreateUnicodeString(
|
|||
|
||||
/*
|
||||
* private
|
||||
*
|
||||
* Creates a nullterminated UNICODE_STRING
|
||||
*/
|
||||
BOOLEAN
|
||||
FASTCALL
|
||||
|
|
|
@ -285,6 +285,9 @@ HACCEL WINAPI CreateAcceleratorTableW(LPACCEL lpaccl, int cEntries)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int WINAPI CopyAcceleratorTableA
|
||||
(
|
||||
HACCEL hAccelSrc,
|
||||
|
|
|
@ -23,7 +23,6 @@ typedef struct _NOTIFY_ENTRY
|
|||
LIST_ENTRY ListEntry;
|
||||
PSTRING FullDirectoryName;
|
||||
BOOLEAN WatchTree;
|
||||
BOOLEAN IgnoreBuffer;
|
||||
BOOLEAN PendingChanges;
|
||||
ULONG CompletionFilter;
|
||||
LIST_ENTRY IrpQueue;
|
||||
|
@ -395,7 +394,7 @@ FsRtlNotifyFullChangeDirectory (
|
|||
IN BOOLEAN WatchTree,
|
||||
IN BOOLEAN IgnoreBuffer,
|
||||
IN ULONG CompletionFilter,
|
||||
IN PIRP NotifyIrp,
|
||||
IN PIRP Irp,
|
||||
IN PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback OPTIONAL,
|
||||
IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL
|
||||
)
|
||||
|
@ -404,7 +403,7 @@ FsRtlNotifyFullChangeDirectory (
|
|||
PNOTIFY_ENTRY NotifyEntry;
|
||||
ULONG IrpBuffLen;
|
||||
|
||||
if (!NotifyIrp)
|
||||
if (!Irp)
|
||||
{
|
||||
/* all other params are ignored if NotifyIrp == NULL */
|
||||
FsRtlpWatchedDirectoryWasDeleted(NotifySync, NotifyList, FsContext);
|
||||
|
@ -415,14 +414,14 @@ FsRtlNotifyFullChangeDirectory (
|
|||
|
||||
ExAcquireFastMutex((PFAST_MUTEX)NotifySync);
|
||||
|
||||
IrpStack = IoGetCurrentIrpStackLocation(NotifyIrp);
|
||||
IrpStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
if (IrpStack->FileObject->Flags & FO_CLEANUP_COMPLETE)
|
||||
{
|
||||
ExReleaseFastMutex((PFAST_MUTEX)NotifySync);
|
||||
|
||||
NotifyIrp->IoStatus.Information = 0;
|
||||
NotifyIrp->IoStatus.Status = STATUS_NOTIFY_CLEANUP;
|
||||
IoCompleteRequest(NotifyIrp, IO_NO_INCREMENT);
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = STATUS_NOTIFY_CLEANUP;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -463,12 +462,13 @@ FsRtlNotifyFullChangeDirectory (
|
|||
FSRTL_NOTIFY_TAG
|
||||
);
|
||||
|
||||
NotifyEntry->PrevEntry = NotifyEntry->Buffer;
|
||||
NotifyEntry->BufferSize = IrpBuffLen;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
/* ExAllocatePoolWithQuotaTag raised exception */
|
||||
/* ExAllocatePoolWithQuotaTag raised exception but we dont care.
|
||||
The impl. doesnt require a buffer, so well continue as usual.
|
||||
*/
|
||||
}
|
||||
_SEH_END;
|
||||
}
|
||||
|
@ -485,26 +485,29 @@ FsRtlNotifyFullChangeDirectory (
|
|||
/* No changes are pending. Queue the irp */
|
||||
|
||||
/* Irp cancelation boilerplate */
|
||||
IoSetCancelRoutine(NotifyIrp, FsRtlpNotifyCancelRoutine);
|
||||
if (NotifyIrp->Cancel && IoSetCancelRoutine(NotifyIrp, NULL))
|
||||
|
||||
/* save NotifySych for use in the cancel routine */
|
||||
Irp->Tail.Overlay.DriverContext[3] = NotifySync;
|
||||
|
||||
IoSetCancelRoutine(Irp, FsRtlpNotifyCancelRoutine);
|
||||
if (Irp->Cancel && IoSetCancelRoutine(Irp, NULL))
|
||||
{
|
||||
//irp was canceled
|
||||
ExReleaseFastMutex((PFAST_MUTEX)NotifySync);
|
||||
|
||||
NotifyIrp->IoStatus.Status = STATUS_CANCELLED;
|
||||
NotifyIrp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IoCompleteRequest(NotifyIrp, IO_NO_INCREMENT);
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return;
|
||||
}
|
||||
|
||||
IoMarkIrpPending(NotifyIrp);
|
||||
IoMarkIrpPending(Irp);
|
||||
|
||||
//FIXME: any point in setting irp status/information before queueing?
|
||||
Irp->IoStatus.Status = STATUS_PENDING;
|
||||
|
||||
/* save NotifySych for use in the cancel routine */
|
||||
NotifyIrp->Tail.Overlay.DriverContext[3] = NotifySync;
|
||||
InsertTailList(&NotifyEntry->IrpQueue, &NotifyIrp->Tail.Overlay.ListEntry);
|
||||
InsertTailList(&NotifyEntry->IrpQueue, &Irp->Tail.Overlay.ListEntry);
|
||||
|
||||
ExReleaseFastMutex((PFAST_MUTEX)NotifySync);
|
||||
return;
|
||||
|
@ -524,24 +527,29 @@ FsRtlNotifyFullChangeDirectory (
|
|||
-Current irp buff was not large enough
|
||||
*/
|
||||
|
||||
NotifyIrp->IoStatus.Information = 0;
|
||||
NotifyIrp->IoStatus.Status = STATUS_NOTIFY_ENUM_DIR;
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = STATUS_NOTIFY_ENUM_DIR;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* terminate last entry */
|
||||
NotifyEntry->PrevEntry->NextEntryOffset = 0;
|
||||
|
||||
//FIXME: copy data correctly to user
|
||||
memcpy(NotifyIrp->UserBuffer, NotifyEntry->Buffer, NotifyEntry->NextEntryOffset);
|
||||
PVOID Adr = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, LowPagePriority);
|
||||
|
||||
NotifyIrp->IoStatus.Information = NotifyEntry->NextEntryOffset;
|
||||
NotifyIrp->IoStatus.Status = STATUS_SUCCESS;
|
||||
if (Adr)
|
||||
{
|
||||
memcpy(Adr, NotifyEntry->Buffer, NotifyEntry->NextEntryOffset);
|
||||
Irp->IoStatus.Information = NotifyEntry->NextEntryOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
Irp->IoStatus.Information = 0;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* reset buffer */
|
||||
NotifyEntry->PrevEntry = NotifyEntry->Buffer;
|
||||
NotifyEntry->PrevEntry = NULL;
|
||||
NotifyEntry->NextEntryOffset = 0;
|
||||
NotifyEntry->BufferExhausted = FALSE;
|
||||
|
||||
|
@ -549,7 +557,9 @@ FsRtlNotifyFullChangeDirectory (
|
|||
|
||||
ExReleaseFastMutex((PFAST_MUTEX)NotifySync);
|
||||
|
||||
IoCompleteRequest(NotifyIrp, IO_NO_INCREMENT);
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
/* caller must return STATUS_PENDING */
|
||||
}
|
||||
|
||||
|
||||
|
@ -671,13 +681,17 @@ FsRtlNotifyFullReportChange (
|
|||
LIST_FOR_EACH_SAFE(EnumEntry, NotifyList, NotifyEntry, NOTIFY_ENTRY, ListEntry )
|
||||
{
|
||||
ASSERT(NotifyEntry->Unicode == FsRtlpIsUnicodePath(FullTargetName));
|
||||
|
||||
|
||||
/* rule out some easy cases */
|
||||
/* FIXME: short vs. long names??? */
|
||||
/* FIXME: short vs. long names??? lower case/upper case/mixed case? */
|
||||
if (!(FilterMatch & NotifyEntry->CompletionFilter)) continue;
|
||||
|
||||
FullDirLen = TargetNameOffset - (NotifyEntry->Unicode?sizeof(WCHAR):sizeof(char));
|
||||
|
||||
FullDirLen = TargetNameOffset - (NotifyEntry->Unicode ? sizeof(WCHAR) : sizeof(char));
|
||||
if (FullDirLen == 0)
|
||||
{
|
||||
/* special case for root dir */
|
||||
FullDirLen = (NotifyEntry->Unicode ? sizeof(WCHAR) : sizeof(char));
|
||||
}
|
||||
|
||||
if (FullDirLen < NotifyEntry->FullDirectoryName->Length) continue;
|
||||
|
||||
|
@ -685,6 +699,7 @@ FsRtlNotifyFullReportChange (
|
|||
|
||||
DPRINT("NotifyEntry->FullDirectoryName: %wZ\n", NotifyEntry->FullDirectoryName);
|
||||
|
||||
/* FIXME: short vs. long names??? lower case/upper case/mixed case? */
|
||||
if (memcmp(NotifyEntry->FullDirectoryName->Buffer,
|
||||
FullTargetName->Buffer,
|
||||
NotifyEntry->FullDirectoryName->Length) != 0) continue;
|
||||
|
@ -751,22 +766,31 @@ FsRtlNotifyFullReportChange (
|
|||
}
|
||||
else
|
||||
{
|
||||
//FIXME: copy data to user correctly
|
||||
CurrentEntry = (PFILE_NOTIFY_INFORMATION)Irp->UserBuffer;
|
||||
|
||||
CurrentEntry->Action = Action;
|
||||
CurrentEntry->NameLength = NameLenU;
|
||||
CurrentEntry->NextEntryOffset = 0;
|
||||
CurrentEntry = (PFILE_NOTIFY_INFORMATION)
|
||||
MmGetSystemAddressForMdlSafe(Irp->MdlAddress, LowPagePriority);
|
||||
|
||||
if (CurrentEntry)
|
||||
{
|
||||
CurrentEntry->Action = Action;
|
||||
CurrentEntry->NameLength = NameLenU;
|
||||
CurrentEntry->NextEntryOffset = 0;
|
||||
|
||||
FsRtlpCopyName(
|
||||
CurrentEntry,
|
||||
NotifyEntry->Unicode,
|
||||
&RelativeName,
|
||||
StreamName
|
||||
);
|
||||
FsRtlpCopyName(
|
||||
CurrentEntry,
|
||||
NotifyEntry->Unicode,
|
||||
&RelativeName,
|
||||
StreamName
|
||||
);
|
||||
|
||||
Irp->IoStatus.Information = RecordLen;
|
||||
}
|
||||
else
|
||||
{
|
||||
Irp->IoStatus.Information = 0;
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = RecordLen;
|
||||
}
|
||||
|
||||
/* avoid holding lock while completing irp */
|
||||
|
@ -803,8 +827,10 @@ FsRtlNotifyFullReportChange (
|
|||
StreamName
|
||||
);
|
||||
|
||||
/* adjust buffer */
|
||||
NotifyEntry->PrevEntry->NextEntryOffset = (char*)CurrentEntry - (char*)NotifyEntry->PrevEntry;
|
||||
if (NotifyEntry->PrevEntry)
|
||||
{
|
||||
NotifyEntry->PrevEntry->NextEntryOffset = (char*)CurrentEntry - (char*)NotifyEntry->PrevEntry;
|
||||
}
|
||||
NotifyEntry->PrevEntry = CurrentEntry;
|
||||
NotifyEntry->NextEntryOffset += RecordLen;
|
||||
|
||||
|
|
|
@ -34,10 +34,10 @@ ULONG IoOtherOperationCount = 0;
|
|||
ULONGLONG IoOtherTransferCount = 0;
|
||||
KSPIN_LOCK EXPORTED IoStatisticsLock = 0;
|
||||
|
||||
static GENERIC_MAPPING IopFileMapping = {STANDARD_RIGHTS_READ | SYNCHRONIZE | FILE_READ_DATA | FILE_READ_PROPERTIES,
|
||||
STANDARD_RIGHTS_WRITE | SYNCHRONIZE | FILE_WRITE_DATA | FILE_APPEND_DATA | FILE_WRITE_PROPERTIES,
|
||||
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE | FILE_EXECUTE | FILE_READ_ATTRIBUTES,
|
||||
FILE_ALL_ACCESS};
|
||||
static GENERIC_MAPPING IopFileMapping = {FILE_GENERIC_READ,
|
||||
FILE_GENERIC_WRITE,
|
||||
FILE_GENERIC_EXECUTE,
|
||||
FILE_ALL_ACCESS};
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
|
|
@ -556,8 +556,10 @@ NtGdiExtFloodFill(
|
|||
COLORREF Color,
|
||||
UINT FillType)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
DPRINT1("FIXME: NtGdiExtFloodFill is UNIMPLEMENTED\n");
|
||||
|
||||
/* lie and say we succeded */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL STDCALL
|
||||
|
|
|
@ -63,7 +63,7 @@ IntGdiCreatePenIndirect(PLOGPEN LogPen)
|
|||
break;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED;
|
||||
DPRINT1("FIXME: IntGdiCreatePenIndirect is UNIMPLEMENTED\n");
|
||||
}
|
||||
|
||||
PENOBJ_UnlockPen(hPen);
|
||||
|
|
Loading…
Reference in a new issue