ntdll: Implementation of process CreationTime and ExitTime.

oldstable
Stefan Siebert 2006-07-20 23:30:04 +02:00 committed by Alexandre Julliard
parent 51cd07c37e
commit 026dd2d88a
6 changed files with 33 additions and 4 deletions

View File

@ -575,16 +575,21 @@ static void TIME_ClockTimeToFileTime(clock_t unix_time, LPFILETIME filetime)
* Also, there is a need to separate times used by different applications.
*
* BUGS
* lpCreationTime and lpExitTime are not initialised in the Wine implementation.
* KernelTime and UserTime are always for the current process
*/
BOOL WINAPI GetProcessTimes( HANDLE hprocess, LPFILETIME lpCreationTime,
LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime )
{
struct tms tms;
KERNEL_USER_TIMES pti;
times(&tms);
TIME_ClockTimeToFileTime(tms.tms_utime,lpUserTime);
TIME_ClockTimeToFileTime(tms.tms_stime,lpKernelTime);
if (NtQueryInformationProcess( hprocess, ProcessTimes, &pti, sizeof(pti), NULL))
return FALSE;
LL2FILETIME( pti.CreateTime.QuadPart, lpCreationTime);
LL2FILETIME( pti.ExitTime.QuadPart, lpExitTime);
return TRUE;
}

View File

@ -228,9 +228,20 @@ NTSTATUS WINAPI NtQueryInformationProcess(
ret = STATUS_INVALID_HANDLE;
else
{
/* FIXME : real data */
/* FIXME : User- and KernelTime have to be implemented */
memset(&pti, 0, sizeof(KERNEL_USER_TIMES));
SERVER_START_REQ(get_process_info)
{
req->handle = ProcessHandle;
if ((ret = wine_server_call( req )) == STATUS_SUCCESS)
{
NTDLL_from_server_timeout(&pti.CreateTime, &reply->start_time);
NTDLL_from_server_timeout(&pti.ExitTime, &reply->end_time);
}
}
SERVER_END_REQ;
memcpy(ProcessInformation, &pti, sizeof(KERNEL_USER_TIMES));
len = sizeof(KERNEL_USER_TIMES);

View File

@ -347,6 +347,8 @@ struct get_process_info_reply
int priority;
int affinity;
void* peb;
abs_time_t start_time;
abs_time_t end_time;
};
@ -4383,6 +4385,6 @@ union generic_reply
struct query_symlink_reply query_symlink_reply;
};
#define SERVER_PROTOCOL_VERSION 238
#define SERVER_PROTOCOL_VERSION 239
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -924,6 +924,10 @@ DECL_HANDLER(get_process_info)
reply->priority = process->priority;
reply->affinity = process->affinity;
reply->peb = process->peb;
reply->start_time.sec = process->start_time.tv_sec;
reply->start_time.usec = process->start_time.tv_usec;
reply->end_time.sec = process->end_time.tv_sec;
reply->end_time.usec = process->end_time.tv_usec;
release_object( process );
}
}

View File

@ -317,6 +317,8 @@ struct token_groups
int priority; /* priority class */
int affinity; /* process affinity mask */
void* peb; /* PEB address in process address space */
abs_time_t start_time; /* process start time */
abs_time_t end_time; /* process end time */
@END

View File

@ -737,7 +737,12 @@ static void dump_get_process_info_reply( const struct get_process_info_reply *re
fprintf( stderr, " exit_code=%d,", req->exit_code );
fprintf( stderr, " priority=%d,", req->priority );
fprintf( stderr, " affinity=%d,", req->affinity );
fprintf( stderr, " peb=%p", req->peb );
fprintf( stderr, " peb=%p,", req->peb );
fprintf( stderr, " start_time=" );
dump_abs_time( &req->start_time );
fprintf( stderr, "," );
fprintf( stderr, " end_time=" );
dump_abs_time( &req->end_time );
}
static void dump_set_process_info_request( const struct set_process_info_request *req )