ReactOS 0.4.15-dev-8093-g3285f69
CDownloadManager Class Reference
Collaboration diagram for CDownloadManager:

Static Public Member Functions

static VOID Add (DownloadInfo info)
 
static VOID Download (const DownloadInfo &DLInfo, BOOL bIsModal=FALSE)
 
static INT_PTR CALLBACK DownloadDlgProc (HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static unsigned int WINAPI ThreadFunc (LPVOID Context)
 
static VOID LaunchDownloadDialog (BOOL)
 

Static Private Member Functions

static VOID UpdateProgress (HWND hDlg, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
 

Static Private Attributes

static ATL::CSimpleArray< DownloadInfoAppsDownloadList
 
static CDowloadingAppsListView DownloadsListView
 
static CDownloaderProgress ProgressBar
 
static BOOL bCancelled = FALSE
 
static BOOL bModal = FALSE
 

Detailed Description

Definition at line 421 of file loaddlg.cpp.

Member Function Documentation

◆ Add()

VOID CDownloadManager::Add ( DownloadInfo  info)
static

Definition at line 451 of file loaddlg.cpp.

452{
454}
BOOL Add(const T &t)
Definition: atlsimpcoll.h:58
static ATL::CSimpleArray< DownloadInfo > AppsDownloadList
Definition: loaddlg.cpp:423

Referenced by DownloadListOfApplications().

◆ Download()

VOID CDownloadManager::Download ( const DownloadInfo DLInfo,
BOOL  bIsModal = FALSE 
)
static

Definition at line 457 of file loaddlg.cpp.

458{
460 AppsDownloadList.Add(DLInfo);
461 LaunchDownloadDialog(bIsModal);
462}
static VOID LaunchDownloadDialog(BOOL)
Definition: loaddlg.cpp:1094

Referenced by DownloadApplication(), and DownloadApplicationsDB().

◆ DownloadDlgProc()

INT_PTR CALLBACK CDownloadManager::DownloadDlgProc ( HWND  Dlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 465 of file loaddlg.cpp.

466{
467 static WCHAR szCaption[MAX_PATH];
468
469 switch (uMsg)
470 {
471 case WM_INITDIALOG:
472 {
473 HICON hIconSm, hIconBg;
474 CStringW szTempCaption;
475
477
478 if (hMainWnd)
479 {
482 }
483 if (!hMainWnd || (!hIconBg || !hIconSm))
484 {
485 /* Load the default icon */
487 }
488
489 if (hIconBg && hIconSm)
490 {
491 SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM)hIconBg);
492 SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
493 }
494
496 if (Item)
497 {
498 // initialize the default values for our nifty progress bar
499 // and subclass it so that it learns to print a status text
503 if (AppsDownloadList.GetSize() > 0)
504 ProgressBar.SetProgress(0, AppsDownloadList[0].SizeInBytes);
505 }
506
507 // Add a ListView
508 HWND hListView = DownloadsListView.Create(Dlg);
509 if (!hListView)
510 {
511 return FALSE;
512 }
514
515 // Get a dlg string for later use
516 GetWindowTextW(Dlg, szCaption, _countof(szCaption));
517
518 // Hide a placeholder from displaying
519 szTempCaption = szCaption;
520 szTempCaption.Replace(L"%ls", L"");
521 SetWindowText(Dlg, szTempCaption.GetString());
522
523 ShowWindow(Dlg, SW_SHOW);
524
525 // Start download process
526 DownloadParam *param = new DownloadParam(Dlg, AppsDownloadList, szCaption);
527 unsigned int ThreadId;
528 HANDLE Thread = (HANDLE)_beginthreadex(NULL, 0, ThreadFunc, (void *)param, 0, &ThreadId);
529 if (!Thread)
530 {
531 return FALSE;
532 }
533
534 CloseHandle(Thread);
536 return TRUE;
537 }
538
539 case WM_COMMAND:
540 if (wParam == IDCANCEL)
541 {
543 PostMessageW(Dlg, WM_CLOSE, 0, 0);
544 }
545 return FALSE;
546
547 case WM_CLOSE:
548 if (ProgressBar)
551 {
552 ::EndDialog(Dlg, 0);
553 }
554 else
555 {
556 ::DestroyWindow(Dlg);
557 }
558 return TRUE;
559
560 default:
561 return FALSE;
562 }
563}
#define IDI_MAIN
Definition: resource.h:4
#define IDC_DOWNLOAD_PROGRESS
Definition: resource.h:41
int GetSize() const
Definition: atlsimpcoll.h:104
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
int Replace(PCXSTR pszOld, PCXSTR pszNew)
Definition: cstringt.h:886
BOOL SubclassWindow(HWND hWnd)
Definition: atlwin.h:1552
HWND UnsubclassWindow(BOOL bForce=FALSE)
Definition: atlwin.h:1575
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1116
HWND Create(HWND hwndParent)
Definition: loaddlg.cpp:298
VOID LoadList(ATL::CSimpleArray< DownloadInfo > arrInfo)
Definition: loaddlg.cpp:318
static BOOL bCancelled
Definition: loaddlg.cpp:426
static BOOL bModal
Definition: loaddlg.cpp:427
static CDownloaderProgress ProgressBar
Definition: loaddlg.cpp:425
static CDowloadingAppsListView DownloadsListView
Definition: loaddlg.cpp:424
static unsigned int WINAPI ThreadFunc(LPVOID Context)
Definition: loaddlg.cpp:628
VOID SetProgress(ULONG ulProgress, ULONG ulProgressMax)
Definition: loaddlg.cpp:170
WPARAM wParam
Definition: combotst.c:138
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define MAX_PATH
Definition: compat.h:34
HINSTANCE hInst
Definition: dxdiag.c:13
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
GLfloat param
Definition: glext.h:5796
HWND hMainWnd
Definition: magnifier.c:32
static HICON
Definition: imagelist.c:84
HICON hIconSm
Definition: msconfig.c:44
#define L(x)
Definition: ntvdm.h:50
#define PBM_SETPOS
Definition: commctrl.h:2184
#define PBM_SETRANGE
Definition: commctrl.h:2183
_CRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security, _In_ unsigned _StackSize, _In_ unsigned(__stdcall *_StartAddress)(void *), _In_opt_ void *_ArgList, _In_ unsigned _InitFlag, _Out_opt_ unsigned *_ThrdAddr)
#define _countof(array)
Definition: sndvol32.h:70
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
PVOID HANDLE
Definition: typedefs.h:73
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_CLOSE
Definition: winuser.h:1621
#define GCLP_HICONSM
Definition: winuser.h:675
#define MAKELPARAM(l, h)
Definition: winuser.h:4008
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDCANCEL
Definition: winuser.h:831
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define GCLP_HICON
Definition: winuser.h:674
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_INITDIALOG
Definition: winuser.h:1739
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define GetClassLongPtrW
Definition: winuser.h:4564
#define SW_SHOW
Definition: winuser.h:775
#define SetWindowText
Definition: winuser.h:5857
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL WINAPI DestroyWindow(_In_ HWND)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2106
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by LaunchDownloadDialog().

