G
Guest
Hi
I am trying to get the sample code at
http://msdn2.microsoft.com/en-us/library/5xh5cfw0(en-US,VS.80).aspx
up and running, but get an AccessViolationException. The exception occurs
where a call is made to
[DllImport("ADVAPI32.DLL", EntryPoint = "SetServiceStatus")]
public static extern bool SetServiceStatus(
IntPtr hServiceStatus,
SERVICE_STATUS lpServiceStatus
);
If i comment out that call, the code works. What have I missed ?
The full message text is "
Service cannot be started. System.AccessViolationException: Attempted
to read or write protected memory. This is often an indication that
other memory is corrupt.
at ServiceSample.SimpleService.SetServiceStatus(IntPtr
hServiceStatus, SERVICE_STATUS lpServiceStatus)
at ServiceSample.SimpleService.OnStart(String[] args)
at
System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object
state)"
What have I missed ?
I am trying to get the sample code at
http://msdn2.microsoft.com/en-us/library/5xh5cfw0(en-US,VS.80).aspx
up and running, but get an AccessViolationException. The exception occurs
where a call is made to
[DllImport("ADVAPI32.DLL", EntryPoint = "SetServiceStatus")]
public static extern bool SetServiceStatus(
IntPtr hServiceStatus,
SERVICE_STATUS lpServiceStatus
);
If i comment out that call, the code works. What have I missed ?
The full message text is "
Service cannot be started. System.AccessViolationException: Attempted
to read or write protected memory. This is often an indication that
other memory is corrupt.
at ServiceSample.SimpleService.SetServiceStatus(IntPtr
hServiceStatus, SERVICE_STATUS lpServiceStatus)
at ServiceSample.SimpleService.OnStart(String[] args)
at
System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object
state)"
What have I missed ?