ReactOS 0.4.15-dev-7998-gdb93cb1
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 413 of file loaddlg.cpp.

Member Function Documentation

◆ Add()

VOID CDownloadManager::Add ( DownloadInfo  info)
static

Definition at line 443 of file loaddlg.cpp.

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

Referenced by DownloadListOfApplications().

◆ Download()

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

Definition at line 449 of file loaddlg.cpp.

450{
452 AppsDownloadList.Add(DLInfo);
453 LaunchDownloadDialog(bIsModal);
454}
static VOID LaunchDownloadDialog(BOOL)
Definition: loaddlg.cpp:1074

Referenced by DownloadApplication(), and DownloadApplicationsDB().

◆ DownloadDlgProc()

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

Definition at line 457 of file loaddlg.cpp.

458{
459 static WCHAR szCaption[MAX_PATH];
460
461 switch (uMsg)
462 {
463 case WM_INITDIALOG:
464 {
465 HICON hIconSm, hIconBg;
466 CStringW szTempCaption;
467
469
470 if (hMainWnd)
471 {
474 }
475 if (!hMainWnd || (!hIconBg || !hIconSm))
476 {
477 /* Load the default icon */
479 }
480
481 if (hIconBg && hIconSm)
482 {
483 SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM)hIconBg);
484 SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
485 }
486
488 if (Item)
489 {
490 // initialize the default values for our nifty progress bar
491 // and subclass it so that it learns to print a status text
495 if (AppsDownloadList.GetSize() > 0)
496 ProgressBar.SetProgress(0, AppsDownloadList[0].SizeInBytes);
497 }
498
499 // Add a ListView
500 HWND hListView = DownloadsListView.Create(Dlg);
501 if (!hListView)
502 {
503 return FALSE;
504 }
506
507 // Get a dlg string for later use
508 GetWindowTextW(Dlg, szCaption, _countof(szCaption));
509
510 // Hide a placeholder from displaying
511 szTempCaption = szCaption;
512 szTempCaption.Replace(L"%ls", L"");
513 SetWindowText(Dlg, szTempCaption.GetString());
514
515 ShowWindow(Dlg, SW_SHOW);
516
517 // Start download process
518 DownloadParam *param = new DownloadParam(Dlg, AppsDownloadList, szCaption);
519 unsigned int ThreadId;
520 HANDLE Thread = (HANDLE)_beginthreadex(NULL, 0, ThreadFunc, (void *)param, 0, &ThreadId);
521 if (!Thread)
522 {
523 return FALSE;
524 }
525
526 CloseHandle(Thread);
528 return TRUE;
529 }
530
531 case WM_COMMAND:
532 if (wParam == IDCANCEL)
533 {
535 PostMessageW(Dlg, WM_CLOSE, 0, 0);
536 }
537 return FALSE;
538
539 case WM_CLOSE:
540 if (ProgressBar)
543 {
544 ::EndDialog(Dlg, 0);
545 }
546 else
547 {
548 ::DestroyWindow(Dlg);
549 }
550 return TRUE;
551
552 default:
553 return FALSE;
554 }
555}
#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:290
VOID LoadList(ATL::CSimpleArray< DownloadInfo > arrInfo)
Definition: loaddlg.cpp:310
static BOOL bCancelled
Definition: loaddlg.cpp:418
static BOOL bModal
Definition: loaddlg.cpp:419
static CDownloaderProgress ProgressBar
Definition: loaddlg.cpp:417
static CDowloadingAppsListView DownloadsListView
Definition: loaddlg.cpp:416
static unsigned int WINAPI ThreadFunc(LPVOID Context)
Definition: loaddlg.cpp:620
VOID SetProgress(ULONG ulProgress, ULONG ulProgressMax)
Definition: loaddlg.cpp:162
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:68
#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 1074 of file loaddlg.cpp.

