1 | //////////////////////////////////////////////////////////// |
---|
2 | // Copyright (C) Roman Ryltsov, 2008-2015 |
---|
3 | // Created by Roman Ryltsov roman@alax.info, http://alax.info |
---|
4 | // |
---|
5 | // This source code is published to complement DirectShowSpy developer powertoy |
---|
6 | // and demonstrate the internal use of APIs and tricks powering the tool. It is |
---|
7 | // allowed to freely re-use the portions of the code in other projects, commercial |
---|
8 | // or otherwise (provided that you dont pretend that you wrote the original tool). |
---|
9 | // |
---|
10 | // Please keep in mind that DirectShowSpy is a developer tool, it is strongly recommended |
---|
11 | // that it is not shipped with release grade software. It is allowed to distribute |
---|
12 | // DirectShowSpy if only it is not registered with Windows by default and either |
---|
13 | // used privately, or registered on specific throubleshooting request. The advice applies |
---|
14 | // to hooking methods used by DirectShowSpy in general as well. |
---|
15 | |
---|
16 | #include "stdafx.h" |
---|
17 | #include "resource.h" |
---|
18 | #include "FilterGraphSpy.h" |
---|
19 | #include "FilterMapperSpy.h" |
---|
20 | #include "SystemDeviceEnumeratorSpy.h" |
---|
21 | |
---|
22 | //////////////////////////////////////////////////////////// |
---|
23 | // DoGraphBuilderCallbackPropertySheetModal |
---|
24 | |
---|
25 | #include "GraphBuilderCallbackPropertySheet.h" |
---|
26 | |
---|
27 | #if defined(_WIN64) |
---|
28 | extern "C" __declspec(dllexport) |
---|
29 | #else |
---|
30 | #pragma comment(linker, "/EXPORT:DoGraphBuilderCallbackPropertySheetModal=_DoGraphBuilderCallbackPropertySheetModal@16,PRIVATE") |
---|
31 | extern "C" // __declspec(dllexport) |
---|
32 | #endif // defined(_WIN64) |
---|
33 | |
---|
34 | HRESULT STDMETHODCALLTYPE DoGraphBuilderCallbackPropertySheetModal(HWND hParentWindow, HINSTANCE, LPSTR pszCommandLine, INT nShowCommand) |
---|
35 | { |
---|
36 | hParentWindow; pszCommandLine; nShowCommand; |
---|
37 | _ATLTRY |
---|
38 | { |
---|
39 | CSingleThreadedApartment SingleThreadedApartment; |
---|
40 | _W(AtlInitCommonControls(ICC_WIN95_CLASSES | ICC_COOL_CLASSES | ICC_STANDARD_CLASSES)); |
---|
41 | CGraphBuilderCallbackPropertySheet PropertySheet; |
---|
42 | PropertySheet.DoModal(GetActiveWindow()); |
---|
43 | } |
---|
44 | _ATLCATCH(Exception) |
---|
45 | { |
---|
46 | _C(Exception); |
---|
47 | } |
---|
48 | return S_OK; |
---|
49 | } |
---|
50 | |
---|
51 | //////////////////////////////////////////////////////////// |
---|
52 | // DoFilterGraphListPropertySheetModal |
---|
53 | |
---|
54 | #include "FilterGraphList.h" |
---|
55 | |
---|
56 | #if defined(_WIN64) |
---|
57 | extern "C" __declspec(dllexport) |
---|
58 | #else |
---|
59 | #pragma comment(linker, "/EXPORT:DoFilterGraphListPropertySheetModal=_DoFilterGraphListPropertySheetModal@16,PRIVATE") |
---|
60 | extern "C" // __declspec(dllexport) |
---|
61 | #endif // defined(_WIN64) |
---|
62 | |
---|
63 | HRESULT STDMETHODCALLTYPE DoFilterGraphListPropertySheetModal(HWND hParentWindow, HINSTANCE, LPSTR pszCommandLine, INT nShowCommand) |
---|
64 | { |
---|
65 | hParentWindow; pszCommandLine; nShowCommand; |
---|
66 | _ATLTRY |
---|
67 | { |
---|
68 | CSingleThreadedApartment SingleThreadedApartment; |
---|
69 | _W(AtlInitCommonControls(ICC_WIN95_CLASSES | ICC_COOL_CLASSES | ICC_STANDARD_CLASSES)); |
---|
70 | CFilterGraphListPropertySheet PropertySheet; |
---|
71 | PropertySheet.DoModal(GetActiveWindow()); |
---|
72 | } |
---|
73 | _ATLCATCH(Exception) |
---|
74 | { |
---|
75 | _C(Exception); |
---|
76 | } |
---|
77 | return S_OK; |
---|
78 | } |
---|
79 | |
---|
80 | //////////////////////////////////////////////////////////// |
---|
81 | // DoGraphBuilderCallbackPropertySheetModal |
---|
82 | |
---|
83 | #include "MediaSampleTrace.h" |
---|
84 | |
---|
85 | #if defined(_WIN64) |
---|
86 | extern "C" __declspec(dllexport) |
---|
87 | #else |
---|
88 | #pragma comment(linker, "/EXPORT:DoMediaSampleTracePropertySheetModal=_DoMediaSampleTracePropertySheetModal@16,PRIVATE") |
---|
89 | extern "C" // __declspec(dllexport) |
---|
90 | #endif // defined(_WIN64) |
---|
91 | |
---|
92 | HRESULT STDMETHODCALLTYPE DoMediaSampleTracePropertySheetModal(HWND hParentWindow, HINSTANCE, LPSTR pszCommandLine, INT nShowCommand) |
---|
93 | { |
---|
94 | hParentWindow; pszCommandLine; nShowCommand; |
---|
95 | _ATLTRY |
---|
96 | { |
---|
97 | CSingleThreadedApartment SingleThreadedApartment; |
---|
98 | _W(AtlInitCommonControls(ICC_WIN95_CLASSES | ICC_COOL_CLASSES | ICC_STANDARD_CLASSES)); |
---|
99 | CMediaSampleTracePropertySheet PropertySheet; |
---|
100 | PropertySheet.DoModal(GetActiveWindow()); |
---|
101 | } |
---|
102 | _ATLCATCH(Exception) |
---|
103 | { |
---|
104 | _C(Exception); |
---|
105 | } |
---|
106 | return S_OK; |
---|
107 | } |
---|
108 | |
---|
109 | #if defined(_WIN64) |
---|
110 | extern "C" __declspec(dllexport) |
---|
111 | #else |
---|
112 | #pragma comment(linker, "/EXPORT:DoMediaSampleTraceTasks=_DoMediaSampleTraceTasks@16,PRIVATE") |
---|
113 | extern "C" // __declspec(dllexport) |
---|
114 | #endif // defined(_WIN64) |
---|
115 | |
---|
116 | HRESULT STDMETHODCALLTYPE DoMediaSampleTraceTasks(HWND hParentWindow, HINSTANCE, LPSTR pszCommandLine, INT nShowCommand) |
---|
117 | { |
---|
118 | hParentWindow; pszCommandLine; nShowCommand; |
---|
119 | _ATLTRY |
---|
120 | { |
---|
121 | CSingleThreadedApartment SingleThreadedApartment; |
---|
122 | hParentWindow; nShowCommand; |
---|
123 | CCommandLineArguments Arguments((LPCWSTR) CStringW(pszCommandLine), 0); |
---|
124 | for(; ; ) |
---|
125 | { |
---|
126 | CCommandLineArguments::CArgument Argument; |
---|
127 | if(!Arguments.Next(Argument)) |
---|
128 | break; |
---|
129 | __D(!Argument.m_bSwitch, E_INVALIDARG); |
---|
130 | if(Argument.m_sValue.CompareNoCase(_T("reset")) == 0) |
---|
131 | { |
---|
132 | CMediaSampleTraceBase::ResetData(); |
---|
133 | } else |
---|
134 | if(Argument.m_sValue.CompareNoCase(_T("write")) == 0) |
---|
135 | { |
---|
136 | CCommandLineArguments::CArgument PathArgument; |
---|
137 | __D(Arguments.Next(PathArgument), E_INVALIDARG); |
---|
138 | __D(!PathArgument.m_bSwitch, E_INVALIDARG); |
---|
139 | CMediaSampleTraceBase::SaveToFile(CMediaSampleTraceBase::CreateDataText(), (LPCTSTR) PathArgument.m_sValue); |
---|
140 | } else |
---|
141 | __C(E_INVALIDARG); |
---|
142 | } |
---|
143 | } |
---|
144 | _ATLCATCH(Exception) |
---|
145 | { |
---|
146 | _C(Exception); |
---|
147 | } |
---|
148 | return S_OK; |
---|
149 | } |
---|
150 | |
---|