Explorer/Assemblies.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
Add-Type -assembly System Add-Type -assembly System.Runtime.InteropServices Add-Type -assembly System.Windows.Forms Add-Type -assembly System.Data Add-Type -assembly System.Drawing Add-Type -assembly System.Design #--------------------- # treeView checkboxes #--------------------- # https://stackoverflow.com/questions/698369/how-to-disable-a-winforms-treeview-node-checkbox # P/invoke $TypeDefinition = @' using System; using System.Runtime.InteropServices; namespace Win32Functions { public class Win32TreeView { // constants used to hide a checkbox public const int TVIF_STATE = 0x8; public const int TVIS_STATEIMAGEMASK = 0xF000; public const int TV_FIRST = 0x1100; public const int TVM_SETITEM = TV_FIRST + 63; [DllImport("user32.dll", SetLastError = true)] public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); // struct used to set node properties public struct TVITEM { public int mask; public IntPtr hItem; public int state; public int stateMask; [MarshalAs(UnmanagedType.LPTStr)] public String lpszText; public int cchTextMax; public int iImage; public int iSelectedImage; public int cChildren; public IntPtr lParam; } public const int SB_HORZ = 0x0; public const int SB_VERT = 0x1; [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern int GetScrollPos(IntPtr hWnd, int nBar); [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern int SetScrollPos(IntPtr hWnd, int nBar, int nPos, bool bRedraw); public const int EM_SETCUEBANNER = 0x1501; } } '@ Add-Type -TypeDefinition $TypeDefinition #-PassThru #Add-Type -ErrorAction SilentlyContinue -TypeDefinition @" #public enum SRxFilteringResult { REMOVED, PROCESSED, ATTRIBUTES } #"@ Add-Type -TypeDefinition @" using System; using System.Diagnostics; using System.Security.Principal; using System.Runtime.InteropServices; public static class Kernel32 { [DllImport("kernel32.dll")] public static extern bool CheckRemoteDebuggerPresent( IntPtr hProcess, out bool pbDebuggerPresent); [DllImport("kernel32.dll")] public static extern int DebugActiveProcess(int PID); [DllImport("kernel32.dll")] public static extern int DebugActiveProcessStop(int PID); } "@ |