1075{
1076 CDownloadManager::bModal = bIsModal;
1077 if (bIsModal)
1078 {
1080 }
1081 else
1082 {
1084 }
1085}
#define IDD_DOWNLOAD_DIALOG
Definition: resource.h:65
static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: loaddlg.cpp:457
#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 620 of file loaddlg.cpp.

621{
622 CPathW Path;
623 PWSTR p, q;
624
625 HWND hDlg = static_cast<DownloadParam *>(param)->Dialog;
626 HWND Item;
627 INT iAppId;
628
629 ULONG dwContentLen, dwBytesWritten, dwBytesRead, dwStatus;
630 ULONG dwCurrentBytesRead = 0;
631 ULONG dwStatusLen = sizeof(dwStatus);
632
633 BOOL bTempfile = FALSE;
634
635 HINTERNET hOpen = NULL;
638
639 unsigned char lpBuffer[4096];
640 LPCWSTR lpszAgent = L"RApps/1.1";
641 URL_COMPONENTSW urlComponents;
642 size_t urlLength, filenameLength;
643
644 const ATL::CSimpleArray<DownloadInfo> &InfoArray = static_cast<DownloadParam *>(param)->AppInfo;
645 LPCWSTR szCaption = static_cast<DownloadParam *>(param)->szCaption;
646 CStringW szNewCaption;
647
648 const DWORD dwUrlConnectFlags =
650
651 if (InfoArray.GetSize() <= 0)
652 {
654 goto end;
655 }
656
657 for (iAppId = 0; iAppId < InfoArray.GetSize(); ++iAppId)
658 {
659 // Reset progress bar
660 if (!IsWindow(hDlg))
661 break;
663 if (Item)
664 {
667 ProgressBar.SetProgress(0, InfoArray[iAppId].SizeInBytes);
668 }
669
670 // is this URL an update package for RAPPS? if so store it in a different place
671 if (InfoArray[iAppId].DLType != DLTYPE_APPLICATION)
672 {
674 {
676 goto end;
677 }
678 }
679 else
680 {
682 }
683
684 // Change caption to show the currently downloaded app
685 switch (InfoArray[iAppId].DLType)
686 {
688 szNewCaption.Format(szCaption, InfoArray[iAppId].szName.GetString());
689 break;
690 case DLTYPE_DBUPDATE:
691 szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_DOWNLOAD_DISP);
692 break;
694 szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP);
695 break;
696 }
697
698 if (!IsWindow(hDlg))
699 goto end;
700 SetWindowTextW(hDlg, szNewCaption.GetString());
701
702 // build the path for the download
703 p = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'/');
704 q = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'?');
705
706 // do we have a final slash separator?
707 if (!p)
708 {
710 goto end;
711 }
712
713 // prepare the tentative length of the filename, maybe we've to remove part of it later on
714 filenameLength = wcslen(p) * sizeof(WCHAR);
715
716 /* do we have query arguments in the target URL after the filename? account for them
717 (e.g. https://example.org/myfile.exe?no_adware_plz) */
718 if (q && q > p && (q - p) > 0)
719 filenameLength -= wcslen(q - 1) * sizeof(WCHAR);
720
721 // is the path valid? can we access it?
723 {
725 {
727 goto end;
728 }
729 }
730
731 switch (InfoArray[iAppId].DLType)
732 {
733 case DLTYPE_DBUPDATE:
736 break;
738 {
739 CStringW str = p + 1; // use the filename retrieved from URL
741 Path += str;
742 break;
743 }
744 }
745
746 if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] &&
748 {
749 // only open it in case of total correctness
750 if (VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path))
751 goto run;
752 }
753
754 // Add the download URL
755 if (!IsWindow(hDlg))
756 goto end;
757 SetDlgItemTextW(hDlg, IDC_DOWNLOAD_STATUS, InfoArray[iAppId].szUrl.GetString());
758
760
761 // download it
763 bTempfile = TRUE;
764
765 /* FIXME: this should just be using the system-wide proxy settings */
766 switch (SettingsInfo.Proxy)
767 {
768 case 0: // preconfig
769 default:
770 hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
771 break;
772 case 1: // direct (no proxy)
773 hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
774 break;
775 case 2: // use proxy
776 hOpen = InternetOpenW(
778 break;
779 }
780
781 if (!hOpen)
782 {
784 goto end;
785 }
786
787 dwStatusLen = sizeof(dwStatus);
788
789 memset(&urlComponents, 0, sizeof(urlComponents));
790 urlComponents.dwStructSize = sizeof(urlComponents);
791
792 urlLength = InfoArray[iAppId].szUrl.GetLength();
793 urlComponents.dwSchemeLength = urlLength + 1;
794 urlComponents.lpszScheme = (LPWSTR)malloc(urlComponents.dwSchemeLength * sizeof(WCHAR));
795
796 if (!InternetCrackUrlW(InfoArray[iAppId].szUrl, urlLength + 1, ICU_DECODE | ICU_ESCAPE, &urlComponents))
797 {
799 goto end;
800 }
801
802 dwContentLen = 0;
803
804 if (urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme == INTERNET_SCHEME_HTTPS)
805 {
806 hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl.GetString(), NULL, 0, dwUrlConnectFlags, 0);
807 if (!hFile)
808 {
810 {
811 /* Workaround for CORE-17377 */
813 }
814 goto end;
815 }
816
817 // query connection
819 {
821 goto end;
822 }
823
825 {
827 goto end;
828 }
829
830 // query content length
832 hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwStatusLen, NULL);
833 }
834 else if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
835 {
836 // force passive mode on FTP
837 hFile =
838 InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl, NULL, 0, dwUrlConnectFlags | INTERNET_FLAG_PASSIVE, 0);
839 if (!hFile)
840 {
842 {
843 /* Workaround for CORE-17377 */
845 }
846 goto end;
847 }
848
849 dwContentLen = FtpGetFileSize(hFile, &dwStatus);
850 }
851 else if (urlComponents.nScheme == INTERNET_SCHEME_FILE)
852 {
853 // Add support for the file scheme so testing locally is simpler
854 WCHAR LocalFilePath[MAX_PATH];
855 DWORD cchPath = _countof(LocalFilePath);
856 // Ideally we would use PathCreateFromUrlAlloc here, but that is not exported (yet)
857 HRESULT hr = PathCreateFromUrlW(InfoArray[iAppId].szUrl, LocalFilePath, &cchPath, 0);
858 if (SUCCEEDED(hr))
859 {
860 if (CopyFileW(LocalFilePath, Path, FALSE))
861 {
862 goto run;
863 }
864 else
865 {
867 goto end;
868 }
869 }
870 else
871 {
873 goto end;
874 }
875 }
876
877 if (!dwContentLen)
878 {
879 // Someone was nice enough to add this, let's use it
880 if (InfoArray[iAppId].SizeInBytes)
881 {
882 dwContentLen = InfoArray[iAppId].SizeInBytes;
883 }
884 else
885 {
886 // content-length is not known, enable marquee mode
888 }
889 }
890
891 free(urlComponents.lpszScheme);
892
893#ifdef USE_CERT_PINNING
894 // are we using HTTPS to download the RAPPS update package? check if the certificate is original
895 if ((urlComponents.nScheme == INTERNET_SCHEME_HTTPS) && (InfoArray[iAppId].DLType == DLTYPE_DBUPDATE))
896 {
897 CLocalPtr<char> subjectName, issuerName;
898 CStringA szMsgText;
899 bool bAskQuestion = false;
900 if (!CertGetSubjectAndIssuer(hFile, subjectName, issuerName))
901 {
902 szMsgText.LoadStringW(IDS_UNABLE_TO_QUERY_CERT);
903 bAskQuestion = true;
904 }
905 else
906 {
907 if (strcmp(subjectName, CERT_SUBJECT_INFO) ||
908 (strcmp(issuerName, CERT_ISSUER_INFO_OLD) && strcmp(issuerName, CERT_ISSUER_INFO_NEW)))
909 {
910 szMsgText.Format(IDS_MISMATCH_CERT_INFO, (char *)subjectName, (const char *)issuerName);
911 bAskQuestion = true;
912 }
913 }
914
915 if (bAskQuestion)
916 {
918 {
919 goto end;
920 }
921 }
922 }
923#endif
924
926
927 if (hOut == INVALID_HANDLE_VALUE)
928 {
930 goto end;
931 }
932
933 dwCurrentBytesRead = 0;
934 do
935 {
936 if (!InternetReadFile(hFile, lpBuffer, _countof(lpBuffer), &dwBytesRead))
937 {
939 goto end;
940 }
941
942 if (!WriteFile(hOut, &lpBuffer[0], dwBytesRead, &dwBytesWritten, NULL))
943 {
945 goto end;
946 }
947
948 dwCurrentBytesRead += dwBytesRead;
949 if (!IsWindow(hDlg))
950 goto end;
951 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
952 } while (dwBytesRead && !bCancelled);
953
954 CloseHandle(hOut);
956
957 if (bCancelled)
958 {
959 DPRINT1("Operation cancelled\n");
960 goto end;
961 }
962
963 if (!dwContentLen)
964 {
965 // set progress bar to 100%
967
968 dwContentLen = dwCurrentBytesRead;
969 if (!IsWindow(hDlg))
970 goto end;
971 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
972 }
973
974 /* if this thing isn't a RAPPS update and it has a SHA-1 checksum
975 verify its integrity by using the native advapi32.A_SHA1 functions */
976 if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] != 0)
977 {
978 CStringW szMsgText;
979
980 // change a few strings in the download dialog to reflect the verification process
981 if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_TITLE))
982 {
983 DPRINT1("Unable to load string\n");
984 goto end;
985 }
986
987 if (!IsWindow(hDlg))
988 goto end;
989 SetWindowTextW(hDlg, szMsgText.GetString());
991
992 // this may take a while, depending on the file size
993 if (!VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path))
994 {
995 if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_FAIL))
996 {
997 DPRINT1("Unable to load string\n");
998 goto end;
999 }
1000
1001 if (!IsWindow(hDlg))
1002 goto end;
1003 MessageBoxW(hDlg, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
1004 goto end;
1005 }
1006 }
1007
1008 run:
1010
1011 // run it
1012 if (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)
1013 {
1014 SHELLEXECUTEINFOW shExInfo = {0};
1015 shExInfo.cbSize = sizeof(shExInfo);
1016 shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
1017 shExInfo.lpVerb = L"open";
1018 shExInfo.lpFile = Path;
1019 shExInfo.lpParameters = L"";
1020 shExInfo.nShow = SW_SHOW;
1021
1022 /* FIXME: Do we want to log installer status? */
1023 WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_INSTALL, InfoArray[iAppId].szName);
1024
1025 if (ShellExecuteExW(&shExInfo))
1026 {
1027 // reflect installation progress in the titlebar
1028 // TODO: make a separate string with a placeholder to include app name?
1030 if (!IsWindow(hDlg))
1031 goto end;
1032 SetWindowTextW(hDlg, szMsgText.GetString());
1033
1035
1036 // TODO: issue an install operation separately so that the apps could be downloaded in the background
1038 CloseHandle(shExInfo.hProcess);
1039 }
1040 else
1041 {
1043 }
1044 }
1045
1046 end:
1047 if (hOut != INVALID_HANDLE_VALUE)
1048 CloseHandle(hOut);
1049
1050 if (hFile)
1052 InternetCloseHandle(hOpen);
1053
1054 if (bTempfile)
1055 {
1056 if (bCancelled || (SettingsInfo.bDelInstaller && (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)))
1058 }
1059
1060 if (!IsWindow(hDlg))
1061 return 0;
1063 }
1064
1065 delete static_cast<DownloadParam *>(param);
1066 if (!IsWindow(hDlg))
1067 return 0;
1068 SendMessageW(hDlg, WM_CLOSE, 0, 0);
1069 return 0;
1070}
PRTL_UNICODE_STRING_BUFFER Path
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define APPLICATION_DATABASE_NAME
Definition: defines.h:41
BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPCWSTR lpMsg)
Definition: misc.cpp:227
BOOL GetStorageDirectory(CStringW &lpDirectory)
Definition: misc.cpp:145
#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 __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
VOID SetDownloadStatus(INT ItemIndex, DownloadStatus Status)
Definition: loaddlg.cpp:319
static VOID UpdateProgress(HWND hDlg, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: loaddlg.cpp:560
VOID SetMarquee(BOOL Enable)
Definition: loaddlg.cpp:151
Definition: misc.h:53
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
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
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:557
VOID UrlUnescapeAndMakeFileNameValid(CStringW &str)
Definition: loaddlg.cpp:93
BOOL ShowLastError(HWND hWndOwner, BOOL bInetError, DWORD dwLastError)
Definition: loaddlg.cpp:601
@ DLSTATUS_DOWNLOADING
Definition: loaddlg.cpp:69
@ DLSTATUS_FINISHED
Definition: loaddlg.cpp:73
@ DLSTATUS_WAITING_INSTALL
Definition: loaddlg.cpp:70
@ DLSTATUS_INSTALLING
Definition: loaddlg.cpp:71
CStringW LoadStatusString(DownloadStatus StatusParam)
Definition: loaddlg.cpp:77
VOID MessageBox_LoadString(HWND hMainWnd, INT StringID)
Definition: loaddlg.cpp:403
@ DLTYPE_DBUPDATE_UNOFFICIAL
Definition: loaddlg.cpp:63
@ DLTYPE_DBUPDATE
Definition: loaddlg.cpp:62
@ DLTYPE_APPLICATION
Definition: loaddlg.cpp:61
#define CREATE_ALWAYS
Definition: disk.h:72
static BYTE subjectName[]
Definition: cert.c:63
_In_ HANDLE hFile
Definition: mswsock.h:90
#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:2391
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 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 560 of file loaddlg.cpp.

566{
567 HWND Item;
568
569 if (!IsWindow(hDlg))
570 return;
571 ProgressBar.SetProgress(ulProgress, ulProgressMax);
572
573 if (!IsWindow(hDlg))
574 return;
576 if (Item && szStatusText && wcslen(szStatusText) > 0 && UrlHasBeenCopied == FALSE)
577 {
578 SIZE_T len = wcslen(szStatusText) + 1;
580 DWORD dummyLen;
581
582 /* beautify our url for display purposes */
583 if (!InternetCanonicalizeUrlW(szStatusText, buf.GetBuffer(len), &dummyLen, ICU_DECODE | ICU_NO_ENCODE))
584 {
585 /* just use the original */
586 buf.ReleaseBuffer();
587 buf = szStatusText;
588 }
589 else
590 {
591 buf.ReleaseBuffer();
592 }
593
594 /* paste it into our dialog and don't do it again in this instance */
595 ::SetWindowText(Item, buf.GetString());
597 }
598}
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 415 of file loaddlg.cpp.

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

◆ bCancelled

BOOL CDownloadManager::bCancelled = FALSE
staticprivate

Definition at line 418 of file loaddlg.cpp.

Referenced by DownloadDlgProc(), and ThreadFunc().

◆ bModal

BOOL CDownloadManager::bModal = FALSE
staticprivate

Definition at line 419 of file loaddlg.cpp.

Referenced by DownloadDlgProc(), and LaunchDownloadDialog().

◆ DownloadsListView

CDowloadingAppsListView CDownloadManager::DownloadsListView
staticprivate

Definition at line 416 of file loaddlg.cpp.

Referenced by DownloadDlgProc(), and ThreadFunc().

◆ ProgressBar

CDownloaderProgress CDownloadManager::ProgressBar
staticprivate

Definition at line 417 of file loaddlg.cpp.

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


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