[Wine-patches] [eterhack eter-2.0.0] ntdll: Add hack for Garant`s dataupd.exe (eterbug #7880).

Alexander Morozov amorozov на etersoft.ru
Ср Июн 6 17:54:35 MSK 2012


---
 dlls/ntdll/loader.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 2c6425d..8e9e5f1 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -1858,6 +1858,40 @@ done:
 }
 
 
+static HANDLE basename_open( const WCHAR *libname )
+{
+    static const char create_file[] = "NtCreateFile";
+
+    NTSTATUS WINAPI (*pNtCreateFile)( PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
+                                      PIO_STATUS_BLOCK, PLARGE_INTEGER, ULONG,
+                                      ULONG, ULONG, ULONG, PVOID, ULONG );
+    HMODULE hModule;
+    ANSI_STRING str;
+    IO_STATUS_BLOCK io;
+    OBJECT_ATTRIBUTES attr;
+    UNICODE_STRING nt_name;
+    HANDLE handle = 0;
+
+    RtlPcToFileHeader( basename_open, (void *)&hModule );
+    RtlInitAnsiString( &str, create_file );
+    LdrGetProcedureAddress( hModule, &str, 0, (void **)&pNtCreateFile );
+
+    if (RtlDosPathNameToNtPathName_U( libname, &nt_name, NULL, NULL ))
+    {
+        attr.Length = sizeof(attr);
+        attr.RootDirectory = 0;
+        attr.Attributes = OBJ_CASE_INSENSITIVE;
+        attr.ObjectName = &nt_name;
+        attr.SecurityDescriptor = NULL;
+        attr.SecurityQualityOfService = NULL;
+        pNtCreateFile( &handle, GENERIC_READ, &attr, &io, NULL, FILE_ATTRIBUTE_NORMAL, 0,
+                       FILE_OPEN, 0, NULL, 0 );
+        RtlFreeUnicodeString( &nt_name );
+    }
+    return handle;
+}
+
+
 /***********************************************************************
  *	find_dll_file
  *
@@ -1932,6 +1966,15 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
             goto found;
         }
 
+        if (handle)
+        {
+            /* HACK for Garant`s dataupd.exe, we can not find dll but can open it */
+            len = RtlGetFullPathName_U( libname, *size, filename, &file_part );
+            if (len >= *size) goto overflow;
+            if ((*handle = basename_open( filename )))
+                goto found;
+        }
+
         /* not found */
 
         if (!contains_path( libname ))
-- 
1.7.9.7



Подробная информация о списке рассылки Wine-patches