Re: [PATCH] kernel32: Actually return a PERFORMANCE_INFORMATION structure in K32GetPerformanceInfo (try 2)
2013/4/24 James Eder <jimportal(a)gmail.com>
This version should either pass or skip on W2KPROSP4. --- dlls/kernel32/cpu.c | 23 ++++++++++++++++++----- dlls/psapi/tests/psapi_main.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c index 0ebf8f3..124e5c0 100644 --- a/dlls/kernel32/cpu.c +++ b/dlls/kernel32/cpu.c @@ -216,16 +216,29 @@ BOOL WINAPI IsProcessorFeaturePresent ( */ BOOL WINAPI K32GetPerformanceInfo(PPERFORMANCE_INFORMATION info, DWORD size) { - NTSTATUS status; + MEMORYSTATUSEX mem_status;
TRACE( "(%p, %d)\n", info, size );
- status = NtQuerySystemInformation( SystemPerformanceInformation, info, size, NULL ); - - if (status) + if(size < sizeof(PERFORMANCE_INFORMATION)) { - SetLastError( RtlNtStatusToDosError( status ) ); + SetLastError(ERROR_BAD_LENGTH); return FALSE; } + + mem_status.dwLength = sizeof(mem_status); + if (!GlobalMemoryStatusEx( &mem_status )) + return FALSE; + + memset(info, 0, sizeof(PERFORMANCE_INFORMATION)); + + info->cb = sizeof(PERFORMANCE_INFORMATION); + info->CommitLimit = min((mem_status.ullTotalPageFile / system_info.PageSize), MAXDWORD); + info->PhysicalTotal = min((mem_status.ullTotalPhys / system_info.PageSize), MAXDWORD); + info->PhysicalAvailable = min((mem_status.ullAvailPhys / system_info.PageSize), MAXDWORD); + info->PageSize = system_info.PageSize; + + FIXME("stub\n"); +
Hi James, That would be better to change the trace at the beginning by FIXME( "(%p, %d): semi-stub\n", info, size ); or FIXME( "(%p, %d): partial stub\n", info, size ); instead of adding another fixme (which is not really correct since it's not a stub). Christian
On Wed, Apr 24, 2013 at 6:58 AM, Christian Costa <titan.costa(a)gmail.com>wrote:
Hi James,
That would be better to change the trace at the beginning by FIXME( "(%p, %d): semi-stub\n", info, size ); or FIXME( "(%p, %d): partial stub\n", info, size ); instead of adding another fixme (which is not really correct since it's not a stub).
Christian
Does this look better? http://source.winehq.org/patches/data/95866 -- Jim
Le 24/04/2013 20:10, James Eder a écrit :
On Wed, Apr 24, 2013 at 6:58 AM, Christian Costa <titan.costa(a)gmail.com <mailto:titan.costa(a)gmail.com>> wrote:
Hi James,
That would be better to change the trace at the beginning by FIXME( "(%p, %d): semi-stub\n", info, size ); or FIXME( "(%p, %d): partial stub\n", info, size ); instead of adding another fixme (which is not really correct since it's not a stub).
Christian
Does this look better? http://source.winehq.org/patches/data/95866
- TRACE( "(%p, %d)\n", info, size ); + FIXME("semi-stub (%p, %d)\n", info, size ); Wine sources used to put semi-stub mention after parameters. There is also inconsistency with spaces near parenthesis. 0 before the format string and 1 after size parameter. Something like FIXME("(%p, %d): semi-stub\n", info, size); Otherwise seems fine. :)
Le 24/04/2013 23:35, Christian Costa a écrit :
Le 24/04/2013 20:10, James Eder a écrit :
On Wed, Apr 24, 2013 at 6:58 AM, Christian Costa <titan.costa(a)gmail.com <mailto:titan.costa(a)gmail.com>> wrote:
Hi James,
That would be better to change the trace at the beginning by FIXME( "(%p, %d): semi-stub\n", info, size ); or FIXME( "(%p, %d): partial stub\n", info, size ); instead of adding another fixme (which is not really correct since it's not a stub).
Christian
Does this look better? http://source.winehq.org/patches/data/95866
- TRACE( "(%p, %d)\n", info, size ); + FIXME("semi-stub (%p, %d)\n", info, size ); Wine sources used to put semi-stub mention after parameters. There is also inconsistency with spaces near parenthesis. 0 before the format string and 1 after size parameter. Something like FIXME("(%p, %d): semi-stub\n", info, size); Otherwise seems fine. :)
- if (status) + if(size < sizeof(PERFORMANCE_INFORMATION)) { + + mem_status.dwLength = sizeof(mem_status); + if (!GlobalMemoryStatusEx( &mem_status )) Oups. Forgot this one. Cosmetic again :|. Still space inconsitency. First if w/o and second w/ space. Christian
participants (2)
-
Christian Costa -
James Eder