Annotation of win32/development/msvcee/custview.h, revision 1.2
1.1 paf 1: #ifndef CUSTVIEW_H
2: #define CUSTVIEW_H
3:
4: #include <windows.h>
5:
6: #define MAX_STRING 0x400
1.2 ! paf 7: typedef const char * CORD;
1.1 paf 8:
9: typedef struct tagDEBUGHELPER
10: {
11: DWORD dwVersion;
12: BOOL (WINAPI *ReadDebuggeeMemory)( struct tagDEBUGHELPER *pThis, DWORD dwAddr, DWORD nWant, VOID* pWhere, DWORD *nGot );
13: // from here only when dwVersion >= 0x20000
14: DWORDLONG (WINAPI *GetRealAddress)( struct tagDEBUGHELPER *pThis );
15: BOOL (WINAPI *ReadDebuggeeMemoryEx)( struct tagDEBUGHELPER *pThis, DWORDLONG qwAddr, DWORD nWant, VOID* pWhere, DWORD *nGot );
16: int (WINAPI *GetProcessorType)( struct tagDEBUGHELPER *pThis );
17:
18: template<typename T>
19: T* peek(T* foreign) {
1.2 ! paf 20: if(!foreign)
! 21: return 0;
! 22:
1.1 paf 23: T* result=new T;
24: DWORD nGot;
25: // read from debuggee memory space
26: if (ReadDebuggeeMemory(this, (DWORD)foreign, sizeof(T), (void*)result, &nGot)!=S_OK)
27: throw 1;
28: if (nGot!=sizeof(T))
29: throw 1;
30:
31: return result;
32: }
33:
1.2 ! paf 34: template<>
1.1 paf 35: const char* peek<>(const char* foreign) {
1.2 ! paf 36: if(!foreign)
! 37: return 0;
! 38:
1.1 paf 39: char* result=new char[MAX_STRING];
40: DWORD nGot;
41: // read from debuggee memory space
42: if (ReadDebuggeeMemory(this, (DWORD)foreign, MAX_STRING, (void*)result, &nGot)!=S_OK)
43: throw 1;
44: result[MAX_STRING-1]=0;
45:
46: return result;
47: }
48: #define D(fp) (pHelper->peek(fp))
49:
50: } DEBUGHELPER;
51:
52: typedef HRESULT (WINAPI *CUSTOMVIEWER)( DWORD dwAddress, DEBUGHELPER *pHelper, int nBase, BOOL bUniStrings, char *pResult, size_t max, DWORD reserved );
53:
54: #endif
E-mail: