Jump-start your project by learning from devs who
write Windows drivers and file systems every day.
Take an OSR seminar!

Upcoming OSR Seminars:
WDM Lab, Seattle, WA 16 August 2010
WDF Lab, Santa Clara, CA 27 September 2010
Debug Lab, Portland, OR 18 October 2010
Windows Internals & Software Drivers Lab, Santa Clara, CA 15 November 2010


Go Back   OSR Online Lists > ntdev
Welcome, Guest
You must login to post to this list
  Message 1 of 5  
12 Jun 01 17:07
Sander Pool
xxxxxx@rhapsodynetworks.com
Join Date: 01 Jun 2001
Posts To This List: 19
ddk samples crash in ntdll.dll

Hello, I've been trying to track down the cause of a crash in NTDLL.dll when I run one of the ddk samples (general\setup\enable). The thing is that I can build the application using the provided shell and BLD command and it runs fine. I then tried to move parts of the code into my own dll that I'm developing using the VC6 IDE. James Antognini pointed out to leave the /GZ flag out to make it compile. So now it compiles and links but as soon as the program starts it crashes. To reduce the size of the problem I let VC create a simple win32 console app and I stuck a single bogus call: // DLLHELL.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <tchar.h> // Make program ansi AND unicode safe #include <windows.h> // Most Windows functions #include <commctrl.h> // Used for TreeView controls #include <setupapi.h> // Used for SetupDiXxx functions #include <cfgmgr32.h> // Used for CM_Xxxx functions #include <regstr.h> // Extract Registry Strings int main(int argc, char* argv[]) { DWORD Status, Problem; SP_DEVINFO_DATA DeviceInfoData = {sizeof(SP_DEVINFO_DATA)}; CM_Get_DevNode_Status(&Status, &Problem, DeviceInfoData.DevInst,0); printf("Hello World!\n"); return 0; } As soon as I run this I get a 'user breakpoint called' crash at the following location: NTDLL! 77f9eea9() NTDLL! 77fcd942() NTDLL! 77fb54c9() NTDLL! 77fb4316() NTDLL! 77fab4ab() SETUPAPI! 778834e2() SETUPAPI! 77883019() SETUPAPI! 77882ce7() SETUPAPI! 77882b69() NTDLL! 77f8bfcc() NTDLL! 77f8f5cb() NTDLL! 77f8f56d() NTDLL! 77f9f02f() Can anyone help please? Looks like somehow things get misalligned or something. Perhaps things got broken when I installed SP5 for VC6? My link flags look like this: cfgmgr32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/DLLHELL.pdb" /debug /machine:I386 /out:"Debug/DLLHELL.exe" /pdbtype:sept /libpath:"c:\ntddk\libchk\i386" My compile flags like this: /nologo /MLd /W3 /Gm /GX /ZI /Od /I "c:\ntddk\inc" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Debug/DLLHELL.pch" /YX I appreciate your time and assistance, Sander --- You are currently subscribed to ntdev as: $subst('Recip.EmailAddr') To unsubscribe send a blank email to leave-ntdev-$subst('Recip.MemberIDChar')@lists.osr.com
  Message 2 of 5  
12 Jun 01 17:47
Sander Pool
xxxxxx@rhapsodynetworks.com
Join Date: 01 Jun 2001
Posts To This List: 19
RE: ddk samples crash in ntdll.dll

Per Dave Jones' suggestion I ran my example in Windbg. I didn't even bother trying to add a dialog box or something because the application crashes before it hits 'main'. So I loaded my app and hit 'F5' and the following appeared: HEAP[RST_DC_Test.exe]: Heap block at 00134970 modified at 00134BD2 past requested size of 25a Hard coded breakpoint hit This is repeatable and I'm sure it's something I'm doing wrong during compilation. In fact it seems related to the removal of the /GZ flag? Stack and heap are not the same of course but I'm grasping for straws here :-) This is with Windbg 5.00.2195.11 if it makes a difference. Thanks, Sander > -----Original Message----- > From: Dave Jones [mailto:xxxxx@digi.com] > Sent: Tuesday, June 12, 2001 2:21 PM > To: 'Sander Pool' > Subject: FW: [ntdev] ddk samples crash in ntdll.dll > > > Sander: > <...excess quoted lines suppressed...> --- You are currently subscribed to ntdev as: $subst('Recip.EmailAddr') To unsubscribe send a blank email to leave-ntdev-$subst('Recip.MemberIDChar')@lists.osr.com
  Message 3 of 5  
12 Jun 01 20:22
Mark Roddy
xxxxxx@hollistech.com
Join Date: 25 Feb 2000
Posts To This List: 2663
RE: ddk samples crash in ntdll.dll

You should go immediately to http://www.microsoft.com/ddk/debugging/ and get the version of windbg found there abouts. Do not bother with anything from either the NT4 or W2K ddk's as they are bogus. > -----Original Message----- > From: xxxxx@lists.osr.com > [mailto:xxxxx@lists.osr.com] On Behalf Of Sander Pool > Sent: Tuesday, June 12, 2001 5:44 PM > To: NT Developers Interest List > Subject: [ntdev] RE: ddk samples crash in ntdll.dll > > > <...excess quoted lines suppressed...> --- You are currently subscribed to ntdev as: $subst('Recip.EmailAddr') To unsubscribe send a blank email to leave-ntdev-$subst('Recip.MemberIDChar')@lists.osr.com
  Message 4 of 5  
13 Jun 01 04:25
Norbert Kawulski
xxxxxx@stollmann.de
Join Date: 02 Jan 2001
Posts To This List: 174
Re: ddk samples crash in ntdll.dll

Looks like you want to get DevNodeStatus for Devinst==NULL. Thats not so clever. Try to get a valid Devnode first and then get the status for that one. > int main(int argc, char* argv[]) > { > DWORD Status, Problem; > SP_DEVINFO_DATA DeviceInfoData = {sizeof(SP_DEVINFO_DATA)}; // ^-- this leaves (AFAIK) // DeviceInfoData.DevInst==NULL > CM_Get_DevNode_Status(&Status, &Problem, > DeviceInfoData.DevInst,0); > printf("Hello World!\n"); > return 0; > } ----------------------------------------------------------------- | Norbert Kawulski | mailto:xxxxx@stollmann.de | | Stollmann T.P.GmbH, Development | http://www.stollmann.de | --If it's ISDN or Bluetooth, make sure it's driven by Stollmann-- "That which does not kill us makes us stronger." --- You are currently subscribed to ntdev as: $subst('Recip.EmailAddr') To unsubscribe send a blank email to leave-ntdev-$subst('Recip.MemberIDChar')@lists.osr.com
  Message 5 of 5  
13 Jun 01 12:43
Sander Pool
xxxxxx@rhapsodynetworks.com
Join Date: 01 Jun 2001
Posts To This List: 19
Re: ddk samples crash in ntdll.dll

Hi Norbert, you are right, that wouldn't be very smart for a real application. However, this was the shortest example I could create that would crash *before* I even hit that CM_* call. Sander > -----Original Message----- > From: Norbert Kawulski [mailto:xxxxx@stollmann.de] > > > Looks like you want to get DevNodeStatus for Devinst==NULL. > Thats not so clever. Try to get a valid Devnode first and then get the > status for that one. > > int main(int argc, char* argv[]) > > { <...excess quoted lines suppressed...> --- You are currently subscribed to ntdev as: $subst('Recip.EmailAddr') To unsubscribe send a blank email to leave-ntdev-$subst('Recip.MemberIDChar')@lists.osr.com
Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You must login to OSR Online AND be a member of the ntdev list to be able to post.

All times are GMT -5. The time now is 13:51.


Copyright ©2005, OSR Open Systems Resourcs, Inc.
Based on vBulletin Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Modified under license