Skip to content

Instantly share code, notes, and snippets.

@jeromerobert
Last active April 16, 2017 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeromerobert/c418b4ac08785fda483c7f717b56a546 to your computer and use it in GitHub Desktop.
Save jeromerobert/c418b4ac08785fda483c7f717b56a546 to your computer and use it in GitHub Desktop.

https://github.com/wine-compholio/wine-staging/tree/master/patches/ntdll-NtQueryVirtualMemory

trace:file:K32GetMappedFileNameW (0xffffffff, 0x590000, 0x33fa78, 259)
trace:file:K32GetMappedFileNameW L"\\??\\C:\\users\\jerome\\Temp\\wbxtra_04162017_085311.wbt"
trace:file:OpenFile \??\C:\users\jerome\Temp\wbxtra_04162017_085311.wbt OF_WRITE OF_SHARE_COMPAT 
trace:file:OpenFile \??\C:\users\jerome\Temp\wbxtra_04162017_085311.wbt 0001
trace:file:RtlGetFullPathName_U (L"\\??\\C:\\users\\jerome\\Temp\\wbxtra_04162017_085311.wbt" 520 0x33f728 0x33f724)
trace:file:RtlDosPathNameToNtPathName_U (L"\\??\\C:\\users\\jerome\\Temp\\wbxtra_04162017_085311.wbt",0x33f598,(nil),(nil))
trace:file:RtlGetFullPathName_U (L"\\??\\C:\\users\\jerome\\Temp\\wbxtra_04162017_085311.wbt" 520 0x33f338 (nil))
warn:file:OpenFile (\??\C:\users\jerome\Temp\wbxtra_04162017_085311.wbt): return = HFILE_ERROR error= 2

Workaround ??? :

--- a/dlls/kernel32/virtual.c
+++ b/dlls/kernel32/virtual.c
@@ -872,7 +872,8 @@ DWORD WINAPI K32GetMappedFileNameW(HANDLE process, LPVOID addr, LPWSTR file_name
         return 0;
     }
 
-    memcpy(file_name, name->SectionFileName.Buffer, name->SectionFileName.MaximumLength);
+    memcpy(file_name, name->SectionFileName.Buffer+4, name->SectionFileName.MaximumLength-4);
+    TRACE_(file)("%s\n", debugstr_w(file_name));
     buf_len = name->SectionFileName.Length;
 
     HeapFree(GetProcessHeap(), 0, name);
trace:file:K32GetMappedFileNameW L"C:\\users\\jerome\\Temp\\wbxtra_04162017_095136.wbt"
trace:file:OpenFile C:\users\jerome\Temp\wbxtra_04162017_095136.wbt OF_WRITE OF_SHARE_COMPAT 
trace:file:OpenFile C:\users\jerome\Temp\wbxtra_04162017_095136.wbt 0001
trace:file:RtlGetFullPathName_U (L"C:\\users\\jerome\\Temp\\wbxtra_04162017_095136.wbt" 520 0x33f728 0x33f724)
trace:file:RtlDosPathNameToNtPathName_U (L"C:\\users\\jerome\\Temp\\wbxtra_04162017_095136.wbt",0x33f598,(nil),(nil))
trace:file:RtlGetFullPathName_U (L"C:\\users\\jerome\\Temp\\wbxtra_04162017_095136.wbt" 520 0x33f338 (nil))
trace:file:RtlGetFullPathName_U (L"C:\\users\\jerome\\Temp\\wbxtra_04162017_095136.wbt" 520 0x33f718 (nil))
trace:file:OpenFile found "C:\\users\\jerome\\Temp\\wbxtra_04162017_095136.wbt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment