Creating NT Services
 

 

 
Execution example from main.cpp:



#define implicit_Services_main
#include "Convert.h" //https://www.netbot.sk/en/14-blog-headers/86-convert-h-en #include "WinApi.h" //https://www.netbot.sk/en/14-blog-headers/44-winapi-en #include "Services.h" //https://www.netbot.sk/en/14-blog-headers/85-service-h-en using namespace std;
void ::WinNTServices::StructServiceStorageInformation::ServiceIsStarting(void) { ::Diall_WinApi::WinApi::GetInstance()->CreateFileW("c:\\Service.txt", "starting\n", 10); }
void ::WinNTServices::StructServiceStorageInformation::ServiceIsRunning(void) { ::Diall_WinApi::WinApi::GetInstance()->CreateFileW("c:\\Service.txt", "running\n ", 10); }
void ::WinNTServices::StructServiceStorageInformation::ServiceIsStopping(void) { ::Diall_WinApi::WinApi::GetInstance()->CreateFileW("c:\\Service.txt", "stopping\n", 10); }
int _cdecl main (void) { ::Diall_WinApi::WinApi::GetInstance()->SystemIntegrity(::Diall_WinApi::Privilege::ENABLE);
::WinNTServices::ServiceStorageInformation.CallServiceEntryPointFromMain("C:\\test.exe","Diallix Service","Diallix"); return 0; }