ReactOS  0.4.15-dev-3165-gdf6fff7
msvidctl.cpp
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS DVB
4  * FILE: dll/directx/msvidctl/msvidctl.cpp
5  * PURPOSE: ReactOS DVB Initialization
6  *
7  * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8  */
9 
10 #include "precomp.h"
11 
13 {
14  {&CLSID_SystemTuningSpaces, CTuningSpaceContainer_fnConstructor},
15  {NULL, NULL}
16 };
17 
18 extern "C"
19 BOOL
20 WINAPI
22  HINSTANCE hInstDLL,
23  DWORD fdwReason,
25 {
26  switch (fdwReason)
27  {
28  case DLL_PROCESS_ATTACH:
30 
31 #ifdef MSDVBNP_TRACE
32  OutputDebugStringW(L"MSVIDCTL::DllMain()\n");
33 #endif
34 
35  DisableThreadLibraryCalls(hInstDLL);
36  break;
37  default:
38  break;
39  }
40 
41  return TRUE;
42 }
43 
44 
45 extern "C"
47 HRESULT
48 WINAPI
50 {
51  ULONG Index = 0;
52  LPOLESTR pStr;
53  HRESULT hr = S_OK;
54  HKEY hClass;
55 
56  if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_SET_VALUE, &hClass) != ERROR_SUCCESS)
57  return E_FAIL;
58 
59  do
60  {
62  if (FAILED(hr))
63  break;
64 
65  RegDeleteKeyW(hClass, pStr);
66  CoTaskMemFree(pStr);
67  Index++;
68  }while(InterfaceTable[Index].lpfnCI != 0);
69 
70  RegCloseKey(hClass);
71  return hr;
72 }
73 
74 extern "C"
76 HRESULT
77 WINAPI
79 {
80  ULONG Index = 0;
81  LPOLESTR pStr;
82  HRESULT hr = S_OK;
83  HKEY hClass, hKey, hSubKey;
84  static LPCWSTR ModuleName = L"msvidctl.ax";
85  static LPCWSTR ThreadingModel = L"Both";
86 
87  if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_WRITE, &hClass) != ERROR_SUCCESS)
88  return E_FAIL;
89 
90  do
91  {
93  if (FAILED(hr))
94  break;
95 
96  if (RegCreateKeyExW(hClass, pStr, 0, 0, 0, KEY_WRITE, NULL, &hKey, 0) == ERROR_SUCCESS)
97  {
98  if (RegCreateKeyExW(hKey, L"InprocServer32", 0, 0, 0, KEY_WRITE, NULL, &hSubKey, 0) == ERROR_SUCCESS)
99  {
100  RegSetValueExW(hSubKey, 0, 0, REG_SZ, (const BYTE*)ModuleName, (wcslen(ModuleName) + 1) * sizeof(WCHAR));
101  RegSetValueExW(hSubKey, L"ThreadingModel", 0, REG_SZ, (const BYTE*)ThreadingModel, (wcslen(ThreadingModel) + 1) * sizeof(WCHAR));
102  RegCloseKey(hSubKey);
103  }
104  RegCloseKey(hKey);
105  }
106 
107  CoTaskMemFree(pStr);
108  Index++;
109  }while(InterfaceTable[Index].lpfnCI != 0);
110 
111  RegCloseKey(hClass);
112  return hr;
113 }
114 
115 KSDDKAPI
116 HRESULT
117 WINAPI
119  REFCLSID rclsid,
120  REFIID riid,
121  LPVOID *ppv)
122 {
123  UINT i;
125  IClassFactory * pcf = NULL;
126 
127  if (!ppv)
128  return E_INVALIDARG;
129 
130  *ppv = NULL;
131 
132  for (i = 0; InterfaceTable[i].riid; i++)
133  {
134  if (IsEqualIID(*InterfaceTable[i].riid, rclsid))
135  {
137  break;
138  }
139  }
140 
141  if (!pcf)
142  {
144  }
145 
146  hres = pcf->QueryInterface(riid, ppv);
147  pcf->Release();
148 
149  return hres;
150 }
151 
152 KSDDKAPI
153 HRESULT
154 WINAPI
156 {
157  return S_OK;
158 }
#define REFIID
Definition: guiddef.h:118
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define KEY_SET_VALUE
Definition: nt_native.h:1017
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
REFIID riid
Definition: precomp.h:44
#define REFCLSID
Definition: guiddef.h:117
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
REFIID LPVOID * ppv
Definition: atlbase.h:39
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1274
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
#define KSDDKAPI
Definition: ks.h:40
static IN DWORD IN LPVOID lpvReserved
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
const GUID * riid
Definition: precomp.h:26
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
unsigned int BOOL
Definition: ntddk_ex.h:94
ULONG Release()
#define E_INVALIDARG
Definition: ddrawi.h:101
static INTERFACE_TABLE InterfaceTable[]
Definition: msvidctl.cpp:12
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
Definition: msvidctl.cpp:21
#define KEY_WRITE
Definition: nt_native.h:1031
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
IClassFactory * CClassFactory_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, IID *riidInst)
HRESULT hres
Definition: protocol.c:465
KSDDKAPI HRESULT WINAPI DllRegisterServer(void)
Definition: msvidctl.cpp:78
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
_In_ WDFCOLLECTION _In_ ULONG Index
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
HRESULT WINAPI CTuningSpaceContainer_fnConstructor(IUnknown *pUnknown, REFIID riid, LPVOID *ppv)
unsigned char BYTE
Definition: xxhash.c:193
#define S_OK
Definition: intsafe.h:52
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
FxAutoRegKey hKey
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
unsigned int ULONG
Definition: retypes.h:1
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
KSDDKAPI HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: msvidctl.cpp:118
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
KSDDKAPI HRESULT WINAPI DllUnregisterServer(void)
Definition: msvidctl.cpp:49
KSDDKAPI HRESULT WINAPI DllCanUnloadNow(void)
Definition: msvidctl.cpp:155
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
#define REG_SZ
Definition: layer.c:22