Solved

Running a service

Posted on 2004-04-22
7
511 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

708 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

16 Experts available now in Live!

Get 1:1 Help Now