HI!
Timothy Wall wrote:
I took a quick look at the w32 service spec an it looks like you can
embed arguments in the "path" parameter when setting up the service, so
you could potentially do away with the C wrapper entirely (unless the
msdev docs are incorrect).
You're right. It works.
I am now looking into installing/removing a service and I have
encountered a problem with LPVOID.
I have this Win32 function:
/*
BOOL WINAPI ChangeServiceConfig2(
SC_HANDLE hService,
DWORD dwInfoLevel,
LPVOID lpInfo
);*/
public boolean ChangeServiceConfig2(Pointer hService, int dwInfoLevel,
Pointer lpInfo);
lpInfo is a pointer to a structure which type depends on the dwInfoLevel
parameter. In my case, I want to pass a SERVICE_DESCRIPTION struct,
defined like this:
/*
typedef struct _SERVICE_DESCRIPTION {
LPTSTR lpDescription;
} SERVICE_DESCRIPTION,
*LPSERVICE_DESCRIPTION;*/
public static class SERVICE_DESCRIPTION extends Structure {
public String lpDescription;
}
Now, I am trying to do the call:
desc = new WINSVC.SERVICE_DESCRIPTION();
desc.lpDescription = "Test";
success = advapi32.ChangeServiceConfig2(service,
WINSVC.SERVICE_CONFIG_DESCRIPTION, desc.getPointer());
This returns true, but does not set the description. Am I doing
something wrong?
Thanks!
Thomas