MFC application Crashes in NTDLL.dll

1.6k views Asked by At

I have an MFC based application. It keeps looking for a file after few seconds (using CreateTimerQueueTimer based timer) and perform some action. This is always crashing (for unknown reason) on XP. This application works fine on windows 7 and windows 8. But problem on XP is persistent.

Below is the call stack which doesn't show any help Call stack after the crash

Disassembly screenshot is below:

enter image description here

EDIT1:

I changed few settings and I got this new call stack. But still did not get the clue.: enter image description here

I am not understanding how can i track down the reason for crash. Is there any hint or any way to track it sown from disassembly? Or may there be any issue with system's NTDLL.DLL file? Any help is welcome.

1

There are 1 answers

0
DTdev On BEST ANSWER

After analyzing the stack, I realized that there might be a problem with the timer call back. I chnaged my timer (createtimerqueuetimer function) to a wait thread and problem was solved. But still the question is open for answer to why timer callback was crashing after few calls? I am just setting and resetting the variable in callback function after 30 sec. so I am not suspecting any pointer related issue.

EDIT1:

Finaly I Got the answer. I needed to change

void MyTimerCallbackRoutine(PVOID lpParameter, BOOLEAN TimerOrWaitFired)

To:

VOID CALLBACK MyTimerCallbackRoutine(PVOID lpParameter, BOOLEAN TimerOrWaitFired)

The problem was related to timer callback function. generally the CALLBACK and WINAPIs are defined as stdcall where as normal functions by default uses cdecl.