- if (type == REG_SZ)
- if (!(list = sp_list_append(list,
- data, (data_len + 1) * sizeof(TCHAR))))
- goto out;
+#ifdef UNICODE
+ name_len = WideCharToMultiByte(CP_ACP, 0, data, -1, NULL, 0, NULL, NULL)
+#else
+ name_len = data_len + 1;
+#endif
+ if (!(name = malloc(name_len)))
+ {
+ ret = SP_ERR_MEM;
+ goto out;
+ }
+#ifdef UNICODE
+ WideCharToMultiByte(CP_ACP, 0, data, -1, name, name_len, NULL, NULL);
+#else
+ strcpy(name, data);
+#endif
+ if (type == REG_SZ && !(list = sp_list_append(list, name)))
+ {
+ ret = SP_ERR_MEM;
+ goto out;
+ }