Solved

Running a service

Posted on 2004-04-22
7
516 Views
Last Modified: 2009-07-29
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.
0
Comment
Question by:jess5503
  • 4
  • 2
7 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 100 total points
ID: 10888717
regsvr32 is used to register/unregister COM servers and not Windows services.
The service you are talking about registers itself:

2. start the program with the switch -i. this will install your service.

I think it has some switch to unregister itself, possibly -u. Read the source code, main function, to see what swicth you need.

0
 

Author Comment

by:jess5503
ID: 10888843
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 :(
0
 
LVL 86

Expert Comment

by:jkr
ID: 10889023
>>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);
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:jess5503
ID: 10889193
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.
0
 
LVL 86

Expert Comment

by:jkr
ID: 10889314
>>The files does not have DllRegisterServer or DllUnregisterServer

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

Author Comment

by:jess5503
ID: 10891243
Hi,

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

Author Comment

by:jess5503
ID: 10971679
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.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question