Ejemplo n.º 1
0
        /// <summary>
        /// Read COM proxy information from a ProxyFileInfo structure.
        /// </summary>
        /// <param name="proxy_file_info">The address of the ProxyFileInfo structure.</param>
        /// <returns>The list of parsed proxy definitions.</returns>
        public IEnumerable <NdrComProxyDefinition> ReadFromProxyFileInfo(IntPtr proxy_file_info)
        {
            List <NdrComProxyDefinition> interfaces = new List <NdrComProxyDefinition>();

            if (!RunWithAccessCatch(() => InitFromProxyFileInfo(_reader.ReadStruct <ProxyFileInfo>(proxy_file_info), interfaces)))
            {
                throw new NdrParserException("Can't find proxy information in server DLL");
            }

            return(interfaces.AsReadOnly());
        }
 public MIDL_SERVER_INFO GetServerInfo(IMemoryReader reader)
 {
     if (InterpreterInfo == IntPtr.Zero)
     {
         return(new MIDL_SERVER_INFO());
     }
     return(reader.ReadStruct <MIDL_SERVER_INFO>(InterpreterInfo));
 }
 public MIDL_STUB_DESC GetStubDesc(IMemoryReader reader)
 {
     if (pStubDesc == IntPtr.Zero)
     {
         return(new MIDL_STUB_DESC());
     }
     return(reader.ReadStruct <MIDL_STUB_DESC>(pStubDesc));
 }
 public NDR_EXPR_DESC GetExprDesc(IMemoryReader reader)
 {
     if (pExprInfo != IntPtr.Zero)
     {
         return(reader.ReadStruct <NDR_EXPR_DESC>(pExprInfo));
     }
     return(new NDR_EXPR_DESC());
 }
        public RPC_DISPATCH_TABLE GetDispatchTable(IMemoryReader reader)
        {
            if (DispatchTable == IntPtr.Zero)
            {
                return(new RPC_DISPATCH_TABLE());
            }

            return(reader.ReadStruct <RPC_DISPATCH_TABLE>(DispatchTable));
        }
 public RPC_SYNTAX_IDENTIFIER GetTransferSyntax(IMemoryReader reader)
 {
     if (pTransferSyntax == IntPtr.Zero)
     {
         return(new RPC_SYNTAX_IDENTIFIER()
         {
             SyntaxGUID = NdrNativeUtils.DCE_TransferSyntax
         });
     }
     return(reader.ReadStruct <RPC_SYNTAX_IDENTIFIER>(pTransferSyntax));
 }
Ejemplo n.º 7
0
        private void ReadTypes(IntPtr midl_type_pickling_info_ptr, IntPtr midl_stub_desc_ptr, IEnumerable <int> fmt_offsets)
        {
            if (midl_type_pickling_info_ptr == IntPtr.Zero)
            {
                throw new ArgumentException("Must specify the MIDL_TYPE_PICKLING_INFO pointer");
            }

            if (midl_stub_desc_ptr == IntPtr.Zero)
            {
                throw new ArgumentException("Must specify the MIDL_STUB_DESC pointer");
            }

            var pickle_info = _reader.ReadStruct <MIDL_TYPE_PICKLING_INFO>(midl_type_pickling_info_ptr);

            if (pickle_info.Version != 0x33205054)
            {
                throw new ArgumentException($"Unsupported picking type version {pickle_info.Version:X}");
            }

            var             flags     = pickle_info.Flags.HasFlag(MidlTypePicklingInfoFlags.NewCorrDesc) ? NdrInterpreterOptFlags2.HasNewCorrDesc : 0;
            MIDL_STUB_DESC  stub_desc = _reader.ReadStruct <MIDL_STUB_DESC>(midl_stub_desc_ptr);
            NdrParseContext context   = new NdrParseContext(_type_cache, null, stub_desc, stub_desc.pFormatTypes, stub_desc.GetExprDesc(_reader),
                                                            flags, _reader, NdrParserFlags.IgnoreUserMarshal);

            foreach (var i in fmt_offsets)
            {
                NdrBaseTypeReference.Read(context, i);
            }
        }
Ejemplo n.º 8
0
        private void ReadTypes(IntPtr midl_type_pickling_info_ptr, IntPtr fmt_str_ptr, IEnumerable <int> fmt_offsets)
        {
            var pickle_info = _reader.ReadStruct <MIDL_TYPE_PICKLING_INFO>(midl_type_pickling_info_ptr);

            if (pickle_info.Version != 0x33205054)
            {
                throw new ArgumentException($"Unsupported picking type version {pickle_info.Version:X}");
            }
            int desc_size = 4;

            if ((pickle_info.Flags & MidlTypePicklingInfoFlags.NewCorrDesc) != 0)
            {
                desc_size = 6;
                // TODO: Might need to support extended correlation descriptors.
            }
            NdrParseContext context = new NdrParseContext(_type_cache, null, new MIDL_STUB_DESC(), fmt_str_ptr, desc_size, _reader, NdrParserFlags.IgnoreUserMarshal);

            foreach (var i in fmt_offsets)
            {
                NdrBaseTypeReference.Read(context, i);
            }
        }
 internal static T[] ReadPointerArray <T>(this IMemoryReader reader, IntPtr p, int count) where T : struct
 {
     return(ReadPointerArray(reader, p, count, i => reader.ReadStruct <T>(i)));
 }
 internal static T[] EnumeratePointerList <T>(this IMemoryReader reader, IntPtr p) where T : struct
 {
     return(EnumeratePointerList(reader, p, i => reader.ReadStruct <T>(i)));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Parse NDR content from an RPC_SERVER_INTERFACE structure in memory.
 /// </summary>
 /// <param name="server_interface">Pointer to the RPC_SERVER_INTERFACE.</param>
 /// <returns>The parsed NDR content.</returns>
 public NdrRpcServerInterface ReadRpcServerInterface(IntPtr server_interface)
 {
     return(ReadRpcServerInterface(_reader, _reader.ReadStruct <RPC_SERVER_INTERFACE>(server_interface), _type_cache, _symbol_resolver));
 }