Skip to content

Commit

Permalink
Revert "Bug #57, 初始化性能优化,减少无意义的GetProcAddress" (GetProcAddress内部存在锁,为…
Browse files Browse the repository at this point in the history
…了避免死锁回滚更改)

This reverts commit e583b94.
  • Loading branch information
mingkuang-Chuyu committed May 25, 2024
1 parent 15472b7 commit 35a609c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/Thunks/YY_Thunks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ RtlCutoverTimeToSystemTime(
static decltype(_FUNCTION)* __cdecl _CRT_CONCATENATE(try_get_, _FUNCTION)() noexcept \
{ \
__CHECK_UNIT_TEST_BOOL(_FUNCTION); \
__declspec(allocate(".YYThr$AAA")) static void* _CRT_CONCATENATE(pInit_ ,_FUNCTION) = \
reinterpret_cast<void*>(&_CRT_CONCATENATE(try_get_, _FUNCTION)); \
/*为了避免编译器将 YYThr$AAA 节优化掉*/ \
__foreinclude(_CRT_CONCATENATE(pInit_ ,_FUNCTION)); \
__declspec(allocate(".YYThu$AAB")) static void* _CRT_CONCATENATE(pFun_, _FUNCTION); \
return reinterpret_cast<decltype(_FUNCTION)*>(try_get_function( \
&_CRT_CONCATENATE(pFun_ ,_FUNCTION), \
Expand Down
8 changes: 4 additions & 4 deletions src/Thunks/YY_Thunks.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,6 @@ static HMODULE __fastcall try_get_module(volatile HMODULE* pModule, const wchar_
#define _APPLY(_MODULE, _NAME, _FLAGS) \
static volatile HMODULE __fastcall _CRT_CONCATENATE(try_get_module_, _MODULE)() noexcept \
{ \
__declspec(allocate(".YYThr$AAA")) static void* _CRT_CONCATENATE(pInit_ ,_MODULE) = \
reinterpret_cast<void*>(&_CRT_CONCATENATE(try_get_module_, _MODULE)); \
/*为了避免编译器将 YYThr$AAA 节优化掉*/ \
__foreinclude(_CRT_CONCATENATE(pInit_ ,_MODULE)); \
__declspec(allocate(".YYThu$AAA")) static volatile HMODULE hModule; \
return try_get_module<_FLAGS>(&hModule, _CRT_CONCATENATE(module_name_, _MODULE)); \
}
Expand Down Expand Up @@ -396,6 +392,10 @@ static void* __fastcall try_get_function(
static _CRT_CONCATENATE(_FUNCTION, _pft) __cdecl _CRT_CONCATENATE(try_get_, _FUNCTION)() noexcept \
{ \
__CHECK_UNIT_TEST_BOOL(_FUNCTION); \
__declspec(allocate(".YYThr$AAA")) static void* _CRT_CONCATENATE(pInit_ ,_FUNCTION) = \
reinterpret_cast<void*>(&_CRT_CONCATENATE(try_get_, _FUNCTION)); \
/*为了避免编译器将 YYThr$AAA 节优化掉*/ \
__foreinclude(_CRT_CONCATENATE(pInit_ ,_FUNCTION)); \
__declspec(allocate(".YYThu$AAB")) static void* _CRT_CONCATENATE( pFun_ ,_FUNCTION); \
return reinterpret_cast<_CRT_CONCATENATE(_FUNCTION, _pft)>(try_get_function( \
&_CRT_CONCATENATE(pFun_ ,_FUNCTION), \
Expand Down

0 comments on commit 35a609c

Please sign in to comment.