Untitled
unknown
c_cpp
2 years ago
6.5 kB
8
Indexable
__int64 __fastcall KIHttpFileSession::DownloadEngine::DownloadFile(__int64 a1, _DWORD *a2) { __int64 session_ptr; // rcx __int64 download_status; // rax int num_bytes_written; // eax DWORD LastError; // edi __int64 stream_handle; // rcx _DWORD *file_info_ptr; // rcx unsigned int should_retry; // edi int num_bytes_expected; // eax BOOL has_expected_bytes; // esi _DWORD *file_info_data_ptr; // rcx __int64 file_handle; // rax void *file_handle_ptr; // rbp __int64 file_info_buffer; // rcx __int64 internet_session_ptr; // rcx __int64 v18; // rcx __int64 num_bytes_downloaded; // rcx __int64 v20; // rcx __int64 v21; // rcx __int64 internet_option_buffer; // rcx __int64 num_bytes_query_result; // rcx DWORD dwNumberOfBytesRead; // [rsp+60h] [rbp-68h] BYREF unsigned int v25; // [rsp+64h] [rbp-64h] BYREF DWORD dwBufferLength; // [rsp+68h] [rbp-60h] BYREF char v27[32]; // [rsp+70h] [rbp-58h] BYREF *a2 = 0; if ( InternetReadFile(*(a1 + 144), *(a1 + 152), 0x1FFFEu, &dwNumberOfBytesRead) ) { if ( dwNumberOfBytesRead ) { *(*(a1 + 16) + 128i64) += dwNumberOfBytesRead; num_bytes_written = sub_1410E64B0(a1 + 32); *(*(a1 + 24) + 96i64) += num_bytes_written; *(*(a1 + 24) + 104i64) += dwNumberOfBytesRead; if ( num_bytes_written == dwNumberOfBytesRead ) { return 100i64; } else { LastError = GetLastError(); if ( sub_1410CF370() <= 140 ) sub_1410CE520( &unk_1432A5438, 0, 140, 0, 1351, "KIHttpFileSession::DownloadEngine::DownloadFile", "C:\\Code\\Wizard101\\Wizard_1_510_Live\\Core\\Common\\PatchSystem\\KIHttpFileSession.cpp"); else sub_1410CF8F0(stream_handle); (*(*a1 + 40i64))(a1); *a2 = (*(*a1 + 64i64))(a1, LastError); return 1i64; } } else { (*(*a1 + 40i64))(a1); file_info_ptr = *(a1 + 24); should_retry = 1; v25 = 0; num_bytes_expected = file_info_ptr[19]; if ( !num_bytes_expected || num_bytes_expected == file_info_ptr[24] ) { has_expected_bytes = file_info_ptr[20] != 0; file_info_data_ptr = file_info_ptr + 10; if ( *(file_info_data_ptr + 3) >= 0x10ui64 ) file_info_data_ptr = *file_info_data_ptr; file_handle = OpenFileStream(file_info_data_ptr, 0, 1u); file_handle_ptr = file_handle; should_retry = has_expected_bytes; if ( file_handle != -1 ) { sub_1411A9E60(*(a1 + 24), file_handle); if ( *(*(a1 + 24) + 80i64) && !CalculateFileCRC32Checksum(file_handle_ptr, &v25) && v25 == *(*(a1 + 24) + 80i64) ) { should_retry = 0; } CloseHandle(file_handle_ptr); } } *(*(a1 + 24) + 100i64) = v25; if ( should_retry == 1 ) { if ( sub_1410CF370() <= 140 ) sub_1410CE520( &unk_1432A5438, 0, 140, 0, 1411, "KIHttpFileSession::DownloadEngine::DownloadFile", "C:\\Code\\Wizard101\\Wizard_1_510_Live\\Core\\Common\\PatchSystem\\KIHttpFileSession.cpp"); else sub_1410CF8F0(file_info_buffer); sub_1411A9EC0(*(a1 + 24), v27, 32i64); internet_session_ptr = *(a1 + 16); dwBufferLength = 0; if ( InternetQueryOptionA(*(internet_session_ptr + 112), 0x26u, 0i64, &dwBufferLength) && dwBufferLength == 8 && MEMORY[0] == 3 ) { if ( sub_1410CF370() <= 100 ) sub_1410CE520( &unk_1432A5438, 0, 100, 0, 1427, "KIHttpFileSession::DownloadEngine::DownloadFile", "C:\\Code\\Wizard101\\Wizard_1_510_Live\\Core\\Common\\PatchSystem\\KIHttpFileSession.cpp"); else sub_1410CF8F0(v18); } if ( sub_1410CF370() <= 100 ) sub_1410CE520( &unk_1432A5438, 0, 100, 0, 1432, "KIHttpFileSession::DownloadEngine::DownloadFile", "C:\\Code\\Wizard101\\Wizard_1_510_Live\\Core\\Common\\PatchSystem\\KIHttpFileSession.cpp"); else sub_1410CF8F0(num_bytes_downloaded); if ( sub_1410CF370() <= 100 ) sub_1410CE520( &unk_1432A5438, 0, 100, 0, 1433, "KIHttpFileSession::DownloadEngine::DownloadFile", "C:\\Code\\Wizard101\\Wizard_1_510_Live\\Core\\Common\\PatchSystem\\KIHttpFileSession.cpp"); else sub_1410CF8F0(v20); if ( sub_1410CF370() <= 100 ) sub_1410CE520( &unk_1432A5438, 0, 100, 0, 1434, "KIHttpFileSession::DownloadEngine::DownloadFile", "C:\\Code\\Wizard101\\Wizard_1_510_Live\\Core\\Common\\PatchSystem\\KIHttpFileSession.cpp"); else sub_1410CF8F0(v21); if ( sub_1410CF370() <= 100 ) sub_1410CE520( &unk_1432A5438, 0, 100, 0, 1442, "KIHttpFileSession::DownloadEngine::DownloadFile", "C:\\Code\\Wizard101\\Wizard_1_510_Live\\Core\\Common\\PatchSystem\\KIHttpFileSession.cpp"); else sub_1410CF8F0(internet_option_buffer); if ( sub_1410CF370() <= 100 ) sub_1410CE520( &unk_1432A5438, 0, 100, 0, 1450, "KIHttpFileSession::DownloadEngine::DownloadFile", "C:\\Code\\Wizard101\\Wizard_1_510_Live\\Core\\Common\\PatchSystem\\KIHttpFileSession.cpp"); else sub_1410CF8F0(num_bytes_query_result); *a2 = 7; } return should_retry; } } else { sub_1411A9EC0(*(a1 + 24), v27, 32i64); if ( sub_1410CF370() <= 140 ) { GetLastError(); sub_1410CE520( &unk_1432A5438, 0, 140, 0, 1323, "KIHttpFileSession::DownloadEngine::DownloadFile", "C:\\Code\\Wizard101\\Wizard_1_510_Live\\Core\\Common\\PatchSystem\\KIHttpFileSession.cpp"); } else { sub_1410CF8F0(session_ptr); } (*(*a1 + 40i64))(a1); download_status = 1i64; *a2 = 3; } return download_status; }
Editor is loading...