bug fixes

This commit is contained in:
rjkiv 2025-08-10 10:15:14 -07:00
parent f80d7dda62
commit da17dd573d
2 changed files with 16 additions and 2 deletions

View File

@ -1635,7 +1635,7 @@ namespace kernel32 {
}
const size_t copyLen = std::min(len, nSize - 1);
memcpy(lpFilename, stringToWideString(path.c_str()).data(), copyLen);
memcpy(lpFilename, stringToWideString(path.c_str()).data(), copyLen * 2);
if (copyLen < nSize) {
lpFilename[copyLen] = 0;
}

View File

@ -324,7 +324,21 @@ namespace msvcrt {
}
int WIN_ENTRY wcscpy_s(uint16_t *dest, size_t dest_size, const uint16_t *src){
DEBUG_LOG("STUB: wcscpy_s\n");
std::string src_str = wideStringToString(src);
DEBUG_LOG("wcscpy_s %s\n", src_str.c_str());
if (!dest || !src || dest_size == 0) {
return -1;
}
size_t src_len = 0;
while (src[src_len] != 0) src_len++;
if (src_len + 1 > dest_size) {
dest[0] = 0;
return -1;
}
wstrcpy(dest, src);
return 0;
}