Hans Leidekker wrote:
>Call SetLastError() on failure, as suggested by Juan Lang.
>
> -Hans
>
>Changelog:
> Stub implementations for EnumPageFiles{A,W}, GetProcessImageFileName{A,W}.
> Implement GetPerformanceInfo, GetProcessMemoryInfo on top of
> NtQueryInformationProcess and GetWsChanges, QueryWorkingSet{,Ex} on top
> of NtQueryVirtualMemory.
>
>
>------------------------------------------------------------------------
>
>@@ -443,15 +461,85 @@
> }
>
> /***********************************************************************
>+ * GetPerformanceInfo (PSAPI.@)
>+ */
>+BOOL WINAPI GetPerformanceInfo( PPERFORMANCE_INFORMATION info, DWORD size )
>+{
>+ NTSTATUS status;
>+
>+ TRACE( "(%p, %ld)\n", info, size );
>+
>+ if (size < sizeof(PERFORMANCE_INFORMATION))
>+ {
>+ SetLastError( ERROR_INSUFFICIENT_BUFFER );
>+ return FALSE;
>+ }
>+
>
>
This check is redundant. All NtQueryInformation* functions check the
buffer size for you.
>+ status = NtQueryInformationProcess( GetCurrentProcess(), SystemPerformanceInformation, info, size, NULL );
>+
>+ if (status)
>+ {
>+ SetLastError( RtlNtStatusToDosError( status ));
>+ return FALSE
>+ }
>+ return FALSE;
>+}
>
>
>@@ -459,14 +547,25 @@
> /***********************************************************************
> * GetWsChanges (PSAPI.@)
> */
>-BOOL WINAPI GetWsChanges(HANDLE hProcess,
>- PPSAPI_WS_WATCH_INFORMATION lpWatchInfo, DWORD cb)
>+BOOL WINAPI GetWsChanges( HANDLE process, PPSAPI_WS_WATCH_INFORMATION watchinfo, DWORD size )
> {
>- FIXME("(hProcess=%p, %p, %ld): stub\n",
>- hProcess, lpWatchInfo, cb);
>+ NTSTATUS status;
>+
>+ TRACE( "(%p, %p, %ld)\n", process, watchinfo, size );
>+
>+ if (size < sizeof(PSAPI_WS_WATCH_INFORMATION))
>+ {
>+ SetLastError( ERROR_INSUFFICIENT_BUFFER );
>+ return FALSE;
>+ }
>
>
So is this.
>
>- memset(lpWatchInfo, 0, cb);
>+ status = NtQueryVirtualMemory( process, NULL, ProcessWorkingSetWatch, watchinfo, size, NULL );
>
>+ if (status)
>+ {
>+ SetLastError( RtlNtStatusToDosError( status ));
>+ return FALSE
>+ }
> return TRUE;
> }
>
>
>
Could you also make sure that the NtDll functions that you are calling
give out a useful fixme message when called from these functions? At the
moment you are mostly replacing some good fixme messages with bad fixme
messages.
Rob