473,320 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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.dwCurrentState = SERVICE_STOPPED;
ServiceStatus.dwWin32ExitCode = 0;
ServiceStatus.dwCheckPoint += 1;
ServiceStatus.dwWaitHint = 0;
SetServiceStatus(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 1186
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(DWORD 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.dwCurrentState = SERVICE_STOPPED;
ServiceStatus.dwWin32ExitCode = 0;
ServiceStatus.dwCheckPoint += 1;
ServiceStatus.dwWaitHint = 0;
SetServiceStatus(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
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>...
4
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...
6
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...
3
by: Paul Michaud | last post by:
Consider the following: Class A { .... } Class B:A { ....
5
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...
0
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...
4
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...
0
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...
1
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.