◆ LaunchDownloadDialog()

VOID CDownloadManager::LaunchDownloadDialog ( BOOL  bIsModal)
static

Definition at line 1094 of file loaddlg.cpp.

1095{
1096 CDownloadManager::bModal = bIsModal;
1097 if (bIsModal)
1098 {
1100 }
1101 else
1102 {
1104 }
1105}
#define IDD_DOWNLOAD_DIALOG
Definition: resource.h:65
static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: loaddlg.cpp:465
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4399
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4281

Referenced by Download(), and DownloadListOfApplications().

◆ ThreadFunc()

unsigned int WINAPI CDownloadManager::ThreadFunc ( LPVOID  Context)
static

Definition at line 628 of file loaddlg.cpp.

629{
630 CPathW Path;
631 PWSTR p, q;
632
633 HWND hDlg = static_cast<DownloadParam *>(param)->Dialog;
634 HWND Item;
635 INT iAppId;
636
637 ULONG dwContentLen, dwBytesWritten, dwBytesRead, dwStatus;
638 ULONG dwCurrentBytesRead = 0;
639 ULONG dwStatusLen = sizeof(dwStatus);
640
641 BOOL bTempfile = FALSE;
642
643 HINTERNET hOpen = NULL;
646
647 unsigned char lpBuffer[4096];
648 LPCWSTR lpszAgent = L"RApps/1.1";
649 URL_COMPONENTSW urlComponents;
650 size_t urlLength, filenameLength;
651
652 const ATL::CSimpleArray<DownloadInfo> &InfoArray = static_cast<DownloadParam *>(param)->AppInfo;
653 LPCWSTR szCaption = static_cast<DownloadParam *>(param)->szCaption;
654 CStringW szNewCaption;
655
656 const DWORD dwUrlConnectFlags =
658
659 if (InfoArray.GetSize() <= 0)
660 {
662 goto end;
663 }
664
665 for (iAppId = 0; iAppId < InfoArray.GetSize(); ++iAppId)
666 {
667 // Reset progress bar
668 if (!IsWindow(hDlg))
669 break;
671 if (Item)
672 {
675 ProgressBar.SetProgress(0, InfoArray[iAppId].SizeInBytes);
676 }
677
678 // is this URL an update package for RAPPS? if so store it in a different place
679 if (InfoArray[iAppId].DLType != DLTYPE_APPLICATION)
680 {
682 {
684 goto end;
685 }
686 }
687 else
688 {
690 }
691
692 // Change caption to show the currently downloaded app
693 switch (InfoArray[iAppId].DLType)
694 {
696 szNewCaption.Format(szCaption, InfoArray[iAppId].szName.GetString());
697 break;
698 case DLTYPE_DBUPDATE:
699 szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_DOWNLOAD_DISP);
700 break;
702 szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP);
703 break;
704 }
705
706 if (!IsWindow(hDlg))
707 goto end;
708 SetWindowTextW(hDlg, szNewCaption.GetString());
709
710 // build the path for the download
711 p = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'/');
712 q = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'?');
713
714 // do we have a final slash separator?
715 if (!p)
716 {
718 goto end;
719 }
720
721 // prepare the tentative length of the filename, maybe we've to remove part of it later on
722 filenameLength = wcslen(p) * sizeof(WCHAR);
723
724 /* do we have query arguments in the target URL after the filename? account for them
725 (e.g. https://example.org/myfile.exe?no_adware_plz) */
726 if (q && q > p && (q - p) > 0)
727 filenameLength -= wcslen(q - 1) * sizeof(WCHAR);
728
729 // is the path valid? can we access it?
731 {
733 {
735 goto end;
736 }
737 }
738
739 switch (InfoArray[iAppId].DLType)
740 {
741 case DLTYPE_DBUPDATE:
744 break;
746 {
747 CStringW str = p + 1; // use the filename retrieved from URL
749 Path += str;
750 break;
751 }
752 }
753
754 if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] &&
756 {
757 // only open it in case of total correctness
758 if (VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path))
759 goto run;
760 }
761
762 // Add the download URL
763 if (!IsWindow(hDlg))
764 goto end;
765 SetDlgItemTextW(hDlg, IDC_DOWNLOAD_STATUS, InfoArray[iAppId].szUrl.GetString());
766
768
769 // download it
771 bTempfile = TRUE;
772
773 /* FIXME: this should just be using the system-wide proxy settings */
774 switch (SettingsInfo.Proxy)
775 {
776 case 0: // preconfig
777 default:
778 hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
779 break;
780 case 1: // direct (no proxy)
781 hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
782 break;
783 case 2: // use proxy
784 hOpen = InternetOpenW(
786 break;
787 }
788
789 if (!hOpen)
790 {
792 goto end;
793 }
794
795 dwStatusLen = sizeof(dwStatus);
796
797 memset(&urlComponents, 0, sizeof(urlComponents));
798 urlComponents.dwStructSize = sizeof(urlComponents);
799
800 urlLength = InfoArray[iAppId].szUrl.GetLength();
801 urlComponents.dwSchemeLength = urlLength + 1;
802 urlComponents.lpszScheme = (LPWSTR)malloc(urlComponents.dwSchemeLength * sizeof(WCHAR));
803
804 if (!InternetCrackUrlW(InfoArray[iAppId].szUrl, urlLength + 1, ICU_DECODE | ICU_ESCAPE, &urlComponents))
805 {
807 goto end;
808 }
809
810 dwContentLen = 0;
811
812 if (urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme == INTERNET_SCHEME_HTTPS)
813 {
814 hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl.GetString(), NULL, 0, dwUrlConnectFlags, 0);
815 if (!hFile)
816 {
818 {
819 /* Workaround for CORE-17377 */
821 }
822 goto end;
823 }
824
825 // query connection
827 {
829 goto end;
830 }
831
833 {
835 goto end;
836 }
837
838 // query content length
840 hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwStatusLen, NULL);
841 }
842 else if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
843 {
844 // force passive mode on FTP
845 hFile =
846 InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl, NULL, 0, dwUrlConnectFlags | INTERNET_FLAG_PASSIVE, 0);
847 if (!hFile)
848 {
850 {
851 /* Workaround for CORE-17377 */
853 }
854 goto end;
855 }
856
857 dwContentLen = FtpGetFileSize(hFile, &dwStatus);
858 }
859 else if (urlComponents.nScheme == INTERNET_SCHEME_FILE)
860 {
861 // Add support for the file scheme so testing locally is simpler
862 WCHAR LocalFilePath[MAX_PATH];
863 DWORD cchPath = _countof(LocalFilePath);
864 // Ideally we would use PathCreateFromUrlAlloc here, but that is not exported (yet)
865 HRESULT hr = PathCreateFromUrlW(InfoArray[iAppId].szUrl, LocalFilePath, &cchPath, 0);
866 if (SUCCEEDED(hr))
867 {
868 if (CopyFileW(LocalFilePath, Path, FALSE))
869 {
870 goto run;
871 }
872 else
873 {
875 goto end;
876 }
877 }
878 else
879 {
881 goto end;
882 }
883 }
884
885 if (!dwContentLen)
886 {
887 // Someone was nice enough to add this, let's use it
888 if (InfoArray[iAppId].SizeInBytes)
889 {
890 dwContentLen = InfoArray[iAppId].SizeInBytes;
891 }
892 else
893 {
894 // content-length is not known, enable marquee mode
896 }
897 }
898
899 free(urlComponents.lpszScheme);
900
901#ifdef USE_CERT_PINNING
902 // are we using HTTPS to download the RAPPS update package? check if the certificate is original
903 if ((urlComponents.nScheme == INTERNET_SCHEME_HTTPS) && (InfoArray[iAppId].DLType == DLTYPE_DBUPDATE))
904 {
905 CLocalPtr<char> subjectName, issuerName;
906 CStringA szMsgText;
907 bool bAskQuestion = false;
908 if (!CertGetSubjectAndIssuer(hFile, subjectName, issuerName))
909 {
910 szMsgText.LoadStringW(IDS_UNABLE_TO_QUERY_CERT);
911 bAskQuestion = true;
912 }
913 else
914 {
915 if (strcmp(subjectName, CERT_SUBJECT_INFO) ||
916 (strcmp(issuerName, CERT_ISSUER_INFO_OLD) && strcmp(issuerName, CERT_ISSUER_INFO_NEW)))
917 {
918 szMsgText.Format(IDS_MISMATCH_CERT_INFO, (char *)subjectName, (const char *)issuerName);
919 bAskQuestion = true;
920 }
921 }
922
923 if (bAskQuestion)
924 {
926 {
927 goto end;
928 }
929 }
930 }
931#endif
932
934
935 if (hOut == INVALID_HANDLE_VALUE)
936 {
938 goto end;
939 }
940
941 dwCurrentBytesRead = 0;
942 do
943 {
944 if (!InternetReadFile(hFile, lpBuffer, _countof(lpBuffer), &dwBytesRead))
945 {
947 goto end;
948 }
949
950 if (!WriteFile(hOut, &lpBuffer[0], dwBytesRead, &dwBytesWritten, NULL))
951 {
953 goto end;
954 }
955
956 dwCurrentBytesRead += dwBytesRead;
957 if (!IsWindow(hDlg))
958 goto end;
959 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
960 } while (dwBytesRead && !bCancelled);
961
962 CloseHandle(hOut);
964
965 if (bCancelled)
966 {
967 DPRINT1("Operation cancelled\n");
968 goto end;
969 }
970
971 if (!dwContentLen)
972 {
973 // set progress bar to 100%
975
976 dwContentLen = dwCurrentBytesRead;
977 if (!IsWindow(hDlg))
978 goto end;
979 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
980 }
981
982 /* if this thing isn't a RAPPS update and it has a SHA-1 checksum
983 verify its integrity by using the native advapi32.A_SHA1 functions */
984 if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] != 0)
985 {
986 CStringW szMsgText;
987
988 // change a few strings in the download dialog to reflect the verification process
989 if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_TITLE))
990 {
991 DPRINT1("Unable to load string\n");
992 goto end;
993 }
994
995 if (!IsWindow(hDlg))
996 goto end;
997 SetWindowTextW(hDlg, szMsgText.GetString());
999
1000 // this may take a while, depending on the file size
1001 if (!VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path))
1002 {
1003 if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_FAIL))
1004 {
1005 DPRINT1("Unable to load string\n");
1006 goto end;
1007 }
1008
1009 if (!IsWindow(hDlg))
1010 goto end;
1011 MessageBoxW(hDlg, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
1012 goto end;
1013 }
1014 }
1015
1016 run:
1018
1019 // run it
1020 if (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)
1021 {
1022 CStringW app, params;
1023 SHELLEXECUTEINFOW shExInfo = {0};
1024 shExInfo.cbSize = sizeof(shExInfo);
1025 shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
1026 shExInfo.lpVerb = L"open";
1027 shExInfo.lpFile = Path;
1028 shExInfo.lpParameters = L"";
1029 shExInfo.nShow = SW_SHOW;
1030
1031 if (InfoArray[iAppId].IType == INSTALLER_GENERATE)
1032 {
1033 params = L"/" + CStringW(CMD_KEY_GENINST) + L" \"" +
1034 InfoArray[iAppId].szPackageName + L"\" \"" +
1035 CStringW(shExInfo.lpFile) + L"\"";
1036 shExInfo.lpParameters = params;
1037 shExInfo.lpFile = app.GetBuffer(MAX_PATH);
1038 GetModuleFileNameW(NULL, const_cast<LPWSTR>(shExInfo.lpFile), MAX_PATH);
1039 app.ReleaseBuffer();
1040 }
1041
1042 /* FIXME: Do we want to log installer status? */
1043 WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_INSTALL, InfoArray[iAppId].szName);
1044
1045 if (ShellExecuteExW(&shExInfo))
1046 {
1047 // reflect installation progress in the titlebar
1048 // TODO: make a separate string with a placeholder to include app name?
1050 if (!IsWindow(hDlg))
1051 goto end;
1052 SetWindowTextW(hDlg, szMsgText.GetString());
1053
1055
1056 // TODO: issue an install operation separately so that the apps could be downloaded in the background
1058 CloseHandle(shExInfo.hProcess);
1059 }
1060 else
1061 {
1063 }
1064 }
1065
1066 end:
1067 if (hOut != INVALID_HANDLE_VALUE)
1068 CloseHandle(hOut);
1069
1070 if (hFile)
1072 InternetCloseHandle(hOpen);
1073
1074 if (bTempfile)
1075 {
1076 if (bCancelled || (SettingsInfo.bDelInstaller && (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)))
1078 }
1079
1080 if (!IsWindow(hDlg))
1081 return 0;
1083 }
1084
1085 delete static_cast<DownloadParam *>(param);
1086 if (!IsWindow(hDlg))
1087 return 0;
1088 SendMessageW(hDlg, WM_CLOSE, 0, 0);
1089 return 0;
1090}
PRTL_UNICODE_STRING_BUFFER Path
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
@ INSTALLER_GENERATE
Definition: appinfo.h:76
#define APPLICATION_DATABASE_NAME
Definition: defines.h:41
BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPCWSTR lpMsg)
Definition: misc.cpp:224
BOOL GetStorageDirectory(CStringW &lpDirectory)
Definition: misc.cpp:142
#define IDS_UNABLE_TO_DOWNLOAD
Definition: resource.h:108
#define IDS_MISMATCH_CERT_INFO
Definition: resource.h:118
#define IDS_UNABLE_TO_DOWNLOAD2
Definition: resource.h:109
#define IDS_UNABLE_PATH
Definition: resource.h:119
#define IDS_UNABLE_TO_QUERY_CERT
Definition: resource.h:110
#define IDC_DOWNLOAD_STATUS
Definition: resource.h:42
#define IDS_INTEG_CHECK_TITLE
Definition: resource.h:111
#define IDS_DL_DIALOG_DB_DOWNLOAD_DISP
Definition: resource.h:218
#define IDS_INTEG_CHECK_FAIL
Definition: resource.h:112
#define IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP
Definition: resource.h:219
SETTINGS_INFO SettingsInfo
Definition: winmain.cpp:20
#define DPRINT1
Definition: precomp.h:8
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:387
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
VOID SetDownloadStatus(INT ItemIndex, DownloadStatus Status)
Definition: loaddlg.cpp:327
static VOID UpdateProgress(HWND hDlg, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: loaddlg.cpp:568
VOID SetMarquee(BOOL Enable)
Definition: loaddlg.cpp:159
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define wcsrchr
Definition: compat.h:16
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileW
Definition: compat.h:741
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:439
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
HRESULT WINAPI PathCreateFromUrlW(LPCWSTR pszUrl, LPWSTR pszPath, LPDWORD pcchPath, DWORD dwReserved)
Definition: path.c:3355
DWORD WINAPI FtpGetFileSize(HINTERNET hFile, LPDWORD lpdwFileSizeHigh)
Definition: ftp.c:1757
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:3870
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1625
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
Definition: internet.c:2154
HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3722
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1414
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:979
#define INFINITE
Definition: serial.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint end
Definition: gl.h:1545
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLenum const GLfloat * params
Definition: glext.h:5645
GLfloat GLfloat p
Definition: glext.h:8902
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define SUCCEEDED(hr)
Definition: intsafe.h:50
BOOL UrlHasBeenCopied
Definition: loaddlg.cpp:565
VOID UrlUnescapeAndMakeFileNameValid(CStringW &str)
Definition: loaddlg.cpp:94
BOOL ShowLastError(HWND hWndOwner, BOOL bInetError, DWORD dwLastError)
Definition: loaddlg.cpp:609
@ DLSTATUS_DOWNLOADING
Definition: loaddlg.cpp:70
@ DLSTATUS_FINISHED
Definition: loaddlg.cpp:74
@ DLSTATUS_WAITING_INSTALL
Definition: loaddlg.cpp:71
@ DLSTATUS_INSTALLING
Definition: loaddlg.cpp:72
VOID MessageBox_LoadString(HWND hOwnerWnd, INT StringID)
Definition: loaddlg.cpp:411
CStringW LoadStatusString(DownloadStatus StatusParam)
Definition: loaddlg.cpp:78
@ DLTYPE_DBUPDATE_UNOFFICIAL
Definition: loaddlg.cpp:64
@ DLTYPE_DBUPDATE
Definition: loaddlg.cpp:63
@ DLTYPE_APPLICATION
Definition: loaddlg.cpp:62
#define CREATE_ALWAYS
Definition: disk.h:72
static BYTE subjectName[]
Definition: cert.c:63
_In_ HANDLE hFile
Definition: mswsock.h:90
CAtlStringW CStringW
Definition: atlstr.h:130
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define GENERIC_WRITE
Definition: nt_native.h:90
static const WCHAR szName[]
Definition: powrprof.c:45
DWORD dwStatus
Definition: mediaobj.idl:95
const WCHAR * str
#define memset(x, y, z)
Definition: compat.h:39
#define SEE_MASK_NOCLOSEPROCESS
Definition: shellapi.h:31
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2428
HRESULT hr
Definition: shlfolder.c:183
Definition: window.h:372
WCHAR szDownloadDir[MAX_PATH]
Definition: settings.h:10
BOOL bDelInstaller
Definition: settings.h:11
WCHAR szNoProxyFor[MAX_PATH]
Definition: settings.h:21
WCHAR szProxyServer[MAX_PATH]
Definition: settings.h:20
DWORD dwStructSize
Definition: wininet.h:211
INTERNET_SCHEME nScheme
Definition: wininet.h:214
LPWSTR lpszScheme
Definition: wininet.h:212
DWORD dwSchemeLength
Definition: wininet.h:213
LPCWSTR lpParameters
Definition: shellapi.h:333
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
#define CMD_KEY_GENINST
Definition: unattended.h:4
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HTTP_STATUS_OK
Definition: winhttp.h:240
#define INTERNET_SCHEME_FTP
Definition: winhttp.h:44
#define ICU_DECODE
Definition: winhttp.h:291
#define INTERNET_SCHEME_HTTP
Definition: winhttp.h:42
#define INTERNET_SCHEME_HTTPS
Definition: winhttp.h:43
#define ICU_ESCAPE
Definition: winhttp.h:48
#define INTERNET_FLAG_PRAGMA_NOCACHE
Definition: wininet.h:85
#define INTERNET_FLAG_DONT_CACHE
Definition: wininet.h:67
#define INTERNET_FLAG_KEEP_CONNECTION
Definition: wininet.h:72
#define INTERNET_FLAG_PASSIVE
Definition: wininet.h:65
#define HTTP_QUERY_FLAG_NUMBER
Definition: wininet.h:1606
#define INTERNET_OPEN_TYPE_DIRECT
Definition: wininet.h:522
@ INTERNET_SCHEME_FILE
Definition: wininet.h:143
#define INTERNET_OPEN_TYPE_PROXY
Definition: wininet.h:523
#define HTTP_QUERY_STATUS_CODE
Definition: wininet.h:1542
#define INTERNET_OPEN_TYPE_PRECONFIG
Definition: wininet.h:521
#define HTTP_QUERY_CONTENT_LENGTH
Definition: wininet.h:1528
BOOL VerifyInteg(LPCWSTR lpSHA1Hash, LPCWSTR lpFileName)
Definition: integrity.cpp:14
#define EVENTLOG_SUCCESS
Definition: winnt_old.h:2833
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)
#define MB_YESNO
Definition: winuser.h:817
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONERROR
Definition: winuser.h:787
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define MB_OK
Definition: winuser.h:790
#define IDYES
Definition: winuser.h:835
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by DownloadDlgProc().

