summaryrefslogtreecommitdiffstats
path: root/private/rpc/ndrdbg/xmit.cxx
blob: 093152e87d80713e1edc49a8e08dc00ad428e870 (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
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Copyright (c) 1989 Microsoft Corporation

 Module Name:
    
    xmit.cxx

 Abstract:

    Implements an output routine for transmit_as and xmit_as types.

 Notes:


 History:

     Sep 15, 1994        RyszardK        Created

 ----------------------------------------------------------------------------*/

#include <sysinc.h>
#include <rpc.h>
#include <rpcndr.h>

#include <ntsdexts.h>

#include "ndrtypes.h"
#include "bufout.hxx"

void 
XMIT_AS::Output()
{
    uchar   Format[10];
    NDR *   Ndr;
    long    FO;

    if ( fOutputLimitReached )
        return;

    FormatString->Read( FormatOffset, Format, 10 );

    if ( Format[0] != FC_TRANSMIT_AS  &&  Format[0] != FC_REPRESENT_AS )
        ABORT2( "Xmit as expected, %s=%x found\n",
                FormatString->GetFormatCharName( Format[0] ),
                Format[0] );

    PrintIndent();
    Print( "%s (transmitted type shown)\n",
           (Format[0] == FC_TRANSMIT_AS) ? "Transmit As"
                                         : "Represent As" );
    FO = FormatOffset + 8;
    FO += GET_SHORT( Format + 8 );

    FormatString->Read( FO, Format, 1 );

    Ndr = Create( Format[0],
                  FO,
                  this );
    IndentInc();

    Ndr->Output();

    IndentDec();

    delete Ndr;
}

long
GetXmittedOffset( long FO )
/*+
    This ia a peek routine to see if in fact an xmit as is handled.
    The assumption is we are at a member.
    If the member is FC_EMBEDDED_COMPLEX that is xmit as we get the offset.
    Otherwise, -1.
-*/
{
    uchar   Format[10];
    long    XmittedOffset = -1;

    FormatString->Read( FO, Format, 1 );

    if ( Format[0] == FC_EMBEDDED_COMPLEX )
        {
        FormatString->Read( FO, Format, 4 );
        FO += 2 + GET_SHORT( Format + 2 );

        FormatString->Read( FO, Format, 1 );
        }

    if ( Format[0] == FC_TRANSMIT_AS  ||  Format[0] == FC_REPRESENT_AS )
        {
        FormatString->Read( FO, Format, 10 );
        XmittedOffset = FO + 8 + GET_SHORT( Format + 8 );

        if ( GetXmittedOffset( XmittedOffset ) != -1 )
            XmittedOffset = GetXmittedOffset( XmittedOffset );
        }

    return XmittedOffset; 
}