473,803 Members | 2,946 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help: Window Service App Error - Need Win Service Expert Help

Van
Developing in C++, .Net 2003 (7.1)
Running on Windows XP SP2

My delima is that all my windows services run fine until I STOP the service
at which time I get a "The windows service terminated unexpectidly" and the
"Send error to microsoft window." I debugged through MY code and it appears
to clean itself up properly. I don't see any memory leaks. The error occurs
after my ServiceMain exits. I can't debug any further as it appears to be in
the kernel.dll.

Is there something special (not disclosed in the docs or examples) that I
must do to keep this from happening?

Here is the last lines of my ServiceMain:

// Report our status one last time.
ServiceStatus.d wCurrentState = SERVICE_STOPPED ;
ServiceStatus.d wWin32ExitCode = 0;
ServiceStatus.d wCheckPoint += 1;
ServiceStatus.d wWaitHint = 0;
SetServiceStatu s(hStatus, &ServiceStatus) ;
} // ServiceMain

And here is the message from the EventLog:

Faulting application OSSExecute.EXE, version 0.0.0.0, faulting module
unknown, version 0.0.0.0, fault address 0x0012e7dc.

This is really annoying me as I can't figure out what the cause is.... Any
help would be appreciated.

Nov 17 '05 #1
1 1201
Van
FYI for those who find this post later.

The problem was my 'ServiceMain' function was *NOT* using the Windows API
calling convention. The MSDN documentation does show the calling convention
syntax however, the MSDN example (the one I have anyways) does NOT show using
the Windows API calling convention.

I had to change my ServiceMain function declaration from:

void ServiceMain(int argc, char* argv[])

to

VOID WINAPI ServiceMain(DWO RD argc, LPSTR* argv)

and that fixed my problem.

Explaination (as it was told to me):

The calling method of 'void ServiceMain' is '__cdecl' and it does not clean
up on its own and thus was corrupting the stacks.
"Van" wrote:
Developing in C++, .Net 2003 (7.1)
Running on Windows XP SP2

My delima is that all my windows services run fine until I STOP the service
at which time I get a "The windows service terminated unexpectidly" and the
"Send error to microsoft window." I debugged through MY code and it appears
to clean itself up properly. I don't see any memory leaks. The error occurs
after my ServiceMain exits. I can't debug any further as it appears to be in
the kernel.dll.

Is there something special (not disclosed in the docs or examples) that I
must do to keep this from happening?

Here is the last lines of my ServiceMain:

// Report our status one last time.
ServiceStatus.d wCurrentState = SERVICE_STOPPED ;
ServiceStatus.d wWin32ExitCode = 0;
ServiceStatus.d wCheckPoint += 1;
ServiceStatus.d wWaitHint = 0;
SetServiceStatu s(hStatus, &ServiceStatus) ;
} // ServiceMain

And here is the message from the EventLog:

Faulting application OSSExecute.EXE, version 0.0.0.0, faulting module
unknown, version 0.0.0.0, fault address 0x0012e7dc.

This is really annoying me as I can't figure out what the cause is.... Any
help would be appreciated.

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3621
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title> </head> <style type="text/css">
4
6729
by: Julian Hershel | last post by:
Hi. I have a very simple web service that I am trying to call from a classic ASP page. The web service project and the ASP page are both on my development machine. That's the code of my web service: <WebService(Namespace:="http://tempuri.org/")> _ Public Class TextData Inherits System.Web.Services.WebService
6
301
by: Jake | last post by:
Hello, We have some code (see below) that has been working intermittently and I was wondering if someone had a better approach or an idea on why we get these errors. This part of code basically gets a file and uploads it from a cable or DSL connection to our t1 line to a server. The file size ranges from 1.7 MB to 4MB and there can be between 1-40 files that need to be uploaded to our server. We also could have multiple laptops running...
3
3160
by: Paul Michaud | last post by:
Consider the following: Class A { .... } Class B:A { ....
5
2873
by: Andrew | last post by:
Hey all, Requesting help from the VB.Net gurus in here. I was given a task to write a Windows Service (VB.Net) that would run an external program, and if that program closed for any reason (other than the service being stopped) it would restart it. I have written the service to do just this, and for testing purposes I am running the program Notepad. And I even have it making entries in the System Event Log. However, and this is my...
0
5577
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
4
6914
by: =?Utf-8?B?Z3Jhenph?= | last post by:
Hello If someone can help me with this it would be greatly appreciated. I’m no web service expert but I don't think i'm trying to do anything too special. I think i must be missing something simple because i have been banging my head against a wall with this for a while now. I have created a web service and a client Win forms application to consume the web service. The problem is i don't know where the web service will be deployed...
0
2700
by: =?Utf-8?B?U2ltb25EZXY=?= | last post by:
Hi All I would like to install the same Windows Service project on the same server under different names, one for each customer. I have been able to do it but I would like an expert opinion as to whether my solution is robust or whether there is a better way to do it. What I've been trying to do is to create a core project with different extension projects, one for each customer. I wanted to create a different Setup project for each...
1
2764
by: Nadeem Ashraf | last post by:
Hi, We are developing a web based application "UltraLearn.com" with a mix of junior/senior Microsoft technologies. That includes Microsoft Silverlight, ASP.Net Ajax and WCF/WF. Recently, we have hit the wall with some of tested/proven technologies. The problem statement follows: We are calling a WCF Service from our site pages to track user navigation. The service in turn makes call to a gateway/server (using HttpWebRequest,...
0
10555
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10317
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5503
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2974
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.