- GET_C_CHARPTR_EXT_DATA_ALLOCA (XSTRING_DATA (string),
- FORMAT_OS, mbcs_string);
+ TO_EXTERNAL_FORMAT (LISP_STRING, string,
+ C_STRING_ALLOCA, mbcs_string,
+ Qnative);
+ uni_string = alloca_array (WCHAR, length + 1);
+ length = MultiByteToWideChar (CP_ACP, 0, mbcs_string, -1,
+ uni_string, sizeof(WCHAR) * (length + 1));
+ Dynarr_add_many (dynarr, uni_string, sizeof(WCHAR) * length);
+}
+
+/* Helper function which converts the supplied string STRING into Unicode and
+ pushes it at the end of DYNARR */
+static void
+push_bufbyte_string_as_unicode (unsigned_char_dynarr* dynarr, Bufbyte *string,
+ Bytecount len)
+{
+ Extbyte *mbcs_string;
+ Charcount length = bytecount_to_charcount (string, len);
+ LPWSTR uni_string;
+
+ TO_EXTERNAL_FORMAT (C_STRING, string,
+ C_STRING_ALLOCA, mbcs_string,
+ Qnative);