◆ UpdateProgress()

VOID CDownloadManager::UpdateProgress ( HWND  hDlg,
ULONG  ulProgress,
ULONG  ulProgressMax,
ULONG  ulStatusCode,
LPCWSTR  szStatusText 
)
staticprivate

Definition at line 568 of file loaddlg.cpp.

574{
575 HWND Item;
576
577 if (!IsWindow(hDlg))
578 return;
579 ProgressBar.SetProgress(ulProgress, ulProgressMax);
580
581 if (!IsWindow(hDlg))
582 return;
584 if (Item && szStatusText && wcslen(szStatusText) > 0 && UrlHasBeenCopied == FALSE)
585 {
586 SIZE_T len = wcslen(szStatusText) + 1;
588 DWORD dummyLen;
589
590 /* beautify our url for display purposes */
591 if (!InternetCanonicalizeUrlW(szStatusText, buf.GetBuffer(len), &dummyLen, ICU_DECODE | ICU_NO_ENCODE))
592 {
593 /* just use the original */
594 buf.ReleaseBuffer();
595 buf = szStatusText;
596 }
597 else
598 {
599 buf.ReleaseBuffer();
600 }
601
602 /* paste it into our dialog and don't do it again in this instance */
603 ::SetWindowText(Item, buf.GetString());
605 }
606}
BOOL WINAPI InternetCanonicalizeUrlW(LPCWSTR lpszUrl, LPWSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
Definition: internet.c:2004
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define ICU_NO_ENCODE
Definition: winhttp.h:290

Referenced by ThreadFunc().

Member Data Documentation

◆ AppsDownloadList

ATL::CSimpleArray< DownloadInfo > CDownloadManager::AppsDownloadList
staticprivate

Definition at line 423 of file loaddlg.cpp.

Referenced by Add(), Download(), and DownloadDlgProc().

◆ bCancelled

BOOL CDownloadManager::bCancelled = FALSE
staticprivate

Definition at line 426 of file loaddlg.cpp.

Referenced by DownloadDlgProc(), and ThreadFunc().

◆ bModal

BOOL CDownloadManager::bModal = FALSE
staticprivate

Definition at line 427 of file loaddlg.cpp.

Referenced by DownloadDlgProc(), and LaunchDownloadDialog().

◆ DownloadsListView

CDowloadingAppsListView CDownloadManager::DownloadsListView
staticprivate

Definition at line 424 of file loaddlg.cpp.

Referenced by DownloadDlgProc(), and ThreadFunc().

◆ ProgressBar

CDownloaderProgress CDownloadManager::ProgressBar
staticprivate

Definition at line 425 of file loaddlg.cpp.

Referenced by DownloadDlgProc(), ThreadFunc(), and UpdateProgress().


The documentation for this class was generated from the following file: