Link to home
Start Free TrialLog in
Avatar of jess5503
jess5503

asked on

Running a service

Hi,

I have downloaded a c program from
http://www.csdn.net/dev/Visual%20C++/source%20code/Misc/nt_service.shtml.htm#build

I have successfully compiled it as an exe file and I was able to register it as a service using the command regsvr32 in windows 2000. I had this service(does nothing) running in my pc for 1 to 2 weeks and now when I tried to uninstall it using regsvr32 -u, it gives an error

"Dllname was loaded, but the DllRegisterServer or DllUnregisterServer entry point was not found.
Dllname is not a .dll or .ocx file."

I tried to create another program to try to register another service and it gives the same error. I tried to run the program in another computer and it still gives the same error.  I do not know what cause the problem but I find it very weird that I can register it previously, but was unable to unregister it now.

Thank You in advance.
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jess5503
jess5503

ASKER

Hi,

I have tried to use the -i and -i with -n but it still gives the same problem. Previously I tried, I was able to register it and unregister it  but I really do not know what causes the registration to stop working :(
Avatar of jkr
>>but I really do not know what causes the registration to stop working :(

How are you declaring 'DllRegisterServer()' and 'DllUnregisterServer()'? It should be like

extern "C" STDAPI __declspec(dllexport) DllRegisterServer(void);

extern "C" STDAPI __declspec(dllexport) DllUnregisterServer(void);
Hi,

Sorry, but I do not quite understand --> extern "C" STDAPI __declspec(dllexport) DllRegisterServer(void);
The files does not have DllRegisterServer or DllUnregisterServer. The program only calls RegisterService(__argc, __argv) in NTService.cpp during InitInstance(). The program will compile to an exe file.
>>The files does not have DllRegisterServer or DllUnregisterServer

So what exactly is unclear about "DllRegisterServer or DllUnregisterServer entry point was not found" then?
Hi,

Sorry, what I mean is that there is no function by the name of DllRegisterServer or DllUnregisterServer.
Hi,

AlexFM is right. I really made such a stupid mistake by trying to use regsvr32 to register the service.  The main program actually calls the register function.

Thanks again.