Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I wrote a dumper for a project i worked on in the past:</p> <pre><code>void CrashHandler::WriteThreadInfo(StringWriter* sw, ArrayList* threads, String* type) { sw-&gt;WriteLine(type); IEnumerator* ie = threads-&gt;GetEnumerator(); while(ie-&gt;MoveNext()) { botNETThread* bnt = static_cast&lt;botNETThread*&gt;(ie-&gt;Current); if(!bnt-&gt;IsAlive) continue; sw-&gt;WriteLine(String::Concat(S"ORIGIN ASSEMBLY: ", bnt-&gt;Assembly-&gt;FullName)); sw-&gt;WriteLine(String::Concat(S"THREAD NAME: ", (bnt-&gt;Name &amp;&amp; bnt-&gt;Name-&gt;Length)?bnt-&gt;Name:S"Unnamed thread")); sw-&gt;Write(GetStackTrace(bnt-&gt;_thread)); sw-&gt;WriteLine(); sw-&gt;WriteLine(); } } String* CrashHandler::GetStackTrace(Thread* t) { System::Diagnostics::StackTrace __gc * trace1 = __gc new System::Diagnostics::StackTrace(t, true); System::String __gc * text1 = System::Environment::NewLine; System::Text::StringBuilder __gc * builder1 = __gc new System::Text::StringBuilder(255); for (System::Int32 num1 = 0; (num1 &lt; trace1-&gt;FrameCount); num1++) { System::Diagnostics::StackFrame __gc * frame1 = trace1-&gt;GetFrame(num1); builder1-&gt;Append(S" at "); System::Reflection::MethodBase __gc * base1 = frame1-&gt;GetMethod(); System::Type __gc * type1 = base1-&gt;DeclaringType; if (type1 != 0) { System::String __gc * text2 = type1-&gt;Namespace; if (text2 != 0) { builder1-&gt;Append(text2); if (builder1 != 0) { builder1-&gt;Append(S"."); } } builder1-&gt;Append(type1-&gt;Name); builder1-&gt;Append(S"."); } builder1-&gt;Append(base1-&gt;Name); builder1-&gt;Append(S"("); System::Reflection::ParameterInfo __gc * infoArray1 __gc [] = base1-&gt;GetParameters(); for (System::Int32 num2 = 0; (num2 &lt; infoArray1-&gt;Length); num2++) { System::String __gc * text3 = S"&lt;UnknownType&gt;"; if (infoArray1[num2]-&gt;ParameterType != 0) { text3 = infoArray1[num2]-&gt;ParameterType-&gt;Name; } builder1-&gt;Append(System::String::Concat(((num2 != 0) ? S", " : S""), text3, S" ", infoArray1[num2]-&gt;Name)); } builder1-&gt;Append(S")"); if (frame1-&gt;GetILOffset() != -1) { System::String __gc * text4 = 0; try { text4 = frame1-&gt;GetFileName(); } catch (System::Security::SecurityException*) { } if (text4 != 0) { builder1-&gt;Append(System::String::Concat(S" in ", text4, S":line ", frame1-&gt;GetFileLineNumber().ToString())); } } if (num1 != (trace1-&gt;FrameCount - 1)) { builder1-&gt;Append(text1); } } return builder1-&gt;ToString(); } </code></pre> <p>You can use Process.GetCurrentProcess().Threads to get threads</p> <p>And I know i spasted Managed C++ but its easy enough to follow. I take an arraylist of threads because for my purpose I had catagorized my threads. And yes i used previously written stack frame code as I was new to MC++ at the time :)</p> <p>The entire file is <a href="http://mattlant.com/CrashHandler.cpp" rel="nofollow noreferrer">here</a>. This was for a <a href="http://www.d2botnet.org" rel="nofollow noreferrer">Diablo II botting engine</a> I wrote some time ago.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload