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.

83 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. cli.cpp
  5. Abstract:
  6. DLL main for Cli
  7. Author:
  8. Ran Kalach [rankala] 3-March-2000
  9. Revision History:
  10. --*/
  11. // cli.cpp : Implementation of DLL standard exports.
  12. // Note: Currently, this DLL does not expose any COM objects.
  13. //
  14. #include "stdafx.h"
  15. CComModule _Module;
  16. HINSTANCE g_hInstance;
  17. /*** CComPtr<IWsbTrace> g_pTrace; ***/
  18. /////////////////////////////////////////////////////////////////////////////
  19. // DLL Entry Point
  20. extern "C"
  21. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  22. {
  23. if (dwReason == DLL_PROCESS_ATTACH)
  24. {
  25. g_hInstance = hInstance;
  26. DisableThreadLibraryCalls(hInstance);
  27. /*** // Initialize trace mechanizm
  28. if (S_OK == CoCreateInstance(CLSID_CWsbTrace, 0, CLSCTX_SERVER, IID_IWsbTrace, (void **)&g_pTrace)) {
  29. CWsbStringPtr tracePath;
  30. CWsbStringPtr regPath;
  31. CWsbStringPtr outString;
  32. // Registry path for CLI settings
  33. // If those expand beyond Trace settings, this path should go to a header file
  34. regPath = L"SOFTWARE\\Microsoft\\RemoteStorage\\CLI";
  35. // Check if tracing path already exists, if not - set it (this should happen only once)
  36. WsbAffirmHr(outString.Alloc(WSB_TRACE_BUFF_SIZE));
  37. if( WsbGetRegistryValueString(NULL, regPath, L"WsbTraceFileName", outString, WSB_TRACE_BUFF_SIZE, 0) != S_OK) {
  38. // No trace settings yet
  39. WCHAR *systemPath;
  40. systemPath = _wgetenv(L"SystemRoot");
  41. WsbAffirmHr(tracePath.Printf( L"%ls\\System32\\RemoteStorage\\Trace\\RsCli.Trc", systemPath));
  42. // Set default settings in the Registry
  43. WsbEnsureRegistryKeyExists(0, regPath);
  44. WsbSetRegistryValueString(0, regPath, L"WsbTraceFileName", tracePath);
  45. // Make sure the trace directory exists.
  46. WsbAffirmHr(tracePath.Printf( L"%ls\\System32\\RemoteStorage", systemPath));
  47. CreateDirectory(tracePath, 0);
  48. WsbAffirmHr(tracePath.Printf( L"%ls\\System32\\RemoteStorage\\Trace", systemPath));
  49. CreateDirectory(tracePath, 0);
  50. }
  51. g_pTrace->SetRegistryEntry(regPath);
  52. g_pTrace->LoadFromRegistry();
  53. } ***/
  54. } else if (dwReason == DLL_PROCESS_DETACH) {
  55. /*** g_pTrace = 0; ***/
  56. }
  57. return TRUE; // ok
  58. }