Try this:
wchar_t testit_name[] = "testit";
SERVICE_TABLE_ENTRY DispatchTable[] =
{
{ testit_name, (LPSERVICE_MAIN_FUNCTION) testit },
{ NULL, NULL }
};
For some reason (probably this definition hasn't been updated in many years)
SERVICE_TABLE_ENTRY is defined as:
typedef struct _SERVICE_TABLE_ENTRYW {
LPWSTR lpServiceName;
LPSERVICE_MAIN_FUNCTIONW lpServiceProc;
} SERVICE_TABLE_ENTRYW, *LPSERVICE_TABLE_ENTRYW;
It should have probably been
LCPWSTR lpServiceName
Setting a string with the service name makes it non-const and the compiler should not complain any more.