.text:714F34F3
.text:714F34F3 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
.text:714F34F3
.text:714F34F3 ; Attributes: bp-based frame
.text:714F34F3
.text:714F34F3 ; int __stdcall NS_CorelSiteBuilder::APIHook_SetWindowTextA(struct HWND__ *, char const *)
.text:714F34F3 ?APIHook_SetWindowTextA@NS_CorelSiteBuilder@@YGHPAUHWND__@@PBD@Z proc near
.text:714F34F3                                         ; DATA XREF: NS_CorelSiteBuilder::InitializeHooksMulti(ulong,char *,ulong *)+7Fo
.text:714F34F3
.text:714F34F3 WindowNameCString= dword ptr -18h
.text:714F34F3 PreviousEsp     = dword ptr -10h
.text:714F34F3 OldEsp          = dword ptr -0Ch
.text:714F34F3 SehLevel        = dword ptr -4
.text:714F34F3 hWnd            = dword ptr  8
.text:714F34F3 lpWindowText    = dword ptr  0Ch
.text:714F34F3
.text:714F34F3                 mov     eax, offset unknown_libname_18 ; MFC 3.1/4.0/4.2/8.0 32bit
.text:714F34F8                 call    __EH_prolog
.text:714F34FD                 sub     esp, 0Ch
.text:714F3500                 push    ebx
.text:714F3501                 push    esi
.text:714F3502                 push    edi
.text:714F3503                 mov     [ebp+PreviousEsp], esp
.text:714F3506                 mov     esi, offset ?g_csGlobals@NS_CorelSiteBuilder@@3U_RTL_CRITICAL_SECTION@@A ; _RTL_CRITICAL_SECTION NS_CorelSiteBuilder::g_csGlobals
.text:714F350B                 push    esi             ; lpCriticalSection
.text:714F350C                 call    ds:__imp__EnterCriticalSection@4 ; Acquire the lock for this shim
.text:714F3512                 xor     ebx, ebx
.text:714F3514                 cmp     [ebp+lpWindowText], ebx
.text:714F3517                 jz      short ReleaseLockAndCallOriginalAPI ; Call original API if there's no window text
.text:714F3519                 push    [ebp+lpWindowText] ; lpMultiByteStr
.text:714F351C                 lea     ecx, [ebp+WindowNameCString]
.text:714F351F                 mov     [ebp+SehLevel], ebx
.text:714F3522                 call    ??0CString@ShimLib@@QAE@PBD@Z ; Convert the ANSI string to an MFC CString
.text:714F3527                 mov     edi, [ebp+hWnd]
.text:714F352A                 cmp     ?g_hLast@NS_CorelSiteBuilder@@3PAUHWND__@@A, edi ; Compare the window handle with the saved one
.text:714F3530                 mov     byte ptr [ebp+SehLevel], 1
.text:714F3534                 jnz     short SavePreviousWindowText ; Jump out if they don't match
.text:714F3536                 push    [ebp+WindowNameCString] ; wchar_t *
.text:714F3539                 mov     ecx, ?g_csLastWindowText@NS_CorelSiteBuilder@@3PAVCString@ShimLib@@A ; ShimLib::CString * NS_CorelSiteBuilder::g_csLastWindowText
.text:714F353F                 call    ?Compare@CString@ShimLib@@QBEHPBG@Z ; Compare the window text with the old one
.text:714F3544                 test    eax, eax
.text:714F3546                 jnz     short SavePreviousWindowText ; Jump out if they don't match
.text:714F3548                 push    esi             ; lpCriticalSection
.text:714F3549                 call    ds:__imp__LeaveCriticalSection@4 ; Release the lock
.text:714F354F                 lea     ecx, [ebp+WindowNameCString]
.text:714F3552                 mov     byte ptr [ebp+SehLevel], bl
.text:714F3555                 call    ??1CString@ShimLib@@QAE@XZ ; Free the CString
.text:714F355A                 xor     eax, eax
.text:714F355C                 inc     eax             ; Set success
.text:714F355D                 jmp     short CleanupSeh ; Return to caller
.text:714F355F ; ---------------------------------------------------------------------------
.text:714F355F
.text:714F355F SavePreviousWindowText:                 ; CODE XREF: NS_CorelSiteBuilder::APIHook_SetWindowTextA(HWND__ *,char const *)+41j
.text:714F355F                                         ; NS_CorelSiteBuilder::APIHook_SetWindowTextA(HWND__ *,char const *)+53j
.text:714F355F                 mov     ecx, ?g_csLastWindowText@NS_CorelSiteBuilder@@3PAVCString@ShimLib@@A ; ShimLib::CString * NS_CorelSiteBuilder::g_csLastWindowText
.text:714F3565                 lea     eax, [ebp+WindowNameCString]
.text:714F3568                 push    eax
.text:714F3569                 mov     ?g_hLast@NS_CorelSiteBuilder@@3PAUHWND__@@A, edi ; HWND__ * NS_CorelSiteBuilder::g_hLast
.text:714F356F                 call    ??4CString@ShimLib@@QAEABV01@ABV01@@Z ; g_csLastWindowText = WindowNameCString
.text:714F3574                 lea     ecx, [ebp+WindowNameCString]
.text:714F3577                 mov     byte ptr [ebp+SehLevel], bl
.text:714F357A                 call    ??1CString@ShimLib@@QAE@XZ ; Free the CString we created
.text:714F357F                 jmp     short ReleaseLockAndCallOriginalAPI
.text:714F3581 ; ---------------------------------------------------------------------------
.text:714F3581
.text:714F3581 SehHandler:                             ; DATA XREF: .text:71513108o
.text:714F3581                 mov     eax, offset SetLockPointer
.text:714F3586                 retn
.text:714F3587 ; ---------------------------------------------------------------------------
.text:714F3587
.text:714F3587 SetLockPointer:                         ; DATA XREF: NS_CorelSiteBuilder::APIHook_SetWindowTextA(HWND__ *,char const *):SehHandlero
.text:714F3587                 mov     esi, offset ?g_csGlobals@NS_CorelSiteBuilder@@3U_RTL_CRITICAL_SECTION@@A ; _RTL_CRITICAL_SECTION NS_CorelSiteBuilder::g_csGlobals
.text:714F358C
.text:714F358C ReleaseLockAndCallOriginalAPI:          ; CODE XREF: NS_CorelSiteBuilder::APIHook_SetWindowTextA(HWND__ *,char const *)+24j
.text:714F358C                                         ; NS_CorelSiteBuilder::APIHook_SetWindowTextA(HWND__ *,char const *)+8Cj
.text:714F358C                 or      [ebp+SehLevel], 0FFFFFFFFh
.text:714F3590                 push    esi             ; lpCriticalSection
.text:714F3591                 call    ds:__imp__LeaveCriticalSection@4 ; Release the lock
.text:714F3597                 push    [ebp+lpWindowText]
.text:714F359A                 mov     eax, ?g_pAPIHooks@NS_CorelSiteBuilder@@3PAUtagHOOKAPI@@A ; tagHOOKAPI * NS_CorelSiteBuilder::g_pAPIHooks
.text:714F359F                 push    [ebp+hWnd]
.text:714F35A2                 call    dword ptr [eax+0Ch] ; Call the original API
.text:714F35A5
.text:714F35A5 CleanupSeh:                             ; CODE XREF: NS_CorelSiteBuilder::APIHook_SetWindowTextA(HWND__ *,char const *)+6Aj
.text:714F35A5                 mov     ecx, [ebp+OldEsp]
.text:714F35A8                 pop     edi
.text:714F35A9                 pop     esi
.text:714F35AA                 mov     large fs:0, ecx
.text:714F35B1                 pop     ebx
.text:714F35B2                 leave
.text:714F35B3                 retn    8
.text:714F35B3 ?APIHook_SetWindowTextA@NS_CorelSiteBuilder@@YGHPAUHWND__@@PBD@Z endp ; sp =  4
.text:714F35B3
.text:714F35B3 ; ---------------------------------------------------------------------------