Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
101 changed files
with
6,700 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// acmenum.cpp | ||
|
||
#include <windows.h> | ||
#include <mmreg.h> | ||
#include <mmiscapi.h> | ||
#include <msacm.h> | ||
#include <stdio.h> | ||
|
||
#include "acmenum.h" | ||
#include "details.h" | ||
#include "list.h" | ||
#include "log.h" | ||
|
||
BOOL myAcmDriverEnumCallback( | ||
HACMDRIVERID hadid, | ||
DWORD_PTR dwInstance, | ||
DWORD fdwSupport | ||
); | ||
|
||
MMRESULT EnumerateACMDrivers() { | ||
AcmDriverList list; | ||
|
||
MMRESULT mmr = acmDriverEnum( | ||
myAcmDriverEnumCallback, | ||
reinterpret_cast<DWORD_PTR>(&list), // app-specific pointer | ||
ACM_DRIVERENUMF_DISABLED // include disabled drivers | ||
); | ||
|
||
if (MMSYSERR_NOERROR != mmr) { | ||
ERR(L"acmDriverEnum failed: mmr = 0x%08x", mmr); | ||
return mmr; | ||
} | ||
|
||
LOG(L"ACM Drivers found: %u", list.nCount); | ||
for (UINT32 i = 0; i < list.nCount; i++) { | ||
ACMDRIVERDETAILS details = {0}; | ||
details.cbStruct = sizeof(details); | ||
|
||
mmr = acmDriverDetails(list.pDrivers[i].id, &details, 0); | ||
if (MMSYSERR_NOERROR != mmr) { | ||
ERR(L"acmDriverDetails failed: mmr = 0x%08x", mmr); | ||
return mmr; | ||
} | ||
|
||
if (list.pDrivers[i].fdwSupport != details.fdwSupport) { | ||
ERR( | ||
L"Different fdwSupport values from " | ||
L"acmDriverEnum Callback (0x%08x) and acmDriverDetails (0x%08x)", | ||
list.pDrivers[i].fdwSupport, | ||
details.fdwSupport | ||
); | ||
} | ||
|
||
LogDetails(details); | ||
|
||
LOG(L""); // blank line | ||
} | ||
|
||
return MMSYSERR_NOERROR; | ||
} | ||
|
||
BOOL myAcmDriverEnumCallback( | ||
HACMDRIVERID hadid, | ||
DWORD_PTR dwInstance, | ||
DWORD fdwSupport | ||
) { | ||
AcmDriverList *pList = reinterpret_cast<AcmDriverList *>(dwInstance); | ||
MMRESULT mmr = pList->Add(AcmDriverInfo(hadid, fdwSupport)); | ||
|
||
return (MMSYSERR_NOERROR == mmr); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// acmenum.h | ||
|
||
MMRESULT EnumerateACMDrivers(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// details.cpp | ||
|
||
#include <windows.h> | ||
#include <mmreg.h> | ||
#include <mmiscapi.h> | ||
#include <msacm.h> | ||
#include <stdio.h> | ||
|
||
#include "details.h" | ||
#include "log.h" | ||
|
||
#define CHARS_FROM_FOURCC(x) \ | ||
(CHAR)((x) & 0xff), \ | ||
(CHAR)(((x) >> 8) & 0xff), \ | ||
(CHAR)(((x) >> 16) & 0xff), \ | ||
(CHAR)(((x) >> 24) & 0xff) \ | ||
|
||
#define COMPONENTS_FROM_VERSION_DWORD(x) \ | ||
((x) >> 24), \ | ||
(((x) >> 16) & 0xff), \ | ||
(((x) >> 8) & 0xffff) | ||
|
||
#define DISPLAY_FLAG(flag, x) \ | ||
(((x) & (flag)) == (flag) ? L" " L ## #flag L"\n" : L"") | ||
|
||
#define DISPLAY_INVALID_FLAGS(mask, x) \ | ||
(((x) & ~(mask)) == 0 ? L"" : L" Invalid flags!\n") | ||
|
||
|
||
void LogDetails(ACMDRIVERDETAILS details) { | ||
|
||
LOG( | ||
L"-- ACM Driver Details: %s --\n" | ||
L" cbStruct: %u\n" | ||
L" fccType: 0x%08x (%hc%hc%hc%hc)\n" | ||
L" fccComp: 0x%08x (%hc%hc%hc%hc)\n" | ||
L" wMid: %u\n" | ||
L" wPid: %u\n" | ||
L" vdwACM: 0x%08x (%u.%u.%u)\n" | ||
L" vdwDriver: 0x%08x (%u.%u.%u)\n" | ||
L" fdwSupport: 0x%08x\n" | ||
L"%s%s%s%s%s%s%s%s" | ||
L" cFormatTags: %d\n" | ||
L" cFilterTags: %d\n" | ||
L" hicon: 0x%p\n" | ||
L" szShortName: \"%s\"\n" | ||
L" szLongName: \"%s\"\n" | ||
L" szCopyright: \"%s\"\n" | ||
L" szLicensing: \"%s\"\n" | ||
L" szFeatures: \"%s\"", | ||
|
||
details.szShortName, | ||
details.cbStruct, | ||
details.fccType, CHARS_FROM_FOURCC(details.fccType ? details.fccType : 0x20202020), // print spaces rather than \0s | ||
details.fccComp, CHARS_FROM_FOURCC(details.fccComp ? details.fccComp : 0x20202020), // to allow piping | ||
details.wMid, | ||
details.wPid, | ||
details.vdwACM, COMPONENTS_FROM_VERSION_DWORD(details.vdwACM), | ||
details.vdwDriver, COMPONENTS_FROM_VERSION_DWORD(details.vdwDriver), | ||
details.fdwSupport, | ||
DISPLAY_FLAG( ACMDRIVERDETAILS_SUPPORTF_ASYNC, details.fdwSupport ), | ||
DISPLAY_FLAG( ACMDRIVERDETAILS_SUPPORTF_CODEC, details.fdwSupport ), | ||
DISPLAY_FLAG( ACMDRIVERDETAILS_SUPPORTF_CONVERTER, details.fdwSupport ), | ||
DISPLAY_FLAG( ACMDRIVERDETAILS_SUPPORTF_DISABLED, details.fdwSupport ), | ||
DISPLAY_FLAG( ACMDRIVERDETAILS_SUPPORTF_FILTER, details.fdwSupport ), | ||
DISPLAY_FLAG( ACMDRIVERDETAILS_SUPPORTF_HARDWARE, details.fdwSupport ), | ||
DISPLAY_FLAG( ACMDRIVERDETAILS_SUPPORTF_LOCAL, details.fdwSupport ), | ||
DISPLAY_INVALID_FLAGS( | ||
ACMDRIVERDETAILS_SUPPORTF_ASYNC | | ||
ACMDRIVERDETAILS_SUPPORTF_CODEC | | ||
ACMDRIVERDETAILS_SUPPORTF_CONVERTER | | ||
ACMDRIVERDETAILS_SUPPORTF_DISABLED | | ||
ACMDRIVERDETAILS_SUPPORTF_FILTER | | ||
ACMDRIVERDETAILS_SUPPORTF_HARDWARE | | ||
ACMDRIVERDETAILS_SUPPORTF_LOCAL, | ||
details.fdwSupport | ||
), | ||
details.cFormatTags, | ||
details.cFilterTags, | ||
details.hicon, // this is a shared icon - do not call DestroyIcon(..) on this HICON | ||
details.szShortName, | ||
details.szLongName, | ||
details.szCopyright, | ||
details.szLicensing, | ||
details.szFeatures | ||
); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// details.h | ||
|
||
void LogDetails(ACMDRIVERDETAILS details); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// list.cpp | ||
|
||
#include <windows.h> | ||
#include <mmreg.h> | ||
#include <mmiscapi.h> | ||
#include <msacm.h> | ||
#include <stdio.h> | ||
|
||
#include "list.h" | ||
#include "log.h" | ||
|
||
// AcmDriverInfo | ||
AcmDriverInfo::AcmDriverInfo() | ||
: id(NULL), fdwSupport(0) | ||
{} | ||
|
||
AcmDriverInfo::AcmDriverInfo(HACMDRIVERID i, DWORD d) | ||
: id(i), fdwSupport(d) | ||
{} | ||
|
||
// AcmDriverList | ||
AcmDriverList::AcmDriverList() | ||
: nCount(0), pDrivers(NULL) | ||
{} | ||
|
||
|
||
AcmDriverList::~AcmDriverList() { | ||
if (NULL != pDrivers) { | ||
delete [] pDrivers; | ||
} | ||
} | ||
|
||
MMRESULT AcmDriverList::Add(AcmDriverInfo newDriver) { | ||
// allocate the new list | ||
AcmDriverInfo *pNewDrivers = new AcmDriverInfo[nCount + 1]; | ||
|
||
if (NULL == pNewDrivers) { | ||
ERR(L"Could not allocate %u-element AcmDriverInfo array", nCount + 1); | ||
return MMSYSERR_NOMEM; | ||
} | ||
|
||
// copy all the old drivers over | ||
for (UINT32 i = 0; i < nCount; i++) { | ||
pNewDrivers[i] = pDrivers[i]; | ||
} | ||
|
||
// don't forget the new driver | ||
pNewDrivers[nCount] = newDriver; | ||
|
||
// free the old list | ||
if (NULL != pDrivers) { | ||
delete [] pDrivers; | ||
} | ||
|
||
// swap in the new list | ||
pDrivers = pNewDrivers; | ||
nCount++; | ||
|
||
return MMSYSERR_NOERROR; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// list.h | ||
|
||
struct AcmDriverInfo { | ||
HACMDRIVERID id; | ||
DWORD fdwSupport; | ||
|
||
AcmDriverInfo(); | ||
AcmDriverInfo(HACMDRIVERID i, DWORD d); | ||
}; | ||
|
||
struct AcmDriverList { | ||
UINT32 nCount; | ||
AcmDriverInfo *pDrivers; | ||
|
||
AcmDriverList(); | ||
~AcmDriverList(); | ||
|
||
MMRESULT Add(AcmDriverInfo newDriver); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// log.h | ||
|
||
#define LOG(sz, ...) wprintf(sz L"\n", __VA_ARGS__); | ||
#define ERR(sz, ...) wprintf(L"ERROR: " sz L"\n", __VA_ARGS__); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// main.cpp | ||
|
||
#include <windows.h> | ||
#include <mmreg.h> | ||
#include <mmiscapi.h> | ||
#include <msacm.h> | ||
#include <stdio.h> | ||
|
||
#include "log.h" | ||
#include "acmenum.h" | ||
|
||
int _cdecl wmain() { | ||
|
||
MMRESULT mmr = EnumerateACMDrivers(); | ||
|
||
return mmr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# sources | ||
TARGETTYPE = PROGRAM | ||
TARGETNAME = acmenum | ||
UMTYPE = console | ||
UMENTRY = wmain | ||
USE_MSVCRT = 1 | ||
|
||
C_DEFINES = $(C_DEFINES) -DUNICODE -D_UNICODE | ||
|
||
MSC_WARNING_LEVEL = /W4 /WX | ||
|
||
_NT_TARGET_VERSION = $(_NT_TARGET_VERSION_WINXP) | ||
|
||
SOURCES = \ | ||
acmenum.cpp \ | ||
details.cpp \ | ||
list.cpp \ | ||
main.cpp \ | ||
|
||
TARGETLIBS = \ | ||
$(SDK_LIB_PATH)\ole32.lib \ | ||
$(SDK_LIB_PATH)\msacm32.lib \ | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// apoenum.cpp | ||
|
||
#include <windows.h> | ||
#include <audioenginebaseapo.h> | ||
#include <stdio.h> | ||
|
||
#include "apoenum.h" | ||
#include "details.h" | ||
#include "log.h" | ||
|
||
HRESULT myEnumerateAPOsCallback( | ||
PAPO_REG_PROPERTIES pProperties, | ||
PVOID pvRefData | ||
); | ||
|
||
HRESULT EnumerateAudioProcessingObjects() { | ||
UINT32 nCount = 0; | ||
|
||
HRESULT hr = EnumerateAPOs(myEnumerateAPOsCallback, &nCount); | ||
if (FAILED(hr)) { | ||
ERR(L"EnumerateAPOs failed: hr = 0x%08x", hr); | ||
return hr; | ||
} | ||
|
||
LOG(L"APOs found: %u", nCount); | ||
|
||
return S_OK; | ||
} | ||
|
||
// note that APO_REG_PROPERTIES is a variable-sized structure so beware of slicing | ||
// also note that it's only valid for the life of the callback; | ||
// if you want to store the info for use later, make a deep copy | ||
HRESULT myEnumerateAPOsCallback( | ||
PAPO_REG_PROPERTIES pProperties, | ||
PVOID pvRefData | ||
) { | ||
UINT32 *pnCount = reinterpret_cast<UINT32 *>(pvRefData); | ||
if (NULL == pnCount) { | ||
ERR(L"myEnumerateAPOsCallback got a NULL pvRefData"); | ||
return E_POINTER; | ||
} | ||
|
||
(*pnCount)++; | ||
|
||
return LogDetails(pProperties); // LogDetails logs its own failures | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// apoenum.h | ||
|
||
HRESULT EnumerateAudioProcessingObjects(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// cleanup.cpp | ||
#include <windows.h> | ||
#include <objbase.h> | ||
#include <stdio.h> | ||
|
||
#include "log.h" | ||
#include "cleanup.h" | ||
|
||
// CoTaskMemFreeOnExit | ||
CoTaskMemFreeOnExit::CoTaskMemFreeOnExit(PVOID p) | ||
: m_p(p) | ||
{} | ||
|
||
CoTaskMemFreeOnExit::~CoTaskMemFreeOnExit() { | ||
CoTaskMemFree(m_p); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// cleanup.h | ||
|
||
class CoTaskMemFreeOnExit { | ||
public: | ||
CoTaskMemFreeOnExit(PVOID p); | ||
~CoTaskMemFreeOnExit(); | ||
|
||
private: | ||
PVOID m_p; | ||
}; |
Oops, something went wrong.