DotNetTools: Remove legacy code
@@ -537,33 +537,10 @@ BOOLEAN OpenDotNetPublicControlBlock_V4(
if (WINDOWS_HAS_IMMERSIVE && IsImmersive)
{
- if (NT_SUCCESS(NtOpenProcessToken(ProcessHandle, TOKEN_QUERY, &tokenHandle)))
- {
- ULONG returnLength = 0;
-
- if (NtQueryInformationToken(
- tokenHandle,
- TokenAppContainerSid,
- NULL,
- 0,
- &returnLength
- ) != STATUS_BUFFER_TOO_SMALL)
+ if (NT_SUCCESS(PhOpenProcessToken(ProcessHandle, TOKEN_QUERY, &tokenHandle)))
{
+ if (!NT_SUCCESS(PhQueryTokenVariableSize(tokenHandle, TokenAppContainerSid, &appContainerInfo)))
goto CleanupExit;
- }
-
- appContainerInfo = PhAllocate(returnLength);
-
- if (!NT_SUCCESS(NtQueryInformationToken(
- tokenHandle,
- TokenAppContainerSid,
- appContainerInfo,
- returnLength,
- &returnLength
- )))
- {
- goto CleanupExit;
- }
if (!NT_SUCCESS(RtlAddSIDToBoundaryDescriptor(&boundaryDescriptorHandle, appContainerInfo->TokenAppContainer)))
goto CleanupExit;
