OSDN Git Service

Fix bug when saving unicode text
authorsdottaka <none@none>
Sat, 8 Sep 2012 16:48:09 +0000 (01:48 +0900)
committersdottaka <none@none>
Sat, 8 Sep 2012 16:48:09 +0000 (01:48 +0900)
Externals/crystaledit/editlib/registry.cpp

index 5871ca2..da5200f 100644 (file)
@@ -821,7 +821,7 @@ RegSaveString (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, LPCTSTR pszStri
   HKEY hSubKey = pszSubKey ? RegCreate (hKey, pszSubKey, KEY_WRITE) : hKey;
   if (hSubKey)
     {
-      if (RegSetValueEx (hSubKey, pszValName, 0, REG_SZ, (LPBYTE) pszString, (DWORD)_tcslen (pszString) + 1) == ERROR_SUCCESS)
+      if (RegSetValueEx (hSubKey, pszValName, 0, REG_SZ, (LPBYTE) pszString, (DWORD)(_tcslen (pszString) + 1) * sizeof(TCHAR)) == ERROR_SUCCESS)
         {
           if (hSubKey != hKey)
             RegClose (hSubKey);