621{
624
628
630 ULONG dwCurrentBytesRead = 0;
632
634
638
642 size_t urlLength, filenameLength;
643
647
648 const DWORD dwUrlConnectFlags =
650
652 {
655 }
656
657 for (iAppId = 0; iAppId < InfoArray.
GetSize(); ++iAppId)
658 {
659
661 break;
664 {
668 }
669
670
672 {
674 {
677 }
678 }
679 else
680 {
682 }
683
684
685 switch (InfoArray[iAppId].DLType)
686 {
688 szNewCaption.
Format(szCaption, InfoArray[iAppId].
szName.GetString());
689 break;
692 break;
695 break;
696 }
697
701
702
703 p =
wcsrchr(InfoArray[iAppId].szUrl.GetString(),
L'/');
704 q =
wcsrchr(InfoArray[iAppId].szUrl.GetString(),
L'?');
705
706
708 {
711 }
712
713
715
716
717
718 if (
q &&
q >
p && (
q -
p) > 0)
720
721
723 {
725 {
728 }
729 }
730
731 switch (InfoArray[iAppId].DLType)
732 {
736 break;
738 {
742 break;
743 }
744 }
745
746 if ((InfoArray[iAppId].DLType ==
DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] &&
748 {
749
751 goto run;
752 }
753
754
758
760
761
764
765
767 {
768 case 0:
769 default:
771 break;
772 case 1:
774 break;
775 case 2:
778 break;
779 }
780
781 if (!hOpen)
782 {
785 }
786
788
789 memset(&urlComponents, 0,
sizeof(urlComponents));
791
792 urlLength = InfoArray[iAppId].szUrl.GetLength();
795
797 {
800 }
801
802 dwContentLen = 0;
803
805 {
808 {
810 {
811
813 }
815 }
816
817
819 {
822 }
823
825 {
828 }
829
830
833 }
835 {
836
840 {
842 {
843
845 }
847 }
848
850 }
852 {
853
856
859 {
861 {
862 goto run;
863 }
864 else
865 {
868 }
869 }
870 else
871 {
874 }
875 }
876
877 if (!dwContentLen)
878 {
879
880 if (InfoArray[iAppId].SizeInBytes)
881 {
882 dwContentLen = InfoArray[iAppId].SizeInBytes;
883 }
884 else
885 {
886
888 }
889 }
890
892
893#ifdef USE_CERT_PINNING
894
896 {
899 bool bAskQuestion = false;
901 {
903 bAskQuestion = true;
904 }
905 else
906 {
908 (
strcmp(issuerName, CERT_ISSUER_INFO_OLD) &&
strcmp(issuerName, CERT_ISSUER_INFO_NEW)))
909 {
911 bAskQuestion = true;
912 }
913 }
914
915 if (bAskQuestion)
916 {
918 {
920 }
921 }
922 }
923#endif
924
926
928 {
931 }
932
933 dwCurrentBytesRead = 0;
934 do
935 {
937 {
940 }
941
943 {
946 }
947
948 dwCurrentBytesRead += dwBytesRead;
951 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
953
956
958 {
959 DPRINT1(
"Operation cancelled\n");
961 }
962
963 if (!dwContentLen)
964 {
965
967
968 dwContentLen = dwCurrentBytesRead;
971 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
972 }
973
974
975
976 if ((InfoArray[iAppId].DLType ==
DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] != 0)
977 {
979
980
982 {
983 DPRINT1(
"Unable to load string\n");
985 }
986
991
992
994 {
996 {
997 DPRINT1(
"Unable to load string\n");
999 }
1000
1005 }
1006 }
1007
1008 run:
1010
1011
1013 {
1015 shExInfo.
cbSize =
sizeof(shExInfo);
1021
1022
1024
1026 {
1027
1028
1033
1035
1036
1039 }
1040 else
1041 {
1043 }
1044 }
1045
1049
1053
1054 if (bTempfile)
1055 {
1058 }
1059
1061 return 0;
1063 }
1064
1067 return 0;
1069 return 0;
1070}
PRTL_UNICODE_STRING_BUFFER Path
int strcmp(const char *String1, const char *String2)
#define APPLICATION_DATABASE_NAME
BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPCWSTR lpMsg)
BOOL GetStorageDirectory(CStringW &lpDirectory)
#define IDS_UNABLE_TO_DOWNLOAD
#define IDS_MISMATCH_CERT_INFO
#define IDS_UNABLE_TO_DOWNLOAD2
#define IDS_UNABLE_TO_QUERY_CERT
#define IDC_DOWNLOAD_STATUS
#define IDS_INTEG_CHECK_TITLE
#define IDS_DL_DIALOG_DB_DOWNLOAD_DISP
#define IDS_INTEG_CHECK_FAIL
#define IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP
SETTINGS_INFO SettingsInfo
void __cdecl Format(UINT nFormatID,...)
VOID SetDownloadStatus(INT ItemIndex, DownloadStatus Status)
static VOID UpdateProgress(HWND hDlg, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
VOID SetMarquee(BOOL Enable)
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
#define INVALID_HANDLE_VALUE
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
HRESULT WINAPI PathCreateFromUrlW(LPCWSTR pszUrl, LPWSTR pszPath, LPDWORD pcchPath, DWORD dwReserved)
DWORD WINAPI FtpGetFileSize(HINTERNET hFile, LPDWORD lpdwFileSizeHigh)
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
GLdouble GLdouble GLdouble GLdouble q
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
VOID UrlUnescapeAndMakeFileNameValid(CStringW &str)
BOOL ShowLastError(HWND hWndOwner, BOOL bInetError, DWORD dwLastError)
@ DLSTATUS_WAITING_INSTALL
CStringW LoadStatusString(DownloadStatus StatusParam)
VOID MessageBox_LoadString(HWND hMainWnd, INT StringID)
@ DLTYPE_DBUPDATE_UNOFFICIAL
static BYTE subjectName[]
static const WCHAR szName[]
#define SEE_MASK_NOCLOSEPROCESS
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
WCHAR szDownloadDir[MAX_PATH]
WCHAR szNoProxyFor[MAX_PATH]
WCHAR szProxyServer[MAX_PATH]
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
#define INVALID_FILE_ATTRIBUTES
DWORD WINAPI GetLastError(void)
#define INTERNET_SCHEME_FTP
#define INTERNET_SCHEME_HTTP
#define INTERNET_SCHEME_HTTPS
#define INTERNET_FLAG_PRAGMA_NOCACHE
#define INTERNET_FLAG_DONT_CACHE
#define INTERNET_FLAG_KEEP_CONNECTION
#define INTERNET_FLAG_PASSIVE
#define HTTP_QUERY_FLAG_NUMBER
#define INTERNET_OPEN_TYPE_DIRECT
#define INTERNET_OPEN_TYPE_PROXY
#define HTTP_QUERY_STATUS_CODE
#define INTERNET_OPEN_TYPE_PRECONFIG
#define HTTP_QUERY_CONTENT_LENGTH
BOOL VerifyInteg(LPCWSTR lpSHA1Hash, LPCWSTR lpFileName)
BOOL WINAPI IsWindow(_In_opt_ HWND)
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)