11using System ;
22using System . Runtime . InteropServices ;
3+ using System . Security . Principal ;
34using System . Text ;
45
56namespace ReClassNET . Util
@@ -81,6 +82,21 @@ public struct SHFILEINFO
8182 public string szTypeName ;
8283 } ;
8384
85+ [ StructLayout ( LayoutKind . Sequential , Pack = 1 ) ]
86+ public struct LUID
87+ {
88+ public uint LowPart ;
89+ public int HighPart ;
90+ }
91+
92+ [ StructLayout ( LayoutKind . Sequential , Pack = 1 ) ]
93+ public struct TOKEN_PRIVILEGES
94+ {
95+ public uint PrivilegeCount ;
96+ public LUID Luid ;
97+ public uint Attributes ;
98+ }
99+
84100 #endregion
85101
86102 #region Natives
@@ -94,25 +110,34 @@ public struct SHFILEINFO
94110 [ DllImport ( "kernel32.dll" , CharSet = CharSet . Ansi , ExactSpelling = true , SetLastError = true ) ]
95111 public static extern IntPtr GetProcAddress ( IntPtr hModule , string lpProcName ) ;
96112
113+ [ DllImport ( "kernel32.dll" , SetLastError = true ) ]
114+ public static extern bool CloseHandle ( IntPtr hObject ) ;
115+
97116 [ DllImport ( "shell32.dll" ) ]
98117 public static extern IntPtr SHGetFileInfo ( string pszPath , uint dwFileAttributes , ref SHFILEINFO psfi , uint cbSizeFileInfo , uint uFlags ) ;
99118
100- [ DllImport ( "User32 .dll" ) ]
119+ [ DllImport ( "user32 .dll" ) ]
101120 public static extern int DestroyIcon ( IntPtr hIcon ) ;
102121
103122 [ DllImport ( "dbghelp.dll" , SetLastError = true , CharSet = CharSet . Unicode ) ]
104123 static extern int UnDecorateSymbolName ( string DecoratedName , StringBuilder UnDecoratedName , int UndecoratedLength , int Flags ) ;
105124
106- [ DllImport ( "User32 .dll" ) ]
125+ [ DllImport ( "user32 .dll" ) ]
107126 [ return : MarshalAs ( UnmanagedType . Bool ) ]
108127 internal static extern bool SetProcessDPIAware ( ) ;
109128
110- [ DllImport ( "ShCore .dll" ) ]
129+ [ DllImport ( "shcore .dll" ) ]
111130 internal static extern int SetProcessDpiAwareness ( [ MarshalAs ( UnmanagedType . U4 ) ] ProcessDpiAwareness a ) ;
112131
113132 [ DllImport ( "kernel32.dll" , SetLastError = true ) ]
114133 public static extern bool GetProcessTimes ( IntPtr handle , out long creation , out long exit , out long kernel , out long user ) ;
115134
135+ [ DllImport ( "advapi32.dll" , SetLastError = true ) ]
136+ public static extern bool OpenProcessToken ( IntPtr ProcessHandle , TokenAccessLevels DesiredAccess , out IntPtr TokenHandle ) ;
137+
138+ [ DllImport ( "advapi32.dll" , SetLastError = true ) ]
139+ public static extern bool AdjustTokenPrivileges ( IntPtr TokenHandle , [ MarshalAs ( UnmanagedType . Bool ) ] bool DisableAllPrivileges , ref TOKEN_PRIVILEGES NewState , uint Zero , IntPtr Null1 , IntPtr Null2 ) ;
140+
116141 #endregion
117142
118143 #region Helper
0 commit comments