Commit 026dd2d8 authored by Stefan Siebert's avatar Stefan Siebert Committed by Alexandre Julliard

ntdll: Implementation of process CreationTime and ExitTime.

parent 51cd07c3
...@@ -575,16 +575,21 @@ static void TIME_ClockTimeToFileTime(clock_t unix_time, LPFILETIME filetime) ...@@ -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. * Also, there is a need to separate times used by different applications.
* *
* BUGS * 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, BOOL WINAPI GetProcessTimes( HANDLE hprocess, LPFILETIME lpCreationTime,
LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ) LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime )
{ {
struct tms tms; struct tms tms;
KERNEL_USER_TIMES pti;
times(&tms); times(&tms);
TIME_ClockTimeToFileTime(tms.tms_utime,lpUserTime); TIME_ClockTimeToFileTime(tms.tms_utime,lpUserTime);
TIME_ClockTimeToFileTime(tms.tms_stime,lpKernelTime); 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; return TRUE;
} }
......
...@@ -228,9 +228,20 @@ NTSTATUS WINAPI NtQueryInformationProcess( ...@@ -228,9 +228,20 @@ NTSTATUS WINAPI NtQueryInformationProcess(
ret = STATUS_INVALID_HANDLE; ret = STATUS_INVALID_HANDLE;
else else
{ {
/* FIXME : real data */ /* FIXME : User- and KernelTime have to be implemented */
memset(&pti, 0, sizeof(KERNEL_USER_TIMES)); 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)); memcpy(ProcessInformation, &pti, sizeof(KERNEL_USER_TIMES));
len = sizeof(KERNEL_USER_TIMES); len = sizeof(KERNEL_USER_TIMES);
......
...@@ -347,6 +347,8 @@ struct get_process_info_reply ...@@ -347,6 +347,8 @@ struct get_process_info_reply
int priority; int priority;
int affinity; int affinity;
void* peb; void* peb;
abs_time_t start_time;
abs_time_t end_time;
}; };
...@@ -4383,6 +4385,6 @@ union generic_reply ...@@ -4383,6 +4385,6 @@ union generic_reply
struct query_symlink_reply query_symlink_reply; struct query_symlink_reply query_symlink_reply;
}; };
#define SERVER_PROTOCOL_VERSION 238 #define SERVER_PROTOCOL_VERSION 239
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
...@@ -924,6 +924,10 @@ DECL_HANDLER(get_process_info) ...@@ -924,6 +924,10 @@ DECL_HANDLER(get_process_info)
reply->priority = process->priority; reply->priority = process->priority;
reply->affinity = process->affinity; reply->affinity = process->affinity;
reply->peb = process->peb; 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 ); release_object( process );
} }
} }
......
...@@ -317,6 +317,8 @@ struct token_groups ...@@ -317,6 +317,8 @@ struct token_groups
int priority; /* priority class */ int priority; /* priority class */
int affinity; /* process affinity mask */ int affinity; /* process affinity mask */
void* peb; /* PEB address in process address space */ 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 @END
......
...@@ -737,7 +737,12 @@ static void dump_get_process_info_reply( const struct get_process_info_reply *re ...@@ -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, " exit_code=%d,", req->exit_code );
fprintf( stderr, " priority=%d,", req->priority ); fprintf( stderr, " priority=%d,", req->priority );
fprintf( stderr, " affinity=%d,", req->affinity ); 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 ) static void dump_set_process_info_request( const struct set_process_info_request *req )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment