2023. 5. 10. 11:59

How to prevent a services from being stopped by administrative users.

It is almost impossible to prevent administrators from stopping services.
But there are some ways to make it difficult for them.

  1. Ignoring the stop notification

SetServiceStatus

 

SetServiceStatus function (winsvc.h) - Win32 apps

Updates the service control manager's status information for the calling service.

learn.microsoft.com

If you call this function without 'SERVICE_ACCEPT_STOP' in dwControlsAccepted member in SERVICE_STAUS structure, the service ignores the stop notification.

  1. Chaning the access control on the service
// Get an acl of the service

  ATL::CDacl dacl;
  bool result = ATL::AtlGetDacl(L"serviceName", SE_SERVICE, &dacl);


// Traverse all access masks

  for (UINT index = 0; index < count; ++index) {
    CSid aceSid;
    ACCESS_MASK mask = 0;
    BYTE type = 0;
    BYTE flags = 0;
    GUID objectType;
    GUID inheritedObjectType;
    dacl.GetAclEntry(index, &aceSid, &mask, &type, &flags, &objectType, &inheritedObjectType);

}

// Change & Set acess mask

// Remove old ace
dacl.RemoveAce(speciifcIndex);
// Remove permissions(SERVICE_CHANGE_CONFIG & SERVICE_STOP)
specificMask &= ~SERVICE_CHANGE_CONFIG; 
specificMask &= ~SERVICE_STOP;
// Add new ace
 result = dacl.AddAllowedAce(specificSid, specificMask, specificFlags);
2009. 1. 1. 17:33

pictograph


1. svn repository : http://OpenSVN.csie.org
2. state : be beginning...
2007. 12. 16. 09:47

RegSvrHelp

ver 1.0.0.3
----------------------------------------------------
Side-by-Side Assembly인 경우 Explore에서 Alert창 드는 현상 수정
----------------------------------------------------
invalid-file

Unicode


사용자 삽입 이미지

Project

Introduction

RegSvrHelp는 ContextMenu( Windows Shell에서 오른쪽 버튼을 누를 때 )에서 Windows COM 객체를 등록하는 기능을 한다.

-          dll 형태(ocx 포함): dll이 일반 dll인지 com인지 판단을 하여 context
menu에 나타난다.

-          exe 형태: exe는 현재 com인지 일반 exe인지 판단하는 기능이 없으므로 모든 exe에 대해서 context menu가 나타나며 메뉴를 선택 시 (실행파일 에 –RegServer/-UnRegServer 의 argument를 붙여서 실행하게 된다.

 

특히 Vista OS에서 UAC가 설정 된 경우 command 창의 RegSvr32 파일을 이용해서 COM 객체를 등록할 때는 매우 불편한데 RegSvrHelp를 이용할 경우 좀 더 편하게 작업이 이루어질 수 있다.

 

OS

Package는 2가지가 제공된다.

-          setup.exe: Ascii version으로 Win98 – Vista까지 지원된다.

-          setupU.exe: Unicode version으로 Win2000 - Vista까지 지원된다.

 

Install

설치는 아래 zip 파일 중 하나를 택해서 압축을 풀고 .msi 를 실행 시켜 install를 하면 설치는 완료된다.



ps : 버그 사항은 댓글로 달아 주세요..