Files
wine-access/control_class.h

31 lines
1.5 KiB
C

// SPDX-License-Identifier: LGPL-2.1-or-later
#pragma once
#include <windows.h>
// Windows Forms registers native-control subclasses with versioned names.
// Match the control token and its boundary; unrelated managed windows are
// not edits merely because their name contains EDIT somewhere.
static inline BOOL wine_access_class_matches(const WCHAR *className, const WCHAR *nativeName) {
if (lstrcmpiW(className, nativeName) == 0) return TRUE;
// Delphi VCL registers native subclasses under its own class names.
// Keep aliases explicit: an arbitrary T-prefixed custom control need not
// implement the corresponding Windows control messages.
if (lstrcmpiW(nativeName, L"SysListView32") == 0 &&
lstrcmpiW(className, L"TListView") == 0) return TRUE;
if (lstrcmpiW(nativeName, L"Button") == 0 &&
(lstrcmpiW(className, L"TButton") == 0 ||
lstrcmpiW(className, L"TBitBtn") == 0)) return TRUE;
if (lstrcmpiW(nativeName, L"Static") == 0 &&
lstrcmpiW(className, L"TStaticText") == 0) return TRUE;
if (lstrlenW(className) > 4 &&
CompareStringOrdinal(className, 4, L"ATL:", 4, TRUE) == CSTR_EQUAL &&
lstrcmpiW(className + 4, nativeName) == 0) return TRUE;
WCHAR expected[128] = L"WindowsForms10.";
if (lstrlenW(nativeName) > 80) return FALSE;
lstrcatW(expected, nativeName);
lstrcatW(expected, L".app.");
int length = lstrlenW(expected);
return lstrlenW(className) > length &&
CompareStringOrdinal(className, length, expected, length, TRUE) == CSTR_EQUAL;
}