internal static extern bool CryptDecodeObjectEx( [In] CertificateEncodingType dwCertEncodingType, [In] IntPtr /* LPCSTR */ lpszStructType, [In] byte[] pbEncoded, [In] int cbEncoded, [In] EncodingFlags dwFlags, [In] IntPtr /* PCRYPT_DECODE_PARA */ pDecodePara, [In, Out] ref IntPtr pvStructInfo, [In, Out] ref int pcbStructInfo);
public EncodingOptions(string charsetName, string cultureName, EncodingFlags encodingFlags) { this.CultureName = cultureName; this.EncodingFlags = encodingFlags; charset = charsetName == null ? null : Globalization.Charset.GetCharset(charsetName); if (charset == null) return; charset.GetEncoding(); }
// Token: 0x060001FF RID: 511 RVA: 0x000093DA File Offset: 0x000075DA public EncodingOptions(string charsetName, string cultureName, EncodingFlags encodingFlags) { this.cultureName = cultureName; this.encodingFlags = encodingFlags; this.charset = ((charsetName == null) ? null : Charset.GetCharset(charsetName)); if (this.charset != null) { this.charset.GetEncoding(); } }
static (Map, byte, EncodingFlags) parsePrefix(List <byte> encoding) { Map map = Map.Primary; byte operandIndex = 0; EncodingFlags flags = 0; bool done = false; const byte RexMask = 0xf0; const byte RexW = 0x8; const byte ByteL = 0x04; const byte ByteW = 0x80; while (!done) { switch ((Prefixes)encoding[operandIndex]) { case Prefixes.OpSize: flags |= EncodingFlags.P; operandIndex++; break; case Prefixes.Rep: flags |= EncodingFlags.F2; operandIndex++; break; case Prefixes.Repne: flags |= EncodingFlags.F3; operandIndex++; break; case Prefixes.ES: case Prefixes.CS: case Prefixes.SS: case Prefixes.DS: case Prefixes.FS: case Prefixes.GS: case Prefixes.AddSize: case Prefixes.Lock: operandIndex++; break; default: done = true; break; } } // Handle Rex prefix if ((encoding[operandIndex] & RexMask) == (byte)Prefixes.Rex) { byte rex = encoding[operandIndex++]; flags |= EncodingFlags.Rex; if ((rex & RexW) != 0) { flags |= EncodingFlags.W; } } switch ((Prefixes)encoding[operandIndex]) { case Prefixes.Secondary: switch ((Prefixes)encoding[operandIndex + 1]) { case Prefixes.Secondary: map = Map.NOW3D; operandIndex += 1; break; case Prefixes.F38: map = Map.F38; operandIndex += 2; break; case Prefixes.F3A: map = Map.F3A; operandIndex += 2; break; default: map = Map.Secondary; operandIndex += 1; break; } break; case Prefixes.Vex: case Prefixes.Xop: { var byte1 = encoding[operandIndex + 1]; var byte2 = encoding[operandIndex + 2]; if ((Prefixes)encoding[operandIndex] == Prefixes.Vex) { switch (encoding[operandIndex + 1] & 0x1f) { case 0x1: map = Map.Vex1; break; case 0x2: map = Map.Vex2; break; case 0x3: map = Map.Vex3; break; default: throw new Exception($"Unexpected VEX map {encoding.ToString()}"); } } else { switch (encoding[operandIndex + 1] & 0x1f) { case 0x0: case 0x1: case 0x2: case 0x3: case 0x4: case 0x5: case 0x6: case 0x7: map = Map.Primary; break; case 0x8: map = Map.XOP8; break; case 0x9: map = Map.XOP9; break; case 0xA: map = Map.XOPA; break; default: { string encodingString = new string(""); foreach (var b in encoding) { encodingString += $"{b:x} "; } throw new Exception($"Unexpected XOP map \noperandIndex:{operandIndex}\nflags:{flags}\nencoding:{encodingString}"); } } if (map == Map.Primary) { goto default; } } if ((byte2 & ByteW) != 0) { flags |= EncodingFlags.W; } if ((byte2 & ByteL) != 0) { flags |= EncodingFlags.L; } operandIndex += 3; break; } case Prefixes.VexShort: { var byte1 = encoding[operandIndex + 1]; map = Map.Vex1; if ((byte1 & ByteL) != 0) { flags |= EncodingFlags.L; } operandIndex += 3; break; } default: map = Map.Primary; break; } return(map, operandIndex, flags); }