Source code of Windows XP (NT5)
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.

54 lines
1.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1999.
  5. //
  6. // File: F I L T D E V . C P P
  7. //
  8. // Contents: Implements the object that represents filter devices.
  9. //
  10. // Notes:
  11. //
  12. // Author: shaunco 15 Jan 1999
  13. //
  14. //----------------------------------------------------------------------------
  15. #include <pch.h>
  16. #pragma hdrstop
  17. #include "filtdev.h"
  18. //static
  19. HRESULT
  20. CFilterDevice::HrCreateInstance (
  21. IN CComponent* pAdapter,
  22. IN CComponent* pFilter,
  23. IN const SP_DEVINFO_DATA* pdeid,
  24. IN PCWSTR pszInstanceGuid,
  25. OUT CFilterDevice** ppFilterDevice)
  26. {
  27. Assert (pAdapter);
  28. Assert (FIsEnumerated(pAdapter->Class()));
  29. Assert (pFilter);
  30. Assert (pFilter->FIsFilter());
  31. Assert (NC_NETSERVICE == pFilter->Class());
  32. Assert (pdeid);
  33. Assert (pszInstanceGuid && *pszInstanceGuid);
  34. Assert ((c_cchGuidWithTerm - 1) == wcslen(pszInstanceGuid));
  35. Assert (ppFilterDevice);
  36. HRESULT hr = E_OUTOFMEMORY;
  37. CFilterDevice* pFilterDevice = new CFilterDevice;
  38. if (pFilterDevice)
  39. {
  40. pFilterDevice->m_pAdapter = pAdapter;
  41. pFilterDevice->m_pFilter = pFilter;
  42. pFilterDevice->m_deid = *pdeid;
  43. wcscpy(pFilterDevice->m_szInstanceGuid, pszInstanceGuid);
  44. hr = S_OK;
  45. }
  46. *ppFilterDevice = pFilterDevice;
  47. TraceHr (ttidError, FAL, hr, FALSE, "CFilterDevice::HrCreateInstance");
  48. return hr;
  49. }