/// <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) { internalImpl = this.SymbolResolver; throwOnError = throwOnKeystoneError; KeystoneError keystoneError = KeystoneImports.Open(architecture, (int)mode, ref engine); if (keystoneError != 0 && throwOnKeystoneError) { throw new InvalidOperationException($"Error while initializing keystone: {ErrorToString(keystoneError)}"); } }
/// <summary> /// Constructs the engine with a given architecture and a given mode. /// </summary> /// <param name="architecture">The target architecture.</param> /// <param name="mode">The mode, i.e. endianness, word size etc.</param> /// <remarks> /// Some architectures are not supported. /// Check with <see cref="IsArchitectureSupported(Architecture)"/> if the engine /// supports the target architecture. /// </remarks> public Engine(Architecture architecture, Mode mode) { internalImpl = ResolveSymbolInternal; var result = NativeInterop.Open(architecture, (int)mode, ref engine); if (result != KeystoneError.KS_ERR_OK) { throw new KeystoneException("Error while initializing keystone", result); } }