+#elif defined(__WIN32__)
+ char *utf8_str;
+ size_t utf8_nbytes;
+ utf8_nbytes = wcstombs(NULL, (const wchar_t*)utf16_str, 0);
+ if (utf8_nbytes == (size_t)(-1)) {
+ ret = WIMLIB_ERR_INVALID_UTF16_STRING;
+ } else {
+ utf8_str = MALLOC(utf8_nbytes + 1);
+ if (!utf8_str) {
+ ret = WIMLIB_ERR_NOMEM;
+ } else {
+ wcstombs(utf8_str, (const wchar_t*)utf16_str, utf8_nbytes + 1);
+ *utf8_str_ret = utf8_str;
+ *utf8_nbytes_ret = utf8_nbytes;
+ ret = 0;
+ }
+ }
+#else