From 5429ce93b81e32dd964b8a40ce7685d274e93a12 Mon Sep 17 00:00:00 2001 From: Fredrik Orderud Date: Sun, 12 Oct 2025 00:54:44 +0200 Subject: [PATCH] Fix AdjustTokenPrivileges call in privilege sample According to the AdjustTokenPrivileges documentation, then the BufferLength parameter specifies the size of the PreviousState parameter. Since PreviousState=NULL, then it follows that BufferLength should be 0. I've also tested the changes locally. --- .../SecAuthZ/enabling-and-disabling-privileges-in-c--.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop-src/SecAuthZ/enabling-and-disabling-privileges-in-c--.md b/desktop-src/SecAuthZ/enabling-and-disabling-privileges-in-c--.md index 9057f302762..6ea9a2bfe0a 100644 --- a/desktop-src/SecAuthZ/enabling-and-disabling-privileges-in-c--.md +++ b/desktop-src/SecAuthZ/enabling-and-disabling-privileges-in-c--.md @@ -65,7 +65,7 @@ BOOL SetPrivilege( hToken, FALSE, &tp, - sizeof(TOKEN_PRIVILEGES), + 0, (PTOKEN_PRIVILEGES) NULL, (PDWORD) NULL) ) {