ReactOS  0.4.15-dev-5126-g3bb451b
loaddlg.cpp
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Applications Manager
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: Displaying a download dialog
5  * COPYRIGHT: Copyright 2001 John R. Sheets (for CodeWeavers)
6  * Copyright 2004 Mike McCormack (for CodeWeavers)
7  * Copyright 2005 Ge van Geldorp (gvg@reactos.org)
8  * Copyright 2009 Dmitry Chapyshev (dmitry@reactos.org)
9  * Copyright 2015 Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com)
10  * Copyright 2017 Alexander Shaposhnikov (sanchaez@reactos.org)
11  */
12 
13  /*
14  * Based on Wine dlls/shdocvw/shdocvw_main.c
15  *
16  * This library is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU Lesser General Public
18  * License as published by the Free Software Foundation; either
19  * version 2.1 of the License, or (at your option) any later version.
20  *
21  * This library is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24  * Lesser General Public License for more details.
25  *
26  * You should have received a copy of the GNU Lesser General Public
27  * License along with this library; if not, write to the Free Software
28  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29  */
30 #include "rapps.h"
31 
32 #include <shlobj_undoc.h>
33 #include <shlguid_undoc.h>
34 
35 #include <atlbase.h>
36 #include <atlcom.h>
37 #include <atlwin.h>
38 #include <wininet.h>
39 #include <shellutils.h>
40 
41 #include <debug.h>
42 
43 #include <ui/rosctrls.h>
44 #include <windowsx.h>
45 #include <process.h>
46 #undef SubclassWindow
47 
48 #include "rosui.h"
49 #include "dialogs.h"
50 #include "misc.h"
51 
52 #ifdef USE_CERT_PINNING
53 #define CERT_ISSUER_INFO_OLD "US\r\nLet's Encrypt\r\nLet's Encrypt Authority X3"
54 #define CERT_ISSUER_INFO_NEW "US\r\nLet's Encrypt\r\nR3"
55 #define CERT_SUBJECT_INFO "rapps.reactos.org"
56 #endif
57 
58 
60 {
64 };
65 
67 {
74 };
75 
77 {
78  ATL::CStringW szString;
79  szString.LoadStringW(StatusParam);
80  return szString;
81 }
82 
84 {
88  , szUrl(AppInfo.m_szUrlDownload)
89  , szName(AppInfo.m_szName)
90  , szSHA1(AppInfo.m_szSHA1)
91  , SizeInBytes(AppInfo.m_SizeBytes)
92  {
93  }
94 
100 };
101 
103 {
106  : Dialog(dlg), AppInfo(info), szCaption(caption)
107  {
108  }
109 
113 };
114 
115 
117  : public CWindowImpl<CDownloaderProgress, CWindow, CControlWinTraits>
118 {
120 
121 public:
123  {
124  }
125 
127  {
128  if (Enable)
129  ModifyStyle(0, PBS_MARQUEE, 0);
130  else
131  ModifyStyle(PBS_MARQUEE, 0, 0);
132 
134  }
135 
136  VOID SetProgress(ULONG ulProgress, ULONG ulProgressMax)
137  {
138  WCHAR szProgress[100];
139 
140  /* format the bits and bytes into pretty and accessible units... */
141  StrFormatByteSizeW(ulProgress, szProgress, _countof(szProgress));
142 
143  /* use our subclassed progress bar text subroutine */
144  ATL::CStringW ProgressText;
145 
146  if (ulProgressMax)
147  {
148  /* total size is known */
149  WCHAR szProgressMax[100];
150  UINT uiPercentage = ((ULONGLONG) ulProgress * 100) / ulProgressMax;
151 
152  /* send the current progress to the progress bar */
153  if (!IsWindow()) return;
154  SendMessage(PBM_SETPOS, uiPercentage, 0);
155 
156  /* format total download size */
157  StrFormatByteSizeW(ulProgressMax, szProgressMax, _countof(szProgressMax));
158 
159  /* generate the text on progress bar */
160  ProgressText.Format(L"%u%% \x2014 %ls / %ls",
161  uiPercentage,
162  szProgress,
163  szProgressMax);
164  }
165  else
166  {
167  /* send the current progress to the progress bar */
168  if (!IsWindow()) return;
169  SendMessage(PBM_SETPOS, 0, 0);
170 
171  /* total size is not known, display only current size */
172  ProgressText.Format(L"%ls...", szProgress);
173  }
174 
175  /* and finally display it */
176  if (!IsWindow()) return;
177  SetWindowText(ProgressText.GetString());
178  }
179 
181  {
182  return TRUE;
183  }
184 
186  {
187  PAINTSTRUCT ps;
188  HDC hDC = BeginPaint(&ps), hdcMem;
189  HBITMAP hbmMem;
190  HANDLE hOld;
191  RECT myRect;
192  UINT win_width, win_height;
193 
194  GetClientRect(&myRect);
195 
196  /* grab the progress bar rect size */
197  win_width = myRect.right - myRect.left;
198  win_height = myRect.bottom - myRect.top;
199 
200  /* create an off-screen DC for double-buffering */
202  hbmMem = CreateCompatibleBitmap(hDC, win_width, win_height);
203 
204  hOld = SelectObject(hdcMem, hbmMem);
205 
206  /* call the original draw code and redirect it to our memory buffer */
207  DefWindowProc(uMsg, (WPARAM) hdcMem, lParam);
208 
209  /* draw our nifty progress text over it */
212  &myRect,
216  1, 1);
217 
218  /* transfer the off-screen DC to the screen */
219  BitBlt(hDC, 0, 0, win_width, win_height, hdcMem, 0, 0, SRCCOPY);
220 
221  /* free the off-screen DC */
222  SelectObject(hdcMem, hOld);
223  DeleteObject(hbmMem);
224  DeleteDC(hdcMem);
225 
226  EndPaint(&ps);
227  return 0;
228  }
229 
231  {
232  PCWSTR pszText = (PCWSTR)lParam;
233  if (pszText)
234  {
235  if (m_szProgressText != pszText)
236  {
237  m_szProgressText = pszText;
239  }
240  }
241  else
242  {
243  if (!m_szProgressText.IsEmpty())
244  {
247  }
248  }
249  return TRUE;
250  }
251 
256  END_MSG_MAP()
257 };
258 
260  : public CListView
261 {
262 public:
264  {
265  RECT r = {10, 150, 320, 350};
268 
270 
271  AddColumn(0, 150, LVCFMT_LEFT);
272  AddColumn(1, 120, LVCFMT_LEFT);
273 
274  return hwnd;
275  }
276 
278  {
279  for (INT i = 0; i < arrInfo.GetSize(); ++i)
280  {
281  AddRow(i, arrInfo[i].szName.GetString(), DLSTATUS_WAITING);
282  }
283  }
284 
286  {
288  SetItemText(ItemIndex, 1, szBuffer.GetString());
289  }
290 
291  BOOL AddItem(INT ItemIndex, LPWSTR lpText)
292  {
293  LVITEMW Item;
294 
295  ZeroMemory(&Item, sizeof(Item));
296 
297  Item.mask = LVIF_TEXT | LVIF_STATE;
298  Item.pszText = lpText;
299  Item.iItem = ItemIndex;
300 
301  return InsertItem(&Item);
302  }
303 
305  {
307  AddItem(RowIndex,
308  const_cast<LPWSTR>(szAppName));
309  SetDownloadStatus(RowIndex, Status);
310  }
311 
313  {
314  LVCOLUMNW Column;
315  ZeroMemory(&Column, sizeof(Column));
316 
317  Column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
318  Column.iSubItem = Index;
319  Column.cx = Width;
320  Column.fmt = Format;
321 
322  return (InsertColumn(Index, &Column) == -1) ? FALSE : TRUE;
323  }
324 };
325 
326 #ifdef USE_CERT_PINNING
327 static BOOL CertGetSubjectAndIssuer(HINTERNET hFile, CLocalPtr<char>& subjectInfo, CLocalPtr<char>& issuerInfo)
328 {
329  DWORD certInfoLength;
331  DWORD size, flags;
332 
333  size = sizeof(flags);
335  {
336  return FALSE;
337  }
338 
340  {
341  return FALSE;
342  }
343 
344  /* Despite what the header indicates, the implementation of INTERNET_CERTIFICATE_INFO is not Unicode-aware. */
345  certInfoLength = sizeof(certInfo);
348  &certInfo,
349  &certInfoLength))
350  {
351  return FALSE;
352  }
353 
354  subjectInfo.Attach(certInfo.lpszSubjectInfo);
355  issuerInfo.Attach(certInfo.lpszIssuerInfo);
356 
357  if (certInfo.lpszProtocolName)
358  LocalFree(certInfo.lpszProtocolName);
359  if (certInfo.lpszSignatureAlgName)
361  if (certInfo.lpszEncryptionAlgName)
363 
364  return certInfo.lpszSubjectInfo && certInfo.lpszIssuerInfo;
365 }
366 #endif
367 
369 {
370  ATL::CStringW szMsgText;
371  if (szMsgText.LoadStringW(StringID))
372  {
374  }
375 }
376 
377 // Download dialog (loaddlg.cpp)
379 {
383  static BOOL bCancelled;
384  static BOOL bModal;
385  static VOID UpdateProgress(HWND hDlg, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText);
386 public:
387  static VOID Add(DownloadInfo info);
388  static VOID Download(const DownloadInfo& DLInfo, BOOL bIsModal = FALSE);
390  static unsigned int WINAPI ThreadFunc(LPVOID Context);
392 };
393 
394 
395 // CDownloadManager
401 
403 {
405 }
406 
408 {
410  AppsDownloadList.Add(DLInfo);
411  LaunchDownloadDialog(bIsModal);
412 }
413 
415 {
416  static WCHAR szCaption[MAX_PATH];
417 
418  switch (uMsg)
419  {
420  case WM_INITDIALOG:
421  {
422  HICON hIconSm, hIconBg;
423  ATL::CStringW szTempCaption;
424 
425  bCancelled = FALSE;
426 
427  if (hMainWnd)
428  {
431  }
432  if (!hMainWnd || (!hIconBg || !hIconSm))
433  {
434  /* Load the default icon */
436  }
437 
438  if (hIconBg && hIconSm)
439  {
440  SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM)hIconBg);
441  SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
442  }
443 
445  if (Item)
446  {
447  // initialize the default values for our nifty progress bar
448  // and subclass it so that it learns to print a status text
452  if (AppsDownloadList.GetSize() > 0)
453  ProgressBar.SetProgress(0, AppsDownloadList[0].SizeInBytes);
454  }
455 
456  // Add a ListView
457  HWND hListView = DownloadsListView.Create(Dlg);
458  if (!hListView)
459  {
460  return FALSE;
461  }
463 
464  // Get a dlg string for later use
465  GetWindowTextW(Dlg, szCaption, _countof(szCaption));
466 
467  // Hide a placeholder from displaying
468  szTempCaption = szCaption;
469  szTempCaption.Replace(L"%ls", L"");
470  SetWindowText(Dlg, szTempCaption.GetString());
471 
472  ShowWindow(Dlg, SW_SHOW);
473 
474  // Start download process
475  DownloadParam *param = new DownloadParam(Dlg, AppsDownloadList, szCaption);
476  unsigned int ThreadId;
477  HANDLE Thread = (HANDLE)_beginthreadex(NULL, 0, ThreadFunc, (void *) param, 0, &ThreadId);
478  if (!Thread)
479  {
480  return FALSE;
481  }
482 
485  return TRUE;
486  }
487 
488  case WM_COMMAND:
489  if (wParam == IDCANCEL)
490  {
491  bCancelled = TRUE;
492  PostMessageW(Dlg, WM_CLOSE, 0, 0);
493  }
494  return FALSE;
495 
496  case WM_CLOSE:
497  if (ProgressBar)
500  {
501  ::EndDialog(Dlg, 0);
502  }
503  else
504  {
505  ::DestroyWindow(Dlg);
506  }
507  return TRUE;
508 
509  default:
510  return FALSE;
511  }
512 }
513 
515 
517  HWND hDlg,
518  ULONG ulProgress,
519  ULONG ulProgressMax,
520  ULONG ulStatusCode,
521  LPCWSTR szStatusText)
522 {
523  HWND Item;
524 
525  if (!IsWindow(hDlg)) return;
526  ProgressBar.SetProgress(ulProgress, ulProgressMax);
527 
528  if (!IsWindow(hDlg)) return;
530  if (Item && szStatusText && wcslen(szStatusText) > 0 && UrlHasBeenCopied == FALSE)
531  {
532  SIZE_T len = wcslen(szStatusText) + 1;
534  DWORD dummyLen;
535 
536  /* beautify our url for display purposes */
537  if (!InternetCanonicalizeUrlW(szStatusText, buf.GetBuffer(len), &dummyLen, ICU_DECODE | ICU_NO_ENCODE))
538  {
539  /* just use the original */
540  buf.ReleaseBuffer();
541  buf = szStatusText;
542  }
543  else
544  {
545  buf.ReleaseBuffer();
546  }
547 
548  /* paste it into our dialog and don't do it again in this instance */
549  ::SetWindowText(Item, buf.GetString());
551  }
552 }
553 
555  HWND hWndOwner,
556  BOOL bInetError,
557  DWORD dwLastError)
558 {
559  CLocalPtr<WCHAR> lpMsg;
560 
564  (bInetError ? GetModuleHandleW(L"wininet.dll") : NULL),
565  dwLastError,
567  (LPWSTR)&lpMsg,
568  0, NULL))
569  {
570  DPRINT1("FormatMessageW unexpected failure (err %d)\n", GetLastError());
571  return FALSE;
572  }
573 
574  MessageBoxW(hWndOwner, lpMsg, NULL, MB_OK | MB_ICONERROR);
575  return TRUE;
576 }
577 
579 {
581  PWSTR p, q;
582 
583  HWND hDlg = static_cast<DownloadParam*>(param)->Dialog;
584  HWND Item;
585  INT iAppId;
586 
587  ULONG dwContentLen, dwBytesWritten, dwBytesRead, dwStatus;
588  ULONG dwCurrentBytesRead = 0;
589  ULONG dwStatusLen = sizeof(dwStatus);
590 
591  BOOL bTempfile = FALSE;
592 
593  HINTERNET hOpen = NULL;
594  HINTERNET hFile = NULL;
596 
597  unsigned char lpBuffer[4096];
598  LPCWSTR lpszAgent = L"RApps/1.1";
599  URL_COMPONENTSW urlComponents;
600  size_t urlLength, filenameLength;
601 
602  const ATL::CSimpleArray<DownloadInfo> &InfoArray = static_cast<DownloadParam*>(param)->AppInfo;
603  LPCWSTR szCaption = static_cast<DownloadParam*>(param)->szCaption;
604  ATL::CStringW szNewCaption;
605 
607 
608  if (InfoArray.GetSize() <= 0)
609  {
611  goto end;
612  }
613 
614  for (iAppId = 0; iAppId < InfoArray.GetSize(); ++iAppId)
615  {
616  // Reset progress bar
617  if (!IsWindow(hDlg)) break;
619  if (Item)
620  {
623  ProgressBar.SetProgress(0, InfoArray[iAppId].SizeInBytes);
624  }
625 
626  // is this URL an update package for RAPPS? if so store it in a different place
627  if (InfoArray[iAppId].DLType != DLTYPE_APPLICATION)
628  {
630  {
632  goto end;
633  }
634  }
635  else
636  {
638  }
639 
640  // Change caption to show the currently downloaded app
641  switch(InfoArray[iAppId].DLType)
642  {
643  case DLTYPE_APPLICATION:
644  szNewCaption.Format(szCaption, InfoArray[iAppId].szName.GetString());
645  break;
646  case DLTYPE_DBUPDATE:
647  szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_DOWNLOAD_DISP);
648  break;
650  szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP);
651  break;
652  }
653 
654  if (!IsWindow(hDlg)) goto end;
655  SetWindowTextW(hDlg, szNewCaption.GetString());
656 
657  // build the path for the download
658  p = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'/');
659  q = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'?');
660 
661  // do we have a final slash separator?
662  if (!p)
663  {
665  goto end;
666  }
667 
668  // prepare the tentative length of the filename, maybe we've to remove part of it later on
669  filenameLength = wcslen(p) * sizeof(WCHAR);
670 
671  /* do we have query arguments in the target URL after the filename? account for them
672  (e.g. https://example.org/myfile.exe?no_adware_plz) */
673  if (q && q > p && (q - p) > 0)
674  filenameLength -= wcslen(q - 1) * sizeof(WCHAR);
675 
676  // is the path valid? can we access it?
677  if (GetFileAttributesW(Path.GetString()) == INVALID_FILE_ATTRIBUTES)
678  {
679  if (!CreateDirectoryW(Path.GetString(), NULL))
680  {
682  goto end;
683  }
684  }
685 
686  // append a \ to the provided file system path, and the filename portion from the URL after that
687 
688  PathAddBackslashW(Path.GetBuffer(MAX_PATH));
689  switch (InfoArray[iAppId].DLType)
690  {
691  case DLTYPE_DBUPDATE:
694  break;
695  case DLTYPE_APPLICATION:
696  PathAppendW(Path.GetBuffer(), (LPWSTR)(p + 1)); // use the filename retrieved from URL
697  break;
698  }
699  Path.ReleaseBuffer();
700 
701  if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] && GetFileAttributesW(Path.GetString()) != INVALID_FILE_ATTRIBUTES)
702  {
703  // only open it in case of total correctness
704  if (VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path))
705  goto run;
706  }
707 
708  // Add the download URL
709  if (!IsWindow(hDlg)) goto end;
710  SetDlgItemTextW(hDlg, IDC_DOWNLOAD_STATUS, InfoArray[iAppId].szUrl.GetString());
711 
713 
714  // download it
716  bTempfile = TRUE;
717 
718  /* FIXME: this should just be using the system-wide proxy settings */
719  switch (SettingsInfo.Proxy)
720  {
721  case 0: // preconfig
722  default:
723  hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
724  break;
725  case 1: // direct (no proxy)
726  hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
727  break;
728  case 2: // use proxy
730  break;
731  }
732 
733  if (!hOpen)
734  {
736  goto end;
737  }
738 
739  dwStatusLen = sizeof(dwStatus);
740 
741  memset(&urlComponents, 0, sizeof(urlComponents));
742  urlComponents.dwStructSize = sizeof(urlComponents);
743 
744  urlLength = InfoArray[iAppId].szUrl.GetLength();
745  urlComponents.dwSchemeLength = urlLength + 1;
746  urlComponents.lpszScheme = (LPWSTR) malloc(urlComponents.dwSchemeLength * sizeof(WCHAR));
747 
748  if (!InternetCrackUrlW(InfoArray[iAppId].szUrl, urlLength + 1, ICU_DECODE | ICU_ESCAPE, &urlComponents))
749  {
751  goto end;
752  }
753 
754  dwContentLen = 0;
755 
756  if (urlComponents.nScheme == INTERNET_SCHEME_HTTP ||
757  urlComponents.nScheme == INTERNET_SCHEME_HTTPS)
758  {
759  hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl.GetString(), NULL, 0,
760  dwUrlConnectFlags,
761  0);
762  if (!hFile)
763  {
765  {
766  /* Workaround for CORE-17377 */
768  }
769  goto end;
770  }
771 
772  // query connection
774  {
776  goto end;
777  }
778 
779  if (dwStatus != HTTP_STATUS_OK)
780  {
782  goto end;
783  }
784 
785  // query content length
787  }
788  else if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
789  {
790  // force passive mode on FTP
791  hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl, NULL, 0,
792  dwUrlConnectFlags | INTERNET_FLAG_PASSIVE,
793  0);
794  if (!hFile)
795  {
797  {
798  /* Workaround for CORE-17377 */
800  }
801  goto end;
802  }
803 
804  dwContentLen = FtpGetFileSize(hFile, &dwStatus);
805  }
806  else if (urlComponents.nScheme == INTERNET_SCHEME_FILE)
807  {
808  // Add support for the file scheme so testing locally is simpler
809  WCHAR LocalFilePath[MAX_PATH];
810  DWORD cchPath = _countof(LocalFilePath);
811  // Ideally we would use PathCreateFromUrlAlloc here, but that is not exported (yet)
812  HRESULT hr = PathCreateFromUrlW(InfoArray[iAppId].szUrl, LocalFilePath, &cchPath, 0);
813  if (SUCCEEDED(hr))
814  {
815  if (CopyFileW(LocalFilePath, Path, FALSE))
816  {
817  goto run;
818  }
819  else
820  {
822  goto end;
823  }
824  }
825  else
826  {
828  goto end;
829  }
830  }
831 
832  if (!dwContentLen)
833  {
834  // Someone was nice enough to add this, let's use it
835  if (InfoArray[iAppId].SizeInBytes)
836  {
837  dwContentLen = InfoArray[iAppId].SizeInBytes;
838  }
839  else
840  {
841  // content-length is not known, enable marquee mode
843  }
844  }
845 
846  free(urlComponents.lpszScheme);
847 
848 #ifdef USE_CERT_PINNING
849  // are we using HTTPS to download the RAPPS update package? check if the certificate is original
850  if ((urlComponents.nScheme == INTERNET_SCHEME_HTTPS) &&
851  (InfoArray[iAppId].DLType == DLTYPE_DBUPDATE))
852  {
853  CLocalPtr<char> subjectName, issuerName;
854  CStringA szMsgText;
855  bool bAskQuestion = false;
856  if (!CertGetSubjectAndIssuer(hFile, subjectName, issuerName))
857  {
858  szMsgText.LoadStringW(IDS_UNABLE_TO_QUERY_CERT);
859  bAskQuestion = true;
860  }
861  else
862  {
863  if (strcmp(subjectName, CERT_SUBJECT_INFO) ||
864  (strcmp(issuerName, CERT_ISSUER_INFO_OLD) &&
865  strcmp(issuerName, CERT_ISSUER_INFO_NEW)))
866  {
867  szMsgText.Format(IDS_MISMATCH_CERT_INFO, (char*)subjectName, (const char*)issuerName);
868  bAskQuestion = true;
869  }
870  }
871 
872  if (bAskQuestion)
873  {
874  if (MessageBoxA(hMainWnd, szMsgText.GetString(), NULL, MB_YESNO | MB_ICONERROR) != IDYES)
875  {
876  goto end;
877  }
878  }
879  }
880 #endif
881 
883 
884  if (hOut == INVALID_HANDLE_VALUE)
885  {
887  goto end;
888  }
889 
890  dwCurrentBytesRead = 0;
891  do
892  {
893  if (!InternetReadFile(hFile, lpBuffer, _countof(lpBuffer), &dwBytesRead))
894  {
896  goto end;
897  }
898 
899  if (!WriteFile(hOut, &lpBuffer[0], dwBytesRead, &dwBytesWritten, NULL))
900  {
902  goto end;
903  }
904 
905  dwCurrentBytesRead += dwBytesRead;
906  if (!IsWindow(hDlg)) goto end;
907  UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
908  } while (dwBytesRead && !bCancelled);
909 
910  CloseHandle(hOut);
911  hOut = INVALID_HANDLE_VALUE;
912 
913  if (bCancelled)
914  {
915  DPRINT1("Operation cancelled\n");
916  goto end;
917  }
918 
919  if (!dwContentLen)
920  {
921  // set progress bar to 100%
923 
924  dwContentLen = dwCurrentBytesRead;
925  if (!IsWindow(hDlg)) goto end;
926  UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
927  }
928 
929  /* if this thing isn't a RAPPS update and it has a SHA-1 checksum
930  verify its integrity by using the native advapi32.A_SHA1 functions */
931  if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] != 0)
932  {
933  ATL::CStringW szMsgText;
934 
935  // change a few strings in the download dialog to reflect the verification process
936  if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_TITLE))
937  {
938  DPRINT1("Unable to load string\n");
939  goto end;
940  }
941 
942  if (!IsWindow(hDlg)) goto end;
943  SetWindowTextW(hDlg, szMsgText.GetString());
944  ::SetDlgItemText(hDlg, IDC_DOWNLOAD_STATUS, Path.GetString());
945 
946  // this may take a while, depending on the file size
947  if (!VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path.GetString()))
948  {
949  if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_FAIL))
950  {
951  DPRINT1("Unable to load string\n");
952  goto end;
953  }
954 
955  if (!IsWindow(hDlg)) goto end;
956  MessageBoxW(hDlg, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
957  goto end;
958  }
959  }
960 
961 run:
963 
964  // run it
965  if (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)
966  {
967  SHELLEXECUTEINFOW shExInfo = {0};
968  shExInfo.cbSize = sizeof(shExInfo);
969  shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
970  shExInfo.lpVerb = L"open";
971  shExInfo.lpFile = Path.GetString();
972  shExInfo.lpParameters = L"";
973  shExInfo.nShow = SW_SHOW;
974 
975  /* FIXME: Do we want to log installer status? */
976  WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_INSTALL, InfoArray[iAppId].szName);
977 
978  if (ShellExecuteExW(&shExInfo))
979  {
980  //reflect installation progress in the titlebar
981  //TODO: make a separate string with a placeholder to include app name?
983  if (!IsWindow(hDlg)) goto end;
984  SetWindowTextW(hDlg, szMsgText.GetString());
985 
987 
988  //TODO: issue an install operation separately so that the apps could be downloaded in the background
990  CloseHandle(shExInfo.hProcess);
991  }
992  else
993  {
995  }
996  }
997 
998 end:
999  if (hOut != INVALID_HANDLE_VALUE)
1000  CloseHandle(hOut);
1001 
1002  if (hFile)
1004  InternetCloseHandle(hOpen);
1005 
1006  if (bTempfile)
1007  {
1008  if (bCancelled || (SettingsInfo.bDelInstaller && (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)))
1009  DeleteFileW(Path.GetString());
1010  }
1011 
1012  if (!IsWindow(hDlg)) return 0;
1014  }
1015 
1016  delete static_cast<DownloadParam*>(param);
1017  if (!IsWindow(hDlg)) return 0;
1018  SendMessageW(hDlg, WM_CLOSE, 0, 0);
1019  return 0;
1020 }
1021 
1022 //TODO: Reuse the dialog
1024 {
1025  CDownloadManager::bModal = bIsModal;
1026  if (bIsModal)
1027  {
1028  DialogBoxW(hInst,
1030  hMainWnd,
1031  DownloadDlgProc);
1032  }
1033  else
1034  {
1037  hMainWnd,
1038  DownloadDlgProc);
1039  }
1040 }
1041 // CDownloadManager
1042 
1043 
1045 {
1046  if (AppsList.GetSize() == 0)
1047  return FALSE;
1048 
1049  // Initialize shared variables
1050  for (INT i = 0; i < AppsList.GetSize(); ++i)
1051  {
1052  CDownloadManager::Add(AppsList[i]); // implicit conversion to DownloadInfo
1053  }
1054 
1055  // Create a dialog and issue a download process
1057 
1058  return TRUE;
1059 }
1060 
1062 {
1063  if (!pAppInfo)
1064  return FALSE;
1065 
1066  CDownloadManager::Download(*pAppInfo, FALSE);
1067  return TRUE;
1068 }
1069 
1071 {
1072  static DownloadInfo DatabaseDLInfo;
1073  DatabaseDLInfo.szUrl = lpUrl;
1074  DatabaseDLInfo.szName.LoadStringW(IDS_DL_DIALOG_DB_DISP);
1075  DatabaseDLInfo.DLType = IsOfficial ? DLTYPE_DBUPDATE : DLTYPE_DBUPDATE_UNOFFICIAL;
1076  CDownloadManager::Download(DatabaseDLInfo, TRUE);
1077 }
1078 
#define HTTP_QUERY_CONTENT_LENGTH
Definition: wininet.h:1528
int GetLength() const
Definition: atlsimpstr.h:356
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2380
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HWND UnsubclassWindow(BOOL bForce=FALSE)
Definition: atlwin.h:1569
const uint16_t * PCWSTR
Definition: typedefs.h:57
static const WCHAR szName[]
Definition: powrprof.c:45
HRESULT WINAPI PathCreateFromUrlW(LPCWSTR pszUrl, LPWSTR pszPath, LPDWORD pcchPath, DWORD dwReserved)
Definition: path.c:3354
#define IDS_DL_DIALOG_DB_DOWNLOAD_DISP
Definition: resource.h:219
DownloadType
Definition: loaddlg.cpp:59
static HICON
Definition: imagelist.c:84
#define CloseHandle
Definition: compat.h:598
#define IDS_STATUS_INSTALLED
Definition: resource.h:195
#define PBS_MARQUEE
Definition: commctrl.h:2198
#define LVCF_WIDTH
Definition: commctrl.h:2587
BOOL VerifyInteg(LPCWSTR lpSHA1Hash, LPCWSTR lpFileName)
Definition: integrity.cpp:13
BOOL Add(const T &t)
Definition: atlsimpcoll.h:58
#define IDS_DL_DIALOG_DB_DISP
Definition: resource.h:218
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)
static VOID Download(const DownloadInfo &DLInfo, BOOL bIsModal=FALSE)
Definition: loaddlg.cpp:407
#define LVS_NOCOLUMNHEADER
Definition: commctrl.h:2284
DWORD dwStructSize
Definition: wininet.h:211
#define IDD_DOWNLOAD_DIALOG
Definition: resource.h:65
#define GetStockFont(i)
Definition: windowsx.h:283
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2267
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define PBM_SETMARQUEE
Definition: commctrl.h:2199
#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
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:124
#define LVS_REPORT
Definition: commctrl.h:2262
static BOOL bCancelled
Definition: loaddlg.cpp:383
#define free
Definition: debug_ros.c:5
static unsigned int WINAPI ThreadFunc(LPVOID Context)
Definition: loaddlg.cpp:578
#define MAKELPARAM(l, h)
Definition: winuser.h:3998
#define IDS_MISMATCH_CERT_INFO
Definition: resource.h:120
#define INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT
Definition: wininet.h:726
BOOL ShowLastError(HWND hWndOwner, BOOL bInetError, DWORD dwLastError)
Definition: loaddlg.cpp:554
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:35
BOOL IsWindow() const
Definition: atlwin.h:941
LONG top
Definition: windef.h:307
LPCWSTR szCaption
Definition: loaddlg.cpp:112
#define INTERNET_OPEN_TYPE_PROXY
Definition: wininet.h:523
#define LVCFMT_LEFT
Definition: commctrl.h:2598
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
static VOID LaunchDownloadDialog(BOOL)
Definition: loaddlg.cpp:1023
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define COLOR_CAPTIONTEXT
Definition: winuser.h:916
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define ZeroMemory
Definition: winbase.h:1667
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
VOID SetProgress(ULONG ulProgress, ULONG ulProgressMax)
Definition: loaddlg.cpp:136
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:753
#define PBM_SETPOS
Definition: commctrl.h:2184
static ATL::CSimpleArray< DownloadInfo > AppsDownloadList
Definition: loaddlg.cpp:380
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1414
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI InternetCanonicalizeUrlW(LPCWSTR lpszUrl, LPWSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
Definition: internet.c:2004
#define IDS_STATUS_DOWNLOADING
Definition: resource.h:199
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT_PTR WPARAM
Definition: windef.h:207
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
void EndPaint(LPPAINTSTRUCT lpPaint)
Definition: atlwin.h:523
#define WS_CHILD
Definition: pedump.c:617
#define IDS_STATUS_INSTALLING
Definition: resource.h:200
LONG left
Definition: windef.h:306
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define IDS_UNABLE_TO_DOWNLOAD
Definition: resource.h:109
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:64
_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 SetWindowText(LPCTSTR lpszString)
Definition: atlwin.h:1294
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
LONG right
Definition: windef.h:308
#define DT_NOPREFIX
Definition: winuser.h:537
int GetSize() const
Definition: atlsimpcoll.h:104
BOOL WINAPI DestroyWindow(_In_ HWND)
HWND Create(HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: rosctrls.h:8
#define INTERNET_FLAG_DONT_CACHE
Definition: wininet.h:67
DownloadInfo(const CAvailableApplicationInfo &AppInfo)
Definition: loaddlg.cpp:86
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetSysColor(_In_ int)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1606
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:126
#define ICON_SMALL
Definition: tnclass.cpp:48
BOOL InvalidateRect(LPCRECT lpRect, BOOL bErase=TRUE)
Definition: atlwin.h:896
#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)
#define LVIF_TEXT
Definition: commctrl.h:2309
#define LVCF_SUBITEM
Definition: commctrl.h:2589
ATL::CStringW szSHA1
Definition: loaddlg.cpp:98
HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3722
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define PBM_SETRANGE
Definition: commctrl.h:2183
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
DownloadParam(HWND dlg, const ATL::CSimpleArray< DownloadInfo > &info, LPCWSTR caption)
Definition: loaddlg.cpp:105
DownloadType DLType
Definition: loaddlg.cpp:95
VOID MessageBox_LoadString(HWND hMainWnd, INT StringID)
Definition: loaddlg.cpp:368
#define L(x)
Definition: ntvdm.h:50
BOOL SubclassWindow(HWND hWnd)
Definition: atlwin.h:1546
DWORD dwSchemeLength
Definition: wininet.h:213
BOOL SetItemText(int i, int subItem, LPCWSTR text)
Definition: rosctrls.h:186
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
DWORD WINAPI FtpGetFileSize(HINTERNET hFile, LPDWORD lpdwFileSizeHigh)
Definition: ftp.c:1757
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
unsigned int BOOL
Definition: ntddk_ex.h:94
ATL::CStringW szUrl
Definition: loaddlg.cpp:96
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
if SUCCEEDED(hr)
#define GENERIC_WRITE
Definition: nt_native.h:90
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:535
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:416
#define IDS_INTEG_CHECK_FAIL
Definition: resource.h:113
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, RECT *prc, DWORD dwFlags, COLORREF crText, COLORREF crShadow, int ixOffset, int iyOffset)
Definition: commctrl.c:1845
static HWND hwndParent
Definition: cryptui.c:300
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2730
static CDowloadingAppsListView DownloadsListView
Definition: loaddlg.cpp:381
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2343
ULONG SizeInBytes
Definition: loaddlg.cpp:99
BOOL UrlHasBeenCopied
Definition: loaddlg.cpp:514
#define DT_VCENTER
Definition: winuser.h:543
#define SW_SHOW
Definition: winuser.h:769
#define WM_SETTEXT
Definition: winuser.h:1607
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:420
VOID LoadList(ATL::CSimpleArray< DownloadInfo > arrInfo)
Definition: loaddlg.cpp:277
#define IDS_STATUS_FINISHED
Definition: resource.h:202
#define FORMAT_MESSAGE_FROM_HMODULE
Definition: winbase.h:419
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4389
#define ICU_ESCAPE
Definition: winhttp.h:48
Status
Definition: gdiplustypes.h:24
VOID SetDownloadStatus(INT ItemIndex, DownloadStatus Status)
Definition: loaddlg.cpp:285
#define GCLP_HICONSM
Definition: winuser.h:670
#define EVENTLOG_SUCCESS
Definition: winnt_old.h:2880
GLsizeiptr size
Definition: glext.h:5919
BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPCWSTR lpMsg)
Definition: misc.cpp:226
LPWSTR lpszScheme
Definition: wininet.h:212
SETTINGS_INFO SettingsInfo
Definition: winmain.cpp:20
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HDC BeginPaint(LPPAINTSTRUCT lpPaint)
Definition: atlwin.h:297
__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
_In_ WDFCOLLECTION _In_ ULONG Index
#define END_MSG_MAP()
Definition: atlwin.h:1911
uint64_t ULONGLONG
Definition: typedefs.h:67
#define _countof(array)
Definition: sndvol32.h:68
#define IDS_UNABLE_TO_QUERY_CERT
Definition: resource.h:111
#define WM_CLOSE
Definition: winuser.h:1611
INTERNET_SCHEME nScheme
Definition: wininet.h:214
GLfloat param
Definition: glext.h:5796
#define MAX_PATH
Definition: compat.h:34
#define WINAPI
Definition: msvc.h:6
PCXSTR GetString() const
Definition: atlsimpstr.h:361
#define IDS_STATUS_DOWNLOADED
Definition: resource.h:197
VOID SetMarquee(BOOL Enable)
Definition: loaddlg.cpp:126
#define LVS_SINGLESEL
Definition: commctrl.h:2266
LRESULT OnSetText(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: loaddlg.cpp:230
PVOID HANDLE
Definition: typedefs.h:73
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ICU_NO_ENCODE
Definition: winhttp.h:290
#define HTTP_STATUS_OK
Definition: winhttp.h:240
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2652
BOOL GetStorageDirectory(ATL::CStringW &lpDirectory)
Definition: misc.cpp:141
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: loaddlg.cpp:414
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define SetDlgItemText
Definition: winuser.h:5839
#define IDS_UNABLE_TO_DOWNLOAD2
Definition: resource.h:110
ATL::CStringW szName
Definition: loaddlg.cpp:97
GLbitfield flags
Definition: glext.h:7161
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
#define WM_PAINT
Definition: winuser.h:1610
#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:516
#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:3870
#define IDS_INTEG_CHECK_TITLE
Definition: resource.h:112
int InsertItem(const LV_ITEM *pitem)
Definition: rosctrls.h:96
BOOL DownloadListOfApplications(const ATL::CSimpleArray< CAvailableApplicationInfo > &AppsList, BOOL bIsModal)
Definition: loaddlg.cpp:1044
#define IDI_MAIN
Definition: resource.h:4
#define GCLP_HICON
Definition: winuser.h:669
#define MB_ICONERROR
Definition: winuser.h:781
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4271
GLenum GLsizei len
Definition: glext.h:6722
VOID DownloadApplicationsDB(LPCWSTR lpUrl, BOOL IsOfficial)
Definition: loaddlg.cpp:1070
#define WM_COMMAND
Definition: winuser.h:1730
#define wcsrchr
Definition: compat.h:16
_In_ HANDLE hFile
Definition: mswsock.h:90
#define IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP
Definition: resource.h:220
LRESULT OnEraseBkgnd(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: loaddlg.cpp:180
#define SelectFont(hdc, hfont)
Definition: windowsx.h:491
#define HTTP_QUERY_STATUS_CODE
Definition: wininet.h:1542
TCHAR szAppName[128]
Definition: solitaire.cpp:17
LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: loaddlg.cpp:185
#define IDS_STATUS_WAITING
Definition: resource.h:201
bool IsEmpty() const
Definition: atlsimpstr.h:379
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:417
static HDC hDC
Definition: 3dtext.c:33
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int Replace(PCXSTR pszOld, PCXSTR pszNew)
Definition: cstringt.h:811
#define INTERNET_FLAG_PASSIVE
Definition: wininet.h:65
#define DT_SINGLELINE
Definition: winuser.h:540
#define INTERNET_FLAG_PRAGMA_NOCACHE
Definition: wininet.h:85
#define LVCF_FMT
Definition: commctrl.h:2586
#define CREATE_ALWAYS
Definition: disk.h:72
WCHAR szProxyServer[MAX_PATH]
Definition: settings.h:20
HINSTANCE hInst
Definition: dxdiag.c:13
DWORD dwStatus
Definition: mediaobj.idl:95
PRTL_UNICODE_STRING_BUFFER Path
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define INTERNET_OPEN_TYPE_PRECONFIG
Definition: wininet.h:521
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
BOOL WINAPI DeleteDC(_In_ HDC)
#define INTERNET_OPTION_SECURITY_FLAGS
Definition: wininet.h:725
HWND Create(HWND hwndParent)
Definition: loaddlg.cpp:263
BOOL ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
Definition: atlwin.h:1002
BOOL AddItem(INT ItemIndex, LPWSTR lpText)
Definition: loaddlg.cpp:291
LPCWSTR lpParameters
Definition: shellapi.h:331
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
Definition: internet.c:2154
ATL::CStringW m_szProgressText
Definition: loaddlg.cpp:119
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: window.h:371
#define SetWindowText
Definition: winuser.h:5847
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HTTP_QUERY_FLAG_NUMBER
Definition: wininet.h:1606
BOOL bDelInstaller
Definition: settings.h:11
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1892
#define DPRINT1
Definition: precomp.h:8
#define CreateFileW
Definition: compat.h:600
Definition: misc.h:45
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1920
static VOID Add(DownloadInfo info)
Definition: loaddlg.cpp:402
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1625
#define IDS_UNABLE_PATH
Definition: resource.h:121
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
ATL::CStringW LoadStatusString(DownloadStatus StatusParam)
Definition: loaddlg.cpp:76
#define APPLICATION_DATABASE_NAME
Definition: defines.h:33
HICON hIconSm
Definition: msconfig.c:44
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1110
unsigned int ULONG
Definition: retypes.h:1
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
LONG bottom
Definition: windef.h:309
#define DT_CENTER
Definition: winuser.h:527
int InsertColumn(int iCol, LV_COLUMN *pcol)
Definition: rosctrls.h:52
WCHAR szNoProxyFor[MAX_PATH]
Definition: settings.h:21
#define malloc
Definition: debug_ros.c:4
#define SECURITY_FLAG_SECURE
Definition: winhttp.h:285
#define LVS_NOSORTHEADER
Definition: commctrl.h:2285
static HBITMAP
Definition: button.c:44
#define COLOR_3DDKSHADOW
Definition: winuser.h:933
#define ICU_DECODE
Definition: winhttp.h:291
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define WM_ERASEBKGND
Definition: winuser.h:1615
VOID AddRow(INT RowIndex, LPCWSTR szAppName, const DownloadStatus Status)
Definition: loaddlg.cpp:304
ATL::CSimpleArray< DownloadInfo > AppInfo
Definition: loaddlg.cpp:111
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
BOOL DownloadApplication(CAvailableApplicationInfo *pAppInfo)
Definition: loaddlg.cpp:1061
#define LVIF_STATE
Definition: commctrl.h:2312
LONG_PTR LRESULT
Definition: windef.h:209
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define INFINITE
Definition: serial.h:102
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:979
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define memset(x, y, z)
Definition: compat.h:39
BOOL AddColumn(INT Index, INT Width, INT Format)
Definition: loaddlg.cpp:312
static BOOL bModal
Definition: loaddlg.cpp:384
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
#define GetClassLongPtrW
Definition: winuser.h:4554
#define SRCCOPY
Definition: wingdi.h:333
HDC hdcMem
Definition: welcome.c:104
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50
#define ICON_BIG
Definition: tnclass.cpp:51
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
static CDownloaderProgress ProgressBar
Definition: loaddlg.cpp:382
#define INTERNET_FLAG_KEEP_CONNECTION
Definition: wininet.h:72
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char * Format
Definition: acpixf.h:1216
DownloadStatus
Definition: loaddlg.cpp:66