From 8e7e14aa6c8cb19ecafeb021265bc42dc914af35 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Fri, 7 Jul 2023 02:30:05 +0100 Subject: [PATCH] fetches the dll path from the registry --- lib/voicemeeter/install.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 lib/voicemeeter/install.rb diff --git a/lib/voicemeeter/install.rb b/lib/voicemeeter/install.rb new file mode 100644 index 0000000..69d4b96 --- /dev/null +++ b/lib/voicemeeter/install.rb @@ -0,0 +1,34 @@ +require "win32/registry" +require "pathname" +require "ffi" + +module Voicemeeter + private + + #stree-ignore + module Install + OS_BITS = FFI::Platform::CPU.downcase == "x64" ? 64 : 32 + + def get_vmpath() + reg_key = [ + :Software, + (OS_BITS == 64 ? :WOW6432Node : nil), + :Microsoft, + :Windows, + :CurrentVersion, + :Uninstall, + :'VB:Voicemeeter {17359A74-1236-5467}' + ] + + Win32::Registry::HKEY_LOCAL_MACHINE.open( + reg_key.compact.join("\\") + ) do |reg| + value = reg[:UninstallString.to_s] + + Pathname.new(value).dirname + end + end + + module_function :get_vmpath + end +end