You define a struct in Go the same way you define a struct in C. You just need to translate the windows C macros into equivalent Go types.
So in C we have:
typedef struct _SERVICE_DESCRIPTION {
LPTSTR lpDescription;
} SERVICE_DESCRIPTION, *LPSERVICE_DESCRIPTION;
Which translates to Go as:
type SERVICE_DESCRIPTION struct {
Description *uint16
}
Se we do the same with the next struct:
typedef struct _SERVICE_FAILURE_ACTIONS {
DWORD dwResetPeriod;
LPTSTR lpRebootMsg;
LPTSTR lpCommand;
DWORD cActions;
SC_ACTION *lpsaActions;
} SERVICE_FAILURE_ACTIONS, *LPSERVICE_FAILURE_ACTIONS;
type SC_ACTION struct {
Delay uint32
}
type SERVICE_FAILURE_ACTIONS struct {
ResetPeriod uint32
RebootMsg *uint16
Command *uint16
ActionCount uint32 // length of action slice.
Actions *SC_ACTION // grab a pointer from the first element in slice.
}
I could be off some of these, but I think they should work.
You could also install the service as a higher privileged system user, rather then the default one. Although then you might need two services.
-Daniel