C:ProcChanger
From Devicenull's Code
This checks running processes, and runs certain things at High priority instead of normal. This was meant to improve my FPS in certain games, but I don't think this code actually works now.
#include <windows.h> #include "Winuser.h" #include <tlhelp32.h> #include <iostream> #include <string> #include "stdafx.h" #include "time.h" #include "process.h" //Delay in seconds #define DELAY 30 //Priority #define PRIOR ABOVE_NORMAL_PRIORITY_CLASS using namespace std; int main(int argc, _TCHAR* argv[]) { HANDLE hSnapShot; PROCESSENTRY32* processInfo; time_t start_time, cur_time; bool isRunning=false; bool foundHL=false; //HWND hCur = (HWND)OpenProcess(PROCESS_ALL_ACCESS,TRUE,_getpid()); //ShowWindow(hCur,(int)SW_HIDE); //CloseHandle(hCur); while (1) { foundHL = false; hSnapShot=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); processInfo=new PROCESSENTRY32; processInfo->dwSize=sizeof(PROCESSENTRY32); int index=0; while(Process32Next(hSnapShot,processInfo)!=FALSE) { /*cout<<endl<<"***********************************************"; cout<<endl<<"\t\t\t"<<++index; cout<<endl<<"***********************************************"; cout<<endl<<"Parent Process ID: "<<processInfo->th32ParentProcessID; cout<<endl<<"Process ID: "<<processInfo->th32ProcessID;*/ cout<<endl<<"Name: "<<processInfo->szExeFile; /*cout<<endl<<"Current Threads: "<<processInfo->cntThreads; cout<<endl<<"Current Usage: "<<processInfo->cntUsage; cout<<endl<<"Flags: "<<processInfo->dwFlags; cout<<endl<<"Size: "<<processInfo->dwSize; cout<<endl<<"Primary Class Base: "<<processInfo->pcPriClassBase; cout<<endl<<"Default Heap ID: "<<processInfo->th32DefaultHeapID; cout<<endl<<"Module ID: "<<processInfo->th32ModuleID;*/ } if (0) { if (strcmp(processInfo->szExeFile,"hl.exe") == 0 || strcmp(processInfo->szExeFile,"hl2.exe") == 0) { foundHL=true; HANDLE hHl=OpenProcess(PROCESS_ALL_ACCESS,TRUE,processInfo->th32ProcessID); if (hHl == NULL) { printf("Couldn't open the Half life or Half Life 2 process...\n"); } else { if (GetPriorityClass(hHl) != PRIOR) { printf("Changed Half life or Half life 2's priority to Above Normal\n"); SetPriorityClass(hHl,PRIOR); } CloseHandle(hHl); } } if (strcmp(processInfo->szExeFile,"foobar2000.exe") == 0) { HANDLE hFB = OpenProcess(PROCESS_ALL_ACCESS,TRUE,processInfo->th32ProcessID); if (hFB == NULL) { printf("Foobar2k running, but we couldn't open it\n"); } else { if (isRunning || foundHL) { if (GetPriorityClass(hFB) != PRIOR) { printf("Changed foobar2k's priority to high...\n"); SetPriorityClass(hFB,PRIOR); } } else { if (GetPriorityClass(hFB) != NORMAL_PRIORITY_CLASS) { printf("Changed foobar2k's priority to normal...\n"); SetPriorityClass(hFB,NORMAL_PRIORITY_CLASS); } } CloseHandle(hFB); }// if (hFB) } if (strcmp(processInfo->szExeFile,"Ventrilo.exe") == 0) { HANDLE hV = OpenProcess(PROCESS_ALL_ACCESS,TRUE,processInfo->th32ProcessID); if (hV == NULL) { printf("Ventrilo running, but we couldn't open it\n"); } else { if (isRunning || foundHL) { if (GetPriorityClass(hV) != PRIOR) { printf("Changed Ventrilo's priority to high...\n"); SetPriorityClass(hV,PRIOR); } } else { if (GetPriorityClass(hV) != NORMAL_PRIORITY_CLASS) { printf("Changed Ventrilo's priority to normal...\n"); SetPriorityClass(hV,NORMAL_PRIORITY_CLASS); } } CloseHandle(hV); }// if (hV) } if (strcmp(processInfo->szExeFile,"winamp.exe") == 0) { HANDLE hW = OpenProcess(PROCESS_ALL_ACCESS,TRUE,processInfo->th32ProcessID); if (hW == NULL) { printf("Winamp running, but we couldn't open it\n"); } else { if (isRunning || foundHL) { if (GetPriorityClass(hW) != PRIOR) { printf("Changed Winamp's priority to high...\n"); SetPriorityClass(hW,PRIOR); } } else { if (GetPriorityClass(hW) != NORMAL_PRIORITY_CLASS) { printf("Changed Winamp's priority to normal...\n"); SetPriorityClass(hW,NORMAL_PRIORITY_CLASS); } } CloseHandle(hW); }// if (hW) } } CloseHandle(hSnapShot); if (foundHL) isRunning = true; else isRunning=false; time(&start_time); do { time(&cur_time); } while((cur_time - start_time) < DELAY); } return 0; }