Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
ca1c8b21
Commit
ca1c8b21
authored
Apr 24, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix link errors with GCC/Clang on Windows.
parent
9c076941
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
3 deletions
+24
-3
mini_al.h
mini_al.h
+24
-3
No files found.
mini_al.h
View file @
ca1c8b21
...
...
@@ -1289,6 +1289,11 @@ struct mal_context
/*HMODULE*/
mal_handle
hUser32DLL
;
mal_proc
GetForegroundWindow
;
mal_proc
GetDesktopWindow
;
/*HMODULE*/
mal_handle
hAdvapi32DLL
;
mal_proc
RegOpenKeyExA
;
mal_proc
RegCloseKey
;
mal_proc
RegQueryValueExA
;
}
win32
;
#endif
#ifdef MAL_POSIX
...
...
@@ -2681,6 +2686,10 @@ typedef int (WINAPI * MAL_PFN_StringFromGUID2)(const GUID* const rguid, LPOL
typedef
HWND
(
WINAPI
*
MAL_PFN_GetForegroundWindow
)();
typedef
HWND
(
WINAPI
*
MAL_PFN_GetDesktopWindow
)();
typedef
LSTATUS
(
WINAPI
*
MAL_PFN_RegOpenKeyExA
)(
HKEY
hKey
,
LPCSTR
lpSubKey
,
DWORD
ulOptions
,
REGSAM
samDesired
,
PHKEY
phkResult
);
typedef
LSTATUS
(
WINAPI
*
MAL_PFN_RegCloseKey
)(
HKEY
hKey
);
typedef
LSTATUS
(
WINAPI
*
MAL_PFN_RegQueryValueExA
)(
HKEY
hKey
,
LPCSTR
lpValueName
,
LPDWORD
lpReserved
,
LPDWORD
lpType
,
LPBYTE
lpData
,
LPDWORD
lpcbData
);
#endif
...
...
@@ -7029,12 +7038,12 @@ mal_result mal_context_get_device_info_from_WAVECAPS(mal_context* pContext, MAL_
mal_strcat_s
(
keyStr
,
sizeof
(
keyStr
),
guidStr
);
HKEY
hKey
;
LONG result =
RegOpenKeyExA
(HKEY_LOCAL_MACHINE, keyStr, 0, KEY_READ, &hKey);
LONG
result
=
((
MAL_PFN_RegOpenKeyExA
)
pContext
->
win32
.
RegOpenKeyExA
)
(
HKEY_LOCAL_MACHINE
,
keyStr
,
0
,
KEY_READ
,
&
hKey
);
if
(
result
==
ERROR_SUCCESS
)
{
BYTE
nameFromReg
[
512
];
DWORD
nameFromRegSize
=
sizeof
(
nameFromReg
);
result =
RegQueryValueExA
(hKey, "Name", 0, NULL, (LPBYTE)nameFromReg, (LPDWORD)&nameFromRegSize);
RegCloseKey
(hKey);
result
=
((
MAL_PFN_RegQueryValueExA
)
pContext
->
win32
.
RegQueryValueExA
)
(
hKey
,
"Name"
,
0
,
NULL
,
(
LPBYTE
)
nameFromReg
,
(
LPDWORD
)
&
nameFromRegSize
);
((
MAL_PFN_RegCloseKey
)
pContext
->
win32
.
RegCloseKey
)
(
hKey
);
if
(
result
==
ERROR_SUCCESS
)
{
// We have the value from the registry, so now we need to construct the name string.
...
...
@@ -14444,6 +14453,7 @@ mal_result mal_context_uninit_backend_apis__win32(mal_context* pContext)
mal_CoUninitialize
(
pContext
);
mal_dlclose
(
pContext
->
win32
.
hUser32DLL
);
mal_dlclose
(
pContext
->
win32
.
hOle32DLL
);
mal_dlclose
(
pContext
->
win32
.
hAdvapi32DLL
);
return
MAL_SUCCESS
;
}
...
...
@@ -14473,6 +14483,17 @@ mal_result mal_context_init_backend_apis__win32(mal_context* pContext)
pContext
->
win32
.
GetForegroundWindow
=
(
mal_proc
)
mal_dlsym
(
pContext
->
win32
.
hUser32DLL
,
"GetForegroundWindow"
);
pContext
->
win32
.
GetDesktopWindow
=
(
mal_proc
)
mal_dlsym
(
pContext
->
win32
.
hUser32DLL
,
"GetDesktopWindow"
);
// Advapi32.dll
pContext
->
win32
.
hAdvapi32DLL
=
mal_dlopen
(
"advapi32.dll"
);
if
(
pContext
->
win32
.
hAdvapi32DLL
==
NULL
)
{
return
MAL_FAILED_TO_INIT_BACKEND
;
}
pContext
->
win32
.
RegOpenKeyExA
=
(
mal_proc
)
mal_dlsym
(
pContext
->
win32
.
hAdvapi32DLL
,
"RegOpenKeyExA"
);
pContext
->
win32
.
RegCloseKey
=
(
mal_proc
)
mal_dlsym
(
pContext
->
win32
.
hAdvapi32DLL
,
"RegCloseKey"
);
pContext
->
win32
.
RegQueryValueExA
=
(
mal_proc
)
mal_dlsym
(
pContext
->
win32
.
hAdvapi32DLL
,
"RegQueryValueExA"
);
#endif
mal_CoInitializeEx
(
pContext
,
NULL
,
0
);
// 0 = COINIT_MULTITHREADED
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment