Mikolaj Zalewski : setupapi: If needed create directories for fake dlls.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Aug 21 07:20:56 CDT 2007


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

Author: Mikolaj Zalewski <mikolajz at google.com>
Date:   Mon Aug 20 10:03:16 2007 -0700

setupapi: If needed create directories for fake dlls.

---

 dlls/setupapi/fakedll.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/dlls/setupapi/fakedll.c b/dlls/setupapi/fakedll.c
index 5bf87c4..ca9e069 100644
--- a/dlls/setupapi/fakedll.c
+++ b/dlls/setupapi/fakedll.c
@@ -301,10 +301,32 @@ BOOL create_fake_dll( const WCHAR *name, const WCHAR *source )
     }
     else
     {
+        if (GetLastError() == ERROR_PATH_NOT_FOUND)
+        {
+            WCHAR *path;
+            WCHAR *pathel;
+
+            /* create the directory/directories */
+            path = HeapAlloc(GetProcessHeap(), 0, (strlenW(name) + 1)*sizeof(WCHAR));
+            strcpyW(path, name);
+
+            pathel = strchrW(path, '\\');
+            while (pathel != NULL)
+            {
+                *pathel = 0;
+                if (!CreateDirectoryW(path, NULL))
+                    TRACE("Couldn't create directory %s - error: %d\n", wine_dbgstr_w(path), GetLastError());
+                *pathel = '\\';
+                pathel = strchrW(pathel+1, '\\');
+            }
+
+            HeapFree(GetProcessHeap(), 0, path);
+        }
+
         h = CreateFileW( name, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL );
         if (h == INVALID_HANDLE_VALUE)
         {
-            WARN( "failed to create %s\n", debugstr_w(name) );
+            ERR( "failed to create %s (error=%u)\n", debugstr_w(name), GetLastError() );
             return FALSE;
         }
     }




More information about the wine-cvs mailing list