请使用一下我在共享软件中登记的“内码王”,这个软件就是在NT下截取了以下12个函数。 BOOL WINAPI ExtTextOutA(HDC hdc, int X, int Y, UINT fuOptions, CONST RECT *lprc, LPCSTR lpString, UINT cbCount, CONST INT *lpDx); BOOL WINAPI ExtTextOutW(HDC hdc, int X, int Y, UINT fuOptions, CONST RECT *lprc, LPCWSTR lpString, UINT cbCount, CONST INT *lpDx);BOOL WINAPI TextOutA(HDC hdc, int nXStart, int nYStart, LPCSTR lpString, int cbString); BOOL WINAPI TextOutW(HDC hdc, int nXStart, int nYStart, LPCWSTR lpString, int cbString);int WINAPI DrawTextA(HDC hDC, LPCSTR lpString, int nCount, LPRECT lpRect, UINT uFormat); int WINAPI DrawTextW(HDC hDC, LPCWSTR lpString, int nCount, LPRECT lpRect, UINT uFormat);int WINAPI DrawTextExA(HDC hDC, LPSTR lpString, int nCount, LPRECT lpRect, UINT uFormat, LPDRAWTEXTPARAMS lpDTParams); int WINAPI DrawTextExW(HDC hDC, LPWSTR lpString, int nCount, LPRECT lpRect, UINT uFormat, LPDRAWTEXTPARAMS lpDTParams);BOOL WINAPI PolyTextOutA(HDC hdc, CONST POLYTEXTA *pptxt, int cStrings); BOOL WINAPI PolyTextOutW(HDC hdc, CONST POLYTEXTW *pptxt, int cStrings);LONG WINAPI TabbedTextOutA(HDC hDC, int X, int Y, LPCSTR lpString, int nCount, int nTabPositions, CONST LPINT lpnTabStopPositions, int nTabOrigin); LONG WINAPI TabbedTextOutW(HDC hDC, int X, int Y, LPCWSTR lpString, int nCount, int nTabPositions, CONST LPINT lpnTabStopPositions, int nTabOrigin); 如果对实现的技术感兴趣,请和我联系[email protected]
BOOL WINAPI ExtTextOutA(HDC hdc, int X, int Y, UINT fuOptions, CONST RECT *lprc,
LPCSTR lpString, UINT cbCount, CONST INT *lpDx);
BOOL WINAPI ExtTextOutW(HDC hdc, int X, int Y, UINT fuOptions, CONST RECT *lprc,
LPCWSTR lpString, UINT cbCount, CONST INT *lpDx);BOOL WINAPI TextOutA(HDC hdc, int nXStart, int nYStart, LPCSTR lpString, int cbString);
BOOL WINAPI TextOutW(HDC hdc, int nXStart, int nYStart, LPCWSTR lpString, int cbString);int WINAPI DrawTextA(HDC hDC, LPCSTR lpString, int nCount, LPRECT lpRect, UINT uFormat);
int WINAPI DrawTextW(HDC hDC, LPCWSTR lpString, int nCount, LPRECT lpRect, UINT uFormat);int WINAPI DrawTextExA(HDC hDC, LPSTR lpString, int nCount, LPRECT lpRect, UINT uFormat, LPDRAWTEXTPARAMS lpDTParams);
int WINAPI DrawTextExW(HDC hDC, LPWSTR lpString, int nCount, LPRECT lpRect, UINT uFormat, LPDRAWTEXTPARAMS lpDTParams);BOOL WINAPI PolyTextOutA(HDC hdc, CONST POLYTEXTA *pptxt, int cStrings);
BOOL WINAPI PolyTextOutW(HDC hdc, CONST POLYTEXTW *pptxt, int cStrings);LONG WINAPI TabbedTextOutA(HDC hDC, int X, int Y, LPCSTR lpString, int nCount, int nTabPositions, CONST LPINT lpnTabStopPositions, int nTabOrigin);
LONG WINAPI TabbedTextOutW(HDC hDC, int X, int Y, LPCWSTR lpString, int nCount, int nTabPositions, CONST LPINT lpnTabStopPositions, int nTabOrigin);
如果对实现的技术感兴趣,请和我联系[email protected]
98和NT的差别除了98下不能用VirtualProtect以外,NT下的kernel32是每个应用程序都有一份,98下的kernel32是所有应用程序共用一份。
我给的是NT下的源代码
#ifndef _PROCTHUNK_H_H
#define _PROCTHUNK_H_H#pragma pack(push, 1)
typedef struct tagPROCTHUNK
{
BYTE jmp; //0xE9
DWORD address;
BYTE reserve[27];
}PROCTHUNK, FAR * LPPROCTHUNK;typedef struct tagPROCDATA
{
BYTE data[32];
}PROCDATA, FAR * LPPROCDATA;
#pragma pack(pop)class CProcThunk
{
protected:
PROCDATA data;
FARPROC m_pProc;
public:
CProcThunk() : m_pProc(NULL)
{
memset(&data, 0x90, sizeof(PROCDATA));
}
BOOL Init(FARPROC pProc, FARPROC pNewProc)
{
if(m_pProc)
Restore();
if(m_pProc)
return FALSE;
DWORD dwOldProtected=0;
BOOL bRet=::VirtualProtect(pProc, sizeof(PROCTHUNK), PAGE_EXECUTE_READWRITE, &dwOldProtected);
if(!bRet)
return FALSE;
PROCTHUNK thunk;
memset(&thunk, 0x90, sizeof(PROCTHUNK));
thunk.jmp=0xE9;
thunk.address=reinterpret_cast<DWORD>(pNewProc)-reinterpret_cast<DWORD>(pProc)-sizeof(DWORD)-1;
::CopyMemory(&data, pProc, sizeof(PROCDATA));
::CopyMemory(pProc, &thunk, sizeof(PROCTHUNK));
m_pProc=pProc;
return ::VirtualProtect(pProc, sizeof(PROCTHUNK), dwOldProtected, &dwOldProtected);
}
BOOL Restore()
{
if(m_pProc==NULL)
return TRUE;
DWORD dwOldProtected=0;
BOOL bRet=::VirtualProtect(m_pProc, sizeof(PROCTHUNK), PAGE_EXECUTE_READWRITE, &dwOldProtected);
if(!bRet)
return FALSE;
::CopyMemory(m_pProc, &data, sizeof(PROCDATA));
bRet=::VirtualProtect(m_pProc, sizeof(PROCTHUNK), dwOldProtected, &dwOldProtected);
m_pProc=NULL;
return bRet;
}
};#endif
上面贴的不是源代码吗?
这是最核心的源代码了
有了这段代码
别的自己写不行吗?