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.

103 lines
2.6 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1997.
  5. //
  6. // File: shrdnam.hxx
  7. //
  8. // Classes: CSharedNameGen
  9. //
  10. // History: 2-21-97 dlee Created from dmnproxy.hxx
  11. //
  12. //----------------------------------------------------------------------------
  13. #pragma once
  14. #define DL_DAEMON_EXE_NAME L"cidaemon.exe"
  15. #define DL_SHARED_MEM_NAME L"__ciSharedMem"
  16. #define DL_CI_EVENT_NAME L"__ciEvent1"
  17. #define DL_DAEMON_EVENT_NAME L"__ciEvent2"
  18. #define DL_RESCAN_TC_EVENT_NAME L"__ciEvent3"
  19. #define DL_MUTEX_NAME L"__ciMutexSem"
  20. #define DL_DAEMON_ARG1 "DownLevelDaemon"
  21. #define DL_DAEMON_ARG1_W L"DownLevelDaemon"
  22. //+---------------------------------------------------------------------------
  23. //
  24. // Class: CSharedNameGen
  25. //
  26. // Purpose: A class to generate the names of the shared named objects.
  27. //
  28. // History: 2-15-96 srikants Created
  29. //
  30. // Notes:
  31. //
  32. //----------------------------------------------------------------------------
  33. class CSharedNameGen
  34. {
  35. public:
  36. CSharedNameGen( WCHAR const * pwszCat )
  37. {
  38. _iRootLen = wcslen( pwszCat );
  39. Win4Assert( _iRootLen < sizeof(_wszBuf)/sizeof(WCHAR) );
  40. RtlCopyMemory( _wszBuf, pwszCat, (_iRootLen+1) * sizeof(WCHAR) );
  41. //
  42. // Replace the backslashes with colons.
  43. //
  44. for ( unsigned i = 0; i < _iRootLen; i++ )
  45. {
  46. if ( L'\\' == _wszBuf[i] )
  47. _wszBuf[i] = L':';
  48. }
  49. }
  50. WCHAR const * GetMutexName()
  51. {
  52. return AppendName( DL_MUTEX_NAME );
  53. }
  54. WCHAR const * GetSharedMemName()
  55. {
  56. return AppendName( DL_SHARED_MEM_NAME );
  57. }
  58. WCHAR const * GetCiEventName()
  59. {
  60. return AppendName( DL_CI_EVENT_NAME );
  61. }
  62. WCHAR const * GetDaemonEventName()
  63. {
  64. return AppendName( DL_DAEMON_EVENT_NAME );
  65. }
  66. WCHAR const * GetRescanTCEventName()
  67. {
  68. return AppendName( DL_RESCAN_TC_EVENT_NAME );
  69. }
  70. private:
  71. WCHAR const * AppendName( WCHAR const * wszName )
  72. {
  73. unsigned len = wcslen( wszName );
  74. Win4Assert( len + _iRootLen < sizeof(_wszBuf)/sizeof(WCHAR) );
  75. RtlCopyMemory( _wszBuf+_iRootLen, wszName, (len+1) * sizeof(WCHAR) );
  76. // event names are case-sensitive
  77. _wcslwr( _wszBuf );
  78. return _wszBuf;
  79. }
  80. unsigned _iRootLen; // Length of the "catalog root" part
  81. WCHAR _wszBuf[MAX_PATH]; // Buffer for generating shared object names.
  82. };