Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
debug.c
Package: shell.rar [view]
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 4k
Category:
Windows Kernel
Development Platform:
Visual C++
- ////////////////////////////////////////////////////////////////////////////////
- //
- // debug.c
- //
- ////////////////////////////////////////////////////////////////////////////////
- #include "priv.h"
- #pragma hdrstop
- #ifdef DEBUG
- #ifndef WINNT
- #include <windows.h>
- //#include <stdlib.h>
- //#include <stdio.h>
- #include "debug.h"
- #endif
- void
- _Assert
- (DWORD dw, LPSTR lpszExp, LPSTR lpszFile, DWORD dwLine)
- {
- DWORD dwT;
- TCHAR lpszT[256];
- wsprintf (lpszT, TEXT("Assertion %hs Failed.nn%hs, line# %ldnnYes to continue, No to debug, Cancel to exit"), lpszExp, lpszFile, dwLine);
- dwT = MessageBox (GetFocus(), lpszT, TEXT("Assertion Failed!"), MB_YESNOCANCEL);
- switch (dwT)
- {
- case IDCANCEL :
- //exit (1);
- FatalExit(1);
- case IDNO :
- DebugTrap;
- }
- }
- void
- _AssertSz
- (DWORD dw, LPSTR lpszExp, LPTSTR lpsz, LPSTR lpszFile, DWORD dwLine)
- {
- DWORD dwT;
- TCHAR lpszT[512];
- wsprintf (lpszT, TEXT("Assertion %hs Failed.nn%sn%hs, line# %ldnnYes to continue, No to debug, Cancel to exit"), lpszExp, lpsz, lpszFile, dwLine);
- dwT = MessageBox (GetFocus(), lpszT, TEXT("Assertion Failed!"), MB_YESNOCANCEL);
- switch (dwT)
- {
- case IDCANCEL:
- //exit (1);
- FatalExit(1);
- case IDNO :
- DebugTrap;
- }
- }
- #ifdef LOTS_O_DEBUG
- #include <windows.h>
- #include <winerror.h>
- #include <oleauto.h>
- #include "debug.h"
- void
- _DebugHr
- (HRESULT hr, LPTSTR lpszFile, DWORD dwLine)
- {
- TCHAR lpstzT[512];
- switch (hr) {
- case S_OK :
- return;
- case STG_E_INVALIDNAME:
- wsprintf (lpstzT, TEXT("tBogus filenamenn%s, line# %ldn"),lpszFile, dwLine);
- break;
- case STG_E_INVALIDFUNCTION :
- wsprintf (lpstzT, TEXT("tInvalid Functionnn%s, line# %ldn"),lpszFile, dwLine);
- break;
- case STG_E_FILENOTFOUND:
- wsprintf (lpstzT, TEXT("tFile not foundnn%s, line# %ldn"),lpszFile, dwLine);
- break;
- case STG_E_INVALIDFLAG:
- wsprintf (lpstzT, TEXT("tBogus flagnn%s, line# %ldn"),lpszFile, dwLine);
- break;
- case STG_E_INVALIDPOINTER:
- wsprintf (lpstzT, TEXT("tBogus pointernn%s, line# %ldn"),lpszFile, dwLine);
- break;
- case STG_E_ACCESSDENIED:
- wsprintf (lpstzT, TEXT("tAccess Deniednn%s, line# %ldn"),lpszFile, dwLine);
- break;
- case STG_E_INSUFFICIENTMEMORY :
- case E_OUTOFMEMORY :
- wsprintf (lpstzT, TEXT("tInsufficient Memorynn%s, line# %ldn"),lpszFile, dwLine);
- break;
- case E_INVALIDARG :
- wsprintf (lpstzT, TEXT("tInvalid argumentnn%s, line# %ldn"),lpszFile, dwLine);
- break;
- case TYPE_E_UNKNOWNLCID:
- wsprintf (lpstzT, TEXT("tUnknown LCIDnn%s, line# %ldn"),lpszFile, dwLine);
- break;
- case TYPE_E_CANTLOADLIBRARY:
- wsprintf (lpstzT, TEXT("tCan't load typelib or dllnn%s, line# %ldn"),lpszFile, dwLine);
- break;
- case TYPE_E_INVDATAREAD:
- wsprintf (lpstzT, TEXT("tCan't read filenn%s, line# %ldn"),lpszFile, dwLine);
- break;
- case TYPE_E_INVALIDSTATE:
- wsprintf (lpstzT, TEXT("tTypelib couldn't be openednn%s, line# %ldn"),lpszFile, dwLine);
- break;
- case TYPE_E_IOERROR:
- wsprintf (lpstzT, TEXT("tI/O errornn%s, line# %ldn"),lpszFile, dwLine);
- break;
- default:
- wsprintf (lpstzT, TEXT("tUnknown HRESULT %lx (%ld) nn%s, line# %ldn"),hr, hr, lpszFile, dwLine);
- }
- MessageBox (GetFocus(), lpstzT, NULL, MB_OK);
- return;
- }
- void
- _DebugGUID (GUID g)
- {
- TCHAR lpsz[200];
- wsprintf (lpsz, TEXT("GUID is: %lx-%hx-%hx-%hx%hx-%hx%hx%hx%hx%hx%hx"),
- g.Data1, g.Data2, g.Data3, g.Data4[0], g.Data4[1], g.Data4[2], g.Data4[3],
- g.Data4[4], g.Data4[5], g.Data4[6], g.Data4[7]);
- DebugSz (lpsz);
- }
- #endif // LOTS_O_DEBUG
- #endif // DEBUG