2010-02-20 34 views
1

我正面臨着相當大的困境。我已經將DLL注入到其他進程中,並且從中抽取了幾個WinAPI調用,ExtTextOutW @ GDI32,DrawTextExW @ GDI32和AlphaBlend @ Msimg32是特定的。現在,問題在於,當其他應用程序用這兩個GDI32函數寫入內容時,我不知道它出現的確切位置。這是因爲包含文本的DC使用AlphaBlend進行處理,AlphaBlend最終也將其放到窗口的DC中。從注入過程跟蹤HDC

那麼,我該如何跟蹤某些HDC?在僞代碼,這裏的其他應用程序如何繪製 文本到屏幕上:


HDC h = DrawTextW("STRING") 

Do something with h. The "STRING" gets new HDC, say h2. 

Pass h2 to AlphaBlend, which draws it to the screen. 

就像我說的,我失去所有與原^ h的軌道作爲字符串的AlphaBlend之前獲得新的DC。 任何想法,我怎麼可以從h> h2與其中的某個字符串建立連接?

我不知道我是否能夠正確地解釋這個問題,請問如果你有任何問題......

+0

如果你能夠鉤住這些調用,是什麼阻止你從鉤子傳遞不同的'HDC'到實際的Win32 API? – dirkgently 2010-02-20 12:08:52

回答

0
static BOOL (WINAPI *AlphaBlend_t)(
    HDC   hdcDest, 
    int   nXOriginDest, 
    int   nYOriginDest, 
    int   nWidthDest, 
    int   nHeightDest, 
    HDC   hdcSrc, 
    int   nXOriginSrc, 
    int   nYOriginSrc, 
    int   nWidthSrc, 
    int   nHeightSrc, 
    BLENDFUNCTION blendFunction 
) = AlphaBlend; 

BOOL MyAlphaBlend(
    HDC   hdcDest, 
    int   nXOriginDest, 
    int   nYOriginDest, 
    int   nWidthDest, 
    int   nHeightDest, 
    HDC   hdcSrc, 
    int   nXOriginSrc, 
    int   nYOriginSrc, 
    int   nWidthSrc, 
    int   nHeightSrc, 
    BLENDFUNCTION blendFunction 
) 
{ 
    // modify hdcDest to hdcDest2 
    return AlphaBlend_t(hdcDest2, ...); 
} 

這應該做的伎倆。輸入任何代碼修改後一個函數中的HDC