microsoft / Detours

Detours is a software package for monitoring and instrumenting API calls on Windows. It is distributed in source code form.
MIT License
5.01k stars 979 forks source link

fix build error for error C2065: 'GetThreadLocale' #247

Closed fishjam closed 1 year ago

fishjam commented 1 year ago

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
bgianfo commented 1 year ago

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

sylveon commented 1 year ago

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.

ghost commented 1 year ago

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.

bgianfo commented 1 year ago

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!