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.

61 lines
1.6 KiB

  1. /*++
  2. Microsoft Confidential
  3. Copyright (c) 1992-2000 Microsoft Corporation
  4. All rights reserved
  5. Module Name:
  6. srcfg.cpp
  7. Abstract:
  8. Adds System Restore tab to the System Control Panel Applet if necessary.
  9. Author:
  10. skkhang 15-Jun-2000
  11. NOTE (7/26/00 skkhang):
  12. Now there is no code to unload srrstr.dll, because property page proc
  13. cannot unload the DLL. It is acceptable for the current CPL mechanism --
  14. using a separate process rundll32.exe which would clean up any loaded
  15. DLLs during termination. However, if system CPL is loaded in the context
  16. of, e.g., Shell itself, srrstr.dll will be leaked.
  17. One possible solution is to place a proxy property page proc in this file
  18. and calls the real proc in srrstr.dll only when srrstr.dll is loaded
  19. in the memory. Of course, even in that case, determination of whether to
  20. show SR Tab or not must be made first of all.
  21. --*/
  22. #include "sysdm.h"
  23. typedef HPROPSHEETPAGE (WINAPI *SRGETPAGEPROC)();
  24. static LPCWSTR s_cszSrSysCfgDllName = L"srrstr.dll";
  25. static LPCSTR s_cszSrGetPageProc = "SRGetCplPropPage";
  26. HPROPSHEETPAGE
  27. CreateSystemRestorePage(int, DLGPROC)
  28. {
  29. HPROPSHEETPAGE hRet = NULL;
  30. HMODULE hModSR = NULL;
  31. SRGETPAGEPROC pfnGetPage;
  32. hModSR = ::LoadLibrary( s_cszSrSysCfgDllName );
  33. if ( hModSR == NULL )
  34. goto Exit;
  35. pfnGetPage = (SRGETPAGEPROC)::GetProcAddress( hModSR, s_cszSrGetPageProc );
  36. if ( pfnGetPage == NULL )
  37. goto Exit;
  38. hRet = pfnGetPage();
  39. Exit:
  40. if ( hRet == NULL )
  41. ::FreeLibrary( hModSR );
  42. return( hRet );
  43. }