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.

81 lines
2.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: N E T O E M D H . C P P
  7. //
  8. // Contents:
  9. //
  10. // Notes:
  11. //
  12. // Author: kumarp
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #pragma hdrstop
  17. #include "kkutils.h"
  18. #include "ncreg.h"
  19. #include "ncsetup.h"
  20. const INT MAX_TEMPSTR_SIZE = 1024;
  21. static const WCHAR c_szKeyRoot[] = L"SYSTEM\\CurrentControlSet\\Services\\Ndis\\NetDetect\\";
  22. static const WCHAR c_szInfFileName[] = L"NetOemDh.Inf";
  23. //+---------------------------------------------------------------------------
  24. //
  25. // function: SetupNetOemDhInfo
  26. //
  27. // Purpose: Create netcard detection info in registry
  28. //
  29. // Arguments: none
  30. //
  31. // Author: kumarp 17-June-97
  32. //
  33. // Notes: this function replaces ParseNetoemdhInfFile.
  34. // it uses the Win95 style INF file to create the same info
  35. // that the old function ParseNetoemdhInfFile created.
  36. // Thus functionally this does not require change in other modules.
  37. //
  38. HRESULT HrSetupNetOemDhInfo()
  39. {
  40. DefineFunctionName("SetupNetOemDhInfo");
  41. TraceFunctionEntry(ttidNetSetup);
  42. HINF hinf=NULL;
  43. HWND hwnd = NULL;
  44. HRESULT hr = HrSetupOpenInfFile(c_szInfFileName, NULL,
  45. INF_STYLE_WIN4, NULL, &hinf);
  46. if (SUCCEEDED(hr))
  47. {
  48. HKEY hkey;
  49. hr = HrRegCreateKeyEx(HKEY_LOCAL_MACHINE, c_szKeyRoot,
  50. REG_OPTION_NON_VOLATILE, KEY_WRITE,
  51. NULL, &hkey, NULL);
  52. if (SUCCEEDED(hr))
  53. {
  54. BOOL fStatus =
  55. ::SetupInstallFromInfSection(hwnd, hinf, L"NetDetect",
  56. SPINST_REGISTRY, hkey,
  57. NULL, NULL, NULL, NULL, NULL, NULL);
  58. if (!fStatus)
  59. {
  60. hr = HrFromLastWin32Error();
  61. }
  62. RegSafeCloseKey(hkey);
  63. }
  64. ::SetupCloseInfFile(hinf);
  65. }
  66. TraceFunctionError(hr);
  67. return hr;
  68. }