ReactOS  0.4.15-dev-1397-g19779b3
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 359 of file loaddlg.cpp.

Member Function Documentation

◆ Add()

VOID CDownloadManager::Add ( DownloadInfo  info)
static

Definition at line 383 of file loaddlg.cpp.

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

Referenced by DownloadListOfApplications().

◆ Download()

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

Definition at line 388 of file loaddlg.cpp.

389 {
391  AppsDownloadList.Add(DLInfo);
392  LaunchDownloadDialog(bIsModal);
393 }
BOOL Add(const T &t)
Definition: atlsimpcoll.h:58
static VOID LaunchDownloadDialog(BOOL)
Definition: loaddlg.cpp:990
static ATL::CSimpleArray< DownloadInfo > AppsDownloadList
Definition: loaddlg.cpp:361

Referenced by DownloadApplication(), and DownloadApplicationsDB().

◆ DownloadDlgProc()

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

Definition at line 395 of file loaddlg.cpp.

396 {
397  static WCHAR szCaption[MAX_PATH];
398 
399  switch (uMsg)
400  {
401  case WM_INITDIALOG:
402  {
403  HICON hIconSm, hIconBg;
404  ATL::CStringW szTempCaption;
405 
406  bCancelled = FALSE;
407 
410 
411  if (hIconBg && hIconSm)
412  {
413  SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM) hIconBg);
414  SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSm);
415  }
416 
419  if (Item)
420  {
421  // initialize the default values for our nifty progress bar
422  // and subclass it so that it learns to print a status text
426  }
427 
428  // Add a ListView
429  HWND hListView = DownloadsListView.Create(Dlg);
430  if (!hListView)
431  {
432  return FALSE;
433  }
435 
436  // Get a dlg string for later use
437  GetWindowTextW(Dlg, szCaption, _countof(szCaption));
438 
439  // Hide a placeholder from displaying
440  szTempCaption = szCaption;
441  szTempCaption.Replace(L"%ls", L"");
442  SetWindowText(Dlg, szTempCaption.GetString());
443 
444  ShowWindow(Dlg, SW_SHOW);
445 
446  // Start download process
447  DownloadParam *param = new DownloadParam(Dlg, AppsDownloadList, szCaption);
448  unsigned int ThreadId;
449  HANDLE Thread = (HANDLE)_beginthreadex(NULL, 0, ThreadFunc, (void *) param, 0, &ThreadId);
450 
451  if (!Thread)
452  {
453  return FALSE;
454  }
455 
458  return TRUE;
459  }
460 
461  case WM_COMMAND:
462  if (wParam == IDCANCEL)
463  {
464  bCancelled = TRUE;
465  PostMessageW(Dlg, WM_CLOSE, 0, 0);
466  }
467  return FALSE;
468 
469  case WM_CLOSE:
471  {
472  ::EndDialog(Dlg, 0);
473  }
474  else
475  {
476  ::DestroyWindow(Dlg);
477  }
478  return TRUE;
479 
480  default:
481  return FALSE;
482  }
483 }
static HICON
Definition: imagelist.c:84
#define CloseHandle
Definition: compat.h:598
#define TRUE
Definition: types.h:120
static BOOL bCancelled
Definition: loaddlg.cpp:364
static unsigned int WINAPI ThreadFunc(LPVOID Context)
Definition: loaddlg.cpp:549
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
#define PBM_SETPOS
Definition: commctrl.h:2180
static ATL::CSimpleArray< DownloadInfo > AppsDownloadList
Definition: loaddlg.cpp:361
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
_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)
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define ICON_SMALL
Definition: tnclass.cpp:48
#define PBM_SETRANGE
Definition: commctrl.h:2179
BOOL SubclassWindow(HWND hWnd)
Definition: atlwin.h:1483
#define FALSE
Definition: types.h:117
#define GWLP_USERDATA
Definition: treelist.c:63
LONG_PTR LPARAM
Definition: windef.h:208
static CDowloadingAppsListView DownloadsListView
Definition: loaddlg.cpp:362
#define SW_SHOW
Definition: winuser.h:769
VOID LoadList(ATL::CSimpleArray< DownloadInfo > arrInfo)
Definition: loaddlg.cpp:258
#define GCLP_HICONSM
Definition: winuser.h:670
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define WM_CLOSE
Definition: winuser.h:1603
GLfloat param
Definition: glext.h:5796
#define MAX_PATH
Definition: compat.h:34
PCXSTR GetString() const
Definition: atlsimpstr.h:361
PVOID HANDLE
Definition: typedefs.h:73
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define IDC_DOWNLOAD_PROGRESS
Definition: resource.h:41
HWND hMainWnd
Definition: magnifier.c:32
static const WCHAR L[]
Definition: oid.c:1250
#define GCLP_HICON
Definition: winuser.h:669
#define WM_COMMAND
Definition: winuser.h:1722
int Replace(PCXSTR pszOld, PCXSTR pszNew)
Definition: cstringt.h:774
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
HWND Create(HWND hwndParent)
Definition: loaddlg.cpp:244
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SetWindowText
Definition: winuser.h:5832
#define NULL
Definition: types.h:112
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HICON hIconSm
Definition: msconfig.c:44
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1048
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define IDCANCEL
Definition: winuser.h:825
static BOOL bModal
Definition: loaddlg.cpp:365
#define WM_INITDIALOG
Definition: winuser.h:1721
#define GetClassLongPtrW
Definition: winuser.h:4539
#define ICON_BIG
Definition: tnclass.cpp:51
static CDownloaderProgress ProgressBar
Definition: loaddlg.cpp:363

