Solved

Running a service

Posted on 2004-04-22
7
512 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now