Revision 9b2f3609
Added by Hamish Coleman over 16 years ago
- ID 9b2f3609cf7b730836031c03c62102791d6c00d0
wconsd.c | ||
---|---|---|
if (GetLastError()==ERROR_IO_PENDING) {
|
||
// Wait for it...
|
||
if (!GetOverlappedResult(hCom,&o,&wsize,TRUE)) {
|
||
dprintf(1,"Error %d (overlapped) writing to COM port\n",GetLastError());
|
||
dprintf(1,"wconsd: Error %d (overlapped) writing to COM port\n",GetLastError());
|
||
}
|
||
} else {
|
||
dprintf(1,"Error %d writing to COM port\n",GetLastError());
|
||
dprintf(1,"wconsd: Error %d writing to COM port\n",GetLastError());
|
||
}
|
||
}
|
||
if (wsize!=size) {
|
||
dprintf(1,"Eeek! WriteFile: wrote %d of %d\n",wsize,size);
|
||
dprintf(1,"wconsd: Eeek! WriteFile: wrote %d of %d\n",wsize,size);
|
||
}
|
||
}
|
||
}
|
||
... | ... | |
if (GetLastError()==ERROR_IO_PENDING) {
|
||
// Wait for overlapped operation to complete
|
||
if (!GetOverlappedResult(hCom,&o,&size,TRUE)) {
|
||
dprintf(1,"Error %d (overlapped) reading from COM port\n",GetLastError());
|
||
dprintf(1,"wconsd: Error %d (overlapped) reading from COM port\n",GetLastError());
|
||
}
|
||
} else {
|
||
dprintf(1,"Error %d reading from COM port\n",GetLastError());
|
||
dprintf(1,"wconsd: Error %d reading from COM port\n",GetLastError());
|
||
SetEvent(connectionCloseEvent);
|
||
return 0;
|
||
}
|
||
... | ... | |
WSAResetEvent(listenSocketEvent);
|
||
as=accept(ls,NULL,NULL);
|
||
|
||
dprintf(1,"wconsd: accepted new connection\n");
|
||
|
||
if (as!=INVALID_SOCKET) {
|
||
if (cs!=INVALID_SOCKET) {
|
||
/* Close down the existing connection and let the new one through */
|
||
... | ... | |
|
||
if (!SetServiceStatus(wconsd_statusHandle, &wconsd_status)) {
|
||
status = GetLastError();
|
||
dprintf(1," [wconsd] SetServiceStatus error %ld\n",status);
|
||
dprintf(1,"wconsd: SetServiceStatus error %ld\n",status);
|
||
}
|
||
|
||
SetEvent(stopEvent);
|
||
... | ... | |
break;
|
||
|
||
default:
|
||
dprintf(1," [wconsd] unrecognised opcode %ld\n",opcode);
|
||
dprintf(1,"wconsd: unrecognised opcode %ld\n",opcode);
|
||
break;
|
||
}
|
||
|
||
// Send current status
|
||
if (!SetServiceStatus(wconsd_statusHandle, &wconsd_status)) {
|
||
status = GetLastError();
|
||
dprintf(1," [wconsd] SetServiceStatus error %ld\n",status);
|
||
dprintf(1,"wconsd: SetServiceStatus error %ld\n",status);
|
||
}
|
||
return;
|
||
}
|
||
... | ... | |
wconsd_statusHandle = RegisterServiceCtrlHandler(TEXT("wconsd"),MyServiceCtrlHandler);
|
||
|
||
if (wconsd_statusHandle == (SERVICE_STATUS_HANDLE)0) {
|
||
dprintf(1," [wconsd] RegisterServiceCtrlHandler failed %d\n", GetLastError());
|
||
dprintf(1,"wconsd: RegisterServiceCtrlHandler failed %d\n", GetLastError());
|
||
return;
|
||
}
|
||
|
||
... | ... | |
|
||
if (!SetServiceStatus(wconsd_statusHandle, &wconsd_status)) {
|
||
status = GetLastError();
|
||
dprintf(1," [wconsd] SetServiceStatus error %ld\n",status);
|
||
dprintf(1,"wconsd: SetServiceStatus error %ld\n",status);
|
||
}
|
||
|
||
wconsd_main();
|
||
... | ... | |
{ NULL, NULL }
|
||
};
|
||
|
||
dprintf(0,"wconsd start\n");
|
||
dprintf(0,"wconsd: start\n");
|
||
|
||
if (argc==1 || argc==0) {
|
||
if (!StartServiceCtrlDispatcher(DispatchTable)) {
|
||
dprintf(1," [wconsd] StartServiceCtrlDispatcher error = %d\n", GetLastError());
|
||
dprintf(1,"wconsd: StartServiceCtrlDispatcher error = %d\n", GetLastError());
|
||
}
|
||
return 0;
|
||
}
|
Also available in: Unified diff
More debug message changes