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.

84 lines
2.0 KiB

  1. /****************************************************************************
  2. IMEMISC.CPP
  3. Owner: cslim
  4. Copyright (c) 1997-1999 Microsoft Corporation
  5. MISC utility functions
  6. History:
  7. 14-JUL-1999 cslim Copied from IME98 source tree
  8. *****************************************************************************/
  9. #include "precomp.h"
  10. #include "imedefs.h"
  11. static BOOL ValidateProductSuite(LPTSTR SuiteName);
  12. #if (FUTURE_VERSION)
  13. // Currently this IME will run on the NT5 only. We don't need to check Hydra in NT4
  14. // Even we have no plan to create Korean NT4 TS
  15. BOOL IsHydra(void)
  16. {
  17. static DWORD fTested = fFalse, fHydra = fFalse;
  18. if (!fTested)
  19. {
  20. fHydra = ValidateProductSuite(TEXT("Terminal Server"));
  21. fTested = fTrue;
  22. }
  23. return(fHydra);
  24. }
  25. BOOL ValidateProductSuite(LPTSTR SuiteName)
  26. {
  27. BOOL rVal = fFalse;
  28. LONG Rslt;
  29. HKEY hKey = NULL;
  30. DWORD Type = 0;
  31. DWORD Size = 0;
  32. LPTSTR ProductSuite = NULL;
  33. LPTSTR p;
  34. Rslt = RegOpenKey(
  35. HKEY_LOCAL_MACHINE,
  36. TEXT("System\\CurrentControlSet\\Control\\ProductOptions"),
  37. &hKey
  38. );
  39. if (Rslt != ERROR_SUCCESS)
  40. goto exit;
  41. Rslt = RegQueryValueEx( hKey, TEXT("ProductSuite"), NULL, &Type, NULL, &Size );
  42. if (Rslt != ERROR_SUCCESS || !Size)
  43. goto exit;
  44. ProductSuite = (LPTSTR) LocalAlloc( LPTR, Size );
  45. if (!ProductSuite)
  46. goto exit;
  47. Rslt = RegQueryValueEx( hKey, TEXT("ProductSuite"), NULL, &Type, (LPBYTE) ProductSuite, &Size );
  48. if (Rslt != ERROR_SUCCESS || Type != REG_MULTI_SZ)
  49. goto exit;
  50. p = ProductSuite;
  51. while (*p)
  52. {
  53. if (lstrcmpi( p, SuiteName ) == 0)
  54. {
  55. rVal = fTrue;
  56. break;
  57. }
  58. p += (lstrlen( p ) + 1);
  59. }
  60. exit:
  61. if (ProductSuite)
  62. LocalFree( ProductSuite );
  63. if (hKey)
  64. RegCloseKey( hKey );
  65. return rVal;
  66. }
  67. #endif