1 #include "windows.h"
2 #include "iostream"
3
4 void main(){
5 DWORD dwIdThis=GetCurrentProcessId();
6
7 DWORD dwVerReq=GetProcessVersion(dwIdThis);
8 WORD wMajorReq=(WORD)(dwVerReq>>16);
9 WORD wMinorReq=(WORD)(dwVerReq & 0xffff);
10
11 printf("Process ID :%d ,requires OS:%d.%d\n",dwIdThis,wMajorReq,wMinorReq);
12
13 OSVERSIONINFOEX osvix;
14
15 ZeroMemory(&osvix,sizeof(osvix));
16 osvix.dwOSVersionInfoSize=sizeof(osvix);
17
18 GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&osvix));
19 printf("Running on OS:%d.%d\n",20 osvix.dwMajorVersion,osvix.dwMinorVersion);
21
22 if(osvix.dwPlatformId==VER_PLATFORM_WIN32_NT && osvix.dwMajorVersion>=5){
23
24 SetPriorityClass(
25 GetCurrentProcess(),
26 HIGH_PRIORITY_CLASS);
27 printf("Task Manager should now indicate this");
28 printf("process is high priority.\n");
29
30 }
31
32 getchar();
33 }
34
时间: 2024-10-26 04:10:31