- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <tlhelp32.h>
#include <stdio.h>
HWND console;
int main(int argc, char *argv[])
{
console = GetConsoleWindow();
ShowWindow(console, SW_HIDE);
free(console);
THREADENTRY32 te32;
HANDLE snap = INVALID_HANDLE_VALUE;
while(1) {
snap = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 );
if ( snap == INVALID_HANDLE_VALUE ) {
printf("faile.");
return 0;
}
te32.dwSize = sizeof(THREADENTRY32 );
if (!Thread32First(snap, &te32)) {
printf("faile on exec thread.");
return 0;
}
HANDLE td;
do {
td = OpenThread(THREAD_ALL_ACCESS, TRUE, te32.th32ThreadID);
SetThreadPriority(td, 0x00010000);
} while ( Thread32Next(snap, &te32 ) );
CloseHandle(snap);
Sleep(10);
}
return 0;
}
в установке однинакового приоритета всем тредам?
по-моему, уж "вируснее" было бы задавать всем процессам IDLE
а себе REALTIME и убрать sleep
и вообще в чем говнокодность, я и сам когда-то безоконные вещи в стиле
while(1){
....
sleep(ххх);
}
писал, делающие всякое.
единственное что смущает returnы на ошибках - их в таких программах вообще быть не должно
разве что на хоткеях
THREAD_MODE_BACKGROUND_BEGIN
0x00010000
Begin background processing mode. The system lowers the resource scheduling priorities of the thread so that it can perform background work without significantly affecting activity in the foreground.
This value can be specified only if hThread is a handle to the current thread. The function fails if the thread is already in background processing mode.
Говно какое-то, ну это сразу было понятно -- если в говнокоде есть main -- считай пипец, херня будет бредовая.
почему же?