Skip to content

Commit

Permalink
- Moved constants to Shared.Inc file
Browse files Browse the repository at this point in the history
- Added InjectApi Hook
- some cleanup
  • Loading branch information
fschetterer committed Oct 15, 2019
1 parent c72d6ae commit d7ffe89
Show file tree
Hide file tree
Showing 16 changed files with 1,860 additions and 86 deletions.
14 changes: 14 additions & 0 deletions Append Bitness.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
::::::::::::: Place in All Config all Platform PostBuild :::::::::::::
:: Set PLATFORM=$(Platform)
:: Set OUTPUTPATH=$(OUTPUTPATH)
:: Set OUTPUTNAME=$(OUTPUTNAME)
:: Set OUTPUTEXT=$(OUTPUTEXT)
:: Set OUTPUTDIR=$(OUTPUTDIR) + any redirect like: $(OUTPUTDIR)\..\..
:: "Append Bitness.cmd"
:::::::::::::::::::::::::::: END ::::::::::::::::::::::::::::

:: Strip Bitness from Platform (Win32/Win64)
SET BITNESS=%PLATFORM:~3,2%
:: Copy so the original stays intact for Debugging
COPY /Y "%OUTPUTPATH%" "%OUTPUTDIR%\%OUTPUTNAME%%BITNESS%%OUTPUTEXT%"

3 changes: 1 addition & 2 deletions Demos/GetMsgHook/GetMsgHooks.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
library GetMsgHooks;

uses
WinApi.Windows,
WinApi.Messages,
WinApi.Windows, WinApi.Messages,
HooksMadeEasy.GetMsg;

function Hookup(AHandle: THandle; AThreadId: Cardinal): Boolean;
Expand Down
26 changes: 26 additions & 0 deletions Demos/GetMsgHook/Unit1.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
{**********************************************************************************************
MIT License
Copyright (c) 2019 Fred Schetterer ([email protected])
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
**********************************************************************************************}

unit Unit1;

interface
Expand All @@ -8,6 +32,8 @@ interface
Vcl.Forms, Vcl.ActnList, Vcl.StdCtrls, Vcl.Controls,
HooksMadeEasy.Common;

{$I HooksMadeEasy.GetMsg.Shared.inc}

/// <summary>
/// Uncomment to use a DLL but its not required for Current Thread Hooks
/// </summary>
Expand Down
44 changes: 44 additions & 0 deletions Demos/InjectAPI/Hook.dpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{**********************************************************************************************
MIT License
Copyright (c) 2019 Fred Schetterer ([email protected])
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
**********************************************************************************************}

Library Hook;

uses
Winapi.Windows,
HooksMadeEasy.InjectApi;

/// <summary>
/// Eporting this will call the record's class constructor
/// for each instance loaded into a process
/// </summary>
function HookActive: Boolean;
begin
Result := TInjectApi.Active;
end;

Exports
HookActive;

begin
end.
17 changes: 17 additions & 0 deletions Demos/InjectAPI/HookLoadTest.dpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/// <summary>
/// Uses RemoteThread to load unload a Hook Dll from a single process.
/// </summary>
program HookLoadTest;

uses
Vcl.Forms,
uHookLoadTest in 'uHookLoadTest.pas' {Form1};

{$R *.res}

begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Loading

0 comments on commit d7ffe89

Please sign in to comment.