setupapi: Don't try to create a fake dll if we could not load the original.

Francois Gouget fgouget at codeweavers.com
Wed Jan 10 09:21:39 CST 2007


---
 dlls/setupapi/fakedll.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/setupapi/fakedll.c b/dlls/setupapi/fakedll.c
index 59dfe08..5f4c91e 100644
--- a/dlls/setupapi/fakedll.c
+++ b/dlls/setupapi/fakedll.c
@@ -284,7 +284,7 @@ BOOL create_fake_dll( const WCHAR *name, const WCHAR *source )
 {
     HANDLE h;
     HMODULE module;
-    BOOL ret;
+    BOOL ret = FALSE;
 
     /* first check for an existing file */
     h = CreateFileW( name, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL );
@@ -311,11 +311,15 @@ BOOL create_fake_dll( const WCHAR *name, const WCHAR *source )
     }
 
     module = LoadLibraryW( source );
-
-    ret = build_fake_dll( h, module );
+    if (module)
+    {
+        ret = build_fake_dll( h, module );
+        FreeLibrary( module );
+    }
+    else
+        TRACE( "could not load %s so not creating a fake dll for it\n", debugstr_w(name) );
 
     CloseHandle( h );
-    if (module) FreeLibrary( module );
     if (!ret) DeleteFileW( name );
     return ret;
 }
-- 
1.4.4.2



More information about the wine-patches mailing list