I'm testing out methods of making services in windows. I'm using the method that microsoft suggests but I'm the binary that gets compiled does not create a service. Any ideas?
Code:
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <winsock.h>
#include <winsvc.h>
#include <windows.h>
int main()
{
SC_HANDLE schService;
SC_HANDLE schSCManager;
LPCTSTR lpszBinaryPathName = "c:\\notepad.exe";
LPCTSTR lpszDisplayName = "NewService";
schService = CreateService(
schSCManager,
"Sample_Srv",
lpszDisplayName,
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS,
SERVICE_DEMAND_START,
SERVICE_ERROR_NORMAL,
lpszBinaryPathName,
NULL,
NULL,
NULL,
NULL,
NULL);
CloseServiceHandle(schService);
}