Fix: Repair task actions and harden machine management
Scheduled task actions never worked end to end: the server built task packets with Unicode-style lengths in a MultiByte build, the client had no dispatch for the run/stop/delete/create commands, and the directory column was derived by replacing every occurrence of the task name, which misplaced tasks whose name also appeared in a parent folder. Packets are now assembled with narrow strings, the four commands are routed to RunOrStopTask/DelTask/CreateTask, and the folder is taken from the task path suffix only. The task list reply is trimmed to its real length instead of sending the whole 32 KB scratch buffer. On the client side, thawing a process resumed a single thread, the inject output path was copied from a narrow string using a wide-character length, and an empty window list dereferenced a NULL buffer. The service list leaked its enumeration block and one service handle per skipped entry, and the description was copied without a bound. Service start and stop now validate every handle, initialize the status structure, and stop synchronously before the start that follows a restart request, which previously always failed because the service was still in STOP_PENDING. Deleting a process used to test only the low byte of the PID and leaked the process handle on early exits, and a failed path conversion kept the previous process image name. The IE history timestamp wrote minutes and seconds in the wrong order, the favorites reader queried and closed an uninitialized registry key, software enumeration never closed its subkeys, and the task scheduler objects were not released after use. The network state list now frees the module, snapshot, and extended tables on every exit path, uses HeapFree for tables allocated on the process heap, and no longer calls an export that may be missing. Growth failures everywhere keep the original buffer instead of overwriting the pointer, the hosts reader rejects an invalid file size, and the COM task walk releases definitions and folders. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
c208b7368e
commit
6c8336b497
3 files changed
+435
-127
No files matched your search
@@ -34,7 +34,7 @@ private:
|
||||
HWND GetHwndByPid(DWORD dwProcessID);
|
||||
bool Is64BitOS();
|
||||
bool Is64BitPorcess(DWORD dwProcessID);
|
||||
char* ProcessPidToName(HANDLE hProcessSnap, DWORD ProcessId, char* ProcessName);
|
||||
char* ProcessPidToName(HANDLE hProcessSnap, DWORD ProcessId, char* ProcessName, int nSize);
|
||||
BOOL EnablePrivilege(LPCTSTR lpPrivilegeName, BOOL bEnable);
|
||||
void DeleteService(LPBYTE lpBuffer, UINT nSize);
|
||||
void MyControlService(LPBYTE lpBuffer, UINT nType);
|
||||
|
||||
Reference in new issue
Block a user