Commit 55d98c57 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Use the loadFrom directory to load dlls from the activation context.

parent 8f3383f7
......@@ -2432,6 +2432,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
*
* Find the full path (if any) of the dll from the activation context.
......@@ -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 )))
......
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