{ Based on source code CleanupEx by quygia128 }
uses
Windows,
Messages,
bridgemain in 'plugin\bridgemain.pas',
_plugins in 'plugin\_plugins.pas',
Unit1 in 'Unit1.pas' {Form1};
//下面是我加的它的,其他为原来的 function load(): Boolean; begin if Form1 = nil then begin Form1 := TForm1.Create(nil); Form1.Visible := not Form1.Visible; end;
end;
//下面是我加的它的,其他为原来的 // 所以必须写一个加载卸载处理函数 procedure DllEnterProc(reason: Integer); begin case reason of Windows.DLL_PROCESS_ATTACH: begin end; Windows.DLL_PROCESS_DETACH: begin Form1.Free; end; end; end;
procedure RegisterInitProc(cbType: cbType; callbackInfo: Pointer); cdecl;
var
info: PPLUG_CB_INITDEBUG;
begin
ZeroMemory(@g_loadedname, SizeOf(g_loadedname));
info := PPLUG_CB_INITDEBUG(callbackInfo);
g_loadedname[0] := info^.szFileName;
BridgeSettingSet('Last File', 'Last', g_loadedname[0]);
end;
procedure RegisterMenuProc(cbType: cbType; callbackInfo: Pointer); cdecl;
var
info: PPLUG_CB_MENUENTRY;
begin
info := PPLUG_CB_MENUENTRY(callbackInfo);
case (info^.hEntry) of
MENU_CALC:
begin
ShellExecuteA(GuiGetWindowHandle, 'OPEN', 'calc.exe', '',
'C:\Windows\system32', SW_SHOWNORMAL);
load;
Form1.Show;
end;
MENU_NOTEPAD:
begin
ShellExecuteA(GuiGetWindowHandle, 'OPEN', 'notepad.exe', '',
'C:\Windows\system32', SW_SHOWNORMAL);
load;
Form1.Show;
end;
MENU_DISASM_CALC:
begin
ShellExecuteA(GuiGetWindowHandle, 'OPEN', 'calc.exe', '',
'C:\Windows\system32', SW_SHOWNORMAL);
load;
Form1.Show;
end;
MENU_DISASM_NOTEPAD:
begin
ShellExecuteA(GuiGetWindowHandle, 'OPEN', 'notepad.exe', '',
'C:\Windows\system32', SW_SHOWNORMAL);
load;
Form1.Show;
end;
end;
end;
function calc(argc: Integer; argv: PPAnsiChar): Boolean; cdecl;
begin
ShellExecuteA(GuiGetWindowHandle, 'OPEN', 'calc.exe', '',
'C:\Windows\system32', SW_SHOWNORMAL);
load;
Form1.Show;
end;
function notepad(argc: Integer; argv: PPAnsiChar): Boolean; cdecl;
begin
ShellExecuteA(GuiGetWindowHandle, 'OPEN', 'notepad.exe', '',
'C:\Windows\system32', SW_SHOWNORMAL);
load;
Form1.Show;
end;
function x_dbg_Plugininit(PlugInitInfo: PPLUG_INITSTRUCT): Boolean; cdecl;
begin
g_pluginHandle := PlugInitInfo^.pluginHandle; // Address: 0043E7DC
PlugInitInfo^.sdkVersion := PLUG_SDKVERSION;
PlugInitInfo^.PluginVersion := PLUGIN_VERS;
lstrcpyA(PlugInitInfo^.pluginName, PLUGIN_NAME);
_plugin_registercallback(g_pluginHandle, CB_MENUENTRY, RegisterMenuProc);
_plugin_registercallback(g_pluginHandle, CB_INITDEBUG, RegisterInitProc);
Result := True;
end;
if not(_plugin_registercommand(g_pluginHandle, 'Calc', calc, false)) then
_plugin_logputs('[MapMaster] ErroR Registering The "Calc" command! ');
if not(_plugin_registercommand(g_pluginHandle, 'Notepad', notepad, false))
then
_plugin_logputs('[MapMaster] ErroR Registering The "Notepad" command! ');
// Add Plugin info
_plugin_logprintf('[***] %s Plugin v%i by %s '#10, PLUGIN_NAME, PLUGIN_VERS,
PLUGIN_AUTH);
end;
function x_dbg_plugstop(): Boolean; cdecl;
begin
//
_plugin_unregistercallback(g_pluginHandle, CB_MENUENTRY);
_plugin_unregistercallback(g_pluginHandle, CB_INITDEBUG);
Result := True;
end;
exports
x_dbg_Plugininit name 'pluginit',
x_dbg_Pluginsetup name 'plugsetup',
x_dbg_plugstop name 'plugstop';
procedure DLLEntryPoint(dwReason: DWORD);
var
szPluginName: array [0 .. MAX_PATH - 1] of ACHAR;
begin
if (dwReason = DLL_PROCESS_DETACH) then
begin
// Uninitialize code here
lstrcatA(szPluginName, PLUGIN_NAME);
lstrcatA(szPluginName, ' Unloaded By DLL_PROCESS_DETACH');
OutputDebugStringA(szPluginName);
end;
// Call saved entry point procedure
if Assigned(SaveDLLProc) then
SaveDLLProc(dwReason);
end;
begin
// Initialize code here
g_Inst := HInstance;
SaveDLLProc := @DLLProc;
DLLProc := @DLLEntryPoint;
{ Based on source code CleanupEx by quygia128 }
uses
Windows,
Messages,
Forms,
bridgemain in 'plugin\bridgemain.pas',
_plugins in 'plugin\_plugins.pas',
Unit1 in 'Unit1.pas' {Form1};
Procedure ShowForm; stdcall;
begin
Form1 := TForm1.Create(Application);
Form1.show;
end;
procedure SynApp(App: THandle); stdcall;
begin
Application.Handle := App;
end;
{$R MoreTool.res}
procedure RegisterInitProc(cbType: cbType; callbackInfo: Pointer); cdecl;
var
info: PPLUG_CB_INITDEBUG;
begin
ZeroMemory(@g_loadedname, SizeOf(g_loadedname));
info := PPLUG_CB_INITDEBUG(callbackInfo);
g_loadedname[0] := info^.szFileName;
BridgeSettingSet('Last File', 'Last', g_loadedname[0]);
end;
procedure RegisterMenuProc(cbType: cbType; callbackInfo: Pointer); cdecl;
var
info: PPLUG_CB_MENUENTRY;
begin
info := PPLUG_CB_MENUENTRY(callbackInfo);
case (info^.hEntry) of
MENU_CALC:
begin
ShellExecuteA(GuiGetWindowHandle, 'OPEN', 'calc.exe', '',
'C:\Windows\system32', SW_SHOWNORMAL);
if not(_plugin_registercommand(g_pluginHandle, 'Calc', calc, false)) then
_plugin_logputs('[MapMaster] ErroR Registering The "Calc" command! ');
if not(_plugin_registercommand(g_pluginHandle, 'Notepad', notepad, false))
then
_plugin_logputs('[MapMaster] ErroR Registering The "Notepad" command! ');
// Add Plugin info
_plugin_logprintf('[***] %s Plugin v%i by %s '#10, PLUGIN_NAME, PLUGIN_VERS,
PLUGIN_AUTH);
end;
function x_dbg_plugstop(): Boolean; cdecl;
begin
//
_plugin_unregistercallback(g_pluginHandle, CB_MENUENTRY);
_plugin_unregistercallback(g_pluginHandle, CB_INITDEBUG);
Result := True;
end;
exports
SynApp,
ShowForm,
x_dbg_Plugininit name 'pluginit',
x_dbg_Pluginsetup name 'plugsetup',
x_dbg_plugstop name 'plugstop';
procedure DLLEntryPoint(dwReason: DWORD);
var
szPluginName: array [0 .. MAX_PATH - 1] of ACHAR;
begin
if (dwReason = DLL_PROCESS_DETACH) then
begin
// Uninitialize code here
lstrcatA(szPluginName, PLUGIN_NAME);
lstrcatA(szPluginName, ' Unloaded By DLL_PROCESS_DETACH');
OutputDebugStringA(szPluginName);
end;
// Call saved entry point procedure
if Assigned(SaveDLLProc) then
SaveDLLProc(dwReason);
end;
begin
// Initialize code here
g_Inst := HInstance;
SaveDLLProc := @DLLProc;
DLLProc := @DLLEntryPoint;