File tree Expand file tree Collapse file tree 3 files changed +23
-16
lines changed
Expand file tree Collapse file tree 3 files changed +23
-16
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,11 @@ public class InjectionEntryPoint : IEntryPoint
1111
1212 public InjectionEntryPoint ( RemoteHooking . IContext context ,
1313 string channelName )
14- {
15- _server = RemoteHooking . IpcConnectClient < ServerInterface > ( channelName ) ;
16- _server . Ping ( ) ;
17- }
14+ => _server = RemoteHooking . IpcConnectClient < ServerInterface > ( channelName ) ;
1815
1916 public void Run ( RemoteHooking . IContext context ,
2017 string channelName )
2118 {
22- _server . Ping ( ) ;
2319 var postMessageHook = LocalHook . Create (
2420 LocalHook . GetProcAddress ( "user32.dll" , "PostMessageW" ) ,
2521 new PostMessageDelegate ( PostMessageHook ) ,
Original file line number Diff line number Diff line change 11using System ;
2+ using System . Diagnostics ;
23using System . IO ;
34using System . Reflection ;
45using System . Runtime . Remoting ;
@@ -41,13 +42,23 @@ public static void SetHook()
4142 if ( _targetPid == 0 )
4243 return ;
4344
44- _channel = RemoteHooking . IpcCreateServer < ServerInterface > ( ref _channelName , WellKnownObjectMode . Singleton ) ;
45+ try
46+ {
47+ _channel = RemoteHooking . IpcCreateServer < ServerInterface > (
48+ ref _channelName ,
49+ WellKnownObjectMode . Singleton ) ;
4550
46- RemoteHooking . Inject (
47- _targetPid ,
48- InjectionLibrary ,
49- InjectionLibrary ,
50- _channelName ) ;
51+ RemoteHooking . Inject (
52+ _targetPid ,
53+ InjectionLibrary ,
54+ InjectionLibrary ,
55+ _channelName ) ;
56+ }
57+ catch ( Exception e )
58+ {
59+ ReleaseHook ( ) ;
60+ Debug . WriteLine ( e . Message ) ;
61+ }
5162 }
5263 }
5364}
Original file line number Diff line number Diff line change @@ -371,15 +371,15 @@ private static IntPtr GetWindowIntPtr(in TaskbarInfo taskbar)
371371 switch ( taskbar . Position )
372372 {
373373 case TaskbarPosition . Bottom :
374- return WindowFromPoint ( new TagPoint { x = taskbar . Rect . left , y = taskbar . Rect . top } ) ;
374+ return WindowFromPoint ( new TagPoint { x = taskbar . Rect . left + 4 , y = taskbar . Rect . top } ) ;
375375 case TaskbarPosition . Left :
376- return WindowFromPoint ( new TagPoint { x = taskbar . Rect . right , y = taskbar . Rect . top } ) ;
376+ return WindowFromPoint ( new TagPoint { x = taskbar . Rect . right , y = taskbar . Rect . top + 4 } ) ;
377377 case TaskbarPosition . Right :
378- return WindowFromPoint ( new TagPoint { x = taskbar . Rect . left , y = taskbar . Rect . top } ) ;
378+ return WindowFromPoint ( new TagPoint { x = taskbar . Rect . left , y = taskbar . Rect . top + 4 } ) ;
379379 case TaskbarPosition . Top :
380- return WindowFromPoint ( new TagPoint { x = taskbar . Rect . left , y = taskbar . Rect . bottom } ) ;
380+ return WindowFromPoint ( new TagPoint { x = taskbar . Rect . left + 4 , y = taskbar . Rect . bottom } ) ;
381381 default :
382- return WindowFromPoint ( new TagPoint { x = taskbar . Rect . left , y = taskbar . Rect . top } ) ;
382+ return WindowFromPoint ( new TagPoint { x = taskbar . Rect . left + 4 , y = taskbar . Rect . top } ) ;
383383 }
384384 }
385385
You can’t perform that action at this time.
0 commit comments