aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/General/gen_ml/setup.cpp
diff options
context:
space:
mode:
authorJean-Francois Mauguit <jfmauguit@mac.com>2024-09-24 09:03:25 -0400
committerGitHub <noreply@github.com>2024-09-24 09:03:25 -0400
commitbab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/General/gen_ml/setup.cpp
parent4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff)
parent20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff)
downloadwinamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Plugins/General/gen_ml/setup.cpp')
-rw-r--r--Src/Plugins/General/gen_ml/setup.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/Src/Plugins/General/gen_ml/setup.cpp b/Src/Plugins/General/gen_ml/setup.cpp
new file mode 100644
index 00000000..1bc0c50d
--- /dev/null
+++ b/Src/Plugins/General/gen_ml/setup.cpp
@@ -0,0 +1,39 @@
+#include "./main.h"
+#include "../winamp/setup/svc_setup.h"
+
+#include <shlwapi.h>
+
+EXTERN_C _declspec(dllexport) BOOL RegisterSetup(HINSTANCE hInstance, api_service *waServices)
+{
+ WIN32_FIND_DATAW findData = {0};
+ WCHAR szPath[MAX_PATH] = {0}, szBase[MAX_PATH] = {0};
+
+ if (0 == GetModuleFileNameW(hInstance, szBase, ARRAYSIZE(szBase)))
+ return 0;
+
+ PathRemoveFileSpecW(szBase);
+ PathCombineW(szPath, szBase, L"ml_*.dll");
+
+
+ HANDLE hFind = FindFirstFileW(szPath, &findData);
+ if (INVALID_HANDLE_VALUE == hFind)
+ return FALSE;
+
+ do
+ {
+ PathCombineW(szPath, szBase, findData.cFileName);
+ HINSTANCE hLib = LoadLibraryW(szPath);
+ if (NULL != hLib)
+ {
+ Plugin_RegisterSetup fn = (Plugin_RegisterSetup)GetProcAddress(hLib, "RegisterSetup");
+ if (NULL == fn || FALSE == fn(hLib, waServices))
+ {
+ FreeModule(hLib);
+ }
+ }
+ }
+ while (FindNextFileW(hFind, &findData));
+ FindClose(hFind);
+
+ return FALSE;
+} \ No newline at end of file