diff --git a/reactos/include/ddk/mmfuncs.h b/reactos/include/ddk/mmfuncs.h index bbf635a0414..6c6ff59c14d 100644 --- a/reactos/include/ddk/mmfuncs.h +++ b/reactos/include/ddk/mmfuncs.h @@ -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 ( diff --git a/reactos/lib/crt/except/matherr.c b/reactos/lib/crt/except/matherr.c index f751c300956..4823522f4d3 100644 --- a/reactos/lib/crt/except/matherr.c +++ b/reactos/lib/crt/except/matherr.c @@ -1,16 +1,8 @@ #include "precomp.h" +#include #include -struct _exception { - int type; - char* name; - double arg1; - double arg2; - double retval; -} ; - - int _matherr(struct _exception* e) { return 0; diff --git a/reactos/lib/ntdll/rtl/libsupp.c b/reactos/lib/ntdll/rtl/libsupp.c index 1f6e70a5964..97dc732ffb2 100644 --- a/reactos/lib/ntdll/rtl/libsupp.c +++ b/reactos/lib/ntdll/rtl/libsupp.c @@ -19,6 +19,13 @@ /* FUNCTIONS ***************************************************************/ +KPROCESSOR_MODE +RtlpGetMode() +{ + return UserMode; +} + + PVOID STDCALL ExAllocatePool( diff --git a/reactos/lib/ntdll/rtl/path.c b/reactos/lib/ntdll/rtl/path.c index 5c100fd71c9..ff4c3b9c256 100644 --- a/reactos/lib/ntdll/rtl/path.c +++ b/reactos/lib/ntdll/rtl/path.c @@ -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) diff --git a/reactos/lib/rtl/unicode.c b/reactos/lib/rtl/unicode.c index f1c8d73400c..8236047961a 100644 --- a/reactos/lib/rtl/unicode.c +++ b/reactos/lib/rtl/unicode.c @@ -2256,6 +2256,8 @@ RtlCreateUnicodeString( /* * private + * + * Creates a nullterminated UNICODE_STRING */ BOOLEAN FASTCALL diff --git a/reactos/lib/user32/windows/accel.c b/reactos/lib/user32/windows/accel.c index 39495484956..f560695e63a 100644 --- a/reactos/lib/user32/windows/accel.c +++ b/reactos/lib/user32/windows/accel.c @@ -285,6 +285,9 @@ HACCEL WINAPI CreateAcceleratorTableW(LPACCEL lpaccl, int cEntries) } +/* + * @implemented + */ int WINAPI CopyAcceleratorTableA ( HACCEL hAccelSrc, diff --git a/reactos/ntoskrnl/fs/notify.c b/reactos/ntoskrnl/fs/notify.c index 837ed5a6c24..8a84e77bd9d 100644 --- a/reactos/ntoskrnl/fs/notify.c +++ b/reactos/ntoskrnl/fs/notify.c @@ -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; diff --git a/reactos/ntoskrnl/io/iomgr.c b/reactos/ntoskrnl/io/iomgr.c index ddd28b1cf0f..0cc528d837d 100644 --- a/reactos/ntoskrnl/io/iomgr.c +++ b/reactos/ntoskrnl/io/iomgr.c @@ -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 ****************************************************************/ diff --git a/reactos/subsys/win32k/objects/bitmaps.c b/reactos/subsys/win32k/objects/bitmaps.c index be7c92fa807..92f193f35b5 100644 --- a/reactos/subsys/win32k/objects/bitmaps.c +++ b/reactos/subsys/win32k/objects/bitmaps.c @@ -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 diff --git a/reactos/subsys/win32k/objects/pen.c b/reactos/subsys/win32k/objects/pen.c index d3c4d2aae15..f13451f59fd 100644 --- a/reactos/subsys/win32k/objects/pen.c +++ b/reactos/subsys/win32k/objects/pen.c @@ -63,7 +63,7 @@ IntGdiCreatePenIndirect(PLOGPEN LogPen) break; default: - UNIMPLEMENTED; + DPRINT1("FIXME: IntGdiCreatePenIndirect is UNIMPLEMENTED\n"); } PENOBJ_UnlockPen(hPen);