setupapi: If needed create directories for fake dlls.

This commit is contained in:
Mikolaj Zalewski 2007-08-20 10:03:16 -07:00 committed by Alexandre Julliard
parent 8942b7888b
commit 0d00a74f47
1 changed files with 23 additions and 1 deletions

View File

@ -301,10 +301,32 @@ BOOL create_fake_dll( const WCHAR *name, const WCHAR *source )
} }
else 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 ); h = CreateFileW( name, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL );
if (h == INVALID_HANDLE_VALUE) 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; return FALSE;
} }
} }