#include <windows.h>

#include <stdio.h>

void CleanRegistry();

VOID _CRTAPI1 main(void)

{

SC_HANDLE schSCManager;

SC_HANDLE schService;

/* Open a handle to the SC Manager database. */

schSCManager = OpenSCManager(

NULL, /* local machine */

NULL, /* ServicesActive database */

SC_MANAGER_ALL_ACCESS); /* full access rights */

if (schSCManager == NULL) {

printf("\nError opening Service Manager.\n");

return;

}

schService = OpenService(

schSCManager, /* SCManager database */

TEXT("CommServ"), /* name of service */

DELETE); /* only need DELETE access */

if (! DeleteService(schService) )

printf("\nFailed to Delete service!\n");

else

printf("DeleteService SUCCESS\n");

CloseServiceHandle(schService);

CloseServiceHandle(schSCManager);

}

void CleanRegistry()

{

if (RegDeleteKey(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\

\\EventLog\\Application\\CommServ"))

{

printf("\nError Cleaning Registry");

} else {

printf("\nCleaning Registry SUCCESS");

}

return;

}