ntdll: Use the loadFrom directory to load dlls from the activation context.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50978 Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8f3383f741
commit
55d98c572c
|
@ -2431,6 +2431,44 @@ failed:
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* build_dlldata_path
|
||||
*
|
||||
* Helper for find_actctx_dll.
|
||||
*/
|
||||
static NTSTATUS build_dlldata_path( LPCWSTR libname, ACTCTX_SECTION_KEYED_DATA *data, LPWSTR *fullname )
|
||||
{
|
||||
struct dllredirect_data *dlldata = data->lpData;
|
||||
char *base = data->lpSectionBase;
|
||||
SIZE_T total = dlldata->total_len + (wcslen(libname) + 1) * sizeof(WCHAR);
|
||||
WCHAR *p, *buffer;
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
ULONG i;
|
||||
|
||||
if (!(p = buffer = RtlAllocateHeap( GetProcessHeap(), 0, total ))) return STATUS_NO_MEMORY;
|
||||
for (i = 0; i < dlldata->paths_count; i++)
|
||||
{
|
||||
memcpy( p, base + dlldata->paths[i].offset, dlldata->paths[i].len );
|
||||
p += dlldata->paths[i].len / sizeof(WCHAR);
|
||||
}
|
||||
wcscpy( p, libname );
|
||||
|
||||
if (dlldata->flags & DLL_REDIRECT_PATH_EXPAND)
|
||||
{
|
||||
RtlExpandEnvironmentStrings( NULL, buffer, wcslen(buffer), NULL, 0, &total );
|
||||
if ((*fullname = RtlAllocateHeap( GetProcessHeap(), 0, total * sizeof(WCHAR) )))
|
||||
RtlExpandEnvironmentStrings( NULL, buffer, wcslen(buffer), *fullname, total, NULL );
|
||||
else
|
||||
status = STATUS_NO_MEMORY;
|
||||
|
||||
RtlFreeHeap( GetProcessHeap(), 0, buffer );
|
||||
}
|
||||
else *fullname = buffer;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* find_actctx_dll
|
||||
*
|
||||
|
@ -2440,8 +2478,9 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
|
|||
{
|
||||
static const WCHAR winsxsW[] = {'\\','w','i','n','s','x','s','\\'};
|
||||
|
||||
ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *info;
|
||||
ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *info = NULL;
|
||||
ACTCTX_SECTION_KEYED_DATA data;
|
||||
struct dllredirect_data *dlldata;
|
||||
UNICODE_STRING nameW;
|
||||
NTSTATUS status;
|
||||
SIZE_T needed, size = 1024;
|
||||
|
@ -2454,6 +2493,18 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
|
|||
&nameW, &data );
|
||||
if (status != STATUS_SUCCESS) return status;
|
||||
|
||||
if (data.ulLength < offsetof( struct dllredirect_data, paths[0] ))
|
||||
{
|
||||
status = STATUS_SXS_KEY_NOT_FOUND;
|
||||
goto done;
|
||||
}
|
||||
dlldata = data.lpData;
|
||||
if (!(dlldata->flags & DLL_REDIRECT_PATH_OMITS_ASSEMBLY_ROOT))
|
||||
{
|
||||
status = build_dlldata_path( libname, &data, fullname );
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (!(info = RtlAllocateHeap( GetProcessHeap(), 0, size )))
|
||||
|
|
Loading…
Reference in New Issue