diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/rpc/ndrdbg/misc.cxx | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to 'private/rpc/ndrdbg/misc.cxx')
-rw-r--r-- | private/rpc/ndrdbg/misc.cxx | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/private/rpc/ndrdbg/misc.cxx b/private/rpc/ndrdbg/misc.cxx new file mode 100644 index 000000000..e97884e85 --- /dev/null +++ b/private/rpc/ndrdbg/misc.cxx @@ -0,0 +1,127 @@ +/*++ + +Copyright (c) 1994 Microsoft Corporation + +Module Name: + + misc.cxx + +Abstract: + + This file contains ntsd debugger extensions for RPC NDR. + +Author: + + David Kays (dkays) August 1 1994 + +Revision History: + +--*/ + +#include <sysinc.h> +#include <rpc.h> +#include <rpcndr.h> + +#include <ntsdexts.h> +#include <ntdbg.h> + +#include <ndrtypes.h> + +#include "misc.hxx" + +extern DWORD NdrRegKeyPickling; + +char * +GetProcFormatString( + HANDLE hCurrentProcess, + PNTSD_EXTENSION_APIS lpExtensionApis, + unsigned int ProcNum, + char * FormatStringAddr + ) +{ + BOOL Status; + BOOL Done; + char * FormatStringStartAddr; + DWORD FormatStringSize; + char FormatChar; + char * pProcFormat; + PNTSD_OUTPUT_ROUTINE pfnOutput; + + pfnOutput = lpExtensionApis->lpOutputRoutine; + + Done = FALSE; + FormatStringStartAddr = FormatStringAddr; + + // For pickling, we have also the proc header to read. + + if ( NdrRegKeyPickling == 1 ) + { + Status = ReadProcessMemory( hCurrentProcess, + FormatStringAddr, + &FormatChar, + 1, + NULL ); + + FormatStringAddr += ( FormatChar == 0 ) ? 10 : 6; + } + + // Now the parameter descriptions. + + for (;!Done;) + { + Status = ReadProcessMemory( hCurrentProcess, + FormatStringAddr, + &FormatChar, + 1, + NULL ); + + switch ( FormatChar ) + { + case FC_IN_PARAM_BASETYPE : + FormatStringAddr += 2; + break; + + case FC_RETURN_PARAM_BASETYPE : + FormatStringAddr += 2; + Done = TRUE; + break; + + case FC_IN_PARAM : + case FC_OUT_PARAM : + case FC_IN_OUT_PARAM : + case FC_IN_PARAM_NO_FREE_INST : + FormatStringAddr += 4; + break; + + case FC_RETURN_PARAM : + FormatStringAddr += 4; + Done = TRUE; + break; + + case FC_END : + FormatStringAddr += 2; + Done = TRUE; + break; + + default : + return 0; + } + + } + + FormatStringSize = FormatStringAddr - FormatStringStartAddr; + + pProcFormat = new char[FormatStringSize]; + + if ( ! pProcFormat ) + return 0; + + Status = ReadProcessMemory( hCurrentProcess, + FormatStringStartAddr, + pProcFormat, + FormatStringSize, + NULL ); + + return pProcFormat; +} + |