c++ - How to run a dll as a service? -
i know how write dll , how write service , how run dll rundll32, want write dll install service in windows
i don't know if that's possible or function in dll should exported?
how can install , run dll service?
there's no inherent reason why can't use rundll32.exe host executable, though use of rundll32 isn't recommended. (to expand on that: gather you're trying build dll service academic exercise, fine. in production, should of course use exe, you've done.)
your main function should have signature:
void callback myserviceentry(hwnd hwnd, hinstance hinst, lpstr lpszcmdline, int ncmdshow) and should call startservicectrldispatcher, in same way main() or winmain() function in conventional service.
you install service use following command line:
rundll32 myservice.dll,myserviceentry for academic exercise, acceptable use svchost.exe described in remy's answer, more important not use in production context: use of rundll32 third parties supported not recommended; use of svchost third parties explicitly unsupported.
Comments
Post a Comment