1
1
using System ;
2
2
using System . Runtime . InteropServices ;
3
+ using System . Security . Principal ;
3
4
using System . Text ;
4
5
5
6
namespace ReClassNET . Util
@@ -81,6 +82,21 @@ public struct SHFILEINFO
81
82
public string szTypeName ;
82
83
} ;
83
84
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
+
84
100
#endregion
85
101
86
102
#region Natives
@@ -94,25 +110,34 @@ public struct SHFILEINFO
94
110
[ DllImport ( "kernel32.dll" , CharSet = CharSet . Ansi , ExactSpelling = true , SetLastError = true ) ]
95
111
public static extern IntPtr GetProcAddress ( IntPtr hModule , string lpProcName ) ;
96
112
113
+ [ DllImport ( "kernel32.dll" , SetLastError = true ) ]
114
+ public static extern bool CloseHandle ( IntPtr hObject ) ;
115
+
97
116
[ DllImport ( "shell32.dll" ) ]
98
117
public static extern IntPtr SHGetFileInfo ( string pszPath , uint dwFileAttributes , ref SHFILEINFO psfi , uint cbSizeFileInfo , uint uFlags ) ;
99
118
100
- [ DllImport ( "User32 .dll" ) ]
119
+ [ DllImport ( "user32 .dll" ) ]
101
120
public static extern int DestroyIcon ( IntPtr hIcon ) ;
102
121
103
122
[ DllImport ( "dbghelp.dll" , SetLastError = true , CharSet = CharSet . Unicode ) ]
104
123
static extern int UnDecorateSymbolName ( string DecoratedName , StringBuilder UnDecoratedName , int UndecoratedLength , int Flags ) ;
105
124
106
- [ DllImport ( "User32 .dll" ) ]
125
+ [ DllImport ( "user32 .dll" ) ]
107
126
[ return : MarshalAs ( UnmanagedType . Bool ) ]
108
127
internal static extern bool SetProcessDPIAware ( ) ;
109
128
110
- [ DllImport ( "ShCore .dll" ) ]
129
+ [ DllImport ( "shcore .dll" ) ]
111
130
internal static extern int SetProcessDpiAwareness ( [ MarshalAs ( UnmanagedType . U4 ) ] ProcessDpiAwareness a ) ;
112
131
113
132
[ DllImport ( "kernel32.dll" , SetLastError = true ) ]
114
133
public static extern bool GetProcessTimes ( IntPtr handle , out long creation , out long exit , out long kernel , out long user ) ;
115
134
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
+
116
141
#endregion
117
142
118
143
#region Helper
0 commit comments