summaryrefslogtreecommitdiffstats
path: root/private/ole32/dbgexts/dstdid.cxx
blob: cf9319ec1d9557210ad29f1b224af6e71594bec9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (C) Microsoft Corporation, 1995
//
//  File:       dstdid.cxx
//
//  Contents:   Ole NTSD extension routines to display CStdIdentity table
//
//  Functions:  stdidHelp
//              displayStdid
//
//
//  History:    06-01-95 BruceMa    Created
//
//
//--------------------------------------------------------------------------


#include <ole2int.h>
#include <windows.h>
#include "ole.h"
#include "dipid.h"
#include "dchannel.h"
#include "dstdid.h"


void FormatCLSID(REFGUID rguid, LPSTR lpsz);
ULONG ScanAddr(char *lpsz);




//+-------------------------------------------------------------------------
//
//  Function:   stdidHelp
//
//  Synopsis:   Display a menu for the command 'id'
//
//  Arguments:  -
//
//  Returns:    -
//
//  History:    07-Mar-95   BruceMa    Created
//
//--------------------------------------------------------------------------
void stdidHelp(PNTSD_EXTENSION_APIS lpExtensionApis)
{
    Printf("\nid       - Display entire CStdIdentity table:\n");
    Printf("addr  oid tid pUnkControl\n");
    Printf("...\n\n");
    Printf("\nid <stdidAdr> - Display CStdIdentity entry:\n");
    Printf("oid mrshlFlags 1stIPID chnlBfr nestedCalls mrshlTime pUnkOuter [pIEC] strongRefs\n");
    Printf("...\n\n");
}






//+-------------------------------------------------------------------------
//
//  Function:   displayStdid
//
//  Synopsis:   Display the CStdIdentify table
//
//  Arguments:  [hProcess]        -       Handle of this process
//              [lpExtensionApis] -       Table of extension functions
//
//  Returns:    -
//
//  History:    07-Mar-95   BruceMa    Created
//
//--------------------------------------------------------------------------
void displayStdid(HANDLE hProcess,
                  PNTSD_EXTENSION_APIS lpExtensionApis,
                  ULONG p)
{
    SIDArray          stdidtbl;
    int               nEnt;
    IDENTRY          *pStdEntries;
    IDENTRY           stdEntry;
    SStdIdentity      stdid;
    char              szOID[CLSIDSTR_MAX];
    SRpcChannelBuffer chanBfr;
    
    // Read the standard identity table
    ReadMem(&stdidtbl, p, sizeof(SIDArray));

    // Do over entries in this table
    for (nEnt = 0, pStdEntries = (IDENTRY *) stdidtbl.m_afv.m_pData;
         nEnt < stdidtbl.m_afv.m_nSize;
         nEnt++, pStdEntries++)
    {
        // Read the next entry
        ReadMem(&stdEntry, pStdEntries, sizeof(IDENTRY));

        // CStdIdentity address
        Printf("%x  ", stdEntry.m_pStdID);

        // Display the object identifier
        FormatCLSID(stdEntry.m_oid, szOID);
        Printf("%s ", szOID);

        // The thread ID
        Printf("%3x ", stdEntry.m_tid);

        // pUnkControl
        Printf("%x\n", stdEntry.m_pUnkControl);
    }

    Printf("\n");
}






//+-------------------------------------------------------------------------
//
//  Function:   displayStdidEntry
//
//  Synopsis:   Display an entry in the CStdIdentify table
//
//  Arguments:  [hProcess]        -       Handle of this process
//              [lpExtensionApis] -       Table of extension functions
//
//  Returns:    -
//
//  History:    07-Mar-95   BruceMa    Created
//
//--------------------------------------------------------------------------
void displayStdidEntry(HANDLE hProcess,
                  PNTSD_EXTENSION_APIS lpExtensionApis,
                  ULONG p,
                  char *arg)
{
    ULONG             pAdr;
    SStdIdentity      stdid;
    char              szOID[CLSIDSTR_MAX];


    // Check for help
    if (arg[0] == '?')
    {
        Printf("oid mrshlFlags 1stIPID chnlBfr nestedCalls mrshlTime pUnkOuter [pIEC] strongRefs\n");
        return;
    }

    // Read the standard identity entry
    pAdr = ScanAddr(arg);
    ReadMem(&stdid, pAdr, sizeof(SStdIdentity));

    // Display the object identifier
    FormatCLSID(stdid.m_oid, szOID);
    Printf("%s ", szOID);

    // Marshal flags
    Printf("%08x ", stdid._dwFlags);

    // First IPID       
    Printf("%d.%d ", stdid._iFirstIPID >> 16, stdid._iFirstIPID & 0xffff);

    // Address of CRpcChannelBuffer
    Printf("%x ", stdid._pChnl);

    // Count of nested calls
    Printf("%d ", stdid._cNestedCalls);

    // Marshal time
    Printf("%d ", stdid._dwMarshalTime);

    // Address of pUnkOuter
    Printf("%x ", stdid.m_pUnkOuter);

    // Address of IExternalConnection (if present)
    if (stdid.m_pIEC)
    {
        Printf("%x ", stdid.m_pIEC);
    }

    // Count of strong references
    Printf("%d\n", stdid.m_cStrongRefs);
}