Referenced by LaunchDownloadDialog().

◆ LaunchDownloadDialog()

VOID CDownloadManager::LaunchDownloadDialog ( BOOL  bIsModal)
static

Definition at line 990 of file loaddlg.cpp.

991 {
992  CDownloadManager::bModal = bIsModal;
993  if (bIsModal)
994  {
997  hMainWnd,
999  }
1000  else
1001  {
1004  hMainWnd,
1005  DownloadDlgProc);
1006  }
1007 }
#define IDD_DOWNLOAD_DIALOG
Definition: resource.h:65
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4374
static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: loaddlg.cpp:395
HWND hMainWnd
Definition: magnifier.c:32
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4256
HINSTANCE hInst
Definition: dxdiag.c:13
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static BOOL bModal
Definition: loaddlg.cpp:365

Referenced by Download(), and DownloadListOfApplications().

◆ ThreadFunc()

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

Definition at line 549 of file loaddlg.cpp.

550 {
552  PWSTR p, q;
553 
554  HWND hDlg = static_cast<DownloadParam*>(param)->Dialog;
555  HWND Item;
556  INT iAppId;
557 
558  ULONG dwContentLen, dwBytesWritten, dwBytesRead, dwStatus;
559  ULONG dwCurrentBytesRead = 0;
560  ULONG dwStatusLen = sizeof(dwStatus);
561 
562  BOOL bTempfile = FALSE;
563 
564  HINTERNET hOpen = NULL;
565  HINTERNET hFile = NULL;
567 
568  unsigned char lpBuffer[4096];
569  LPCWSTR lpszAgent = L"RApps/1.1";
570  URL_COMPONENTSW urlComponents;
571  size_t urlLength, filenameLength;
572 
573  const ATL::CSimpleArray<DownloadInfo> &InfoArray = static_cast<DownloadParam*>(param)->AppInfo;
574  LPCWSTR szCaption = static_cast<DownloadParam*>(param)->szCaption;
575  ATL::CStringW szNewCaption;
576 
578 
579  if (InfoArray.GetSize() <= 0)
580  {
582  goto end;
583  }
584 
585  for (iAppId = 0; iAppId < InfoArray.GetSize(); ++iAppId)
586  {
587  // Reset progress bar
588  if (!IsWindow(hDlg)) break;
590  if (Item)
591  {
595  }
596 
597  // is this URL an update package for RAPPS? if so store it in a different place
598  if (InfoArray[iAppId].DLType != DLTYPE_APPLICATION)
599  {
601  {
603  goto end;
604  }
605  }
606  else
607  {
609  }
610 
611  // Change caption to show the currently downloaded app
612  switch(InfoArray[iAppId].DLType)
613  {
614  case DLTYPE_APPLICATION:
615  szNewCaption.Format(szCaption, InfoArray[iAppId].szName.GetString());
616  break;
617  case DLTYPE_DBUPDATE:
618  szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_DOWNLOAD_DISP);
619  break;
621  szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP);
622  break;
623  }
624 
625  if (!IsWindow(hDlg)) goto end;
626  SetWindowTextW(hDlg, szNewCaption.GetString());
627 
628  // build the path for the download
629  p = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'/');
630  q = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'?');
631 
632  // do we have a final slash separator?
633  if (!p)
634  {
636  goto end;
637  }
638 
639  // prepare the tentative length of the filename, maybe we've to remove part of it later on
640  filenameLength = wcslen(p) * sizeof(WCHAR);
641 
642  /* do we have query arguments in the target URL after the filename? account for them
643  (e.g. https://example.org/myfile.exe?no_adware_plz) */
644  if (q && q > p && (q - p) > 0)
645  filenameLength -= wcslen(q - 1) * sizeof(WCHAR);
646 
647  // is the path valid? can we access it?
648  if (GetFileAttributesW(Path.GetString()) == INVALID_FILE_ATTRIBUTES)
649  {
650  if (!CreateDirectoryW(Path.GetString(), NULL))
651  {
653  goto end;
654  }
655  }
656 
657  // append a \ to the provided file system path, and the filename portion from the URL after that
658 
659  PathAddBackslashW(Path.GetBuffer(MAX_PATH));
660  switch (InfoArray[iAppId].DLType)
661  {
662  case DLTYPE_DBUPDATE:
665  break;
666  case DLTYPE_APPLICATION:
667  PathAppendW(Path.GetBuffer(), (LPWSTR)(p + 1)); // use the filename retrieved from URL
668  break;
669  }
670  Path.ReleaseBuffer();
671 
672  if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] && GetFileAttributesW(Path.GetString()) != INVALID_FILE_ATTRIBUTES)
673  {
674  // only open it in case of total correctness
675  if (VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path))
676  goto run;
677  }
678 
679  // Add the download URL
680  if (!IsWindow(hDlg)) goto end;
681  SetDlgItemTextW(hDlg, IDC_DOWNLOAD_STATUS, InfoArray[iAppId].szUrl.GetString());
682 
684 
685  // download it
687  bTempfile = TRUE;
688 
689  /* FIXME: this should just be using the system-wide proxy settings */
690  switch (SettingsInfo.Proxy)
691  {
692  case 0: // preconfig
693  default:
694  hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
695  break;
696  case 1: // direct (no proxy)
697  hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
698  break;
699  case 2: // use proxy
701  break;
702  }
703 
704  if (!hOpen)
705  {
707  goto end;
708  }
709 
710  dwStatusLen = sizeof(dwStatus);
711 
712  memset(&urlComponents, 0, sizeof(urlComponents));
713  urlComponents.dwStructSize = sizeof(urlComponents);
714 
715  urlLength = InfoArray[iAppId].szUrl.GetLength();
716  urlComponents.dwSchemeLength = urlLength + 1;
717  urlComponents.lpszScheme = (LPWSTR) malloc(urlComponents.dwSchemeLength * sizeof(WCHAR));
718 
719  if (!InternetCrackUrlW(InfoArray[iAppId].szUrl, urlLength + 1, ICU_DECODE | ICU_ESCAPE, &urlComponents))
720  {
722  goto end;
723  }
724 
725  dwContentLen = 0;
726 
727  if (urlComponents.nScheme == INTERNET_SCHEME_HTTP ||
728  urlComponents.nScheme == INTERNET_SCHEME_HTTPS)
729  {
730  hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl.GetString(), NULL, 0,
731  dwUrlConnectFlags,
732  0);
733  if (!hFile)
734  {
736  {
737  /* Workaround for CORE-17377 */
739  }
740  goto end;
741  }
742 
743  // query connection
745  {
747  goto end;
748  }
749 
750  if (dwStatus != HTTP_STATUS_OK)
751  {
753  goto end;
754  }
755 
756  // query content length
758  }
759  else if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
760  {
761  // force passive mode on FTP
762  hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl, NULL, 0,
763  dwUrlConnectFlags | INTERNET_FLAG_PASSIVE,
764  0);
765  if (!hFile)
766  {
768  {
769  /* Workaround for CORE-17377 */
771  }
772  goto end;
773  }
774 
775  dwContentLen = FtpGetFileSize(hFile, &dwStatus);
776  }
777  else if (urlComponents.nScheme == INTERNET_SCHEME_FILE)
778  {
779  // Add support for the file scheme so testing locally is simpler
780  WCHAR LocalFilePath[MAX_PATH];
781  DWORD cchPath = _countof(LocalFilePath);
782  // Ideally we would use PathCreateFromUrlAlloc here, but that is not exported (yet)
783  HRESULT hr = PathCreateFromUrlW(InfoArray[iAppId].szUrl, LocalFilePath, &cchPath, 0);
784  if (SUCCEEDED(hr))
785  {
786  if (CopyFileW(LocalFilePath, Path, FALSE))
787  {
788  goto run;
789  }
790  else
791  {
793  goto end;
794  }
795  }
796  else
797  {
799  goto end;
800  }
801  }
802 
803  if (!dwContentLen)
804  {
805  // Someone was nice enough to add this, let's use it
806  if (InfoArray[iAppId].SizeInBytes)
807  {
808  dwContentLen = InfoArray[iAppId].SizeInBytes;
809  }
810  else
811  {
812  // content-length is not known, enable marquee mode
814  }
815  }
816 
817  free(urlComponents.lpszScheme);
818 
819 #ifdef USE_CERT_PINNING
820  // are we using HTTPS to download the RAPPS update package? check if the certificate is original
821  if ((urlComponents.nScheme == INTERNET_SCHEME_HTTPS) &&
822  (InfoArray[iAppId].DLType == DLTYPE_DBUPDATE))
823  {
824  CLocalPtr<char> subjectName, issuerName;
825  CStringA szMsgText;
826  bool bAskQuestion = false;
827  if (!CertGetSubjectAndIssuer(hFile, subjectName, issuerName))
828  {
829  szMsgText.LoadStringW(IDS_UNABLE_TO_QUERY_CERT);
830  bAskQuestion = true;
831  }
832  else
833  {
834  if (strcmp(subjectName, CERT_SUBJECT_INFO) ||
835  strcmp(issuerName, CERT_ISSUER_INFO))
836  {
837  szMsgText.Format(IDS_MISMATCH_CERT_INFO, (char*)subjectName, (const char*)issuerName);
838  bAskQuestion = true;
839  }
840  }
841 
842  if (bAskQuestion)
843  {
844  if (MessageBoxA(hMainWnd, szMsgText.GetString(), NULL, MB_YESNO | MB_ICONERROR) != IDYES)
845  {
846  goto end;
847  }
848  }
849  }
850 #endif
851 
853 
854  if (hOut == INVALID_HANDLE_VALUE)
855  {
857  goto end;
858  }
859 
860  dwCurrentBytesRead = 0;
861  do
862  {
863  if (!InternetReadFile(hFile, lpBuffer, _countof(lpBuffer), &dwBytesRead))
864  {
866  goto end;
867  }
868 
869  if (!WriteFile(hOut, &lpBuffer[0], dwBytesRead, &dwBytesWritten, NULL))
870  {
872  goto end;
873  }
874 
875  dwCurrentBytesRead += dwBytesRead;
876  if (!IsWindow(hDlg)) goto end;
877  UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
878  } while (dwBytesRead && !bCancelled);
879 
880  CloseHandle(hOut);
881  hOut = INVALID_HANDLE_VALUE;
882 
883  if (bCancelled)
884  {
885  DPRINT1("Operation cancelled\n");
886  goto end;
887  }
888 
889  if (!dwContentLen)
890  {
891  // set progress bar to 100%
893 
894  dwContentLen = dwCurrentBytesRead;
895  if (!IsWindow(hDlg)) goto end;
896  UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
897  }
898 
899  /* if this thing isn't a RAPPS update and it has a SHA-1 checksum
900  verify its integrity by using the native advapi32.A_SHA1 functions */
901  if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] != 0)
902  {
903  ATL::CStringW szMsgText;
904 
905  // change a few strings in the download dialog to reflect the verification process
906  if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_TITLE))
907  {
908  DPRINT1("Unable to load string\n");
909  goto end;
910  }
911 
912  if (!IsWindow(hDlg)) goto end;
913  SetWindowTextW(hDlg, szMsgText.GetString());
915 
916  // this may take a while, depending on the file size
917  if (!VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path.GetString()))
918  {
919  if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_FAIL))
920  {
921  DPRINT1("Unable to load string\n");
922  goto end;
923  }
924 
925  if (!IsWindow(hDlg)) goto end;
926  MessageBoxW(hDlg, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
927  goto end;
928  }
929  }
930 
931 run:
933 
934  // run it
935  if (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)
936  {
937  SHELLEXECUTEINFOW shExInfo = {0};
938  shExInfo.cbSize = sizeof(shExInfo);
939  shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
940  shExInfo.lpVerb = L"open";
941  shExInfo.lpFile = Path.GetString();
942  shExInfo.lpParameters = L"";
943  shExInfo.nShow = SW_SHOW;
944 
945  if (ShellExecuteExW(&shExInfo))
946  {
947  //reflect installation progress in the titlebar
948  //TODO: make a separate string with a placeholder to include app name?
950  if (!IsWindow(hDlg)) goto end;
951  SetWindowTextW(hDlg, szMsgText.GetString());
952 
954 
955  //TODO: issue an install operation separately so that the apps could be downloaded in the background
957  CloseHandle(shExInfo.hProcess);
958  }
959  else
960  {
962  }
963  }
964 
965 end:
966  if (hOut != INVALID_HANDLE_VALUE)
967  CloseHandle(hOut);
968 
969  if (hFile)
971  InternetCloseHandle(hOpen);
972 
973  if (bTempfile)
974  {
975  if (bCancelled || (SettingsInfo.bDelInstaller && (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)))
976  DeleteFileW(Path.GetString());
977  }
978 
979  if (!IsWindow(hDlg)) return 0;
981  }
982 
983  delete static_cast<DownloadParam*>(param);
984  if (!IsWindow(hDlg)) return 0;
985  SendMessageW(hDlg, WM_CLOSE, 0, 0);
986  return 0;
987 }
#define HTTP_QUERY_CONTENT_LENGTH
Definition: wininet.h:1528
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
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:3334
#define IDS_DL_DIALOG_DB_DOWNLOAD_DISP
Definition: resource.h:218
#define CloseHandle
Definition: compat.h:598
BOOL VerifyInteg(LPCWSTR lpSHA1Hash, LPCWSTR lpFileName)
Definition: integrity.cpp:13
HRESULT hr
Definition: shlfolder.c:183
#define IDYES
Definition: winuser.h:829
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI IsWindow(_In_opt_ HWND)
DWORD dwStructSize
Definition: wininet.h:211
#define SEE_MASK_NOCLOSEPROCESS
Definition: shellapi.h:31
#define TRUE
Definition: types.h:120
static BYTE subjectName[]
Definition: cert.c:63
uint16_t * PWSTR
Definition: typedefs.h:56
static BOOL bCancelled
Definition: loaddlg.cpp:364
#define free
Definition: debug_ros.c:5
#define IDS_MISMATCH_CERT_INFO
Definition: resource.h:120
BOOL ShowLastError(HWND hWndOwner, BOOL bInetError, DWORD dwLastError)
Definition: loaddlg.cpp:525
#define INTERNET_OPEN_TYPE_PROXY
Definition: wininet.h:523
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:716
#define PBM_SETPOS
Definition: commctrl.h:2180
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1436
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define IDS_UNABLE_TO_DOWNLOAD
Definition: resource.h:109
int GetSize() const
Definition: atlsimpcoll.h:104
#define INTERNET_FLAG_DONT_CACHE
Definition: wininet.h:67
int32_t INT
Definition: typedefs.h:58
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:121
#define IDC_DOWNLOAD_STATUS
Definition: resource.h:42
WCHAR szDownloadDir[MAX_PATH]
Definition: settings.h:10
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3605
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
VOID MessageBox_LoadString(HWND hMainWnd, INT StringID)
Definition: loaddlg.cpp:349
DWORD dwSchemeLength
Definition: wininet.h:213
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
DWORD WINAPI FtpGetFileSize(HINTERNET hFile, LPDWORD lpdwFileSizeHigh)
Definition: ftp.c:1754
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:289
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
if SUCCEEDED(hr)
#define GENERIC_WRITE
Definition: nt_native.h:90
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
#define IDS_INTEG_CHECK_FAIL
Definition: resource.h:113
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
LONG_PTR LPARAM
Definition: windef.h:208
static CDowloadingAppsListView DownloadsListView
Definition: loaddlg.cpp:362
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2263
BOOL UrlHasBeenCopied
Definition: loaddlg.cpp:485
#define SW_SHOW
Definition: winuser.h:769
#define WM_SETTEXT
Definition: winuser.h:1599
#define ICU_ESCAPE
Definition: winhttp.h:48
VOID SetDownloadStatus(INT ItemIndex, DownloadStatus Status)
Definition: loaddlg.cpp:266
LPWSTR lpszScheme
Definition: wininet.h:212
SETTINGS_INFO SettingsInfo
Definition: winmain.cpp:20
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:439
#define _countof(array)
Definition: sndvol32.h:68
#define IDS_UNABLE_TO_QUERY_CERT
Definition: resource.h:111
#define WM_CLOSE
Definition: winuser.h:1603
INTERNET_SCHEME nScheme
Definition: wininet.h:214
GLfloat param
Definition: glext.h:5796
#define MAX_PATH
Definition: compat.h:34
PCXSTR GetString() const
Definition: atlsimpstr.h:361
VOID SetMarquee(BOOL Enable)
Definition: loaddlg.cpp:125
unsigned long DWORD
Definition: ntddk_ex.h:95
#define HTTP_STATUS_OK
Definition: winhttp.h:240
BOOL GetStorageDirectory(ATL::CStringW &lpDirectory)
Definition: misc.cpp:180
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define IDS_UNABLE_TO_DOWNLOAD2
Definition: resource.h:110
#define IDC_DOWNLOAD_PROGRESS
Definition: resource.h:41
GLuint GLuint end
Definition: gl.h:1545
static VOID UpdateProgress(HWND hDlg, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: loaddlg.cpp:487
#define INTERNET_OPEN_TYPE_DIRECT
Definition: wininet.h:522
HWND hMainWnd
Definition: magnifier.c:32
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:3883
#define IDS_INTEG_CHECK_TITLE
Definition: resource.h:112
static const WCHAR L[]
Definition: oid.c:1250
#define MB_ICONERROR
Definition: winuser.h:781
#define wcsrchr
Definition: compat.h:16
_In_ HANDLE hFile
Definition: mswsock.h:90
#define IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP
Definition: resource.h:219
#define HTTP_QUERY_STATUS_CODE
Definition: wininet.h:1542
#define INTERNET_FLAG_PASSIVE
Definition: wininet.h:65
#define INTERNET_FLAG_PRAGMA_NOCACHE
Definition: wininet.h:85
#define CREATE_ALWAYS
Definition: disk.h:72
WCHAR szProxyServer[MAX_PATH]
Definition: settings.h:20
DWORD dwStatus
Definition: mediaobj.idl:95
PRTL_UNICODE_STRING_BUFFER Path
#define INTERNET_OPEN_TYPE_PRECONFIG
Definition: wininet.h:521
LPCWSTR lpParameters
Definition: shellapi.h:331
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
Definition: internet.c:2174
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define HTTP_QUERY_FLAG_NUMBER
Definition: wininet.h:1606
BOOL bDelInstaller
Definition: settings.h:11
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
#define DPRINT1
Definition: precomp.h:8
#define CreateFileW
Definition: compat.h:600
Definition: misc.h:63
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1644
#define IDS_UNABLE_PATH
Definition: resource.h:121
static const WCHAR szName[]
Definition: msipriv.h:1194
ATL::CStringW LoadStatusString(DownloadStatus StatusParam)
Definition: loaddlg.cpp:75
#define APPLICATION_DATABASE_NAME
Definition: defines.h:34
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1048
unsigned int ULONG
Definition: retypes.h:1
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
WCHAR szNoProxyFor[MAX_PATH]
Definition: settings.h:21
#define malloc
Definition: debug_ros.c:4
#define ICU_DECODE
Definition: winhttp.h:291
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define INFINITE
Definition: serial.h:102
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1001
#define memset(x, y, z)
Definition: compat.h:39
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
static CDownloaderProgress ProgressBar
Definition: loaddlg.cpp:363
#define INTERNET_FLAG_KEEP_CONNECTION
Definition: wininet.h:72

Referenced by DownloadDlgProc().

◆ UpdateProgress()

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

Definition at line 487 of file loaddlg.cpp.

493 {
494  HWND Item;
495 
496  if (!IsWindow(hDlg)) return;
497  ProgressBar.SetProgress(ulProgress, ulProgressMax);
498 
499  if (!IsWindow(hDlg)) return;
501  if (Item && szStatusText && wcslen(szStatusText) > 0 && UrlHasBeenCopied == FALSE)
502  {
503  SIZE_T len = wcslen(szStatusText) + 1;
505  DWORD dummyLen;
506 
507  /* beautify our url for display purposes */
508  if (!InternetCanonicalizeUrlW(szStatusText, buf.GetBuffer(len), &dummyLen, ICU_DECODE | ICU_NO_ENCODE))
509  {
510  /* just use the original */
511  buf.ReleaseBuffer();
512  buf = szStatusText;
513  }
514  else
515  {
516  buf.ReleaseBuffer();
517  }
518 
519  /* paste it into our dialog and don't do it again in this instance */
520  SendMessageW(Item, WM_SETTEXT, 0, (LPARAM) buf.GetString());
522  }
523 }
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
VOID SetProgress(ULONG ulProgress, ULONG ulProgressMax)
Definition: loaddlg.cpp:135
BOOL WINAPI InternetCanonicalizeUrlW(LPCWSTR lpszUrl, LPWSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
Definition: internet.c:2026
#define IDC_DOWNLOAD_STATUS
Definition: resource.h:42
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define FALSE
Definition: types.h:117
LONG_PTR LPARAM
Definition: windef.h:208
BOOL UrlHasBeenCopied
Definition: loaddlg.cpp:485
#define WM_SETTEXT
Definition: winuser.h:1599
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ICU_NO_ENCODE
Definition: winhttp.h:290
GLenum GLsizei len
Definition: glext.h:6722
ULONG_PTR SIZE_T
Definition: typedefs.h:80
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
#define ICU_DECODE
Definition: winhttp.h:291
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
static CDownloaderProgress ProgressBar
Definition: loaddlg.cpp:363

Referenced by ThreadFunc().

Member Data Documentation

◆ AppsDownloadList

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

Definition at line 361 of file loaddlg.cpp.

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

◆ bCancelled

BOOL CDownloadManager::bCancelled = FALSE
staticprivate

Definition at line 364 of file loaddlg.cpp.

Referenced by DownloadDlgProc(), and ThreadFunc().

◆ bModal

BOOL CDownloadManager::bModal = FALSE
staticprivate

Definition at line 365 of file loaddlg.cpp.

Referenced by DownloadDlgProc(), and LaunchDownloadDialog().

◆ DownloadsListView

CDowloadingAppsListView CDownloadManager::DownloadsListView
staticprivate

Definition at line 362 of file loaddlg.cpp.

Referenced by DownloadDlgProc(), and ThreadFunc().

◆ ProgressBar

CDownloaderProgress CDownloadManager::ProgressBar
staticprivate

Definition at line 363 of file loaddlg.cpp.

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


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