Skip to content

Instantly share code, notes, and snippets.

@DinisCruz
Created May 31, 2012 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DinisCruz/2840056 to your computer and use it in GitHub Desktop.
Save DinisCruz/2840056 to your computer and use it in GitHub Desktop.
O2 Script to Inject Snoop into process with WPF control
//return "Util - DiagramDesigner Editor.h2".local().startProcess();
var process = "O2 Xaml Editor (PoC).h2".local().startProcess();
this.sleep(2000);
var hwnd = process.MainWindowHandle;
if (hwnd == IntPtr.Zero)
return "Could not get MainWindow handle";
"Got main Window Handle: {0}".info(hwnd);
var snoopAssembly = @"Snoop\Snoop.exe".assembly();
var directoryName = snoopAssembly.Location.directoryName();
var suffix = snoopAssembly.type("Injector")
.invokeStatic("Suffix", hwnd);
var fileName = directoryName.pathCombine("ManagedInjectorLauncher" + suffix+ ".exe");
var windowHandle= hwnd;
var className = "Snoop.SnoopUI";
var methodName = "GoBabyGo";
var arguments = string.Concat(new object[]
{
windowHandle, " \"", snoopAssembly.Location,"\" \"", className, "\" \"", methodName,"\""
});
return fileName.startProcess(arguments);
//using Snoop;
//O2Ref:Snoop\Snoop.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment