Module: wine Branch: stable Commit: b11f882ec24f2a17f278ccb65669c927138739b5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b11f882ec24f2a17f278ccb656...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Mon Oct 14 08:07:58 2013 +0400
ntdll: Support pinning module refcount with LdrAddRefDll().
(cherry picked from commit 146ff49161fb35095ae9ac6f4c40281cd8f748f4)
---
dlls/ntdll/loader.c | 7 +++++-- include/winternl.h | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 9642f62..5c4121f 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2130,13 +2130,16 @@ NTSTATUS WINAPI LdrAddRefDll( ULONG flags, HMODULE module ) NTSTATUS ret = STATUS_SUCCESS; WINE_MODREF *wm;
- if (flags) FIXME( "%p flags %x not implemented\n", module, flags ); + if (flags & ~LDR_ADDREF_DLL_PIN) FIXME( "%p flags %x not implemented\n", module, flags );
RtlEnterCriticalSection( &loader_section );
if ((wm = get_modref( module ))) { - if (wm->ldr.LoadCount != -1) wm->ldr.LoadCount++; + if (flags & LDR_ADDREF_DLL_PIN) + wm->ldr.LoadCount = -1; + else + if (wm->ldr.LoadCount != -1) wm->ldr.LoadCount++; TRACE( "(%s) ldr.LoadCount: %d\n", debugstr_w(wm->ldr.BaseDllName.Buffer), wm->ldr.LoadCount ); } else ret = STATUS_INVALID_PARAMETER; diff --git a/include/winternl.h b/include/winternl.h index 2a0537c..85aec65 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -1970,6 +1970,9 @@ typedef struct _LDR_MODULE #define LDR_DONT_RESOLVE_REFS 0x40000000 #define LDR_WINE_INTERNAL 0x80000000
+/* flag for LdrAddRefDll */ +#define LDR_ADDREF_DLL_PIN 0x00000001 + /* FIXME: to be checked */ #define MAXIMUM_FILENAME_LENGTH 256