ReactOS  0.4.15-dev-1200-gc3b3fcd
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 <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 "US\r\nLet's Encrypt\r\nLet's Encrypt Authority X3"
54 #define CERT_SUBJECT_INFO "rapps.reactos.org"
55 #endif
56 
57 
59 {
63 };
64 
66 {
73 };
74 
76 {
77  ATL::CStringW szString;
78  szString.LoadStringW(StatusParam);
79  return szString;
80 }
81 
83 {
87  , szUrl(AppInfo.m_szUrlDownload)
88  , szName(AppInfo.m_szName)
89  , szSHA1(AppInfo.m_szSHA1)
90  , SizeInBytes(AppInfo.m_SizeBytes)
91  {
92  }
93 
99 };
100 
102 {
105  : Dialog(dlg), AppInfo(info), szCaption(caption)
106  {
107  }
108 
112 };
113 
114 
116  : public CWindowImpl<CDownloaderProgress, CWindow, CControlWinTraits>
117 {
119 
120 public:
122  {
123  }
124 
126  {
127  if (Enable)
128  ModifyStyle(0, PBS_MARQUEE, 0);
129  else
130  ModifyStyle(PBS_MARQUEE, 0, 0);
131 
133  }
134 
135  VOID SetProgress(ULONG ulProgress, ULONG ulProgressMax)
136  {
137  WCHAR szProgress[100];
138 
139  /* format the bits and bytes into pretty and accessible units... */
141 
142  /* use our subclassed progress bar text subroutine */
143  ATL::CStringW ProgressText;
144 
145  if (ulProgressMax)
146  {
147  /* total size is known */
148  WCHAR szProgressMax[100];
149  UINT uiPercentage = ((ULONGLONG) ulProgress * 100) / ulProgressMax;
150 
151  /* send the current progress to the progress bar */
152  if (!IsWindow()) return;
153  SendMessage(PBM_SETPOS, uiPercentage, 0);
154 
155  /* format total download size */
156  StrFormatByteSizeW(ulProgressMax, szProgressMax, _countof(szProgressMax));
157 
158  /* generate the text on progress bar */
159  ProgressText.Format(L"%u%% \x2014 %ls / %ls",
160  uiPercentage,
161  szProgress,
162  szProgressMax);
163  }
164  else
165  {
166  /* send the current progress to the progress bar */
167  if (!IsWindow()) return;
168  SendMessage(PBM_SETPOS, 0, 0);
169 
170  /* total size is not known, display only current size */
171  ProgressText.Format(L"%ls...", szProgress);
172  }
173 
174  /* and finally display it */
175  if (!IsWindow()) return;
176  SendMessage(WM_SETTEXT, 0, (LPARAM) ProgressText.GetString());
177  }
178 
180  {
181  PAINTSTRUCT ps;
182  HDC hDC = BeginPaint(&ps), hdcMem;
183  HBITMAP hbmMem;
184  HANDLE hOld;
185  RECT myRect;
186  UINT win_width, win_height;
187 
188  GetClientRect(&myRect);
189 
190  /* grab the progress bar rect size */
191  win_width = myRect.right - myRect.left;
192  win_height = myRect.bottom - myRect.top;
193 
194  /* create an off-screen DC for double-buffering */
196  hbmMem = CreateCompatibleBitmap(hDC, win_width, win_height);
197 
198  hOld = SelectObject(hdcMem, hbmMem);
199 
200  /* call the original draw code and redirect it to our memory buffer */
201  DefWindowProc(uMsg, (WPARAM) hdcMem, lParam);
202 
203  /* draw our nifty progress text over it */
206  &myRect,
210  1, 1);
211 
212  /* transfer the off-screen DC to the screen */
213  BitBlt(hDC, 0, 0, win_width, win_height, hdcMem, 0, 0, SRCCOPY);
214 
215  /* free the off-screen DC */
216  SelectObject(hdcMem, hOld);
217  DeleteObject(hbmMem);
218  DeleteDC(hdcMem);
219 
220  EndPaint(&ps);
221  return 0;
222  }
223 
225  {
226  if (lParam)
227  {
229  }
230  return 0;
231  }
232 
237  END_MSG_MAP()
238 };
239 
241  : public CListView
242 {
243 public:
245  {
246  RECT r = {10, 150, 320, 350};
249 
251 
252  AddColumn(0, 150, LVCFMT_LEFT);
253  AddColumn(1, 120, LVCFMT_LEFT);
254 
255  return hwnd;
256  }
257 
259  {
260  for (INT i = 0; i < arrInfo.GetSize(); ++i)
261  {
262  AddRow(i, arrInfo[i].szName.GetString(), DLSTATUS_WAITING);
263  }
264  }
265 
267  {
269  SetItemText(ItemIndex, 1, szBuffer.GetString());
270  }
271 
272  BOOL AddItem(INT ItemIndex, LPWSTR lpText)
273  {
274  LVITEMW Item;
275 
276  ZeroMemory(&Item, sizeof(Item));
277 
278  Item.mask = LVIF_TEXT | LVIF_STATE;
279  Item.pszText = lpText;
280  Item.iItem = ItemIndex;
281 
282  return InsertItem(&Item);
283  }
284 
286  {
288  AddItem(RowIndex,
289  const_cast<LPWSTR>(szAppName));
290  SetDownloadStatus(RowIndex, Status);
291  }
292 
294  {
295  LVCOLUMNW Column;
296  ZeroMemory(&Column, sizeof(Column));
297 
298  Column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
299  Column.iSubItem = Index;
300  Column.cx = Width;
301  Column.fmt = Format;
302 
303  return (InsertColumn(Index, &Column) == -1) ? FALSE : TRUE;
304  }
305 };
306 
307 #ifdef USE_CERT_PINNING
308 static BOOL CertGetSubjectAndIssuer(HINTERNET hFile, CLocalPtr<char>& subjectInfo, CLocalPtr<char>& issuerInfo)
309 {
310  DWORD certInfoLength;
312  DWORD size, flags;
313 
314  size = sizeof(flags);
316  {
317  return FALSE;
318  }
319 
321  {
322  return FALSE;
323  }
324 
325  /* Despite what the header indicates, the implementation of INTERNET_CERTIFICATE_INFO is not Unicode-aware. */
326  certInfoLength = sizeof(certInfo);
329  &certInfo,
330  &certInfoLength))
331  {
332  return FALSE;
333  }
334 
335  subjectInfo.Attach(certInfo.lpszSubjectInfo);
336  issuerInfo.Attach(certInfo.lpszIssuerInfo);
337 
338  if (certInfo.lpszProtocolName)
339  LocalFree(certInfo.lpszProtocolName);
340  if (certInfo.lpszSignatureAlgName)
342  if (certInfo.lpszEncryptionAlgName)
344 
345  return certInfo.lpszSubjectInfo && certInfo.lpszIssuerInfo;
346 }
347 #endif
348 
350 {
351  ATL::CStringW szMsgText;
352  if (szMsgText.LoadStringW(StringID))
353  {
355  }
356 }
357 
358 // Download dialog (loaddlg.cpp)
360 {
364  static BOOL bCancelled;
365  static BOOL bModal;
366  static VOID UpdateProgress(HWND hDlg, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText);
367 public:
368  static VOID Add(DownloadInfo info);
369  static VOID Download(const DownloadInfo& DLInfo, BOOL bIsModal = FALSE);
371  static unsigned int WINAPI ThreadFunc(LPVOID Context);
373 };
374 
375 
376 // CDownloadManager
382 
384 {
386 }
387 
389 {
391  AppsDownloadList.Add(DLInfo);
392  LaunchDownloadDialog(bIsModal);
393 }
394 
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 }
484 
486 
488  HWND hDlg,
489  ULONG ulProgress,
490  ULONG ulProgressMax,
491  ULONG ulStatusCode,
492  LPCWSTR szStatusText)
493 {
494  HWND Item;
495 
496  if (!IsWindow(hDlg)) return;
497  ProgressBar.SetProgress(ulProgress, ulProgressMax);
498 
499  if (!IsWindow(hDlg)) return;
500  Item = GetDlgItem(hDlg, IDC_DOWNLOAD_STATUS);
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 }
524 
526  HWND hWndOwner,
527  DWORD dwLastError)
528 {
529  CLocalPtr<WCHAR> lpMsg;
530 
534  NULL,
535  dwLastError,
537  (LPWSTR)&lpMsg,
538  0, NULL))
539  {
540  return;
541  }
542 
543  MessageBoxW(hWndOwner, lpMsg, NULL, MB_OK | MB_ICONERROR);
544 }
545 
547 {
549  PWSTR p, q;
550 
551  HWND hDlg = static_cast<DownloadParam*>(param)->Dialog;
552  HWND Item;
553  INT iAppId;
554 
555  ULONG dwContentLen, dwBytesWritten, dwBytesRead, dwStatus;
556  ULONG dwCurrentBytesRead = 0;
557  ULONG dwStatusLen = sizeof(dwStatus);
558 
559  BOOL bTempfile = FALSE;
560 
561  HINTERNET hOpen = NULL;
562  HINTERNET hFile = NULL;
564 
565  unsigned char lpBuffer[4096];
566  LPCWSTR lpszAgent = L"RApps/1.1";
567  URL_COMPONENTSW urlComponents;
568  size_t urlLength, filenameLength;
569 
570  const ATL::CSimpleArray<DownloadInfo> &InfoArray = static_cast<DownloadParam*>(param)->AppInfo;
571  LPCWSTR szCaption = static_cast<DownloadParam*>(param)->szCaption;
572  ATL::CStringW szNewCaption;
573 
575 
576  if (InfoArray.GetSize() <= 0)
577  {
579  goto end;
580  }
581 
582  for (iAppId = 0; iAppId < InfoArray.GetSize(); ++iAppId)
583  {
584  // Reset progress bar
585  if (!IsWindow(hDlg)) break;
586  Item = GetDlgItem(hDlg, IDC_DOWNLOAD_PROGRESS);
587  if (Item)
588  {
592  }
593 
594  // is this URL an update package for RAPPS? if so store it in a different place
595  if (InfoArray[iAppId].DLType != DLTYPE_APPLICATION)
596  {
598  {
600  goto end;
601  }
602  }
603  else
604  {
606  }
607 
608  // Change caption to show the currently downloaded app
609  switch(InfoArray[iAppId].DLType)
610  {
611  case DLTYPE_APPLICATION:
612  szNewCaption.Format(szCaption, InfoArray[iAppId].szName.GetString());
613  break;
614  case DLTYPE_DBUPDATE:
615  szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_DOWNLOAD_DISP);
616  break;
618  szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP);
619  break;
620  }
621 
622  if (!IsWindow(hDlg)) goto end;
623  SetWindowTextW(hDlg, szNewCaption.GetString());
624 
625  // build the path for the download
626  p = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'/');
627  q = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'?');
628 
629  // do we have a final slash separator?
630  if (!p)
631  {
633  goto end;
634  }
635 
636  // prepare the tentative length of the filename, maybe we've to remove part of it later on
637  filenameLength = wcslen(p) * sizeof(WCHAR);
638 
639  /* do we have query arguments in the target URL after the filename? account for them
640  (e.g. https://example.org/myfile.exe?no_adware_plz) */
641  if (q && q > p && (q - p) > 0)
642  filenameLength -= wcslen(q - 1) * sizeof(WCHAR);
643 
644  // is the path valid? can we access it?
645  if (GetFileAttributesW(Path.GetString()) == INVALID_FILE_ATTRIBUTES)
646  {
647  if (!CreateDirectoryW(Path.GetString(), NULL))
648  {
650  goto end;
651  }
652  }
653 
654  // append a \ to the provided file system path, and the filename portion from the URL after that
655 
656  PathAddBackslashW(Path.GetBuffer(MAX_PATH));
657  switch (InfoArray[iAppId].DLType)
658  {
659  case DLTYPE_DBUPDATE:
662  break;
663  case DLTYPE_APPLICATION:
664  PathAppendW(Path.GetBuffer(), (LPWSTR)(p + 1)); // use the filename retrieved from URL
665  break;
666  }
667  Path.ReleaseBuffer();
668 
669  if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] && GetFileAttributesW(Path.GetString()) != INVALID_FILE_ATTRIBUTES)
670  {
671  // only open it in case of total correctness
672  if (VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path))
673  goto run;
674  }
675 
676  // Add the download URL
677  if (!IsWindow(hDlg)) goto end;
678  SetDlgItemTextW(hDlg, IDC_DOWNLOAD_STATUS, InfoArray[iAppId].szUrl.GetString());
679 
681 
682  // download it
684  bTempfile = TRUE;
685 
686  /* FIXME: this should just be using the system-wide proxy settings */
687  switch (SettingsInfo.Proxy)
688  {
689  case 0: // preconfig
690  default:
691  hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
692  break;
693  case 1: // direct (no proxy)
694  hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
695  break;
696  case 2: // use proxy
698  break;
699  }
700 
701  if (!hOpen)
702  {
704  goto end;
705  }
706 
707  dwStatusLen = sizeof(dwStatus);
708 
709  memset(&urlComponents, 0, sizeof(urlComponents));
710  urlComponents.dwStructSize = sizeof(urlComponents);
711 
712  urlLength = InfoArray[iAppId].szUrl.GetLength();
713  urlComponents.dwSchemeLength = urlLength + 1;
714  urlComponents.lpszScheme = (LPWSTR) malloc(urlComponents.dwSchemeLength * sizeof(WCHAR));
715 
716  if (!InternetCrackUrlW(InfoArray[iAppId].szUrl, urlLength + 1, ICU_DECODE | ICU_ESCAPE, &urlComponents))
717  {
719  goto end;
720  }
721 
722  dwContentLen = 0;
723 
724  if (urlComponents.nScheme == INTERNET_SCHEME_HTTP ||
725  urlComponents.nScheme == INTERNET_SCHEME_HTTPS)
726  {
727  hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl.GetString(), NULL, 0,
728  dwUrlConnectFlags,
729  0);
730  if (!hFile)
731  {
733  goto end;
734  }
735 
736  // query connection
738  {
740  goto end;
741  }
742 
743  if (dwStatus != HTTP_STATUS_OK)
744  {
746  goto end;
747  }
748 
749  // query content length
751  }
752  else if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
753  {
754  // force passive mode on FTP
755  hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl, NULL, 0,
756  dwUrlConnectFlags | INTERNET_FLAG_PASSIVE,
757  0);
758  if (!hFile)
759  {
761  goto end;
762  }
763 
764  dwContentLen = FtpGetFileSize(hFile, &dwStatus);
765  }
766  else if (urlComponents.nScheme == INTERNET_SCHEME_FILE)
767  {
768  // Add support for the file scheme so testing locally is simpler
769  WCHAR LocalFilePath[MAX_PATH];
770  DWORD cchPath = _countof(LocalFilePath);
771  // Ideally we would use PathCreateFromUrlAlloc here, but that is not exported (yet)
772  HRESULT hr = PathCreateFromUrlW(InfoArray[iAppId].szUrl, LocalFilePath, &cchPath, 0);
773  if (SUCCEEDED(hr))
774  {
775  if (CopyFileW(LocalFilePath, Path, FALSE))
776  {
777  goto run;
778  }
779  else
780  {
782  goto end;
783  }
784  }
785  else
786  {
788  goto end;
789  }
790  }
791 
792  if (!dwContentLen)
793  {
794  // Someone was nice enough to add this, let's use it
795  if (InfoArray[iAppId].SizeInBytes)
796  {
797  dwContentLen = InfoArray[iAppId].SizeInBytes;
798  }
799  else
800  {
801  // content-length is not known, enable marquee mode
803  }
804  }
805 
806  free(urlComponents.lpszScheme);
807 
808 #ifdef USE_CERT_PINNING
809  // are we using HTTPS to download the RAPPS update package? check if the certificate is original
810  if ((urlComponents.nScheme == INTERNET_SCHEME_HTTPS) &&
811  (InfoArray[iAppId].DLType == DLTYPE_DBUPDATE))
812  {
813  CLocalPtr<char> subjectName, issuerName;
814  CStringA szMsgText;
815  bool bAskQuestion = false;
816  if (!CertGetSubjectAndIssuer(hFile, subjectName, issuerName))
817  {
818  szMsgText.LoadStringW(IDS_UNABLE_TO_QUERY_CERT);
819  bAskQuestion = true;
820  }
821  else
822  {
823  if (strcmp(subjectName, CERT_SUBJECT_INFO) ||
824  strcmp(issuerName, CERT_ISSUER_INFO))
825  {
826  szMsgText.Format(IDS_MISMATCH_CERT_INFO, (char*)subjectName, (const char*)issuerName);
827  bAskQuestion = true;
828  }
829  }
830 
831  if (bAskQuestion)
832  {
833  if (MessageBoxA(hMainWnd, szMsgText.GetString(), NULL, MB_YESNO | MB_ICONERROR) != IDYES)
834  {
835  goto end;
836  }
837  }
838  }
839 #endif
840 
842 
843  if (hOut == INVALID_HANDLE_VALUE)
844  {
846  goto end;
847  }
848 
849  dwCurrentBytesRead = 0;
850  do
851  {
852  if (!InternetReadFile(hFile, lpBuffer, _countof(lpBuffer), &dwBytesRead))
853  {
855  goto end;
856  }
857 
858  if (!WriteFile(hOut, &lpBuffer[0], dwBytesRead, &dwBytesWritten, NULL))
859  {
861  goto end;
862  }
863 
864  dwCurrentBytesRead += dwBytesRead;
865  if (!IsWindow(hDlg)) goto end;
866  UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
867  } while (dwBytesRead && !bCancelled);
868 
869  CloseHandle(hOut);
870  hOut = INVALID_HANDLE_VALUE;
871 
872  if (bCancelled)
873  {
874  DPRINT1("Operation cancelled\n");
875  goto end;
876  }
877 
878  if (!dwContentLen)
879  {
880  // set progress bar to 100%
882 
883  dwContentLen = dwCurrentBytesRead;
884  if (!IsWindow(hDlg)) goto end;
885  UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
886  }
887 
888  /* if this thing isn't a RAPPS update and it has a SHA-1 checksum
889  verify its integrity by using the native advapi32.A_SHA1 functions */
890  if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] != 0)
891  {
892  ATL::CStringW szMsgText;
893 
894  // change a few strings in the download dialog to reflect the verification process
895  if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_TITLE))
896  {
897  DPRINT1("Unable to load string\n");
898  goto end;
899  }
900 
901  if (!IsWindow(hDlg)) goto end;
902  SetWindowTextW(hDlg, szMsgText.GetString());
904 
905  // this may take a while, depending on the file size
906  if (!VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path.GetString()))
907  {
908  if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_FAIL))
909  {
910  DPRINT1("Unable to load string\n");
911  goto end;
912  }
913 
914  if (!IsWindow(hDlg)) goto end;
915  MessageBoxW(hDlg, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
916  goto end;
917  }
918  }
919 
920 run:
922 
923  // run it
924  if (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)
925  {
926  SHELLEXECUTEINFOW shExInfo = {0};
927  shExInfo.cbSize = sizeof(shExInfo);
928  shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
929  shExInfo.lpVerb = L"open";
930  shExInfo.lpFile = Path.GetString();
931  shExInfo.lpParameters = L"";
932  shExInfo.nShow = SW_SHOW;
933 
934  if (ShellExecuteExW(&shExInfo))
935  {
936  //reflect installation progress in the titlebar
937  //TODO: make a separate string with a placeholder to include app name?
939  if (!IsWindow(hDlg)) goto end;
940  SetWindowTextW(hDlg, szMsgText.GetString());
941 
943 
944  //TODO: issue an install operation separately so that the apps could be downloaded in the background
946  CloseHandle(shExInfo.hProcess);
947  }
948  else
949  {
951  }
952  }
953 
954 end:
955  if (hOut != INVALID_HANDLE_VALUE)
956  CloseHandle(hOut);
957 
958  if (hFile)
960  InternetCloseHandle(hOpen);
961 
962  if (bTempfile)
963  {
964  if (bCancelled || (SettingsInfo.bDelInstaller && (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)))
965  DeleteFileW(Path.GetString());
966  }
967 
968  if (!IsWindow(hDlg)) return 0;
970  }
971 
972  delete static_cast<DownloadParam*>(param);
973  if (!IsWindow(hDlg)) return 0;
974  SendMessageW(hDlg, WM_CLOSE, 0, 0);
975  return 0;
976 }
977 
978 //TODO: Reuse the dialog
980 {
981  CDownloadManager::bModal = bIsModal;
982  if (bIsModal)
983  {
986  hMainWnd,
988  }
989  else
990  {
993  hMainWnd,
995  }
996 }
997 // CDownloadManager
998 
999 
1001 {
1002  if (AppsList.GetSize() == 0)
1003  return FALSE;
1004 
1005  // Initialize shared variables
1006  for (INT i = 0; i < AppsList.GetSize(); ++i)
1007  {
1008  CDownloadManager::Add(AppsList[i]); // implicit conversion to DownloadInfo
1009  }
1010 
1011  // Create a dialog and issue a download process
1013 
1014  return TRUE;
1015 }
1016 
1018 {
1019  if (!pAppInfo)
1020  return FALSE;
1021 
1022  CDownloadManager::Download(*pAppInfo, bIsModal);
1023  return TRUE;
1024 }
1025 
1027 {
1028  static DownloadInfo DatabaseDLInfo;
1029  DatabaseDLInfo.szUrl = lpUrl;
1030  DatabaseDLInfo.szName.LoadStringW(IDS_DL_DIALOG_DB_DISP);
1031  DatabaseDLInfo.DLType = IsOfficial ? DLTYPE_DBUPDATE : DLTYPE_DBUPDATE_UNOFFICIAL;
1032  CDownloadManager::Download(DatabaseDLInfo, TRUE);
1033 }
1034 
#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
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
const uint16_t * PCWSTR
Definition: typedefs.h:57
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
DownloadType
Definition: loaddlg.cpp:58
static HICON
Definition: imagelist.c:84
#define CloseHandle
Definition: compat.h:598
BOOL DownloadApplication(CAvailableApplicationInfo *pAppInfo, BOOL bIsModal)
Definition: loaddlg.cpp:1017
#define IDS_STATUS_INSTALLED
Definition: resource.h:194
#define PBS_MARQUEE
Definition: commctrl.h:2194
#define LVCF_WIDTH
Definition: commctrl.h:2583
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:217
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:388
#define LVS_NOCOLUMNHEADER
Definition: commctrl.h:2280
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:2263
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define PBM_SETMARQUEE
Definition: commctrl.h:2195
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#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
#define LVS_REPORT
Definition: commctrl.h:2258
static BOOL bCancelled
Definition: loaddlg.cpp:364
#define free
Definition: debug_ros.c:5
static unsigned int WINAPI ThreadFunc(LPVOID Context)
Definition: loaddlg.cpp:546
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
#define IDS_MISMATCH_CERT_INFO
Definition: resource.h:120
#define INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT
Definition: wininet.h:726
_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:879
LONG top
Definition: windef.h:307
LPCWSTR szCaption
Definition: loaddlg.cpp:111
#define INTERNET_OPEN_TYPE_PROXY
Definition: wininet.h:523
#define LVCFMT_LEFT
Definition: commctrl.h:2594
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
static VOID LaunchDownloadDialog(BOOL)
Definition: loaddlg.cpp:979
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define COLOR_CAPTIONTEXT
Definition: winuser.h:912
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define ZeroMemory
Definition: winbase.h:1648
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
VOID SetProgress(ULONG ulProgress, ULONG ulProgressMax)
Definition: loaddlg.cpp:135
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:716
#define PBM_SETPOS
Definition: commctrl.h:2180
static ATL::CSimpleArray< DownloadInfo > AppsDownloadList
Definition: loaddlg.cpp:361
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1436
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI InternetCanonicalizeUrlW(LPCWSTR lpszUrl, LPWSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
Definition: internet.c:2026
#define IDS_STATUS_DOWNLOADING
Definition: resource.h:198
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT_PTR WPARAM
Definition: windef.h:207
GLuint GLuint end
Definition: gl.h:1545
void EndPaint(LPPAINTSTRUCT lpPaint)
Definition: atlwin.h:495
#define WS_CHILD
Definition: pedump.c:617
#define IDS_STATUS_INSTALLING
Definition: resource.h:199
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)
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
VOID ShowLastError(HWND hWndOwner, DWORD dwLastError)
Definition: loaddlg.cpp:525
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:85
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:1522
#define FILE_SHARE_READ
Definition: compat.h:136
#define COLOR_3DSHADOW
Definition: winuser.h:921
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:121
#define ICON_SMALL
Definition: tnclass.cpp:48
#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:2305
#define LVCF_SUBITEM
Definition: commctrl.h:2585
ATL::CStringW szSHA1
Definition: loaddlg.cpp:97
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)
#define PBM_SETRANGE
Definition: commctrl.h:2179
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:104
DownloadType DLType
Definition: loaddlg.cpp:94
VOID MessageBox_LoadString(HWND hMainWnd, INT StringID)
Definition: loaddlg.cpp:349
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
BOOL SubclassWindow(HWND hWnd)
Definition: atlwin.h:1483
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:1754
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:289
unsigned int BOOL
Definition: ntddk_ex.h:94
ATL::CStringW szUrl
Definition: loaddlg.cpp:95
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define GENERIC_WRITE
Definition: nt_native.h:90
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:507
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
#define IDS_INTEG_CHECK_FAIL
Definition: resource.h:113
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
#define GWLP_USERDATA
Definition: treelist.c:63
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
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
LONG_PTR LPARAM
Definition: windef.h:208
static const WCHAR szProgress[]
Definition: dialog.c:138
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2607
static CDowloadingAppsListView DownloadsListView
Definition: loaddlg.cpp:362
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2263
ULONG SizeInBytes
Definition: loaddlg.cpp:98
BOOL UrlHasBeenCopied
Definition: loaddlg.cpp:485
#define DT_VCENTER
Definition: winuser.h:543
#define SW_SHOW
Definition: winuser.h:769
#define WM_SETTEXT
Definition: winuser.h:1599
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
VOID LoadList(ATL::CSimpleArray< DownloadInfo > arrInfo)
Definition: loaddlg.cpp:258
#define IDS_STATUS_FINISHED
Definition: resource.h:201
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4374
#define ICU_ESCAPE
Definition: winhttp.h:48
VOID SetDownloadStatus(INT ItemIndex, DownloadStatus Status)
Definition: loaddlg.cpp:266
#define GCLP_HICONSM
Definition: winuser.h:670
GLsizeiptr size
Definition: glext.h:5919
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)
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
#define END_MSG_MAP()
Definition: atlwin.h:1799
uint64_t ULONGLONG
Definition: typedefs.h:67
#define _countof(array)
Definition: sndvol32.h:68
static const WCHAR szStatus[]
Definition: http.c:74
#define IDS_UNABLE_TO_QUERY_CERT
Definition: resource.h:111
LPWSTR pszText
Definition: commctrl.h:2361
#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
#define WINAPI
Definition: msvc.h:6
PCXSTR GetString() const
Definition: atlsimpstr.h:361
static const UCHAR Index[8]
Definition: usbohci.c:18
#define IDS_STATUS_DOWNLOADED
Definition: resource.h:196
VOID SetMarquee(BOOL Enable)
Definition: loaddlg.cpp:125
#define LVS_SINGLESEL
Definition: commctrl.h:2262
LRESULT OnSetText(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: loaddlg.cpp:224
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:2653
BOOL GetStorageDirectory(ATL::CStringW &lpDirectory)
Definition: misc.cpp:180
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:395
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
ATL::CStringW szName
Definition: loaddlg.cpp:96
GLbitfield flags
Definition: glext.h:7161
#define DEFAULT_GUI_FONT
Definition: wingdi.h:908
#define WM_PAINT
Definition: winuser.h:1602
UINT mask
Definition: commctrl.h:2356
#define IDC_DOWNLOAD_PROGRESS
Definition: resource.h:41
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
Status
Definition: gdiplustypes.h:24
#define IDS_INTEG_CHECK_TITLE
Definition: resource.h:112
int InsertItem(const LV_ITEM *pitem)
Definition: rosctrls.h:96
static const WCHAR L[]
Definition: oid.c:1250
BOOL DownloadListOfApplications(const ATL::CSimpleArray< CAvailableApplicationInfo > &AppsList, BOOL bIsModal)
Definition: loaddlg.cpp:1000
#define GCLP_HICON
Definition: winuser.h:669
#define MB_ICONERROR
Definition: winuser.h:781
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4256
GLenum GLsizei len
Definition: glext.h:6722
VOID DownloadApplicationsDB(LPCWSTR lpUrl, BOOL IsOfficial)
Definition: loaddlg.cpp:1026
#define WM_COMMAND
Definition: winuser.h:1722
#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 SelectFont(hdc, hfont)
Definition: windowsx.h:491
#define HTTP_QUERY_STATUS_CODE
Definition: wininet.h:1542
TCHAR szAppName[128]
Definition: solitaire.cpp:16
LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: loaddlg.cpp:179
#define IDS_STATUS_WAITING
Definition: resource.h:200
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:401
static HDC hDC
Definition: 3dtext.c:33
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int Replace(PCXSTR pszOld, PCXSTR pszNew)
Definition: cstringt.h:774
#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:2582
#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
#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:244
BOOL ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
Definition: atlwin.h:940
BOOL AddItem(INT ItemIndex, LPWSTR lpText)
Definition: loaddlg.cpp:272
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:2174
ATL::CStringW m_szProgressText
Definition: loaddlg.cpp:118
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: window.h:371
#define SetWindowText
Definition: winuser.h:5832
unsigned int UINT
Definition: ndis.h:50
#define MB_OK
Definition: winuser.h:784
#define HTTP_QUERY_FLAG_NUMBER
Definition: wininet.h:1606
BOOL bDelInstaller
Definition: settings.h:11
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1780
#define DPRINT1
Definition: precomp.h:8
#define CreateFileW
Definition: compat.h:600
Definition: misc.h:63
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1808
static VOID Add(DownloadInfo info)
Definition: loaddlg.cpp:383
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
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
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
HICON hIconSm
Definition: msconfig.c:44
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
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:2281
#define SetWindowLongPtrW
Definition: winuser.h:5321
static HBITMAP
Definition: button.c:44
#define ICU_DECODE
Definition: winhttp.h:291
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define WM_ERASEBKGND
Definition: winuser.h:1607
VOID AddRow(INT RowIndex, LPCWSTR szAppName, const DownloadStatus Status)
Definition: loaddlg.cpp:285
ATL::CSimpleArray< DownloadInfo > AppInfo
Definition: loaddlg.cpp:110
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define LVIF_STATE
Definition: commctrl.h:2308
LONG_PTR LRESULT
Definition: windef.h:209
#define INFINITE
Definition: serial.h:102
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1001
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:293
static BOOL bModal
Definition: loaddlg.cpp:365
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define GetClassLongPtrW
Definition: winuser.h:4539
#define SRCCOPY
Definition: wingdi.h:332
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 SUCCEEDED(hr)
Definition: intsafe.h:49
#define ICON_BIG
Definition: tnclass.cpp:51
static CDownloaderProgress ProgressBar
Definition: loaddlg.cpp:363
#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:65