Everhart, Glenn From: Maxim Shatskih [maxim@vest.msk.ru] Sent: Monday, June 01, 1998 7:25 AM To: Palo Sestak; 'ntdev@atria.com'" Subject: RE: [ntdev] How to write ServiceMain & Handler main() in a service must call StartServiceCtrlDispatcher(), not RegisterServiceCtrlHandler(). Passed to StartServiceCtrlDispatcher() is array of structures which are describing all services in your process - there can be several like in INETINFO.EXE or SERVICES.EXE Each structure will hold a pointer to ServiceStart function which, in turn, has to call RegisterServiceCtrlHandler(). Max > -----Original Message----- > From: Palo Sestak [SMTP:sestak@frpd.utcpd.sk] > Sent: Friday, May 29, 1998 11:52 PM > To: 'ntdev@atria.com' > Subject: [ntdev] How to write ServiceMain & Handler > > Hello! > I'm writting some service on NT. Can somone send to me exact > template, how to write > ServiceMain and Handler of common service? > I wrote ServiceMain and Handlre like this: > > //dummy Handler > void SrvHandler(DWORD fdwControl); // requested control code > { > } > > void ServiceMain(DWORD dwArgc; // number of arguments > LPTSTR *lpszArgv); // address of array of > argument string pointers > { > ServiceStatusHandle = RegisterServiceCtrlHandler( > ServiceName, // address of name of > service > SrvHandler); // address of handler > function, meanwhile empty:begin > // end; > > ServiceStatus->dwServiceType = SERVICE_WIN32_SHARE_PROCESS; > ServiceStatus->dwCurrentState = SERVICE_START_PENDING; > ServiceStatus->dwControlsAccepted = SERVICE_ACCEPT_STOP | > SERVICE_ACCEPT_PAUSE_CONTINUE | > SERVICE_ACCEPT_SHUTDOWN; > ServiceStatus->dwWin32ExitCode = NO_ERROR; > ServiceStatus->dwServiceSpecificExitCode = > ERROR_SERVICE_SPECIFIC_ERROR; > ServiceStatus->dwCheckPoint = 3; > ServiceStatus->dwWaitHint = 1000; > > SetServiceStatus(ServiceStatusHandle, ServiceStatus); > } > > After, I was trying to run service from Control Panel, Control Panel, > respectively rundll32 hangs up. > Do somebody know, where I made mistake? > > Thanks for any indicies. > > sestak@frpd.utcpd.sk > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > [ To unsubscribe, send email to ntdev-request@atria.com with body > UNSUBSCRIBE (the subject is ignored). ] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntdev-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ]