c# barcode maker 13-1: Options Option 0 in C#

Drawer Code 3/9 in C# 13-1: Options Option 0

Table 13-1: Options Option 0
Make Code 3/9 In C#.NET
Using Barcode printer for Visual Studio .NET Control to generate, create ANSI/AIM Code 39 image in VS .NET applications.
www.OnBarcode.com
Code 39 Reader In Visual C#
Using Barcode decoder for Visual Studio .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
GetFirstStackTraceString Output Just the stack address
Creating Bar Code In Visual C#.NET
Using Barcode creation for VS .NET Control to generate, create barcode image in .NET applications.
www.OnBarcode.com
Scan Barcode In Visual C#.NET
Using Barcode recognizer for VS .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
GetNextStackTraceString
Code 39 Full ASCII Generator In VS .NET
Using Barcode creation for ASP.NET Control to generate, create Code 39 Extended image in ASP.NET applications.
www.OnBarcode.com
Creating Code 39 In Visual Studio .NET
Using Barcode drawer for .NET Control to generate, create Code 39 Extended image in VS .NET applications.
www.OnBarcode.com
GSTSO_PARAMS GSTSO_MODULE GSTSO_SYMBOL GSTSO_SRCLINE
ANSI/AIM Code 39 Generator In VB.NET
Using Barcode generation for Visual Studio .NET Control to generate, create USS Code 39 image in Visual Studio .NET applications.
www.OnBarcode.com
Making Code-128 In C#
Using Barcode generation for VS .NET Control to generate, create Code 128A image in .NET framework applications.
www.OnBarcode.com
The first four possible parameters The module name The symbol name of the stack address The source file and line number information of the stack address
Generating GS1 128 In Visual C#
Using Barcode creation for .NET framework Control to generate, create EAN128 image in Visual Studio .NET applications.
www.OnBarcode.com
Drawing Bar Code In Visual C#
Using Barcode encoder for Visual Studio .NET Control to generate, create bar code image in VS .NET applications.
www.OnBarcode.com
To show you the GetFirstStackTraceString and GetNextStackTraceString functions in action, I included two sample test programs with the sample files for this book. The first, BugslayerUtil\Tests\CrashHandler, exercises the CrashHandler methods. The second program, CrashTest, shows a full dialog box example you could display in the event of an unhandled crash. Between these two programs, you should get a pretty good idea of how to use all the functions I've presented. Figure 13-2 shows CrashTest displaying its crash dialog box.
DataMatrix Encoder In C#.NET
Using Barcode drawer for VS .NET Control to generate, create Data Matrix 2d barcode image in .NET applications.
www.OnBarcode.com
Postnet Maker In Visual C#.NET
Using Barcode generator for VS .NET Control to generate, create Postnet image in .NET applications.
www.OnBarcode.com
Figure 13-2: CrashTest dialog box Minidumps Some of you might be wondering why I went to the trouble to write and continue to support the EXCEPTION_POINTERS manipulation code in the CrashHandler library because you've heard about or used a thing called minidumps. The main reason is that there are many companies out there using my code in their applications and I didn't want to break compatibility. However, the minidump capabilities are so amazingly cool, I'm sure that many folks will rip out the existing code inside their crash handlers and simply replace it with a call to the minidump-creation functions as soon as they can. I've already talked about how to read minidump files with both Microsoft Visual Studio .NET and WinDBG in 7 and 8, respectively. What I want to turn to now is how you can create your own minidumps right from your own code. After the symbol server technology and Visual Studio .NET itself, I think that minidumps API is the second greatest thing Microsoft has released for native developers in the last couple of years! However, there are a few quirks with creating your own, so I want to show you how to get the very best minidumps possible so that you can solve your bugs much faster. The MiniDumpWriteDump API DBGHELP.DLL contains the MiniDumpWriteDump function, which does all the work. DBGHELP.DLL version 5.1 or later contains the function. This means that the versions that come with stock Microsoft Windows 2000 (up through Service Pack 3) are earlier versions and don't export MiniDumpWriteDump. Additionally, versions of DBGHELP.DLL earlier than version 6.0 had a bug in MiniDumpWriteDump that caused a deadlock when you called it to write a minidump from the current process. Fortunately, those versions were distributed only with Debugging Tools for Windows, so they should not be on users' machines. To ensure life is good for your application, your best bet is to include DBGHELP.DLL 6.1.17.1 or later with your application and install it into your application's 503
Matrix 2D Barcode Encoder In Visual Basic .NET
Using Barcode creator for Visual Studio .NET Control to generate, create Matrix 2D Barcode image in .NET framework applications.
www.OnBarcode.com
Bar Code Encoder In Objective-C
Using Barcode printer for iPhone Control to generate, create bar code image in iPhone applications.
www.OnBarcode.com
directory because it's now fully redistributable. Do not install it into the %SYSTEMROOT%\System32 directory. DBGHELP.DLL is a part of Debugging Tools for Windows (that is, WinDBG), which is included with the sample files for this book. To get the latest version of DBGHELP.DLL, go to http://www.microsoft.com/ddk/debugging/ and download Debugging Tools for Windows. After you install everything, you can extract DBGHELP.DLL from the Debugging Tools for Windows directory. The next snippet of code is the prototype for MiniDumpWriteDump. The parameters are generally self-explanatory, but I want to discuss a few highlights. The first parameter, the handle to the process, must have read and query rights. Since many of our programs are not running with full Administrator rights, you might need to do the security dance to ensure you have the rights to call MiniDumpWriteDump if you're doing impersonation or other cross user/rights programming. However, in all the different types of applications I've used MiniDumpWriteDump in, I've never needed to do any security work on the process handle. BOOL MiniDumpWriteDump ( HANDLE hProcess , DWORD ProcessId , MINIDUMP_TYPE , PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam , PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, PMINIDUMP_CALLBACK_INFORMATION CallbackParam ); The fourth parameter is the type of dump you want to write. This enumeration seems to be updated with every release of Debugging Tools for Windows, so make sure you do a custom installation of Debugging Tools for Windows and install the SDK components to get the latest DBGHELP.H header file. What's not clear from the documentation is that you can OR together the various MINIDUMP_TYPE enumeration flags to request that additional bits of information be written to the dump. No matter what you do, you'll always want to ensure MiniDumpWithHandleData is included so that you can get the handle information. If you're working with secure applications or have customers that are extremely concerned about protecting data, MiniDumpWriteDump can expose information in the dump that you DBGHELP.DLL shouldn't see. To protect users, Microsoft introduced two flags with 6.1.17.1 and later versions: MiniDumpFilterMemory and MiniDumpFilterModulePaths. The former removes private data unnecessary for stack walking, and the latter filters pathnames for usernames and important directory names. Although useful, MiniDumpFilterModulePaths can make finding the modules in a minidump harder. The final parameter of interest is the fifth, ExceptionParam. You'll set this parameter to a pointer to an EXCEPTION_POINTERS structure to get the crash information added to the minidump. For the final two parameters, you'll almost always pass NULL. However, if you do want to consider writing custom information the key program state, user preferences, object lists, or anything else your heart desires you can plop information into the 504 DumpType , HANDLE hFile
EAN13 Recognizer In None
Using Barcode scanner for Software Control to read, scan read, scan image in Software applications.
www.OnBarcode.com
Data Matrix ECC200 Drawer In Objective-C
Using Barcode drawer for iPad Control to generate, create Data Matrix ECC200 image in iPad applications.
www.OnBarcode.com
UserStreamParam parameter and get it written to the minidump file. It'll be up to you to read the user streams out with MiniDumpReadDumpStream, but the good news is that you're limited only to your imagination regarding what you want to have in a minidump. Pacifying MiniDumpWriteDump When I first looked at MiniDumpWriteDump, I immediately realized that I needed a wrapper function around it to accomplish two things: hiding the grunge of GetProcAddress because I wanted to ensure my code ran on a stock copy of Windows 2000; and avoiding having to open the file before every call to MiniDumpWriteDump. After I'd done the first version of my simple wrapper, I realized I was never going to do more than set the ExceptionParam parameter to point to the EXCEPTION_POINTERS structure I was processing in a crash. My minidump function for writing dumps in your crash handler function is CreateCurrentProcessCrashDump. I also added a function, IsMiniDumpFunctionAvailable, that returns TRUE when MiniDumpWriteDump is available in the address space. You can see both functions in the BugslayerUtil MINIDUMP.CPP file. Everything was going along well until one day, I decided I wanted a function that would snap out a minidump at any point during program execution, not just when I crashed. I was working on a server application and we wanted to be able to snap out the minidump when a specific event was signaled externally to the application. That way we could look at application states after the fact without attaching a debugger to the machine. Alas, the minidumps created by MiniDumpWriteDump weren't always readable. WinDBG always reported what looked like a bogus call stack in those snapped minidumps. Visual Studio .NET did a better job but sometimes reported weird stack walks even though I had perfect symbols all around. After a little bit of head scratching, it dawned on me what was going on. MiniDumpWriteDump was writing the call stack for the thread that was writing the dump, starting deep in the bowels of MiniDumpWriteDump itself. Even though I had perfect symbols, walking back into my code was proving very difficult. Since I was snapping out a dump file and not responding to a crash, I was a little stumped about how to proceed. Any dump files I wrote as part of a crash were perfectly formed and readable by both debuggers. Of course, to get WinDBG to read a true crash dump file, I had to issue the .ecxr;kp commands to get the exception record set and to look at the stack. That gave me the idea to set up the MINIDUMP_EXCEPTION_INFORMATION structure and fake the same information as a crash so that I could get a minidump file with good call stacks. The whole key to setting up the MINIDUMP_EXCEPTION_INFORMATION structure is getting the CONTEXT (register) information correct so that the debuggers think the fake crash looks like a real one. After much trial and error, I came up with the SnapCurrentProcessMiniDump function. Now snapping a minidump at any time will always walk the stack. You might want to examine the code in Listing 13-5 because the way it works is a little interesting. Listing 13-5: SnapCurrentProcessMiniDump and friends from MINIDUMP.CPP // The following are snippets from MINIDUMP.CPP so you can see // how SnapCurrentProcessMiniDump works. // The distances (in bytes) from a return address to the call 505
Bar Code Printer In Visual Studio .NET
Using Barcode generation for Visual Studio .NET Control to generate, create barcode image in Visual Studio .NET applications.
www.OnBarcode.com
QR Code ISO/IEC18004 Generator In Objective-C
Using Barcode encoder for iPhone Control to generate, create QR Code image in iPhone applications.
www.OnBarcode.com
// instruction for near and far calls. These are used in the // CalculateBeginningOfCallInstruction function. #define k_CALLNEARBACK #define k_CALLFARBACK 5 6
Matrix 2D Barcode Drawer In .NET Framework
Using Barcode generator for ASP.NET Control to generate, create Matrix 2D Barcode image in ASP.NET applications.
www.OnBarcode.com
Bar Code Recognizer In VB.NET
Using Barcode reader for Visual Studio .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
// The common prolog for the naked functions, // SnapCurrentProcessMiniDumpA and SnapCurrentProcessMiniDumpW. #define \ __asm PUSH */ \ __asm */ \ MOV EBP EBP , ESP SNAPPROLOG(Cntx) /* Save EBP explictly. /* Move the stack.
Copyright © OnBarcode.com . All rights reserved.