2 using System.Runtime.InteropServices;
10 #pragma warning disable SA1600 11 #pragma warning disable SA1602 12 #pragma warning disable SA1611 13 #pragma warning disable SA1615 24 AllowUnprivilegedCreate = 2
32 SuspendResume = 0x0002,
41 WithDataSegs = 0x00000001,
42 WithFullMemory = 0x00000002,
43 WithHandleData = 0x00000004,
44 WithUnloadedModules = 0x00000020,
45 WithThreadInfo = 0x00001000,
51 [DllImport(
"user32.dll")]
52 public static extern int GetWindowThreadProcessId(IntPtr hWnd, out
int lpdwProcessId);
57 [DllImport(
"user32.dll", CharSet = CharSet.Unicode)]
58 public static extern IntPtr FindWindow(
string lpClassName,
string lpWindowName);
63 [DllImport(
"user32.dll")]
64 public static extern int SendMessage(IntPtr hWnd,
int wMsg, IntPtr wParam, IntPtr lParam);
69 public delegate
bool EnumWindowProc(IntPtr hwnd, IntPtr lParam);
74 [DllImport(
"user32.dll")]
75 public static extern bool EnumChildWindows(IntPtr window, EnumWindowProc callback, IntPtr lParam);
80 [DllImport(
"user32.dll", CharSet = CharSet.Unicode, SetLastError =
true)]
81 public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString,
int nMaxCount);
86 [DllImport(
"advapi32.dll", SetLastError =
true, CharSet = CharSet.Unicode)]
87 public static extern bool LogonUser(
string lpszUsername,
string lpszDomain,
string lpszPassword,
int dwLogonType,
int dwLogonProvider, out IntPtr phToken);
92 [DllImport(
"kernel32.dll", SetLastError =
true, CharSet = CharSet.Unicode)]
93 public static extern bool CreateSymbolicLink(
string lpSymlinkFileName,
string lpTargetFileName,
CreateSymbolicLinkFlags dwFlags);
98 [DllImport(
"kernel32.dll", SetLastError =
true, CharSet = CharSet.Unicode)]
99 public static extern IntPtr OpenThread(
ThreadAccess dwDesiredAccess,
bool bInheritHandle, uint dwThreadId);
104 [DllImport(
"kernel32.dll", SetLastError =
true, CharSet = CharSet.Unicode)]
105 public static extern bool CloseHandle(IntPtr hObject);
110 [DllImport(
"kernel32.dll", SetLastError =
true, CharSet = CharSet.Unicode)]
111 public static extern uint SuspendThread(IntPtr hThread);
116 [DllImport(
"kernel32.dll", SetLastError =
true, CharSet = CharSet.Unicode)]
117 public static extern uint ResumeThread(IntPtr hThread);
122 [DllImport(
"dbghelp.dll", SetLastError =
true, CharSet = CharSet.Unicode)]
123 public static extern bool MiniDumpWriteDump(
129 IntPtr userStreamParam,
130 IntPtr callbackParam);
Use server authentication
MiniDumpType
See https://docs.microsoft.com/en-us/windows/win32/api/minidumpapiset/ne-minidumpapiset-minidump_type...
CreateSymbolicLinkFlags
See https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-createsymboliclinka#param...
Native Windows methods used by the code.
ThreadAccess
See https://msdn.microsoft.com/en-us/library/windows/desktop/ms686769(v=vs.85).aspx ...