Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.3 KiB

  1. #include "miscdev.h"
  2. HRESULT CMiscDeviceInterface::Init(LPCWSTR pszElemName)
  3. {
  4. HRESULT hr = _SetName(pszElemName);
  5. if (SUCCEEDED(hr))
  6. {
  7. DEVINST devinst;
  8. GUID guidDummy;
  9. hr = _GetDeviceInstance(pszElemName, &devinst, &guidDummy);
  10. if (SUCCEEDED(hr) && (S_FALSE != hr))
  11. {
  12. hr = _hwdevinst.Init(devinst);
  13. }
  14. }
  15. return hr;
  16. }
  17. HRESULT CMiscDeviceInterface::InitInterfaceGUID(const GUID* pguidInterface)
  18. {
  19. return _hwdevinst.InitInterfaceGUID(pguidInterface);
  20. }
  21. HRESULT CMiscDeviceInterface::GetHWDeviceInst(CHWDeviceInst** pphwdevinst)
  22. {
  23. *pphwdevinst = &_hwdevinst;
  24. return S_OK;
  25. }
  26. //static
  27. HRESULT CMiscDeviceInterface::Create(CNamedElem** ppelem)
  28. {
  29. HRESULT hres = S_OK;
  30. *ppelem = new CMiscDeviceInterface();
  31. if (!(*ppelem))
  32. {
  33. hres = E_OUTOFMEMORY;
  34. }
  35. return hres;
  36. }
  37. ///////////////////////////////////////////////////////////////////////////////
  38. //
  39. CMiscDeviceInterface::CMiscDeviceInterface()
  40. {}
  41. CMiscDeviceInterface::~CMiscDeviceInterface()
  42. {}
  43. ///////////////////////////////////////////////////////////////////////////////
  44. ///////////////////////////////////////////////////////////////////////////////
  45. ///////////////////////////////////////////////////////////////////////////////
  46. ///////////////////////////////////////////////////////////////////////////////
  47. HRESULT CMiscDeviceNode::Init(LPCWSTR pszElemName)
  48. {
  49. HRESULT hr = _SetName(pszElemName);
  50. if (SUCCEEDED(hr))
  51. {
  52. DEVINST devinst;
  53. hr = _GetDeviceInstanceFromDevNode(pszElemName, &devinst);
  54. if (SUCCEEDED(hr) && (S_FALSE != hr))
  55. {
  56. hr = _hwdevinst.Init(devinst);
  57. }
  58. }
  59. return hr;
  60. }
  61. HRESULT CMiscDeviceNode::GetHWDeviceInst(CHWDeviceInst** pphwdevinst)
  62. {
  63. *pphwdevinst = &_hwdevinst;
  64. return S_OK;
  65. }
  66. //static
  67. HRESULT CMiscDeviceNode::Create(CNamedElem** ppelem)
  68. {
  69. HRESULT hres = S_OK;
  70. *ppelem = new CMiscDeviceNode();
  71. if (!(*ppelem))
  72. {
  73. hres = E_OUTOFMEMORY;
  74. }
  75. return hres;
  76. }
  77. ///////////////////////////////////////////////////////////////////////////////
  78. //
  79. CMiscDeviceNode::CMiscDeviceNode()
  80. {}
  81. CMiscDeviceNode::~CMiscDeviceNode()
  82. {}