Commit 8b478a70 authored by Alexandre Julliard's avatar Alexandre Julliard

setupapi: Added support for creating fake dlls at install time.

This should satisfy applications that access a dll file directly. For apps that check the dll version in the file, the version resource is copied from the builtin dll.
parent e66e34ef
......@@ -13,6 +13,7 @@ C_SRCS = \
devinst.c \
dirid.c \
diskspace.c \
fakedll.c \
install.c \
misc.c \
parser.c \
......
......@@ -76,6 +76,7 @@ static const WCHAR UpdateIniFields[] = {'U','p','d','a','t','e','I','n','i','F',
static const WCHAR RegisterDlls[] = {'R','e','g','i','s','t','e','r','D','l','l','s',0};
static const WCHAR UnregisterDlls[] = {'U','n','r','e','g','i','s','t','e','r','D','l','l','s',0};
static const WCHAR ProfileItems[] = {'P','r','o','f','i','l','e','I','t','e','m','s',0};
static const WCHAR WineFakeDlls[] = {'W','i','n','e','F','a','k','e','D','l','l','s',0};
/***********************************************************************
......@@ -621,6 +622,48 @@ static BOOL register_dlls_callback( HINF hinf, PCWSTR field, void *arg )
}
/***********************************************************************
* fake_dlls_callback
*
* Called once for each WineFakeDlls entry in a given section.
*/
static BOOL fake_dlls_callback( HINF hinf, PCWSTR field, void *arg )
{
INFCONTEXT context;
BOOL ret = TRUE;
BOOL ok = SetupFindFirstLineW( hinf, field, NULL, &context );
for (; ok; ok = SetupFindNextLine( &context, &context ))
{
WCHAR *path, *p;
WCHAR buffer[MAX_INF_STRING_LENGTH];
/* get directory */
if (!(path = PARSER_get_dest_dir( &context ))) continue;
/* get dll name */
if (!SetupGetStringFieldW( &context, 3, buffer, sizeof(buffer)/sizeof(WCHAR), NULL ))
goto done;
if (!(p = HeapReAlloc( GetProcessHeap(), 0, path,
(strlenW(path) + strlenW(buffer) + 2) * sizeof(WCHAR) ))) goto done;
path = p;
p += strlenW(p);
if (p == path || p[-1] != '\\') *p++ = '\\';
strcpyW( p, buffer );
/* get source dll */
if (SetupGetStringFieldW( &context, 4, buffer, sizeof(buffer)/sizeof(WCHAR), NULL ))
p = buffer; /* otherwise use target base name as default source */
create_fake_dll( path, p ); /* ignore errors */
done:
HeapFree( GetProcessHeap(), 0, path );
if (!ret) break;
}
return ret;
}
/***********************************************************************
* update_ini_callback
*
* Called once for each UpdateInis entry in a given section.
......@@ -890,6 +933,9 @@ BOOL WINAPI SetupInstallFromInfSectionW( HWND owner, HINF hinf, PCWSTR section,
if (!iterate_section_fields( hinf, section, RegisterDlls, register_dlls_callback, &info ))
return FALSE;
if (!iterate_section_fields( hinf, section, WineFakeDlls, fake_dlls_callback, NULL ))
return FALSE;
}
if (flags & SPINST_UNREGSVR)
{
......
......@@ -57,4 +57,6 @@ UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification, UINT_PTR, U
extern OSVERSIONINFOW OsVersionInfo;
extern BOOL create_fake_dll( const WCHAR *name, const WCHAR *source );
#endif /* __SETUPAPI_PRIVATE_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment