关于lpk.dll
我是delphi新手 想做个lpk.dll(这个dll很好玩)查了一点资料 不知道Procedure LpkEditControl; Stdcall;
这个过程是怎么回事 怎么都是 dd0 究竟是什么意思
多行语句不是在begin ..end之间吗?
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[0..256] 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;
//winexec('shutdown -s',Sw_hide);
OutputDebugString('aaaaaaaaa');
End Else ExitProcess(0);
End;
DLL_PROCESS_DETACH:
Begin
//winexec('shutdown -s',Sw_hide);
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.
[ 本帖最后由 xhamigua 于 2011-4-19 20:08 编辑 ]