|
1 | 1 | using System; |
2 | | -using System.Text; |
3 | 2 | using System.Runtime.InteropServices; |
4 | 3 |
|
5 | 4 | namespace SmartSystemMenu |
@@ -175,4 +174,90 @@ public void Init() |
175 | 174 | cbSize = (uint)Marshal.SizeOf(this); |
176 | 175 | } |
177 | 176 | } |
| 177 | + |
| 178 | + struct TOKEN_PRIVILEGES |
| 179 | + { |
| 180 | + public uint PrivilegeCount; |
| 181 | + |
| 182 | + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] |
| 183 | + public LUID_AND_ATTRIBUTES[] Privileges; |
| 184 | + } |
| 185 | + |
| 186 | + [StructLayout(LayoutKind.Sequential, Pack = 4)] |
| 187 | + struct LUID_AND_ATTRIBUTES |
| 188 | + { |
| 189 | + public LUID Luid; |
| 190 | + public uint Attributes; |
| 191 | + } |
| 192 | + |
| 193 | + [StructLayout(LayoutKind.Sequential)] |
| 194 | + struct LUID |
| 195 | + { |
| 196 | + public uint LowPart; |
| 197 | + public int HighPart; |
| 198 | + } |
| 199 | + |
| 200 | + [Flags] |
| 201 | + enum ProcessAccessFlags : uint |
| 202 | + { |
| 203 | + All = 0x001F0FFF, |
| 204 | + Terminate = 0x00000001, |
| 205 | + CreateThread = 0x00000002, |
| 206 | + VirtualMemoryOperation = 0x00000008, |
| 207 | + VirtualMemoryRead = 0x00000010, |
| 208 | + VirtualMemoryWrite = 0x00000020, |
| 209 | + DuplicateHandle = 0x00000040, |
| 210 | + CreateProcess = 0x000000080, |
| 211 | + SetQuota = 0x00000100, |
| 212 | + SetInformation = 0x00000200, |
| 213 | + QueryInformation = 0x00000400, |
| 214 | + QueryLimitedInformation = 0x00001000, |
| 215 | + Synchronize = 0x00100000 |
| 216 | + } |
| 217 | + |
| 218 | + enum SECURITY_IMPERSONATION_LEVEL |
| 219 | + { |
| 220 | + SecurityAnonymous, |
| 221 | + SecurityIdentification, |
| 222 | + SecurityImpersonation, |
| 223 | + SecurityDelegation |
| 224 | + } |
| 225 | + |
| 226 | + enum TOKEN_TYPE |
| 227 | + { |
| 228 | + TokenPrimary = 1, |
| 229 | + TokenImpersonation |
| 230 | + } |
| 231 | + |
| 232 | + [StructLayout(LayoutKind.Sequential)] |
| 233 | + struct PROCESS_INFORMATION |
| 234 | + { |
| 235 | + public IntPtr hProcess; |
| 236 | + public IntPtr hThread; |
| 237 | + public int dwProcessId; |
| 238 | + public int dwThreadId; |
| 239 | + } |
| 240 | + |
| 241 | + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] |
| 242 | + struct STARTUPINFO |
| 243 | + { |
| 244 | + public int cb; |
| 245 | + public string lpReserved; |
| 246 | + public string lpDesktop; |
| 247 | + public string lpTitle; |
| 248 | + public int dwX; |
| 249 | + public int dwY; |
| 250 | + public int dwXSize; |
| 251 | + public int dwYSize; |
| 252 | + public int dwXCountChars; |
| 253 | + public int dwYCountChars; |
| 254 | + public int dwFillAttribute; |
| 255 | + public int dwFlags; |
| 256 | + public short wShowWindow; |
| 257 | + public short cbReserved2; |
| 258 | + public IntPtr lpReserved2; |
| 259 | + public IntPtr hStdInput; |
| 260 | + public IntPtr hStdOutput; |
| 261 | + public IntPtr hStdError; |
| 262 | + } |
178 | 263 | } |
0 commit comments