File tree Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -1495,12 +1495,26 @@ NTSTATUS PhSipQueryProcessorLogicalInformationEx(
1495
1495
_Out_ PULONG BufferLength
1496
1496
)
1497
1497
{
1498
+ static ULONG initialBufferSize [2 ] = { 0x200 , 0x80 };
1498
1499
NTSTATUS status ;
1500
+ ULONG classIndex ;
1499
1501
PVOID buffer ;
1500
1502
ULONG bufferSize ;
1501
1503
ULONG attempts ;
1502
1504
1503
- bufferSize = 0x100 ;
1505
+ switch (RelationshipType )
1506
+ {
1507
+ case RelationProcessorCore :
1508
+ classIndex = 0 ;
1509
+ break ;
1510
+ case RelationProcessorPackage :
1511
+ classIndex = 1 ;
1512
+ break ;
1513
+ default :
1514
+ return STATUS_INVALID_INFO_CLASS ;
1515
+ }
1516
+
1517
+ bufferSize = initialBufferSize [classIndex ];
1504
1518
buffer = PhAllocate (bufferSize );
1505
1519
1506
1520
status = NtQuerySystemInformationEx (
@@ -1529,13 +1543,15 @@ NTSTATUS PhSipQueryProcessorLogicalInformationEx(
1529
1543
attempts ++ ;
1530
1544
}
1531
1545
1532
- if (NT_SUCCESS (status ))
1546
+ if (! NT_SUCCESS (status ))
1533
1547
{
1534
- * Buffer = buffer ;
1535
- * BufferLength = bufferSize ;
1536
- }
1537
- else
1538
1548
PhFree (buffer );
1549
+ return status ;
1550
+ }
1551
+
1552
+ if (bufferSize <= 0x100000 ) initialBufferSize [classIndex ] = bufferSize ;
1553
+ * Buffer = buffer ;
1554
+ * BufferLength = bufferSize ;
1539
1555
1540
1556
return status ;
1541
1557
}
You can’t perform that action at this time.
0 commit comments