Sebastian Lackner : ntdll: Implement TpCallbackUnloadDllOnCompletion.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jul 2 07:18:07 CDT 2015


Module: wine
Branch: master
Commit: 8965511957d3d9f92fa0d6f41e5961d8a867f927
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8965511957d3d9f92fa0d6f41e5961d8a867f927

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Wed Jul  1 22:58:23 2015 +0200

ntdll: Implement TpCallbackUnloadDllOnCompletion.

---

 dlls/ntdll/ntdll.spec   |  1 +
 dlls/ntdll/threadpool.c | 22 +++++++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 03f3af2..134a3f7 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -978,6 +978,7 @@
 @ stdcall TpCallbackReleaseMutexOnCompletion(ptr long)
 @ stdcall TpCallbackReleaseSemaphoreOnCompletion(ptr long long)
 @ stdcall TpCallbackSetEventOnCompletion(ptr long)
+@ stdcall TpCallbackUnloadDllOnCompletion(ptr ptr)
 @ stdcall TpPostWork(ptr)
 @ stdcall TpReleaseCleanupGroup(ptr)
 @ stdcall TpReleaseCleanupGroupMembers(ptr long ptr)
diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c
index af4f620..eeb275f 100644
--- a/dlls/ntdll/threadpool.c
+++ b/dlls/ntdll/threadpool.c
@@ -210,6 +210,7 @@ struct threadpool_instance
         HANDLE              semaphore;
         LONG                semaphore_count;
         HANDLE              event;
+        HMODULE             library;
     } cleanup;
 };
 
@@ -1644,6 +1645,7 @@ static void CALLBACK threadpool_worker_proc( void *param )
             instance.cleanup.semaphore          = NULL;
             instance.cleanup.semaphore_count    = 0;
             instance.cleanup.event              = NULL;
+            instance.cleanup.library            = NULL;
 
             switch (object->type)
             {
@@ -1696,7 +1698,12 @@ static void CALLBACK threadpool_worker_proc( void *param )
             }
             if (instance.cleanup.event)
             {
-                NtSetEvent( instance.cleanup.event, NULL );
+                status = NtSetEvent( instance.cleanup.event, NULL );
+                if (status != STATUS_SUCCESS) goto skip_cleanup;
+            }
+            if (instance.cleanup.library)
+            {
+                LdrUnloadDll( instance.cleanup.library );
             }
 
         skip_cleanup:
@@ -1893,6 +1900,19 @@ VOID WINAPI TpCallbackSetEventOnCompletion( TP_CALLBACK_INSTANCE *instance, HAND
 }
 
 /***********************************************************************
+ *           TpCallbackUnloadDllOnCompletion    (NTDLL.@)
+ */
+VOID WINAPI TpCallbackUnloadDllOnCompletion( TP_CALLBACK_INSTANCE *instance, HMODULE module )
+{
+    struct threadpool_instance *this = impl_from_TP_CALLBACK_INSTANCE( instance );
+
+    TRACE( "%p %p\n", instance, module );
+
+    if (!this->cleanup.library)
+        this->cleanup.library = module;
+}
+
+/***********************************************************************
  *           TpPostWork    (NTDLL.@)
  */
 VOID WINAPI TpPostWork( TP_WORK *work )




More information about the wine-cvs mailing list