Solved

Running a service

Posted on 2004-04-22
7
514 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 …
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

822 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