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.

94 lines
2.5 KiB

  1. // cnfgprts.cpp : Implementation of CCnfgprtsApp and DLL registration.
  2. #include "stdafx.h"
  3. #include "cnfgprts.h"
  4. #ifdef _DEBUG
  5. #define new DEBUG_NEW
  6. #undef THIS_FILE
  7. static char THIS_FILE[] = __FILE__;
  8. #endif
  9. CCnfgprtsApp NEAR theApp;
  10. const GUID CDECL BASED_CODE _tlid =
  11. { 0xba634600, 0xb771, 0x11d0, { 0x92, 0x96, 0, 0xc0, 0x4f, 0xb6, 0x67, 0x8b } };
  12. const WORD _wVerMajor = 1;
  13. const WORD _wVerMinor = 0;
  14. ////////////////////////////////////////////////////////////////////////////
  15. // CCnfgprtsApp::InitInstance - DLL initialization
  16. BOOL CCnfgprtsApp::InitInstance()
  17. {
  18. BOOL bInit = COleControlModule::InitInstance();
  19. AfxEnableControlContainer( );
  20. if (bInit)
  21. {
  22. // finally, we need to redirect the winhelp file location to something more desirable
  23. CString sz;
  24. CString szHelpLocation;
  25. sz.LoadString( IDS_HELPLOC_HELP );
  26. // expand the path
  27. ExpandEnvironmentStrings(
  28. sz, // pointer to string with environment variables
  29. szHelpLocation.GetBuffer(MAX_PATH + 1), // pointer to string with expanded environment variables
  30. MAX_PATH // maximum characters in expanded string
  31. );
  32. szHelpLocation.ReleaseBuffer();
  33. // free the existing path, and copy in the new one
  34. if ( m_pszHelpFilePath )
  35. free((void*)m_pszHelpFilePath);
  36. m_pszHelpFilePath = _tcsdup(szHelpLocation);
  37. }
  38. return bInit;
  39. }
  40. ////////////////////////////////////////////////////////////////////////////
  41. // CCnfgprtsApp::ExitInstance - DLL termination
  42. int CCnfgprtsApp::ExitInstance()
  43. {
  44. return COleControlModule::ExitInstance();
  45. }
  46. /////////////////////////////////////////////////////////////////////////////
  47. // DllRegisterServer - Adds entries to the system registry
  48. STDAPI DllRegisterServer(void)
  49. {
  50. AFX_MANAGE_STATE(_afxModuleAddrThis);
  51. if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid))
  52. return ResultFromScode(SELFREG_E_TYPELIB);
  53. if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE))
  54. return ResultFromScode(SELFREG_E_CLASS);
  55. return NOERROR;
  56. }
  57. /////////////////////////////////////////////////////////////////////////////
  58. // DllUnregisterServer - Removes entries from the system registry
  59. STDAPI DllUnregisterServer(void)
  60. {
  61. AFX_MANAGE_STATE(_afxModuleAddrThis);
  62. if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor))
  63. return ResultFromScode(SELFREG_E_TYPELIB);
  64. if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE))
  65. return ResultFromScode(SELFREG_E_CLASS);
  66. return NOERROR;
  67. }