進程處理之進程監控

來源:互聯網
上載者:User

使用者需求:
對使用者自訂進程進行監控,每個進程自己的屬性(允許運行,禁止運行和必須運行),當發現進程違規時進行相應處理
思路:
每個進程都有一個結構體,自創結構體儲存進程名,在系統中擷取進程快照,查看使用者自訂進程是否運行,然後根據進程屬性進行處理(啟動,殺死或者不處理進程)。

 

進程處理:

 

//殺死違規進程

HANDLE hp = OpenProcess(PROCESS_TERMINATE,FALSE, pid);

if (hp != NULL && TerminateProcess(hp, 0))

{

char succnotice[260] = "Killed irregulate progress:";

}

 

//開啟進程

PROCESS_INFORMATION process_info;

if(CreateProcess(m_procuserdefinenamelist[i],NULL,NULL,NULL,FALSE,0,NULL,NULL,NULL,&process_info))

{

char  succnotice[260] = "open progress:";

}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.