|
陷阱技术探秘----动态汉化Windows技术的分析(9) *(lpStr+wOffset)=0xEA; *lpLong=Func.lpFarProcReplace; GlobalUnlock(hMemData);
MessageBox(NULL,"改为自己的函数","提示",MB_OK);
//将保留的内容改回来 hMemData=AllocCStoDSAlias(hMemCode); lpStr=GlobalLock(hMemData); lpLong=(lpStr+wOffset+1 ); *(lpStr+wOffset)=Func.bOld; *lpLong=Func.lOld; GlobalUnlock(hMemData);
MessageBox(NULL,"改回原Windows函数","提示",MB_OK); return 1; }
//自己的替代函数 BOOL WINAPI MyExtTextOut(HDC hDC, int x, int y, UINT nInt1, const RECT FAR* lpRect, LPCSTR lpStr, UINT nInt2, int FAR* lpInt) { BYTE NameDot[96]={ 0x09, 0x00, 0xfd, 0x08, 0x09, 0x08, 0x09, 0x10, 0x09, 0x20, 0x79, 0x40, 0x41, 0x04, 0x47, 0xfe, 0x41, 0x40, 0x79, 0x40, 0x09, 0x20, 0x09, 0x20, 0x09, 0x10, 0x09, 0x4e, 0x51, 0x84, 0x21, 0x00, 0x02, 0x00, 0x01, 0x04, 0xff, 0xfe, 0x00, 0x00, 0x1f, 0xf0, 0x10, 0x10, 0x10, 0x10, 0x1f, 0xf0, 0x00, 0x00, 0x7f, 0xfc, 0x40, 0x04, 0x4f, 0xe4, 0x48, 0x24, 0x48, 0x24, 0x4f, 0xe4, 0x40, 0x0c, 0x10, 0x80, 0x10, 0xfc, 0x10, 0x88, 0x11, 0x50, 0x56, 0x20, 0x54, 0xd8, 0x57, 0x06, 0x54, 0x20, 0x55, 0xfc, 0x54, 0x20, 0x55, 0xfc, 0x5c, 0x20, 0x67, 0xfe, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20 };
HBITMAP hBitmap,hOldBitmap; HDC hMemDC; BYTE far *lpDot; int i;
for ( i=0;i<3;i++ ) { lpDot=(LPSTR)NameDot+i*32; hMemDC=CreateCompatibleDC(hDC); hBitmap=CreateBitmap(16,16,1,1,lpDot); SetBitmapBits(hBitmap,32L,lpDot); hOldBitmap=SelectObject(hMemDC,hBitmap); BitBlt(hDC,x+i*16,y,16,16,hMemDC,0,0,SRCCOPY); DeleteDC(hMemDC); DeleteObject(hBitmap); }
return TRUE; }
//模块定义文件relocate.def NAMERELOCATE EXETYPE WINDOWS CODEPRELOAD MOVEABLE DISCARDABLE DATAPRELOAD MOVEABLE MULTIPLE HEAPSIZE1024 EXPORTS
五、结束语 本文从原理上分析了称为“陷阱”技术的汉化Windows方法。要彻底汉化Windows还要涉及显示,键盘输入等诸多内容,决非一日之功。但作为对“陷阱”技术的分析,本文介绍了将任一Windows函数调用改向到自己指定函数处的通用方法,这种方法可以拓展到其它应用中,如多语种显示,不同内码制式的切换显示等。
|