Reactos

[RTL] When taking system volume ownership, assert that we succeeded to restore privileges

CORE-17637

authored by

Jérôme Gardou and committed by
Jérôme Gardou
fb9ebe17 9c5b39e2

+13 -7
+13 -7
sdk/lib/rtl/sysvol.c
··· 412 412 return Status; 413 413 } 414 414 415 - static NTSTATUS 415 + _Must_inspect_result_ 416 + static 417 + NTSTATUS 416 418 RtlpSysVolTakeOwnership(IN PUNICODE_STRING DirectoryPath, 417 419 IN PSECURITY_DESCRIPTOR SecurityDescriptor) 418 420 { ··· 511 513 Cleanup: 512 514 if (TokenEnabled) 513 515 { 514 - ZwAdjustPrivilegesToken(hToken, 515 - FALSE, 516 - &TokenPrivileges, 517 - 0, 518 - NULL, 519 - NULL); 516 + /* Disable privileges that we had to enable, whetever the result was. */ 517 + NTSTATUS Status2 = ZwAdjustPrivilegesToken(hToken, 518 + FALSE, 519 + &TokenPrivileges, 520 + 0, 521 + NULL, 522 + NULL); 523 + /* This must succeed */ 524 + ASSERT(NT_SUCCESS(Status2)); 525 + (void)Status2; 520 526 } 521 527 522 528 if (AdminSid != NULL)