Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure the destination for downloaded ADMX files is writable
- Loading branch information
Showing
4 changed files
with
33 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Imports System.Runtime.InteropServices | ||
Public Class Privilege | ||
Public Shared Sub EnablePrivilege(Name As String) | ||
Dim luid As PInvokeLuid | ||
Dim priv As PInvokeTokenPrivileges | ||
Dim thisProcToken As IntPtr | ||
PInvoke.OpenProcessToken(PInvoke.GetCurrentProcess, &H28, thisProcToken) ' 0x28 = TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY | ||
PInvoke.LookupPrivilegeValueW(Nothing, Name, luid) | ||
priv.Attributes = 2 ' SE_PRIVILEGE_ENABLED | ||
priv.PrivilegeCount = 1 | ||
priv.LUID = luid | ||
PInvoke.AdjustTokenPrivileges(thisProcToken, False, priv, Marshal.SizeOf(priv), IntPtr.Zero, 0) | ||
PInvoke.CloseHandle(thisProcToken) | ||
End Sub | ||
End Class |