[PATCH] kernel32: Don't use the TEB static buffer in CreateFileA().
Zebediah Figura
z.figura12 at gmail.com
Fri Dec 1 10:07:39 CST 2017
We might call GetModuleHandle("krnl386.exe16") later, which will overwrite
the static buffer.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/kernel32/file.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c
index 3e93b0d..5301eaf 100644
--- a/dlls/kernel32/file.c
+++ b/dlls/kernel32/file.c
@@ -1633,10 +1633,13 @@ HANDLE WINAPI CreateFileA( LPCSTR filename, DWORD access, DWORD sharing,
DWORD attributes, HANDLE template)
{
WCHAR *nameW;
+ HANDLE file;
if ((GetVersion() & 0x80000000) && IsBadStringPtrA(filename, -1)) return INVALID_HANDLE_VALUE;
- if (!(nameW = FILE_name_AtoW( filename, FALSE ))) return INVALID_HANDLE_VALUE;
- return CreateFileW( nameW, access, sharing, sa, creation, attributes, template );
+ if (!(nameW = FILE_name_AtoW( filename, TRUE ))) return INVALID_HANDLE_VALUE;
+ file = CreateFileW( nameW, access, sharing, sa, creation, attributes, template );
+ HeapFree( GetProcessHeap(), 0, nameW );
+ return file;
}
/*************************************************************************
--
2.7.4
More information about the wine-devel
mailing list