/// <summary> /// Construct the object with a given architecture and a given mode. /// </summary> /// <param name="architecture">Architecture</param> /// <param name="mode">Mode, i.e. endianess, word size etc.</param> /// <param name="throwOnKeystoneError">Throw when there are errors</param> /// <remarks> /// Some architectures are not supported. /// Check with <see cref="IsArchitectureSupported(KeystoneArchitecture)"/> if the engine /// support the architecture. /// </remarks> public Keystone(KeystoneArchitecture architecture, KeystoneMode mode, bool throwOnKeystoneError = true) { internalImpl = SymbolResolver; throwOnError = throwOnKeystoneError; var result = KeystoneImports.Open(architecture, (int)mode, ref engine); if (result != KeystoneError.KS_ERR_OK && throwOnKeystoneError) { throw new InvalidOperationException($"Error while initializing keystone: {ErrorToString(result)}"); } }
public Keystone( KeystoneArchitecture architecture, KeystoneMode mode, bool throwOnKeystoneError = true) { this.internalImpl = new Keystone.ResolverInternal(this.SymbolResolver); this.throwOnError = throwOnKeystoneError; KeystoneError result = KeystoneImports.Open(architecture, (int)mode, ref this.engine); if ((uint)result > 0U & throwOnKeystoneError) { throw new InvalidOperationException(string.Format("Error while initializing keystone: {0}", (object)Keystone.ErrorToString(result))); } }