Paul Gofman : ntoskrnl.exe: Implement image load notify routines registration.
Alexandre Julliard
julliard at winehq.org
Fri May 29 15:22:55 CDT 2020
Module: wine
Branch: master
Commit: 26fbff05a1e39a3c910ff778e2229c674a0569c5
URL: https://source.winehq.org/git/wine.git/?a=commit;h=26fbff05a1e39a3c910ff778e2229c674a0569c5
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Fri May 29 10:53:10 2020 +0300
ntoskrnl.exe: Implement image load notify routines registration.
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntoskrnl.exe/ntoskrnl.c | 28 ++++++++++++++++++++++++----
include/ddk/ntddk.h | 1 +
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index e9c35cf7e3..94733ec60a 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -85,6 +85,9 @@ static DWORD client_tid;
static HANDLE ntoskrnl_heap;
+static PLOAD_IMAGE_NOTIFY_ROUTINE load_image_notify_routines[8];
+static unsigned int load_image_notify_routine_count;
+
struct wine_driver
{
DRIVER_OBJECT driver_obj;
@@ -3001,10 +3004,21 @@ NTSTATUS WINAPI PsRemoveCreateThreadNotifyRoutine( PCREATE_THREAD_NOTIFY_ROUTINE
/***********************************************************************
* PsRemoveLoadImageNotifyRoutine (NTOSKRNL.EXE.@)
*/
- NTSTATUS WINAPI PsRemoveLoadImageNotifyRoutine(PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine)
+NTSTATUS WINAPI PsRemoveLoadImageNotifyRoutine(PLOAD_IMAGE_NOTIFY_ROUTINE routine)
{
- FIXME( "stub: %p\n", NotifyRoutine );
- return STATUS_SUCCESS;
+ unsigned int i;
+
+ TRACE("routine %p.\n", routine);
+
+ for (i = 0; i < load_image_notify_routine_count; ++i)
+ if (load_image_notify_routines[i] == routine)
+ {
+ --load_image_notify_routine_count;
+ memmove(&load_image_notify_routines[i], &load_image_notify_routines[i + 1],
+ sizeof(*load_image_notify_routines) * (load_image_notify_routine_count - i));
+ return STATUS_SUCCESS;
+ }
+ return STATUS_PROCEDURE_NOT_FOUND;
}
@@ -3160,7 +3174,13 @@ NTSTATUS WINAPI IoWMIOpenBlock(LPCGUID guid, ULONG desired_access, PVOID *data_b
*/
NTSTATUS WINAPI PsSetLoadImageNotifyRoutine(PLOAD_IMAGE_NOTIFY_ROUTINE routine)
{
- FIXME("(%p) stub\n", routine);
+ FIXME("routine %p, semi-stub.\n", routine);
+
+ if (load_image_notify_routine_count == ARRAY_SIZE(load_image_notify_routines))
+ return STATUS_INSUFFICIENT_RESOURCES;
+
+ load_image_notify_routines[load_image_notify_routine_count++] = routine;
+
return STATUS_SUCCESS;
}
diff --git a/include/ddk/ntddk.h b/include/ddk/ntddk.h
index e3c9124023..2b05fda711 100644
--- a/include/ddk/ntddk.h
+++ b/include/ddk/ntddk.h
@@ -231,6 +231,7 @@ BOOLEAN WINAPI MmIsAddressValid(void *);
HANDLE WINAPI PsGetProcessId(PEPROCESS);
HANDLE WINAPI PsGetThreadId(PETHREAD);
HANDLE WINAPI PsGetThreadProcessId(PETHREAD);
+NTSTATUS WINAPI PsRemoveLoadImageNotifyRoutine(PLOAD_IMAGE_NOTIFY_ROUTINE);
NTSTATUS WINAPI PsSetCreateProcessNotifyRoutine(PCREATE_PROCESS_NOTIFY_ROUTINE,BOOLEAN);
NTSTATUS WINAPI PsSetCreateProcessNotifyRoutineEx(PCREATE_PROCESS_NOTIFY_ROUTINE_EX,BOOLEAN);
NTSTATUS WINAPI PsSetCreateThreadNotifyRoutine(PCREATE_THREAD_NOTIFY_ROUTINE);
More information about the wine-cvs
mailing list