4 static char* title
= " PID PARENT TIME NAME\n";
9 HANDLE stdout
= GetStdHandle(STD_OUTPUT_HANDLE
);
12 WriteFile(stdout
,title
,lstrlen(title
),&r
,NULL
);
14 HANDLE pl
= CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS
,0);
17 pe
.dwSize
= sizeof(PROCESSENTRY32
);
18 pe
.th32ParentProcessID
= 0;
20 if(Process32First(pl
,&pe
)) do
22 HANDLE p
=OpenProcess(PROCESS_QUERY_INFORMATION
,FALSE
,pe
.th32ProcessID
);
27 GetProcessTimes(p
,&cr
,&ex
,&kt
,&ut
);
30 FileTimeToDosDateTime(&cr
,&fatdate
,&fattime
);
31 int hour
= (fattime
& 0xf800) >> 11;
32 int minute
= (fattime
& 0x07e0) >> 5;
34 wsprintf(buf
,"%08X %08X %2d:%02d %s\n",pe
.th32ProcessID
,pe
.th32ParentProcessID
,hour
,minute
,pe
.szExeFile
);
35 WriteFile(stdout
,buf
,lstrlen(buf
),&r
,NULL
);
37 pe
.th32ParentProcessID
= 0;
39 } while( Process32Next(pl
,&pe
));
46 FileTimeToDosDateTime(
47 CONST FILETIME *lpFileTime,