Hmily 发表于 2009-5-5 10:06

lpk.dll of delphi

Library lpk;
uses
Windows;
Var
ModHandle: Cardinal = 0;
POldLpkDllInitialize,
    POldLpkDrawTextEx,
    POldLpkExtTextOut,
    POldLpkGetCharacterPlacement,
    POldLpkGetTextExtentExPoint,
    POldLpkPSMTextOut,
    POldLpkUseGDIWidthCache,
    POldftsWordBreak,
    POldLpkInitialize,
    POldLpkTabbedTextOut,
    POldLpkEditControl: Pointer;
Procedure LpkDllInitialize; Stdcall;
Asm jmp POldLpkDllInitialize
End;
Procedure LpkDrawTextEx; Stdcall;
Asm jmp POldLpkDrawTextEx
End;
Procedure LpkExtTextOut; Stdcall;
Asm jmp POldLpkExtTextOut
End;
Procedure LpkGetCharacterPlacement; Stdcall;
Asm jmp POldLpkGetCharacterPlacement
End;
Procedure LpkGetTextExtentExPoint; Stdcall;
Asm jmp POldLpkGetTextExtentExPoint
End;
Procedure LpkPSMTextOut; Stdcall;
Asm jmp POldLpkPSMTextOut
End;
Procedure LpkUseGDIWidthCache; Stdcall;
Asm jmp POldLpkUseGDIWidthCache
End;
Procedure ftsWordBreak; Stdcall;
Asm jmp POldftsWordBreak
End;
Procedure LpkInitialize; Stdcall;
Asm jmp POldLpkInitialize
End;
Procedure LpkTabbedTextOut; Stdcall;
Asm jmp POldLpkTabbedTextOut
End;
Procedure LpkEditControl; Stdcall;
Asm
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
End;
Procedure ModMemData();
Var
dwOldProtect: DWORD;
Begin
VirtualProtect(@LpkEditControl, $40, PAGE_READWRITE, @dwOldProtect);
End;
Procedure lpk_DllHandler(Reason: Integer);
Var
SysDir: Array Of Char;
LibPath: String;
Begin
Case Reason Of
    DLL_PROCESS_ATTACH:
      Begin
      GetSystemDirectory(SysDir, 256);
      LibPath := SysDir + '\LPK.DLL';
      ModHandle := LoadLibrary(PChar(LibPath));
      If ModHandle > 0 Then
      Begin
          ModMemData;
          POldLpkDllInitialize := GetProcAddress(ModHandle, 'LpkDllInitialize');
          POldLpkDrawTextEx := GetProcAddress(ModHandle, 'LpkDrawTextEx');
          POldLpkExtTextOut := GetProcAddress(ModHandle, 'LpkExtTextOut');
          POldLpkGetCharacterPlacement := GetProcAddress(ModHandle,
'LpkGetCharacterPlacement');
          POldLpkGetTextExtentExPoint := GetProcAddress(ModHandle, 'LpkGetTextExtentExPoint');
          POldLpkPSMTextOut := GetProcAddress(ModHandle, 'LpkPSMTextOut');
          POldLpkUseGDIWidthCache := GetProcAddress(ModHandle, 'LpkUseGDIWidthCache');
          POldftsWordBreak := GetProcAddress(ModHandle, 'ftsWordBreak');
          POldLpkInitialize := GetProcAddress(ModHandle, 'LpkInitialize');
          POldLpkTabbedTextOut := GetProcAddress(ModHandle, 'LpkTabbedTextOut');
          POldLpkEditControl := GetProcAddress(ModHandle, 'LpkEditControl');
          Asm
            pushad
            mov esi, eax
            lea edi, LpkEditControl
            mov ecx, 40h
            rep movsb
            popad
          End;
          //此处添加你的代码........
         OutputDebugString('aaaaaaaaa');
      End Else ExitProcess(0);
      End;
    DLL_PROCESS_DETACH:
      Begin
      //此处添加你的代码........
      If ModHandle <> 0 Then FreeLibrary(ModHandle);
      End;
    DLL_THREAD_ATTACH: ;
    DLL_THREAD_DETACH: ;
End;
End;
Exports
LpkDllInitialize,
LpkDrawTextEx,
LpkEditControl,
LpkExtTextOut,
LpkGetCharacterPlacement,
LpkGetTextExtentExPoint,
LpkPSMTextOut,
LpkUseGDIWidthCache,
ftsWordBreak,
LpkInitialize,
LpkTabbedTextOut;
Begin
DLLProc := @lpk_DllHandler;
DLLProc(DLL_PROCESS_ATTACH);
End.

lkicesky 发表于 2009-11-24 20:46

这个……确实是好东西

xie83544109 发表于 2009-12-10 11:15

轻轻的问一声这是什么东东

twfy914 发表于 2009-12-10 13:25

怎么用

Squn 发表于 2009-12-16 18:27

以前有汇编源码,但 不知道存哪里去了。
哈哈 delphi的更好~

574852485 发表于 2009-12-18 10:35

lpk 多开用的?

silly 发表于 2009-12-18 13:16

LZ这个代码加的,DELPHI+ASM.
主要还是ASM,没彻底翻译过来.看起来就是替换LPK,

dalao 发表于 2010-2-8 19:23

好东西顶一个!

zhan1616 发表于 2010-2-22 14:31

Delphi版不知道怎么样~!


那如果要修改401000处的EEEE改为FFFF,该怎么写呢???

zhan1616 发表于 2010-2-22 17:25

回复 1# Hmily


    这个为什么我一加进一点代码,就加载错误呢?

例如:
   地址:00401000
原数据:AAAA
新数据:BBBB

   能否给个例子???

谢谢
页: [1] 2
查看完整版本: lpk.dll of delphi