55b638801b
Moved `FindText` to `UiaTextRangeBase`. Now that Search is a shared component (thanks #3279), I can just reuse it basically as-is. #3279 - Make Search a shared component #4018 - UiaTextRange Refactor I removed it from the two different kinds of UiaTextRange and put it in the base class. I needed a very minor change to ensure we convert from an inclusive end (from Search) to an exclusive end (in UTR). Worked with `FindText` was globally messed with in windows.h. So we had to do a few weird things there (thanks Michael). No need for additional tests because it _literally_ just sets up a Searcher and calls it.
55 lines
1.9 KiB
C
55 lines
1.9 KiB
C
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT license.
|
|
#pragma once
|
|
|
|
// clang-format off
|
|
|
|
#ifndef WIN32_LEAN_AND_MEAN
|
|
#define WIN32_LEAN_AND_MEAN // If this is not defined, windows.h includes commdlg.h which defines FindText globally and conflicts with UIAutomation ITextRangeProvider.
|
|
#endif
|
|
|
|
// Define and then undefine WIN32_NO_STATUS because windows.h has no guard to prevent it from double defing certain statuses
|
|
// when included with ntstatus.h
|
|
#define WIN32_NO_STATUS
|
|
#include <windows.h>
|
|
#undef WIN32_NO_STATUS
|
|
|
|
// From ntdef.h, but that can't be included or it'll fight over PROBE_ALIGNMENT and other such arch specific defs
|
|
typedef _Return_type_success_(return >= 0) LONG NTSTATUS;
|
|
/*lint -save -e624 */ // Don't complain about different typedefs.
|
|
typedef NTSTATUS *PNTSTATUS;
|
|
/*lint -restore */ // Resume checking for different typedefs.
|
|
#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
|
|
|
|
// End From ntdef.h
|
|
|
|
#define INLINE_NTSTATUS_FROM_WIN32 1 // Must use inline NTSTATUS or it will call the wrapped function twice.
|
|
#pragma warning(push)
|
|
#pragma warning(disable:4430) // Must disable 4430 "default int" warning for C++ because ntstatus.h is inflexible SDK definition.
|
|
#include <ntstatus.h>
|
|
#pragma warning(pop)
|
|
|
|
#include <initguid.h>
|
|
|
|
#ifdef EXTERNAL_BUILD
|
|
#include <ShlObj.h>
|
|
#else
|
|
#include <shlobj_core.h>
|
|
#endif
|
|
|
|
#include <winuser.h>
|
|
|
|
#include <cwchar>
|
|
|
|
// Only remaining item from w32gdip.h. There's probably a better way to do this as well.
|
|
#define IS_ANY_DBCS_CHARSET( CharSet ) \
|
|
( ((CharSet) == SHIFTJIS_CHARSET) ? TRUE : \
|
|
((CharSet) == HANGEUL_CHARSET) ? TRUE : \
|
|
((CharSet) == CHINESEBIG5_CHARSET) ? TRUE : \
|
|
((CharSet) == GB2312_CHARSET) ? TRUE : FALSE )
|
|
|
|
#include "conddkrefs.h"
|
|
#include "conwinuserrefs.h"
|
|
|
|
// clang-format on
|