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.

61 lines
1.6 KiB

  1. #include <windows.h>
  2. #include "rulelex.h"
  3. #include "lexicon.h"
  4. #include "LexMgr.h"
  5. #include "chtbrkr.h"
  6. #include "IWBrKr.h"
  7. TCHAR tszLangSpecificKey[] = TEXT("System\\CurrentControlSet\\Control\\ContentIndex\\Language\\Chinese_Traditional");
  8. HRESULT COMRegister(
  9. BOOL fRegister)
  10. {
  11. HKEY hKey;
  12. WCHAR tszCLSID[MAX_PATH];
  13. TCHAR tszBuf[MAX_PATH * 2];
  14. HRESULT hr = S_OK;
  15. //HKEY_CLASSES_ROOT\\CLSID\\CLSID_CHTBRKR, {E1B6B375-3412-11D3-A9E2-00AA0059F9F6};
  16. StringFromGUID2(CLSID_CHTBRKR, tszCLSID, sizeof(tszCLSID));
  17. lstrcpy(tszBuf, TEXT("CLSID\\"));
  18. lstrcat(tszBuf, tszCLSID);
  19. if (fRegister) {
  20. lstrcat(tszBuf, TEXT("\\InprocServer32"));
  21. if (RegCreateKey(HKEY_CLASSES_ROOT, tszBuf, &hKey) != ERROR_SUCCESS) {
  22. hr = S_FALSE;
  23. goto _exit;
  24. }
  25. RegSetValueEx(hKey, NULL, 0, REG_SZ, (LPBYTE)g_tszModuleFileName,
  26. lstrlen(g_tszModuleFileName) * sizeof(TCHAR));
  27. RegCloseKey(hKey);
  28. } else {
  29. RegDeleteKey(HKEY_CLASSES_ROOT, tszBuf);
  30. }
  31. // HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\ContentIndex\\
  32. // Language\\Chinese_Traditional
  33. /*
  34. if (RegCreateKey(HKEY_LOCAL_MACHINE, tszLangSpecificKey, &hKey) != ERROR_SUCCESS) {
  35. hr = S_FALSE;
  36. goto _exit;
  37. }
  38. if (fRegister) {
  39. RegSetValueEx(hKey, TEXT("WBreakerClass"), 0, REG_SZ, (LPBYTE)tszCLSID,
  40. lstrlen(tszCLSID) * sizeof (TCHAR));
  41. } else {
  42. RegDeleteValue(hKey, TEXT("WBreakerClass"));
  43. }
  44. */
  45. _exit:
  46. return hr;
  47. }
  48. STDAPI DllRegisterServer(void)
  49. {
  50. return COMRegister(TRUE);
  51. }
  52. STDAPI DllUnregisterServer(void)
  53. {
  54. return COMRegister(FALSE);
  55. }