- UID
- 2
- 精华
- 积分
- 7736
- 威望
- 点
- 宅币
- 个
- 贡献
- 次
- 宅之契约
- 份
- 最后登录
- 1970-1-1
- 在线时间
- 小时
|
- typedef struct _JOB_FILE_HEADER
- {
- WORD ProductInfo;//System Product Info
- WORD FileVersion;//File Version
- GUID Guid;//UUID
- WORD PathOffset;//Application Name Offset
- WORD TriggerOffset;//Trigger Offset
- WORD ErrorRetryCount;//Error Retry Count
- WORD ErrorRetryInterval;//Error Retry Interval
- WORD IdleDeadline;
- WORD IdleWait;
- DWORD Priority;
- DWORD MaximumRuntime;
- DWORD ExitCode;
- DWORD Status;
- DWORD Flags;
- }JOB_FILE_HEADER,*PJOB_FILE_HEADER;
- bool GetPathFromJobFile(wstring& path)
- {
- HANDLE hTaskFile = CreateFile(_T("c:\\windows\\tasks\\At1.job"), GENERIC_READ, FILE_SHARE_READ |FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- if(hTaskFile != INVALID_HANDLE_VALUE)
- {
- DWORD FileSize = GetFileSize(hTaskFile, NULL);
- BYTE* buf = new BYTE[FileSize];
- PJOB_FILE_HEADER pjfh = (PJOB_FILE_HEADER)buf;
- if(buf && (FileSize > sizeof(JOB_FILE_HEADER) + 8))
- {
- DWORD nread = 0;
- ReadFile(hTaskFile, buf, FileSize, &nread, NULL);
- if(nread && pjfh->PathOffset == 0x46)
- {
- path = (wchar_t*)(buf+pjfh->PathOffset);
- }
-
- }
- if(buf)
- delete []buf;
- CloseHandle(hTaskFile);
- }
- return false;
- }
复制代码 |
|