FILETIME Kernel_Time;
HANDLE Process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, 0);
GetProcessTimes(Process, NULL, NULL, &Kernel_Time, NULL);
SYSTEMTIME Sys_Time;
FileTimeToSystemTime(&Kernel_Time, &Sys_Time);
printf("%d", Sys_Time.wYear); // WHY ?
Why Sys_Time.wYear
is not 2013?
Could anyone help me?
HANDLE Process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, 0);
As per the documentation,
If the specified process is the System Process (0x00000000), the function fails and the last error code is ERROR_INVALID_PARAMETER.
So, your OpenProcess
fails with ERROR_INVALID_PARAMETER
, and the HANDLE Process
is NULL
. Always check for the Failure conditions and respective Error Codes.
Then again, GetProcessTimes API parameters are not optional, so you should not be passing NULL to them instead of pointer to FILETIME structures
.