'Service'에 해당되는 글 3건
- 2023.05.10 How to prevent a services from being stopped by administrative users.
- 2015.01.12 Debugging windows services
- 2013.09.16 Development Windows Service
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.
- Ignoring the stop notification
If you call this function without 'SERVICE_ACCEPT_STOP' in dwControlsAccepted member in SERVICE_STAUS structure, the service ignores the stop notification.
- 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);
Debugging windows services
using psexec
psexec –sd –i 0 "c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\x86\msvsmon.exe" /noauth /anyuser /silent
How to debug Windows services with Windbg
Development Windows Service
Simple Service in C++
http://www.codeproject.com/Articles/499465/Simple-Windows-Service-in-Cplusplus
A basic Windows service in c++ by MS
http://code.msdn.microsoft.com/windowsdesktop/CppWindowsService-cacf4948
Interaction between services and applications in Windows Vista
http://www.codeproject.com/Articles/36581/Interaction-between-services-and-applications-at-u
Launch your application in Vista under the local system accoun without the UAC popup
http://www.codeproject.com/Articles/18367/Launch-your-application-in-Vista-under-the-local-s