Skip to content

Commit

Permalink
Исправлена работа системного фильтра "File Source (Async.)" с файлами…
Browse files Browse the repository at this point in the history
… AVI в GraphStudioNext (и возможно в другом софте).

Если регистрировать BASS Audio Source по старой схеме, то GraphStudioNext не может построить граф для файлов AVI. В графе появляется один системный фильтр "File Source (Async.)", который ни к чему не подключен.

Изменен GUID раздела реестра (куда пишутся сигнатуры) на {FFFB1509-D0C1-4E23-8DAC-4BF554615BB6}. Благодаря трем F в начале раздел фильтра в реестре будет последним в HKEY_CLASSES_ROOT\Media Type\{E436EB83-524F-11CE-9F53-0020AF0BA770}\, что устраняет баг.
  • Loading branch information
v0lt committed May 10, 2023
1 parent 392baa3 commit 853b1e8
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions Source/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "BassSource.h"
#include "dllmain.h"

#define STR_GUID_REGISTRY "{FFFB1509-D0C1-4E23-8DAC-4BF554615BB6}" // need a large enough value to be at the end of the list

HMODULE HInstance;

template <class T>
Expand Down Expand Up @@ -73,6 +75,16 @@ CFactoryTemplate g_Templates[] = {
};
int g_cTemplates = (int)std::size(g_Templates);

void ClearRegistry()
{
HKEY hKey;
LONG ec = ::RegOpenKeyExW(HKEY_CLASSES_ROOT, L"Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}", 0, KEY_ALL_ACCESS, &hKey);
if (ec == ERROR_SUCCESS) {
ec = ::RegDeleteKeyW(hKey, _CRT_WIDE(STR_CLSID_BassAudioSource)); // purge registration of old versions
ec = ::RegDeleteKeyW(hKey, _CRT_WIDE(STR_GUID_REGISTRY));
::RegCloseKey(hKey);
}
}

//
// DllRegisterServer
Expand All @@ -81,8 +93,10 @@ int g_cTemplates = (int)std::size(g_Templates);
//
STDAPI DllRegisterServer()
{
ClearRegistry();

HKEY hKey;
LONG ec = ::RegCreateKeyExW(HKEY_CLASSES_ROOT, L"Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}\\" STR_CLSID_BassAudioSource, 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, 0);
LONG ec = ::RegCreateKeyExW(HKEY_CLASSES_ROOT, L"Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}\\" STR_GUID_REGISTRY, 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, 0);
if (ec == ERROR_SUCCESS) {
const LPCWSTR value_data0 = _CRT_WIDE(STR_CLSID_BassAudioSource);
const LPCWSTR value_data1 = L"0,1,00,00"; // connect to any data
Expand All @@ -106,12 +120,7 @@ STDAPI DllRegisterServer()
//
STDAPI DllUnregisterServer()
{
HKEY hKey;
LONG ec = ::RegOpenKeyExW(HKEY_CLASSES_ROOT, L"Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}", 0, KEY_ALL_ACCESS, &hKey);
if (ec == ERROR_SUCCESS) {
ec = ::RegDeleteKeyW(hKey, _CRT_WIDE(STR_CLSID_BassAudioSource));
::RegCloseKey(hKey);
}
ClearRegistry();

return AMovieDllRegisterServer2(FALSE);
}
Expand Down

0 comments on commit 853b1e8

Please sign in to comment.