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.

54 lines
1.5 KiB

  1. //
  2. // Debug.cpp -- COM+ Debugging Flags
  3. //
  4. // COM+ 1.0
  5. // Copyright 1998 Microsoft Corporation. All Rights Reserved.
  6. //
  7. // Jim Lyon, March 1998.
  8. //
  9. #include <windows.h>
  10. #include "debug.hxx"
  11. #if DBG == 1
  12. // The data returned by this module:
  13. BOOL DebugFlags::sm_fDebugBreakOnLaunchDllHost = FALSE;
  14. DebugFlags DebugFlags::sm_singleton; // the only object of this class
  15. // Constructor: Its job is to initialize the static members of this class
  16. DebugFlags::DebugFlags()
  17. {
  18. HKEY hKey;
  19. if (ERROR_SUCCESS != RegOpenKeyEx (HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\COM3\\Debug"), 0, KEY_READ, &hKey))
  20. return; // no further initialization possible
  21. InitBoolean (hKey, TEXT("DebugBreakOnLaunchDllHost"), &sm_fDebugBreakOnLaunchDllHost);
  22. RegCloseKey (hKey);
  23. }
  24. // InitBoolean will initialize a boolean depending on a particular value in the registry.
  25. // If the value starts with "Y" or "y", the boolean will be set to TRUE.
  26. // If the value starts with "N" or "n", the boolean will be set to FALSE.
  27. // If the value doesn't exist, or starts with anything else, the boolean will be unchanged.
  28. void DebugFlags::InitBoolean (HKEY hKey, const TCHAR* tszValueName, BOOL* pf)
  29. {
  30. TCHAR tszValue[20];
  31. unsigned long cbData = (sizeof tszValue) / (sizeof tszValue[0]);
  32. if (ERROR_SUCCESS != RegQueryValueEx (hKey, tszValueName, NULL, NULL, (BYTE*)tszValue, &cbData))
  33. return;
  34. if (((USHORT)tszValue[0] & 0xFFDF) == 'Y')
  35. *pf = TRUE;
  36. if (((USHORT)tszValue[0] & 0xFFDF) == 'N')
  37. *pf = FALSE;
  38. }
  39. #endif