Rename architecture related functions and structs

This commit is contained in:
Robbert van der Helm
2020-11-30 21:29:57 +01:00
parent 7fc7a51a46
commit 47baef3107
7 changed files with 26 additions and 27 deletions
+3 -3
View File
@@ -5,7 +5,7 @@
namespace fs = boost::filesystem;
PluginArchitecture find_vst_architecture(fs::path plugin_path) {
LibArchitecture find_dll_architecture(fs::path plugin_path) {
std::ifstream file(plugin_path, std::ifstream::binary | std::ifstream::in);
// The linker will place the offset where the PE signature is placed at the
@@ -34,11 +34,11 @@ PluginArchitecture find_vst_architecture(fs::path plugin_path) {
// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types
switch (machine_type) {
case 0x014c: // IMAGE_FILE_MACHINE_I386
return PluginArchitecture::vst_32;
return LibArchitecture::dll_32;
break;
case 0x8664: // IMAGE_FILE_MACHINE_AMD64
case 0x0000: // IMAGE_FILE_MACHINE_UNKNOWN
return PluginArchitecture::vst_64;
return LibArchitecture::dll_64;
break;
}
+6 -7
View File
@@ -24,21 +24,20 @@
// Utilities and tags for plugin types and architectures
/**
* A tag to differentiate between 32 and 64-bit plugins, used to determine which
* host application to use.
* A tag to differentiate between 32 and 64-bit `.dll` files, used to determine
* which host application to use.
*/
enum class PluginArchitecture { vst_32, vst_64 };
enum class LibArchitecture { dll_32, dll_64 };
/**
* Determine the architecture of a VST plugin (or rather, a .dll file) based on
* it's header values.
* Determine the architecture of a `.dll` file based on the file header.
*
* See https://docs.microsoft.com/en-us/windows/win32/debug/pe-format for more
* information on the PE32 format.
*
* @param plugin_path The path to the .dll file we're going to check.
* @param path The path to the .dll file we're going to check.
*
* @return The detected architecture.
* @throw std::runtime_error If the file is not a .dll file.
*/
PluginArchitecture find_vst_architecture(boost::filesystem::path);
LibArchitecture find_dll_architecture(boost::filesystem::path);