D - Windows service sample
- Gifford Hesketh (3/3) Feb 10 2004 I have not seen one, so I thought I would ask: Are there samples in D o...
- Matthew (5/8) Feb 10 2004 Not yet. That'd be good to do though. Are you offering?
- Gifford Hesketh (2/12) Feb 10 2004
- Gifford.Hesketh (65/79) Feb 11 2004 Help !
- Gifford.Hesketh (15/96) Feb 11 2004 I guess this is what I need to do:
I have not seen one, so I thought I would ask: Are there samples in D of implementing Windows services (with ServiceMain et al.) -- or, for that matter, Linux daemons ?
Feb 10 2004
Not yet. That'd be good to do though. Are you offering? :) "Gifford Hesketh" <Gifford_member pathlink.com> wrote in message news:c0an69$133s$1 digitaldaemon.com...I have not seen one, so I thought I would ask: Are there samples in D of implementing Windows services (with ServiceMain et al.) -- or, for thatmatter,Linux daemons ?
Feb 10 2004
I guess I will give it a whirl. In article <c0bili$2fqe$1 digitaldaemon.com>, Matthew says...Not yet. That'd be good to do though. Are you offering? :) "Gifford Hesketh" <Gifford_member pathlink.com> wrote in message news:c0an69$133s$1 digitaldaemon.com...I have not seen one, so I thought I would ask: Are there samples in D of implementing Windows services (with ServiceMain et al.) -- or, for thatmatter,Linux daemons ?
Feb 10 2004
Help ! I have a problem porting this part of WinSvc.h: <code> // // Function Prototype for the Service Main Function // typedef VOID (WINAPI *LPSERVICE_MAIN_FUNCTIONW)( DWORD dwNumServicesArgs, LPWSTR *lpServiceArgVectors ); typedef VOID (WINAPI *LPSERVICE_MAIN_FUNCTIONA)( DWORD dwNumServicesArgs, LPSTR *lpServiceArgVectors ); #ifdef UNICODE #define LPSERVICE_MAIN_FUNCTION LPSERVICE_MAIN_FUNCTIONW #else #define LPSERVICE_MAIN_FUNCTION LPSERVICE_MAIN_FUNCTIONA #endif //UNICODE // // Service Start Table // typedef struct _SERVICE_TABLE_ENTRYA { LPSTR lpServiceName; LPSERVICE_MAIN_FUNCTIONA lpServiceProc; }SERVICE_TABLE_ENTRYA, *LPSERVICE_TABLE_ENTRYA; typedef struct _SERVICE_TABLE_ENTRYW { LPWSTR lpServiceName; LPSERVICE_MAIN_FUNCTIONW lpServiceProc; }SERVICE_TABLE_ENTRYW, *LPSERVICE_TABLE_ENTRYW; #ifdef UNICODE typedef SERVICE_TABLE_ENTRYW SERVICE_TABLE_ENTRY; typedef LPSERVICE_TABLE_ENTRYW LPSERVICE_TABLE_ENTRY; #else typedef SERVICE_TABLE_ENTRYA SERVICE_TABLE_ENTRY; typedef LPSERVICE_TABLE_ENTRYA LPSERVICE_TABLE_ENTRY; #endif // UNICODE </code> Getting rid of the ASCII/UNICODE distinction and converting to D would seem to yield this (please excuse my white-space conventions): <code> export extern ( Windows ) { void (* LPSERVICE_MAIN_FUNCTION) ( uint dwNumServicesArgs, char * * lpServiceArgVectors ); struct SERVICE_TABLE_ENTRY { char * lpServiceName; LPSERVICE_MAIN_FUNCTION lpServiceProc; } alias SERVICE_TABLE_ENTRY * LPSERVICE_TABLE_ENTRY; } // export </code> The problem is that the member of type LPSERVICE_MAIN_FUNCTION in the struct SERVICE_TABLE_ENTRY crashes dmd. The rest of my winsvc.d is complete. I saw that Pavel Minayev's windows.d has: <code> extern(Windows) alias void (*LPSERVICE_MAIN_FUNCTION)(DWORD); </code> but I do not think that is going to work for me. Can anyone shed some light here ? In article <c0c8qq$jhn$1 digitaldaemon.com>, Gifford Hesketh says...I guess I will give it a whirl. In article <c0bili$2fqe$1 digitaldaemon.com>, Matthew says...Not yet. That'd be good to do though. Are you offering? :) "Gifford Hesketh" <Gifford_member pathlink.com> wrote in message news:c0an69$133s$1 digitaldaemon.com...I have not seen one, so I thought I would ask: Are there samples in D of implementing Windows services (with ServiceMain et al.) -- or, for thatmatter,Linux daemons ?
Feb 11 2004
I guess this is what I need to do: <code> alias void (* LPSERVICE_MAIN_FUNCTION) ( uint dwNumServicesArgs, char * * lpServiceArgVectors ); struct SERVICE_TABLE_ENTRY { char * lpServiceName; LPSERVICE_MAIN_FUNCTION lpServiceProc; } alias SERVICE_TABLE_ENTRY * LPSERVICE_TABLE_ENTRY; </code> In article <c0e8bs$102b$1 digitaldaemon.com>, Gifford.Hesketh says...Help ! I have a problem porting this part of WinSvc.h: <code> // // Function Prototype for the Service Main Function // typedef VOID (WINAPI *LPSERVICE_MAIN_FUNCTIONW)( DWORD dwNumServicesArgs, LPWSTR *lpServiceArgVectors ); typedef VOID (WINAPI *LPSERVICE_MAIN_FUNCTIONA)( DWORD dwNumServicesArgs, LPSTR *lpServiceArgVectors ); #ifdef UNICODE #define LPSERVICE_MAIN_FUNCTION LPSERVICE_MAIN_FUNCTIONW #else #define LPSERVICE_MAIN_FUNCTION LPSERVICE_MAIN_FUNCTIONA #endif //UNICODE // // Service Start Table // typedef struct _SERVICE_TABLE_ENTRYA { LPSTR lpServiceName; LPSERVICE_MAIN_FUNCTIONA lpServiceProc; }SERVICE_TABLE_ENTRYA, *LPSERVICE_TABLE_ENTRYA; typedef struct _SERVICE_TABLE_ENTRYW { LPWSTR lpServiceName; LPSERVICE_MAIN_FUNCTIONW lpServiceProc; }SERVICE_TABLE_ENTRYW, *LPSERVICE_TABLE_ENTRYW; #ifdef UNICODE typedef SERVICE_TABLE_ENTRYW SERVICE_TABLE_ENTRY; typedef LPSERVICE_TABLE_ENTRYW LPSERVICE_TABLE_ENTRY; #else typedef SERVICE_TABLE_ENTRYA SERVICE_TABLE_ENTRY; typedef LPSERVICE_TABLE_ENTRYA LPSERVICE_TABLE_ENTRY; #endif // UNICODE </code> Getting rid of the ASCII/UNICODE distinction and converting to D would seem to yield this (please excuse my white-space conventions): <code> export extern ( Windows ) { void (* LPSERVICE_MAIN_FUNCTION) ( uint dwNumServicesArgs, char * * lpServiceArgVectors ); struct SERVICE_TABLE_ENTRY { char * lpServiceName; LPSERVICE_MAIN_FUNCTION lpServiceProc; } alias SERVICE_TABLE_ENTRY * LPSERVICE_TABLE_ENTRY; } // export </code> The problem is that the member of type LPSERVICE_MAIN_FUNCTION in the struct SERVICE_TABLE_ENTRY crashes dmd. The rest of my winsvc.d is complete. I saw that Pavel Minayev's windows.d has: <code> extern(Windows) alias void (*LPSERVICE_MAIN_FUNCTION)(DWORD); </code> but I do not think that is going to work for me. Can anyone shed some light here ? In article <c0c8qq$jhn$1 digitaldaemon.com>, Gifford Hesketh says...I guess I will give it a whirl. In article <c0bili$2fqe$1 digitaldaemon.com>, Matthew says...Not yet. That'd be good to do though. Are you offering? :) "Gifford Hesketh" <Gifford_member pathlink.com> wrote in message news:c0an69$133s$1 digitaldaemon.com...I have not seen one, so I thought I would ask: Are there samples in D of implementing Windows services (with ServiceMain et al.) -- or, for thatmatter,Linux daemons ?
Feb 11 2004