-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathstreamlink-delayload.cpp
More file actions
29 lines (25 loc) · 1.02 KB
/
streamlink-delayload.cpp
File metadata and controls
29 lines (25 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "obs-streamlink.h"
#include <Windows.h>
#include "delayimp.h"
#include <filesystem>
#include <cstring>
FARPROC WINAPI obs_streamlink_delay_load(unsigned dliNotify, PDelayLoadInfo pdli);
ExternC const PfnDliHook __pfnDliNotifyHook2 = obs_streamlink_delay_load;
FARPROC WINAPI obs_streamlink_delay_load(unsigned dliNotify, PDelayLoadInfo pdli)
{
if (dliNotify == dliNotePreLoadLibrary)
{
auto pathFFmpeg = obs_streamlink_data_path / "ffmpeg" / pdli->szDll;
auto pathPython = obs_streamlink_data_path / obs_streamlink_python_ver / pdli->szDll;
if (exists(pathFFmpeg))
{
auto directLoad = LoadLibraryA(pdli->szDll);
if (!directLoad)
return reinterpret_cast<FARPROC>(LoadLibraryW(pathFFmpeg.wstring().c_str()));
return reinterpret_cast<FARPROC>(directLoad);
}
if (exists(pathPython))
return reinterpret_cast<FARPROC>(LoadLibraryW(pathPython.wstring().c_str()));
}
return 0;
}