internal override IList<ulong> GetMethodDescList(ulong methodTable) { IMethodTableData mtData = Request<IMethodTableData, LegacyMethodTableData>(DacRequests.METHODTABLE_DATA, methodTable); ulong[] values = new ulong[mtData.NumMethods]; if (mtData.NumMethods == 0) return values; CodeHeaderData codeHeader = new CodeHeaderData(); byte[] slotArgs = new byte[0x10]; byte[] result = new byte[sizeof(ulong)]; WriteValueToBuffer(methodTable, slotArgs, 0); for (int i = 0; i < mtData.NumMethods; ++i) { WriteValueToBuffer(i, slotArgs, sizeof(ulong)); if (!Request(DacRequests.METHODTABLE_SLOT, slotArgs, result)) continue; ulong ip = BitConverter.ToUInt64(result, 0); if (!RequestStruct<CodeHeaderData>(DacRequests.CODEHEADER_DATA, ip, ref codeHeader)) continue; values[i] = codeHeader.MethodDescPtr; } return values; }
private IMethodDescData GetMethodDescData(uint request_id, ulong addr) { if (addr == 0) return null; IMethodDescData result; if (_version == DesktopVersion.v4 || _minor > 4016) { result = Request<IMethodDescData, V35MethodDescData>(request_id, addr); } else if (_minor < 3053) { result = Request<IMethodDescData, V2MethodDescData>(request_id, addr); } else { // We aren't sure which version it is between 3053 and 4016, so we'll just do both. Slow, but we // might not even encounter those versions in the wild. result = Request<IMethodDescData, V35MethodDescData>(request_id, addr); if (result == null) result = Request<IMethodDescData, V2MethodDescData>(request_id, addr); } if (result == null && request_id == DacRequests.METHODDESC_IP_DATA) { CodeHeaderData codeHeaderData = new CodeHeaderData(); if (RequestStruct<CodeHeaderData>(DacRequests.CODEHEADER_DATA, addr, ref codeHeaderData)) result = GetMethodDescData(DacRequests.METHODDESC_DATA, codeHeaderData.MethodDescPtr); } return result; }
private ulong GetMethodDescFromIp(ulong ip) { if (ip == 0) return 0; IMethodDescData data = Request<IMethodDescData, V35MethodDescData>(DacRequests.METHODDESC_IP_DATA, ip); if (data == null) data = Request<IMethodDescData, V2MethodDescData>(DacRequests.METHODDESC_IP_DATA, ip); if (data == null) { CodeHeaderData codeHeaderData = new CodeHeaderData(); if (RequestStruct<CodeHeaderData>(DacRequests.CODEHEADER_DATA, ip, ref codeHeaderData)) return codeHeaderData.MethodDescPtr; } return data != null ? data.MethodDesc : 0; }