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.

90 lines
2.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1999.
  5. //
  6. // File: O B O T O K E N . C P P
  7. //
  8. // Contents:
  9. //
  10. // Notes:
  11. //
  12. // Author: shaunco 15 Jan 1999
  13. //
  14. //----------------------------------------------------------------------------
  15. #include <pch.h>
  16. #pragma hdrstop
  17. #include "obotoken.h"
  18. #include "icomp.h"
  19. #include "ncvalid.h"
  20. BOOL
  21. FOboTokenValidForClass (
  22. IN const OBO_TOKEN* pOboToken,
  23. IN NETCLASS Class )
  24. {
  25. // OboTokens must be specified for anything other than adapters.
  26. //
  27. if (!pOboToken && !FIsEnumerated (Class))
  28. {
  29. return FALSE;
  30. }
  31. return TRUE;
  32. }
  33. HRESULT
  34. HrProbeOboToken (
  35. IN const OBO_TOKEN* pOboToken)
  36. {
  37. // Only probe if pOboToken was specified.
  38. //
  39. if (!pOboToken)
  40. {
  41. return S_OK;
  42. }
  43. HRESULT hr = S_OK;
  44. if (FBadInPtr (pOboToken))
  45. {
  46. hr = E_POINTER;
  47. }
  48. else
  49. {
  50. switch (pOboToken->Type)
  51. {
  52. case OBO_USER:
  53. hr = S_OK;
  54. break;
  55. case OBO_COMPONENT:
  56. hr = E_POINTER;
  57. if (!FBadInPtr (pOboToken->pncc))
  58. {
  59. hr = HrIsValidINetCfgComponent (pOboToken->pncc);
  60. }
  61. break;
  62. case OBO_SOFTWARE:
  63. if (FBadInPtr (pOboToken->pszwManufacturer) ||
  64. FBadInPtr (pOboToken->pszwProduct) ||
  65. FBadInPtr (pOboToken->pszwDisplayName))
  66. {
  67. hr = E_POINTER;
  68. }
  69. else if (!*pOboToken->pszwManufacturer ||
  70. !*pOboToken->pszwProduct ||
  71. !*pOboToken->pszwDisplayName)
  72. {
  73. hr = E_INVALIDARG;
  74. }
  75. break;
  76. default:
  77. hr = E_INVALIDARG;
  78. }
  79. }
  80. TraceError ("HrProbeOboToken", hr);
  81. return hr;
  82. }