More string switching.
This commit is contained in:
@@ -87,10 +87,9 @@ X_STATUS DiscImageEntry::QueryDirectory(
|
||||
auto end = (uint8_t*)out_info + length;
|
||||
|
||||
auto entry = *gdfx_entry_iterator_;
|
||||
auto entry_name = entry->name.c_str();
|
||||
size_t entry_name_length = xestrlena(entry_name);
|
||||
auto entry_name = entry->name;
|
||||
|
||||
if (((uint8_t*)&out_info->file_name[0]) + entry_name_length > end) {
|
||||
if (((uint8_t*)&out_info->file_name[0]) + entry_name.size() > end) {
|
||||
gdfx_entry_iterator_ = gdfx_entry_->children.end();
|
||||
return X_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
@@ -104,8 +103,8 @@ X_STATUS DiscImageEntry::QueryDirectory(
|
||||
out_info->end_of_file = entry->size;
|
||||
out_info->allocation_size = 2048;
|
||||
out_info->attributes = (X_FILE_ATTRIBUTES)entry->attributes;
|
||||
out_info->file_name_length = (uint32_t)entry_name_length;
|
||||
memcpy(out_info->file_name, entry_name, entry_name_length);
|
||||
out_info->file_name_length = static_cast<uint32_t>(entry_name.size());
|
||||
memcpy(out_info->file_name, entry_name.c_str(), entry_name.size());
|
||||
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -66,10 +66,9 @@ X_STATUS STFSContainerEntry::QueryDirectory(
|
||||
auto end = (uint8_t*)out_info + length;
|
||||
|
||||
auto entry = *stfs_entry_iterator_;
|
||||
auto entry_name = entry->name.c_str();
|
||||
size_t entry_name_length = xestrlena(entry_name);
|
||||
auto entry_name = entry->name;
|
||||
|
||||
if (((uint8_t*)&out_info->file_name[0]) + entry_name_length > end) {
|
||||
if (((uint8_t*)&out_info->file_name[0]) + entry_name.size() > end) {
|
||||
stfs_entry_iterator_ = stfs_entry_->children.end();
|
||||
return X_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
@@ -82,8 +81,8 @@ X_STATUS STFSContainerEntry::QueryDirectory(
|
||||
out_info->end_of_file = entry->size;
|
||||
out_info->allocation_size = 4096;
|
||||
out_info->attributes = entry->attributes;
|
||||
out_info->file_name_length = (uint32_t)entry_name_length;
|
||||
memcpy(out_info->file_name, entry_name, entry_name_length);
|
||||
out_info->file_name_length = static_cast<uint32_t>(entry_name.size());
|
||||
memcpy(out_info->file_name, entry_name.c_str(), entry_name.size());
|
||||
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ SHIM_CALL RtlInitAnsiString_shim(
|
||||
|
||||
if (source_ptr != 0) {
|
||||
const char* source = (char*)SHIM_MEM_ADDR(source_ptr);
|
||||
uint16_t length = (uint16_t)xestrlena(source);
|
||||
uint16_t length = (uint16_t)strlen(source);
|
||||
SHIM_SET_MEM_16(destination_ptr + 0, length);
|
||||
SHIM_SET_MEM_16(destination_ptr + 2, length + 1);
|
||||
} else {
|
||||
@@ -211,8 +211,10 @@ SHIM_CALL RtlInitUnicodeString_shim(
|
||||
// _In_opt_ PCWSTR SourceString
|
||||
|
||||
if (source.size()) {
|
||||
SHIM_SET_MEM_16(destination_ptr + 0, source.size() * 2);
|
||||
SHIM_SET_MEM_16(destination_ptr + 2, (source.size() + 1) * 2);
|
||||
SHIM_SET_MEM_16(destination_ptr + 0,
|
||||
static_cast<uint16_t>(source.size() * 2));
|
||||
SHIM_SET_MEM_16(destination_ptr + 2,
|
||||
static_cast<uint16_t>((source.size() + 1) * 2));
|
||||
SHIM_SET_MEM_32(destination_ptr + 4, source_ptr);
|
||||
} else {
|
||||
SHIM_SET_MEM_16(destination_ptr + 0, 0);
|
||||
|
||||
Reference in New Issue
Block a user