ReactOS  0.4.14-dev-552-g2fad488
bdaplgin.cpp File Reference
#include "precomp.h"
Include dependency graph for bdaplgin.cpp:

Go to the source code of this file.

Functions

BOOL WINAPI DllMain (HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
 
KSDDKAPI HRESULT WINAPI DllUnregisterServer (void)
 
KSDDKAPI HRESULT WINAPI DllRegisterServer (void)
 
KSDDKAPI HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
KSDDKAPI HRESULT WINAPI DllCanUnloadNow (void)
 

Variables

const GUID CBDADeviceControl_GUID = {STATIC_KSMETHODSETID_BdaChangeSync}
 
const GUID CBDAPinControl_GUID = {0x0DED49D5, 0xA8B7, 0x4d5d, {0x97, 0xA1, 0x12, 0xB0, 0xC1, 0x95, 0x87, 0x4D}}
 
static INTERFACE_TABLE InterfaceTable []
 

Function Documentation

◆ DllCanUnloadNow()

KSDDKAPI HRESULT WINAPI DllCanUnloadNow ( void  )

Definition at line 159 of file bdaplgin.cpp.

160 {
161  return S_OK;
162 }
#define S_OK
Definition: intsafe.h:59

◆ DllGetClassObject()

KSDDKAPI HRESULT WINAPI DllGetClassObject ( REFCLSID  rclsid,
REFIID  riid,
LPVOID ppv 
)

Definition at line 122 of file bdaplgin.cpp.

126 {
127  UINT i;
129  IClassFactory * pcf = NULL;
130 
131  if (!ppv)
132  return E_INVALIDARG;
133 
134  *ppv = NULL;
135 
136  for (i = 0; InterfaceTable[i].riid; i++)
137  {
138  if (IsEqualIID(*InterfaceTable[i].riid, rclsid))
139  {
141  break;
142  }
143  }
144 
145  if (!pcf)
146  {
148  }
149 
150  hres = pcf->QueryInterface(riid, ppv);
151  pcf->Release();
152 
153  return hres;
154 }
static INTERFACE_TABLE InterfaceTable[]
Definition: bdaplgin.cpp:15
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
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
const GUID * riid
Definition: precomp.h:26
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
ULONG Release()
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
IClassFactory * CClassFactory_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, IID *riidInst)
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
unsigned int UINT
Definition: ndis.h:50
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hInstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 25 of file bdaplgin.cpp.

29 {
30  switch (fdwReason)
31  {
32  case DLL_PROCESS_ATTACH:
34 
35 #ifdef BDAPLGIN_TRACE
36  OutputDebugStringW(L"BDAPLGIN::DllMain()\n");
37 #endif
38 
39  DisableThreadLibraryCalls(hInstDLL);
40  break;
41  default:
42  break;
43  }
44 
45  return TRUE;
46 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR L[]
Definition: oid.c:1250
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964

◆ DllRegisterServer()

KSDDKAPI HRESULT WINAPI DllRegisterServer ( void  )

Definition at line 82 of file bdaplgin.cpp.

83 {
84  ULONG Index = 0;
85  LPOLESTR pStr;
86  HRESULT hr = S_OK;
87  HKEY hClass, hKey, hSubKey;
88  static LPCWSTR ModuleName = L"bdaplgin.ax";
89  static LPCWSTR ThreadingModel = L"Both";
90 
91  if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_WRITE, &hClass) != ERROR_SUCCESS)
92  return E_FAIL;
93 
94  do
95  {
97  if (FAILED(hr))
98  break;
99 
100  if (RegCreateKeyExW(hClass, pStr, 0, 0, 0, KEY_WRITE, NULL, &hKey, 0) == ERROR_SUCCESS)
101  {
102  if (RegCreateKeyExW(hKey, L"InprocServer32", 0, 0, 0, KEY_WRITE, NULL, &hSubKey, 0) == ERROR_SUCCESS)
103  {
104  RegSetValueExW(hSubKey, 0, 0, REG_SZ, (const BYTE*)ModuleName, (wcslen(ModuleName) + 1) * sizeof(WCHAR));
105  RegSetValueExW(hSubKey, L"ThreadingModel", 0, REG_SZ, (const BYTE*)ThreadingModel, (wcslen(ThreadingModel) + 1) * sizeof(WCHAR));
106  RegCloseKey(hSubKey);
107  }
108  RegCloseKey(hKey);
109  }
110 
111  CoTaskMemFree(pStr);
112  Index++;
113  }while(InterfaceTable[Index].lpfnCI != 0);
114 
115  RegCloseKey(hClass);
116  return hr;
117 }
static INTERFACE_TABLE InterfaceTable[]
Definition: bdaplgin.cpp:15
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
REFIID riid
Definition: precomp.h:44
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
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:1270
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
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
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:416
#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
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static const UCHAR Index[8]
Definition: usbohci.c:18
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: mem.h:68
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
#define REG_SZ
Definition: layer.c:22

◆ DllUnregisterServer()

KSDDKAPI HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 53 of file bdaplgin.cpp.

54 {
55  ULONG Index = 0;
56  LPOLESTR pStr;
57  HRESULT hr = S_OK;
58  HKEY hClass;
59 
60  if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_SET_VALUE, &hClass) != ERROR_SUCCESS)
61  return E_FAIL;
62 
63  do
64  {
66  if (FAILED(hr))
67  break;
68 
69  RegDeleteKeyW(hClass, pStr);
70  CoTaskMemFree(pStr);
71  Index++;
72  }while(InterfaceTable[Index].lpfnCI != 0);
73 
74  RegCloseKey(hClass);
75  return hr;
76 }
static INTERFACE_TABLE InterfaceTable[]
Definition: bdaplgin.cpp:15
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define KEY_SET_VALUE
Definition: nt_native.h:1017
REFIID riid
Definition: precomp.h:44
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
LONG HRESULT
Definition: typedefs.h:77
static const UCHAR Index[8]
Definition: usbohci.c:18
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412

Variable Documentation

◆ CBDADeviceControl_GUID

const GUID CBDADeviceControl_GUID = {STATIC_KSMETHODSETID_BdaChangeSync}

Definition at line 12 of file bdaplgin.cpp.

◆ CBDAPinControl_GUID

const GUID CBDAPinControl_GUID = {0x0DED49D5, 0xA8B7, 0x4d5d, {0x97, 0xA1, 0x12, 0xB0, 0xC1, 0x95, 0x87, 0x4D}}

Definition at line 13 of file bdaplgin.cpp.

◆ InterfaceTable

INTERFACE_TABLE InterfaceTable[]
static
Initial value:
=
{
}
smooth NULL
Definition: ftsmooth.c:416
const GUID CBDADeviceControl_GUID
Definition: bdaplgin.cpp:12
const GUID CBDAPinControl_GUID
Definition: bdaplgin.cpp:13
HRESULT WINAPI CBDADeviceControl_fnConstructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)
HRESULT WINAPI CBDAPinControl_fnConstructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)
Definition: pincontrol.cpp:236

Definition at line 15 of file bdaplgin.cpp.

Referenced by DllGetClassObject(), DllRegisterServer(), and DllUnregisterServer().