Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the tinymce_templates domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/u888376268/domains/chot.co.kr/public_html/wp-includes/functions.php on line 6121
윈도우 서비스 제거하기 - BBT 쏙쏙 정보통

윈도우 서비스 제거하기

-인자로 전달된 서비스명의 윈도우 서비스를 제거한다.

#include

#define BUFSIZE 512

void RemoveService(char* sc_name){
        SC_HANDLE hManager;
        SC_HANDLE hService;
        SERVICE_STATUS sStat;
        char path[BUFSIZE];

        hManager=OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS);

        hService=OpenService(hManager,sc_name,SERVICE_ALL_ACCESS);

        if(hService){
                //서비스 실행 중지
                ControlService(hService,SERVICE_CONTROL_STOP,&sStat);

                while(QueryServiceStatus(hService,&sStat)){
                        if(sStat.dwCurrentState == SERVICE_STOP_PENDING){
                                Sleep(1000);
                        }else{
                                break;
                        }
                }

                //서비스 제거
                if(sStat.dwCurrentState == SERVICE_STOPPED){
                        DeleteService(hService);
                }

                CloseServiceHandle(hService);
        }

        CloseServiceHandle(hManager);
}


댓글 남기기

바로가기