mirror of
git://source.winehq.org/git/wine.git
synced 2024-07-21 13:44:09 +00:00
regsvr32: Don't use GetBinaryType() on DLL files.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
89db25afda
commit
44f0a67ba5
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <winternl.h>
|
||||||
#include <ole2.h>
|
#include <ole2.h>
|
||||||
#include "regsvr32.h"
|
#include "regsvr32.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
@ -166,9 +167,9 @@ static void reexec_self(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
# define ALT_BINARY_TYPE SCS_32BIT_BINARY
|
# define ALT_MACHINE IMAGE_FILE_MACHINE_I386
|
||||||
#else
|
#else
|
||||||
# define ALT_BINARY_TYPE SCS_64BIT_BINARY
|
# define ALT_MACHINE IMAGE_FILE_MACHINE_AMD64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -187,12 +188,12 @@ static VOID *LoadProc(const WCHAR* strDll, const char* procName, HMODULE* DllHan
|
||||||
*DllHandle = LoadLibraryExW(strDll, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
|
*DllHandle = LoadLibraryExW(strDll, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
|
||||||
if(!*DllHandle)
|
if(!*DllHandle)
|
||||||
{
|
{
|
||||||
DWORD binary_type;
|
HMODULE module;
|
||||||
if (firstDll && GetLastError() == ERROR_BAD_EXE_FORMAT &&
|
if (firstDll && GetLastError() == ERROR_BAD_EXE_FORMAT &&
|
||||||
GetBinaryTypeW(strDll, &binary_type) &&
|
(module = LoadLibraryExW(strDll, 0, LOAD_LIBRARY_AS_IMAGE_RESOURCE)))
|
||||||
binary_type == ALT_BINARY_TYPE)
|
|
||||||
{
|
{
|
||||||
reexec_self();
|
IMAGE_NT_HEADERS *nt = RtlImageNtHeader( (HMODULE)((ULONG_PTR)module & ~3) );
|
||||||
|
if (nt->FileHeader.Machine == ALT_MACHINE) reexec_self();
|
||||||
}
|
}
|
||||||
output_write(STRING_DLL_LOAD_FAILED, strDll);
|
output_write(STRING_DLL_LOAD_FAILED, strDll);
|
||||||
ExitProcess(LOADLIBRARY_FAILED);
|
ExitProcess(LOADLIBRARY_FAILED);
|
||||||
|
|
Loading…
Reference in a new issue