Commit f181e25a authored by Evan Tang's avatar Evan Tang Committed by Alexandre Julliard

kernel32: Null-terminate the atom names passed to NtAddAtom.

Adobe Reader XI patches NtAddAtom() and expects the name to be null-terminated Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53872
parent b558c87c
...@@ -110,8 +110,10 @@ ATOM WINAPI GlobalAddAtomA( LPCSTR str /* [in] String to add */ ) ...@@ -110,8 +110,10 @@ ATOM WINAPI GlobalAddAtomA( LPCSTR str /* [in] String to add */ )
{ {
if (!check_integral_atom( str, &atom )) if (!check_integral_atom( str, &atom ))
{ {
WCHAR buffer[MAX_ATOM_LEN]; /* Note: Adobe Reader XI in protected mode hijacks NtAddAtom and its replacement expects the string to be null terminated. */
WCHAR buffer[MAX_ATOM_LEN+1];
DWORD len = MultiByteToWideChar( CP_ACP, 0, str, strlen(str), buffer, MAX_ATOM_LEN ); DWORD len = MultiByteToWideChar( CP_ACP, 0, str, strlen(str), buffer, MAX_ATOM_LEN );
buffer[len] = 0;
if (!len) SetLastError( ERROR_INVALID_PARAMETER ); if (!len) SetLastError( ERROR_INVALID_PARAMETER );
else if (!set_ntstatus( NtAddAtom( buffer, len * sizeof(WCHAR), &atom ))) atom = 0; else if (!set_ntstatus( NtAddAtom( buffer, len * sizeof(WCHAR), &atom ))) atom = 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment