setupapi: if needed create directories for fake dlls
Mikolaj Zalewski
mikolajz at google.com
Fri Aug 17 14:23:41 CDT 2007
Skipped content of type multipart/alternative-------------- next part --------------
From a80cc3d39c5c85c1b55d045070e7272bc7fe195c Mon Sep 17 00:00:00 2001
From: Mikolaj Zalewski <mikolaj at zalewski.pl>
Date: Fri, 17 Aug 2007 12:21:01 -0700
Subject: [PATCH] setupapi: if needed create directories for fake dlls
---
dlls/setupapi/fakedll.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/dlls/setupapi/fakedll.c b/dlls/setupapi/fakedll.c
index 5bf87c4..f9ad821 100644
--- a/dlls/setupapi/fakedll.c
+++ b/dlls/setupapi/fakedll.c
@@ -302,9 +302,28 @@ BOOL create_fake_dll( const WCHAR *name,
else
{
h = CreateFileW( name, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL );
+
+ if (h == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND)
+ {
+ WCHAR *pathel;
+
+ /* create the directory/directories */
+ pathel = strchrW(name, '\\');
+ while (pathel != NULL)
+ {
+ *pathel = 0;
+ if (!CreateDirectoryW(name, NULL))
+ TRACE("Couldn't create directory %s - error: %d\n", wine_dbgstr_w(name), GetLastError());
+ *pathel = '\\';
+ pathel = strchrW(pathel+1, '\\');
+ }
+
+ 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 (last error=%d)\n", debugstr_w(name), GetLastError() );
return FALSE;
}
}
--
1.4.1
More information about the wine-patches
mailing list