Sample code for copying Html to Clipboard

// Sample class for Copying and Pasting HTML fragments to and from the clipboard. // // Mike Stall. http://blogs.msdn.com/jmstall // using System; using System.Diagnostics; using System.Windows.Forms; using System.Text.RegularExpressions; using System.Collections.Generic; using System.Text; using System.IO; /// <summary> /// Helper class to decode HTML from the clipboard. /// See http://blogs.msdn.com/jmstall/archive/2007/01/21/html-clipboard.aspx for details. /// </summary> class HtmlFragment {…

1

Sample code for CreateRemoteThread in C#.

// Sample for CreateRemoteThread in C# using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Diagnostics; namespace CreateThread { class Program { #region standard imports from kernel32 // Thread proc, to be used with Create*Thread public delegate int ThreadProc(IntPtr param); // Friendly version, marshals thread-proc as friendly delegate [DllImport(“kernel32”)] public static extern IntPtr CreateThread( IntPtr…

1

Sample code for snapshot tool

//—————————————————————————– // Harness to snapshot a process’s callstacks and some variables. // Built on MDbg. // Needs a reference to MdbgCore.dll (ships in CLR 2.0 SDK). // // Author: Mike Stall (http://blogs.msdn.com/jmstall) // More info: http://blogs.msdn.com/jmstall/archive/2005/11/28/snapshot.aspx //—————————————————————————– using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using Microsoft.Samples.Debugging.MdbgEngine; using System.IO; using System.Xml; using Microsoft.Samples.Debugging.CorDebug.NativeApi; using System.Text.RegularExpressions;…

2

Sample Python script for Mdbg-Python extension

#—————————————————-# Python Script for MDbg commands#—————————————————- #—————————————————-# Support for accessing the root Shell object.# We can get at everything else from this. #—————————————————-#Shell = None # Helper to give this module access to the “Shell” Object# Since globals are public, you can set this directly too.def SetShell(x):     #global g_Shell    #Shell = x    pass def…

2

Sample code for MDbg-IronPython extension

//—————————————————————————– // Simple extension to hookup Iron Python to Mdbg // // Mike Stall: http://blogs.msdn.com/jmstall // IronPython from here: http://workspaces.gotdotnet.com/ironpython // Mdbg here: http://blogs.msdn.com/jmstall/archive/2005/11/08/mdbg_linkfest.aspx // // This targets the IronPython Beta 1 release (which has breaking changes from .0.9.3) // // To use this extension, you must build it as a dll, and then load…

6

Sample code for PDB 2 XML tool

// NOTE this version is now out of date.// UPDATED VERSION IS AVAILABLE in the MDBG DISTRIBUTION.// See http://blogs.msdn.com/jmstall/archive/2005/11/08/mdbg_linkfest.aspx  // Sample to load PDB and dump as XML. // Author: Mike Stall (http://blogs.msdn.com/jmstall) // UPDATED on 1/26/05, uses PDB wrappers from MDBG sample. // must include reference to Mdbg (such as MdbgCore.dll) using System; using…

3