// unicode <-> oem codepage conversions void unicode_to_oem(AnsiString& oem_str, const UnicodeString& u_str) { unsigned size = u_str.size() + 1; int res = WideCharToMultiByte(CP_OEMCP, 0, u_str.data(), size, oem_str.buf(u_str.size()), size, NULL, NULL); if (res == 0) FAIL(SystemError()); oem_str.set_size(res - 1); }