Merge remote-tracking branch 'upstream/master' into canary

This commit is contained in:
illusion98 2019-08-21 07:00:47 -05:00
commit ad6448cd29
6 changed files with 60 additions and 1 deletions

View File

@ -68,7 +68,10 @@ X_RESULT XLiveBaseApp::DispatchMessageSync(uint32_t message,
return X_STATUS_UNSUCCESSFUL;
}
case 0x00058046: {
XELOGD("CXLivePresence::InitializeTitle(%.8X,%.8X)", buffer_ptr,
// Required to be successful for Forza 4 to detect signed-in profile
// Doesn't seem to set anything in the given buffer, probably only takes
// input
XELOGD("XLiveBaseUnk58046(%.8X, %.8X) unimplemented", buffer_ptr,
buffer_length);
return X_ERROR_SUCCESS;
}

View File

@ -509,6 +509,40 @@ dword_result_t XeKeysHmacSha(dword_t key_num, lpvoid_t inp_1,
}
DECLARE_XBOXKRNL_EXPORT1(XeKeysHmacSha, kNone, kImplemented);
static const uint8_t xe_key_obfuscation_key[16] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
dword_result_t XeKeysAesCbcUsingKey(lpvoid_t obscured_key, lpvoid_t inp_ptr,
dword_t inp_size, lpvoid_t out_ptr,
lpvoid_t feed_ptr, dword_t encrypt) {
uint8_t key[16];
// Deobscure key
XECRYPT_AES_STATE aes;
XeCryptAesKey(&aes, (uint8_t*)xe_key_obfuscation_key);
XeCryptAesEcb(&aes, obscured_key, key, 0);
// Run CBC using deobscured key
XeCryptAesKey(&aes, key);
XeCryptAesCbc(&aes, inp_ptr, inp_size, out_ptr, feed_ptr, encrypt);
return X_STATUS_SUCCESS;
}
DECLARE_XBOXKRNL_EXPORT1(XeKeysAesCbcUsingKey, kNone, kImplemented);
dword_result_t XeKeysObscureKey(lpvoid_t input, lpvoid_t output) {
// Based on HvxKeysObscureKey
// Seems to encrypt input with per-console KEY_OBFUSCATION_KEY (key 0x18)
XECRYPT_AES_STATE aes;
XeCryptAesKey(&aes, (uint8_t*)xe_key_obfuscation_key);
XeCryptAesEcb(&aes, input, output, 1);
return X_STATUS_SUCCESS;
}
DECLARE_XBOXKRNL_EXPORT1(XeKeysObscureKey, kNone, kImplemented);
void RegisterCryptExports(xe::cpu::ExportResolver* export_resolver,
KernelState* kernel_state) {}

View File

@ -404,6 +404,9 @@ dword_result_t NtSetInformationFile(
assert_true(length == 8);
auto eof = xe::load_and_swap<uint64_t>(file_info);
result = file->SetLength(eof);
// Update the files vfs::Entry information
file->entry()->update();
break;
}
case XFileCompletionInformation: {
@ -487,6 +490,11 @@ dword_result_t NtQueryInformationFile(
// };
assert_true(length == 56);
// Make sure we're working with up-to-date information, just in case the
// file size has changed via something other than NtSetInfoFile
// (eg. seems NtWriteFile might extend the file in some cases)
file->entry()->update();
auto file_info = file_info_ptr.as<X_FILE_NETWORK_OPEN_INFORMATION*>();
file_info->creation_time = file->entry()->create_timestamp();
file_info->last_access_time = file->entry()->access_timestamp();

View File

@ -104,5 +104,17 @@ bool HostPathEntry::DeleteEntryInternal(Entry* entry) {
}
}
void HostPathEntry::update() {
xe::filesystem::FileInfo file_info;
if (!xe::filesystem::GetInfo(local_path_, &file_info)) {
return;
}
if (file_info.type == xe::filesystem::FileInfo::Type::kFile) {
size_ = file_info.total_size;
allocation_size_ =
xe::round_up(file_info.total_size, device()->bytes_per_sector());
}
}
} // namespace vfs
} // namespace xe

View File

@ -38,6 +38,7 @@ class HostPathEntry : public Entry {
std::unique_ptr<MappedMemory> OpenMapped(MappedMemory::Mode mode,
size_t offset,
size_t length) override;
void update() override;
private:
friend class HostPathDevice;

View File

@ -120,6 +120,7 @@ class Entry {
size_t length = 0) {
return nullptr;
}
virtual void update() { return; }
protected:
Entry(Device* device, Entry* parent, const std::string& path);