Detours icon indicating copy to clipboard operation
Detours copied to clipboard

fix build error for error C2065: 'GetThreadLocale'

Open fishjam opened this issue 2 years ago • 3 comments

When I try to build sample in vcpkg's download detours code(v4.0.1-2f7d798f9a) , I meet same build error: C2065: 'GetThreadLocale' as #202 and #240 , although there is fix by add #if(WINVER >= 0x0500), but I think it's not best solution now, especially for traceapi( it can not hook GetThreadLocale ).

consider detour src build configuration is D_WIN32_WINNT=0x501 now, so update the samples's build macro to high value, 0x0501(same as source code define macro)

Microsoft Reviewers: Open in CodeFlow

fishjam avatar Jul 23 '22 02:07 fishjam

If you look at the Detours FAQ we explicitly try to maintain compatibility with Windows NT.

If we took this change, we would be breaking that by assuming the minimum Windows API we support is Windows XP? https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170

bgianfo avatar Jul 25 '22 18:07 bgianfo

The source code builds with Windows XP as target, and does use APIs introduced in Windows XP, so the idea of Windows NT compat is probably gone already. This just fixes up the samples to also target Windows XP.

sylveon avatar Jul 25 '22 18:07 sylveon

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days.

ghost avatar Aug 01 '22 23:08 ghost

The source code builds with Windows XP as target, and does use APIs introduced in Windows XP, so the idea of Windows NT compat is probably gone already. This just fixes up the samples to also target Windows XP.

That's true, I had misremembered the _WIN32_WINNT version src\Makefile specifies. Thanks for keeping me honest!

bgianfo avatar Aug 15 '22 23:08 bgianfo