From e410a12242a50e850846058ef5c53652340c1724 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Wed, 15 Jan 2020 01:14:30 +0100 Subject: [PATCH] [ATL30] Fix m_szAutoName definition and construction in Wine's ATL30 dll. - Make the format actually MS-compatible: "ATL" followed by colon, followed by hexadecimal digits of pointer. - The MS counterpart of this DLL was delivered with Visual C++ 6.0 and Windows 98+, so obviously it always was 32-bit and they never had a 64-bit version for it. But we do. So make the size of the m_szAutoName buffer cross-compatible. - See previous commit dbddd878 and the discussion in PR #2010. --- dll/win32/atl/atl30.c | 8 ++++++++ sdk/include/reactos/wine/atlwin.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/dll/win32/atl/atl30.c b/dll/win32/atl/atl30.c index 06504d09940..254dbadb084 100644 --- a/dll/win32/atl/atl30.c +++ b/dll/win32/atl/atl30.c @@ -313,7 +313,11 @@ ATOM WINAPI AtlModuleRegisterWndClassInfoA(_ATL_MODULEA *pm, _ATL_WNDCLASSINFOA if (!wci->m_wc.lpszClassName) { +#ifdef __REACTOS__ + sprintf(wci->m_szAutoName, "ATL:%p", wci); +#else sprintf(wci->m_szAutoName, "ATL%08lx", (UINT_PTR)wci); +#endif TRACE("auto-generated class name %s\n", wci->m_szAutoName); wci->m_wc.lpszClassName = wci->m_szAutoName; } @@ -372,7 +376,11 @@ ATOM WINAPI AtlModuleRegisterWndClassInfoW(_ATL_MODULEW *pm, _ATL_WNDCLASSINFOW if (!wci->m_wc.lpszClassName) { +#ifdef __REACTOS__ + static const WCHAR szFormat[] = {'A','T','L',':','%','p',0}; +#else static const WCHAR szFormat[] = {'A','T','L','%','0','8','l','x',0}; +#endif swprintf(wci->m_szAutoName, szFormat, (UINT_PTR)wci); TRACE("auto-generated class name %s\n", debugstr_w(wci->m_szAutoName)); wci->m_wc.lpszClassName = wci->m_szAutoName; diff --git a/sdk/include/reactos/wine/atlwin.h b/sdk/include/reactos/wine/atlwin.h index 386177ba610..099f48bcb52 100644 --- a/sdk/include/reactos/wine/atlwin.h +++ b/sdk/include/reactos/wine/atlwin.h @@ -29,7 +29,11 @@ typedef struct _ATL_WNDCLASSINFOA_TAG LPCSTR m_lpszCursorID; BOOL m_bSystemCursor; ATOM m_atom; +#ifdef __REACTOS__ + CHAR m_szAutoName[sizeof("ATL:") + sizeof(void *) * 2]; // == 4 characters + NULL + number of hexadecimal digits describing a pointer. +#else CHAR m_szAutoName[14]; +#endif } _ATL_WNDCLASSINFOA; typedef struct _ATL_WNDCLASSINFOW_TAG @@ -40,7 +44,11 @@ typedef struct _ATL_WNDCLASSINFOW_TAG LPCWSTR m_lpszCursorID; BOOL m_bSystemCursor; ATOM m_atom; +#ifdef __REACTOS__ + WCHAR m_szAutoName[sizeof("ATL:") + sizeof(void *) * 2]; // == 4 characters + NULL + number of hexadecimal digits describing a pointer. +#else WCHAR m_szAutoName[14]; +#endif } _ATL_WNDCLASSINFOW; ATOM WINAPI AtlModuleRegisterWndClassInfoA(_ATL_MODULEA *pm, _ATL_WNDCLASSINFOA *wci, WNDPROC *pProc); -- 2.17.1