[PATCH] ntdll: Make warn+module silent for a fake dll
Detlef Riekenberg
wine.dev at web.de
Thu Oct 25 15:05:48 CDT 2007
---
dlls/ntdll/loader.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 6c1d7bc..ea57247 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -68,7 +68,10 @@ static const char * const reason_names[]
};
static const WCHAR dllW[] = {'.','d','l','l',0};
+static const char fakedll_signature[] = "Wine placeholder DLL";
+/* ######################### */
+
/* internal representation of 32bit modules. per process. */
typedef struct _wine_modref
{
@@ -1214,7 +1217,6 @@ NTSTATUS WINAPI LdrGetProcedureAddress(H
*/
static BOOL is_fake_dll( const void *base )
{
- static const char fakedll_signature[] = "Wine placeholder DLL";
const IMAGE_DOS_HEADER *dos = base;
if (dos->e_lfanew >= sizeof(*dos) + sizeof(fakedll_signature) &&
@@ -1502,12 +1504,27 @@ static NTSTATUS load_builtin_dll( LPCWST
handle = wine_dlopen( unix_name.Buffer, RTLD_NOW, error, sizeof(error) );
builtin_load_info = prev_info;
RtlFreeUnicodeString( &nt_name );
- RtlFreeHeap( GetProcessHeap(), 0, unix_name.Buffer );
if (!handle)
{
+ int fd = open( unix_name.Buffer, O_RDONLY );
+ RtlFreeHeap( GetProcessHeap(), 0, unix_name.Buffer );
+
+ if (fd != -1) {
+ /* reuse the buffer "dllname" to avoid a memory-allocation */
+ len = read( fd, dllname, sizeof(dllname) );
+ close( fd );
+ /* do not warn for a fake dll */
+ if( (len > (sizeof(IMAGE_DOS_HEADER) + sizeof(fakedll_signature))) &&
+ is_fake_dll(dllname) ) {
+ return STATUS_INVALID_IMAGE_FORMAT;
+ }
+ }
+
WARN( "failed to load .so lib for builtin %s: %s\n", debugstr_w(path), error );
return STATUS_INVALID_IMAGE_FORMAT;
}
+ RtlFreeHeap( GetProcessHeap(), 0, unix_name.Buffer );
+
}
else
{
--
1.4.1
--=-6WFnp5ia4yixCyJsiLTa--
More information about the wine-patches
mailing list