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.

97 lines
2.7 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. // get debug flag
  38. GetOutputDebugFlag();
  39. }
  40. return bInit;
  41. }
  42. ////////////////////////////////////////////////////////////////////////////
  43. // CCnfgprtsApp::ExitInstance - DLL termination
  44. int CCnfgprtsApp::ExitInstance()
  45. {
  46. return COleControlModule::ExitInstance();
  47. }
  48. /////////////////////////////////////////////////////////////////////////////
  49. // DllRegisterServer - Adds entries to the system registry
  50. STDAPI DllRegisterServer(void)
  51. {
  52. AFX_MANAGE_STATE(_afxModuleAddrThis);
  53. if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid))
  54. return ResultFromScode(SELFREG_E_TYPELIB);
  55. if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE))
  56. return ResultFromScode(SELFREG_E_CLASS);
  57. return NOERROR;
  58. }
  59. /////////////////////////////////////////////////////////////////////////////
  60. // DllUnregisterServer - Removes entries from the system registry
  61. STDAPI DllUnregisterServer(void)
  62. {
  63. AFX_MANAGE_STATE(_afxModuleAddrThis);
  64. if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor))
  65. return ResultFromScode(SELFREG_E_TYPELIB);
  66. if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE))
  67. return ResultFromScode(SELFREG_E_CLASS);
  68. return NOERROR;
  69. }