629{
632
636
638 ULONG dwCurrentBytesRead = 0;
640
642
646
650 size_t urlLength, filenameLength;
651
655
656 const DWORD dwUrlConnectFlags =
658
660 {
663 }
664
665 for (iAppId = 0; iAppId < InfoArray.
GetSize(); ++iAppId)
666 {
667
669 break;
672 {
676 }
677
678
680 {
682 {
685 }
686 }
687 else
688 {
690 }
691
692
693 switch (InfoArray[iAppId].DLType)
694 {
696 szNewCaption.
Format(szCaption, InfoArray[iAppId].
szName.GetString());
697 break;
700 break;
703 break;
704 }
705
709
710
711 p =
wcsrchr(InfoArray[iAppId].szUrl.GetString(),
L'/');
712 q =
wcsrchr(InfoArray[iAppId].szUrl.GetString(),
L'?');
713
714
716 {
719 }
720
721
723
724
725
726 if (
q &&
q >
p && (
q -
p) > 0)
728
729
731 {
733 {
736 }
737 }
738
739 switch (InfoArray[iAppId].DLType)
740 {
744 break;
746 {
750 break;
751 }
752 }
753
754 if ((InfoArray[iAppId].DLType ==
DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] &&
756 {
757
759 goto run;
760 }
761
762
766
768
769
772
773
775 {
776 case 0:
777 default:
779 break;
780 case 1:
782 break;
783 case 2:
786 break;
787 }
788
789 if (!hOpen)
790 {
793 }
794
796
797 memset(&urlComponents, 0,
sizeof(urlComponents));
799
800 urlLength = InfoArray[iAppId].szUrl.GetLength();
803
805 {
808 }
809
810 dwContentLen = 0;
811
813 {
816 {
818 {
819
821 }
823 }
824
825
827 {
830 }
831
833 {
836 }
837
838
841 }
843 {
844
848 {
850 {
851
853 }
855 }
856
858 }
860 {
861
864
867 {
869 {
870 goto run;
871 }
872 else
873 {
876 }
877 }
878 else
879 {
882 }
883 }
884
885 if (!dwContentLen)
886 {
887
888 if (InfoArray[iAppId].SizeInBytes)
889 {
890 dwContentLen = InfoArray[iAppId].SizeInBytes;
891 }
892 else
893 {
894
896 }
897 }
898
900
901#ifdef USE_CERT_PINNING
902
904 {
907 bool bAskQuestion = false;
909 {
911 bAskQuestion = true;
912 }
913 else
914 {
916 (
strcmp(issuerName, CERT_ISSUER_INFO_OLD) &&
strcmp(issuerName, CERT_ISSUER_INFO_NEW)))
917 {
919 bAskQuestion = true;
920 }
921 }
922
923 if (bAskQuestion)
924 {
926 {
928 }
929 }
930 }
931#endif
932
934
936 {
939 }
940
941 dwCurrentBytesRead = 0;
942 do
943 {
945 {
948 }
949
951 {
954 }
955
956 dwCurrentBytesRead += dwBytesRead;
959 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
961
964
966 {
967 DPRINT1(
"Operation cancelled\n");
969 }
970
971 if (!dwContentLen)
972 {
973
975
976 dwContentLen = dwCurrentBytesRead;
979 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
980 }
981
982
983
984 if ((InfoArray[iAppId].DLType ==
DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] != 0)
985 {
987
988
990 {
991 DPRINT1(
"Unable to load string\n");
993 }
994
999
1000
1002 {
1004 {
1005 DPRINT1(
"Unable to load string\n");
1007 }
1008
1013 }
1014 }
1015
1016 run:
1018
1019
1021 {
1024 shExInfo.
cbSize =
sizeof(shExInfo);
1030
1032 {
1034 InfoArray[iAppId].szPackageName +
L"\" \"" +
1040 }
1041
1042
1044
1046 {
1047
1048
1053
1055
1056
1059 }
1060 else
1061 {
1063 }
1064 }
1065
1069
1073
1074 if (bTempfile)
1075 {
1078 }
1079
1081 return 0;
1083 }
1084
1087 return 0;
1089 return 0;
1090}
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 ReleaseBuffer(_In_ int nNewLength=-1)
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)
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
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
GLenum const GLfloat * params
_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
VOID MessageBox_LoadString(HWND hOwnerWnd, INT StringID)
CStringW LoadStatusString(DownloadStatus StatusParam)
@ 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)