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.

92 lines
2.3 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: misc.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. #include "pch.h"
  11. #include <advpub.h> // REGINSTALL
  12. /*-----------------------------------------------------------------------------
  13. / DPA_DestroyCallback
  14. / --------------
  15. / Same as in newer comctl32, but not present in NT4 SP4.
  16. /
  17. / In:
  18. / -
  19. / Out:
  20. /
  21. /----------------------------------------------------------------------------*/
  22. /*-----------------------------------------------------------------------------
  23. / CallRegInstall
  24. / --------------
  25. / Called by DllRegisterServer and DllUnregisterServer to register/unregister
  26. / this module. Uses the ADVPACK APIs and loads our INF data from resources.
  27. /
  28. / In:
  29. / -
  30. / Out:
  31. / HRESULT
  32. /----------------------------------------------------------------------------*/
  33. HRESULT
  34. CallRegInstall(HMODULE hModule, LPCSTR pszSection)
  35. {
  36. HRESULT hr = E_FAIL;
  37. HINSTANCE hinstAdvPack;
  38. TraceEnter(TRACE_COMMON_MISC, "CallRegInstall");
  39. hinstAdvPack = LoadLibrary(TEXT("ADVPACK.DLL"));
  40. if (hinstAdvPack)
  41. {
  42. REGINSTALL pfnRegInstall = (REGINSTALL)GetProcAddress(hinstAdvPack, achREGINSTALL);
  43. if ( pfnRegInstall )
  44. {
  45. STRENTRY seReg[] =
  46. {
  47. // These two NT-specific entries must be at the end
  48. { "25", "%SystemRoot%" },
  49. { "11", "%SystemRoot%\\system32" },
  50. };
  51. STRTABLE stReg = { ARRAYSIZE(seReg), seReg };
  52. hr = pfnRegInstall(hModule, pszSection, &stReg);
  53. }
  54. FreeLibrary(hinstAdvPack);
  55. }
  56. TraceLeaveResult(hr);
  57. }
  58. // This wrapper function required to make prefast shut up when we are
  59. // initializing a critical section in a constructor.
  60. void
  61. ExceptionPropagatingInitializeCriticalSection(LPCRITICAL_SECTION critsec)
  62. {
  63. __try
  64. {
  65. ::InitializeCriticalSection(critsec);
  66. }
  67. // propagate the exception to our caller. This will cause Log::Log
  68. // to abort prematurely, which will jump to the the handler in
  69. // Log::GetInstance
  70. __except (EXCEPTION_CONTINUE_SEARCH)
  71. {
  72. }
  73. }