ReactOS  0.4.15-dev-4603-gb922b6d
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  SendMessage(WM_SETTEXT, 0, (LPARAM) ProgressText.GetString());
178  }
179 
181  {
182  PAINTSTRUCT ps;
183  HDC hDC = BeginPaint(&ps), hdcMem;
184  HBITMAP hbmMem;
185  HANDLE hOld;
186  RECT myRect;
187  UINT win_width, win_height;
188 
189  GetClientRect(&myRect);
190 
191  /* grab the progress bar rect size */
192  win_width = myRect.right - myRect.left;
193  win_height = myRect.bottom - myRect.top;
194 
195  /* create an off-screen DC for double-buffering */
197  hbmMem = CreateCompatibleBitmap(hDC, win_width, win_height);
198 
199  hOld = SelectObject(hdcMem, hbmMem);
200 
201  /* call the original draw code and redirect it to our memory buffer */
202  DefWindowProc(uMsg, (WPARAM) hdcMem, lParam);
203 
204  /* draw our nifty progress text over it */
207  &myRect,
211  1, 1);
212 
213  /* transfer the off-screen DC to the screen */
214  BitBlt(hDC, 0, 0, win_width, win_height, hdcMem, 0, 0, SRCCOPY);
215 
216  /* free the off-screen DC */
217  SelectObject(hdcMem, hOld);
218  DeleteObject(hbmMem);
219  DeleteDC(hdcMem);
220 
221  EndPaint(&ps);
222  return 0;
223  }
224 
226  {
227  if (lParam)
228  {
230  }
231  return 0;
232  }
233 
238  END_MSG_MAP()
239 };
240 
242  : public CListView
243 {
244 public:
246  {
247  RECT r = {10, 150, 320, 350};
250 
252 
253  AddColumn(0, 150, LVCFMT_LEFT);
254  AddColumn(1, 120, LVCFMT_LEFT);
255 
256  return hwnd;
257  }
258 
260  {
261  for (INT i = 0; i < arrInfo.GetSize(); ++i)
262  {
263  AddRow(i, arrInfo[i].szName.GetString(), DLSTATUS_WAITING);
264  }
265  }
266 
268  {
270  SetItemText(ItemIndex, 1, szBuffer.GetString());
271  }
272 
273  BOOL AddItem(INT ItemIndex, LPWSTR lpText)
274  {
275  LVITEMW Item;
276 
277  ZeroMemory(&Item, sizeof(Item));
278 
279  Item.mask = LVIF_TEXT | LVIF_STATE;
280  Item.pszText = lpText;
281  Item.iItem = ItemIndex;
282 
283  return InsertItem(&Item);
284  }
285 
287  {
289  AddItem(RowIndex,
290  const_cast<LPWSTR>(szAppName));
291  SetDownloadStatus(RowIndex, Status);
292  }
293 
295  {
296  LVCOLUMNW Column;
297  ZeroMemory(&Column, sizeof(Column));
298 
299  Column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
300  Column.iSubItem = Index;
301  Column.cx = Width;
302  Column.fmt = Format;
303 
304  return (InsertColumn(Index, &Column) == -1) ? FALSE : TRUE;
305  }
306 };
307 
308 #ifdef USE_CERT_PINNING
309 static BOOL CertGetSubjectAndIssuer(HINTERNET hFile, CLocalPtr<char>& subjectInfo, CLocalPtr<char>& issuerInfo)
310 {
311  DWORD certInfoLength;
313  DWORD size, flags;
314 
315  size = sizeof(flags);
317  {
318  return FALSE;
319  }
320 
322  {
323  return FALSE;
324  }
325 
326  /* Despite what the header indicates, the implementation of INTERNET_CERTIFICATE_INFO is not Unicode-aware. */
327  certInfoLength = sizeof(certInfo);
330  &certInfo,
331  &certInfoLength))
332  {
333  return FALSE;
334  }
335 
336  subjectInfo.Attach(certInfo.lpszSubjectInfo);
337  issuerInfo.Attach(certInfo.lpszIssuerInfo);
338 
339  if (certInfo.lpszProtocolName)
340  LocalFree(certInfo.lpszProtocolName);
341  if (certInfo.lpszSignatureAlgName)
343  if (certInfo.lpszEncryptionAlgName)
345 
346  return certInfo.lpszSubjectInfo && certInfo.lpszIssuerInfo;
347 }
348 #endif
349 
351 {
352  ATL::CStringW szMsgText;
353  if (szMsgText.LoadStringW(StringID))
354  {
356  }
357 }
358 
359 // Download dialog (loaddlg.cpp)
361 {
365  static BOOL bCancelled;
366  static BOOL bModal;
367  static VOID UpdateProgress(HWND hDlg, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText);
368 public:
369  static VOID Add(DownloadInfo info);
370  static VOID Download(const DownloadInfo& DLInfo, BOOL bIsModal = FALSE);
372  static unsigned int WINAPI ThreadFunc(LPVOID Context);
374 };
375 
376 
377 // CDownloadManager
383 
385 {
387 }
388 
390 {
392  AppsDownloadList.Add(DLInfo);
393  LaunchDownloadDialog(bIsModal);
394 }
395 
397 {
398  static WCHAR szCaption[MAX_PATH];
399 
400  switch (uMsg)
401  {
402  case WM_INITDIALOG:
403  {
404  HICON hIconSm, hIconBg;
405  ATL::CStringW szTempCaption;
406 
407  bCancelled = FALSE;
408 
409  if (hMainWnd)
410  {
413  }
414  if (!hMainWnd || (!hIconBg || !hIconSm))
415  {
416  /* Load the default icon */
418  }
419 
420  if (hIconBg && hIconSm)
421  {
422  SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM)hIconBg);
423  SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
424  }
425 
427  if (Item)
428  {
429  // initialize the default values for our nifty progress bar
430  // and subclass it so that it learns to print a status text
434  }
435 
436  // Add a ListView
437  HWND hListView = DownloadsListView.Create(Dlg);
438  if (!hListView)
439  {
440  return FALSE;
441  }
443 
444  // Get a dlg string for later use
445  GetWindowTextW(Dlg, szCaption, _countof(szCaption));
446 
447  // Hide a placeholder from displaying
448  szTempCaption = szCaption;
449  szTempCaption.Replace(L"%ls", L"");
450  SetWindowText(Dlg, szTempCaption.GetString());
451 
452  ShowWindow(Dlg, SW_SHOW);
453 
454  // Start download process
455  DownloadParam *param = new DownloadParam(Dlg, AppsDownloadList, szCaption);
456  unsigned int ThreadId;
457  HANDLE Thread = (HANDLE)_beginthreadex(NULL, 0, ThreadFunc, (void *) param, 0, &ThreadId);
458  if (!Thread)
459  {
460  return FALSE;
461  }
462 
465  return TRUE;
466  }
467 
468  case WM_COMMAND:
469  if (wParam == IDCANCEL)
470  {
471  bCancelled = TRUE;
472  PostMessageW(Dlg, WM_CLOSE, 0, 0);
473  }
474  return FALSE;
475 
476  case WM_CLOSE:
478  {
479  ::EndDialog(Dlg, 0);
480  }
481  else
482  {
483  ::DestroyWindow(Dlg);
484  }
485  return TRUE;
486 
487  default:
488  return FALSE;
489  }
490 }
491 
493 
495  HWND hDlg,
496  ULONG ulProgress,
497  ULONG ulProgressMax,
498  ULONG ulStatusCode,
499  LPCWSTR szStatusText)
500 {
501  HWND Item;
502 
503  if (!IsWindow(hDlg)) return;
504  ProgressBar.SetProgress(ulProgress, ulProgressMax);
505 
506  if (!IsWindow(hDlg)) return;
508  if (Item && szStatusText && wcslen(szStatusText) > 0 && UrlHasBeenCopied == FALSE)
509  {
510  SIZE_T len = wcslen(szStatusText) + 1;
512  DWORD dummyLen;
513 
514  /* beautify our url for display purposes */
515  if (!InternetCanonicalizeUrlW(szStatusText, buf.GetBuffer(len), &dummyLen, ICU_DECODE | ICU_NO_ENCODE))
516  {
517  /* just use the original */
518  buf.ReleaseBuffer();
519  buf = szStatusText;
520  }
521  else
522  {
523  buf.ReleaseBuffer();
524  }
525 
526  /* paste it into our dialog and don't do it again in this instance */
527  SendMessageW(Item, WM_SETTEXT, 0, (LPARAM) buf.GetString());
529  }
530 }
531 
533  HWND hWndOwner,
534  BOOL bInetError,
535  DWORD dwLastError)
536 {
537  CLocalPtr<WCHAR> lpMsg;
538 
542  (bInetError ? GetModuleHandleW(L"wininet.dll") : NULL),
543  dwLastError,
545  (LPWSTR)&lpMsg,
546  0, NULL))
547  {
548  DPRINT1("FormatMessageW unexpected failure (err %d)\n", GetLastError());
549  return FALSE;
550  }
551 
552  MessageBoxW(hWndOwner, lpMsg, NULL, MB_OK | MB_ICONERROR);
553  return TRUE;
554 }
555 
557 {
559  PWSTR p, q;
560 
561  HWND hDlg = static_cast<DownloadParam*>(param)->Dialog;
562  HWND Item;
563  INT iAppId;
564 
565  ULONG dwContentLen, dwBytesWritten, dwBytesRead, dwStatus;
566  ULONG dwCurrentBytesRead = 0;
567  ULONG dwStatusLen = sizeof(dwStatus);
568 
569  BOOL bTempfile = FALSE;
570 
571  HINTERNET hOpen = NULL;
572  HINTERNET hFile = NULL;
574 
575  unsigned char lpBuffer[4096];
576  LPCWSTR lpszAgent = L"RApps/1.1";
577  URL_COMPONENTSW urlComponents;
578  size_t urlLength, filenameLength;
579 
580  const ATL::CSimpleArray<DownloadInfo> &InfoArray = static_cast<DownloadParam*>(param)->AppInfo;
581  LPCWSTR szCaption = static_cast<DownloadParam*>(param)->szCaption;
582  ATL::CStringW szNewCaption;
583 
585 
586  if (InfoArray.GetSize() <= 0)
587  {
589  goto end;
590  }
591 
592  for (iAppId = 0; iAppId < InfoArray.GetSize(); ++iAppId)
593  {
594  // Reset progress bar
595  if (!IsWindow(hDlg)) break;
597  if (Item)
598  {
602  }
603 
604  // is this URL an update package for RAPPS? if so store it in a different place
605  if (InfoArray[iAppId].DLType != DLTYPE_APPLICATION)
606  {
608  {
610  goto end;
611  }
612  }
613  else
614  {
616  }
617 
618  // Change caption to show the currently downloaded app
619  switch(InfoArray[iAppId].DLType)
620  {
621  case DLTYPE_APPLICATION:
622  szNewCaption.Format(szCaption, InfoArray[iAppId].szName.GetString());
623  break;
624  case DLTYPE_DBUPDATE:
625  szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_DOWNLOAD_DISP);
626  break;
628  szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP);
629  break;
630  }
631 
632  if (!IsWindow(hDlg)) goto end;
633  SetWindowTextW(hDlg, szNewCaption.GetString());
634 
635  // build the path for the download
636  p = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'/');
637  q = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'?');
638 
639  // do we have a final slash separator?
640  if (!p)
641  {
643  goto end;
644  }
645 
646  // prepare the tentative length of the filename, maybe we've to remove part of it later on
647  filenameLength = wcslen(p) * sizeof(WCHAR);
648 
649  /* do we have query arguments in the target URL after the filename? account for them
650  (e.g. https://example.org/myfile.exe?no_adware_plz) */
651  if (q && q > p && (q - p) > 0)
652  filenameLength -= wcslen(q - 1) * sizeof(WCHAR);
653 
654  // is the path valid? can we access it?
655  if (GetFileAttributesW(Path.GetString()) == INVALID_FILE_ATTRIBUTES)
656  {
657  if (!CreateDirectoryW(Path.GetString(), NULL))
658  {
660  goto end;
661  }
662  }
663 
664  // append a \ to the provided file system path, and the filename portion from the URL after that
665 
666  PathAddBackslashW(Path.GetBuffer(MAX_PATH));
667  switch (InfoArray[iAppId].DLType)
668  {
669  case DLTYPE_DBUPDATE:
672  break;
673  case DLTYPE_APPLICATION:
674  PathAppendW(Path.GetBuffer(), (LPWSTR)(p + 1)); // use the filename retrieved from URL
675  break;
676  }
677  Path.ReleaseBuffer();
678 
679  if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] && GetFileAttributesW(Path.GetString()) != INVALID_FILE_ATTRIBUTES)
680  {
681  // only open it in case of total correctness
682  if (VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path))
683  goto run;
684  }
685 
686  // Add the download URL
687  if (!IsWindow(hDlg)) goto end;
688  SetDlgItemTextW(hDlg, IDC_DOWNLOAD_STATUS, InfoArray[iAppId].szUrl.GetString());
689 
691 
692  // download it
694  bTempfile = TRUE;
695 
696  /* FIXME: this should just be using the system-wide proxy settings */
697  switch (SettingsInfo.Proxy)
698  {
699  case 0: // preconfig
700  default:
701  hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
702  break;
703  case 1: // direct (no proxy)
704  hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
705  break;
706  case 2: // use proxy
708  break;
709  }
710 
711  if (!hOpen)
712  {
714  goto end;
715  }
716 
717  dwStatusLen = sizeof(dwStatus);
718 
719  memset(&urlComponents, 0, sizeof(urlComponents));
720  urlComponents.dwStructSize = sizeof(urlComponents);
721 
722  urlLength = InfoArray[iAppId].szUrl.GetLength();
723  urlComponents.dwSchemeLength = urlLength + 1;
724  urlComponents.lpszScheme = (LPWSTR) malloc(urlComponents.dwSchemeLength * sizeof(WCHAR));
725 
726  if (!InternetCrackUrlW(InfoArray[iAppId].szUrl, urlLength + 1, ICU_DECODE | ICU_ESCAPE, &urlComponents))
727  {
729  goto end;
730  }
731 
732  dwContentLen = 0;
733 
734  if (urlComponents.nScheme == INTERNET_SCHEME_HTTP ||
735  urlComponents.nScheme == INTERNET_SCHEME_HTTPS)
736  {
737  hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl.GetString(), NULL, 0,
738  dwUrlConnectFlags,
739  0);
740  if (!hFile)
741  {
743  {
744  /* Workaround for CORE-17377 */
746  }
747  goto end;
748  }
749 
750  // query connection
752  {
754  goto end;
755  }
756 
757  if (dwStatus != HTTP_STATUS_OK)
758  {
760  goto end;
761  }
762 
763  // query content length
765  }
766  else if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
767  {
768  // force passive mode on FTP
769  hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl, NULL, 0,
770  dwUrlConnectFlags | INTERNET_FLAG_PASSIVE,
771  0);
772  if (!hFile)
773  {
775  {
776  /* Workaround for CORE-17377 */
778  }
779  goto end;
780  }
781 
782  dwContentLen = FtpGetFileSize(hFile, &dwStatus);
783  }
784  else if (urlComponents.nScheme == INTERNET_SCHEME_FILE)
785  {
786  // Add support for the file scheme so testing locally is simpler
787  WCHAR LocalFilePath[MAX_PATH];
788  DWORD cchPath = _countof(LocalFilePath);
789  // Ideally we would use PathCreateFromUrlAlloc here, but that is not exported (yet)
790  HRESULT hr = PathCreateFromUrlW(InfoArray[iAppId].szUrl, LocalFilePath, &cchPath, 0);
791  if (SUCCEEDED(hr))
792  {
793  if (CopyFileW(LocalFilePath, Path, FALSE))
794  {
795  goto run;
796  }
797  else
798  {
800  goto end;
801  }
802  }
803  else
804  {
806  goto end;
807  }
808  }
809 
810  if (!dwContentLen)
811  {
812  // Someone was nice enough to add this, let's use it
813  if (InfoArray[iAppId].SizeInBytes)
814  {
815  dwContentLen = InfoArray[iAppId].SizeInBytes;
816  }
817  else
818  {
819  // content-length is not known, enable marquee mode
821  }
822  }
823 
824  free(urlComponents.lpszScheme);
825 
826 #ifdef USE_CERT_PINNING
827  // are we using HTTPS to download the RAPPS update package? check if the certificate is original
828  if ((urlComponents.nScheme == INTERNET_SCHEME_HTTPS) &&
829  (InfoArray[iAppId].DLType == DLTYPE_DBUPDATE))
830  {
831  CLocalPtr<char> subjectName, issuerName;
832  CStringA szMsgText;
833  bool bAskQuestion = false;
834  if (!CertGetSubjectAndIssuer(hFile, subjectName, issuerName))
835  {
836  szMsgText.LoadStringW(IDS_UNABLE_TO_QUERY_CERT);
837  bAskQuestion = true;
838  }
839  else
840  {
841  if (strcmp(subjectName, CERT_SUBJECT_INFO) ||
842  (strcmp(issuerName, CERT_ISSUER_INFO_OLD) &&
843  strcmp(issuerName, CERT_ISSUER_INFO_NEW)))
844  {
845  szMsgText.Format(IDS_MISMATCH_CERT_INFO, (char*)subjectName, (const char*)issuerName);
846  bAskQuestion = true;
847  }
848  }
849 
850  if (bAskQuestion)
851  {
852  if (MessageBoxA(hMainWnd, szMsgText.GetString(), NULL, MB_YESNO | MB_ICONERROR) != IDYES)
853  {
854  goto end;
855  }
856  }
857  }
858 #endif
859 
861 
862  if (hOut == INVALID_HANDLE_VALUE)
863  {
865  goto end;
866  }
867 
868  dwCurrentBytesRead = 0;
869  do
870  {
871  if (!InternetReadFile(hFile, lpBuffer, _countof(lpBuffer), &dwBytesRead))
872  {
874  goto end;
875  }
876 
877  if (!WriteFile(hOut, &lpBuffer[0], dwBytesRead, &dwBytesWritten, NULL))
878  {
880  goto end;
881  }
882 
883  dwCurrentBytesRead += dwBytesRead;
884  if (!IsWindow(hDlg)) goto end;
885  UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
886  } while (dwBytesRead && !bCancelled);
887 
888  CloseHandle(hOut);
889  hOut = INVALID_HANDLE_VALUE;
890 
891  if (bCancelled)
892  {
893  DPRINT1("Operation cancelled\n");
894  goto end;
895  }
896 
897  if (!dwContentLen)
898  {
899  // set progress bar to 100%
901 
902  dwContentLen = dwCurrentBytesRead;
903  if (!IsWindow(hDlg)) goto end;
904  UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
905  }
906 
907  /* if this thing isn't a RAPPS update and it has a SHA-1 checksum
908  verify its integrity by using the native advapi32.A_SHA1 functions */
909  if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] != 0)
910  {
911  ATL::CStringW szMsgText;
912 
913  // change a few strings in the download dialog to reflect the verification process
914  if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_TITLE))
915  {
916  DPRINT1("Unable to load string\n");
917  goto end;
918  }
919 
920  if (!IsWindow(hDlg)) goto end;
921  SetWindowTextW(hDlg, szMsgText.GetString());
923 
924  // this may take a while, depending on the file size
925  if (!VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path.GetString()))
926  {
927  if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_FAIL))
928  {
929  DPRINT1("Unable to load string\n");
930  goto end;
931  }
932 
933  if (!IsWindow(hDlg)) goto end;
934  MessageBoxW(hDlg, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
935  goto end;
936  }
937  }
938 
939 run:
941 
942  // run it
943  if (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)
944  {
945  SHELLEXECUTEINFOW shExInfo = {0};
946  shExInfo.cbSize = sizeof(shExInfo);
947  shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
948  shExInfo.lpVerb = L"open";
949  shExInfo.lpFile = Path.GetString();
950  shExInfo.lpParameters = L"";
951  shExInfo.nShow = SW_SHOW;
952 
953  /* FIXME: Do we want to log installer status? */
954  WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_INSTALL, InfoArray[iAppId].szName);
955 
956  if (ShellExecuteExW(&shExInfo))
957  {
958  //reflect installation progress in the titlebar
959  //TODO: make a separate string with a placeholder to include app name?
961  if (!IsWindow(hDlg)) goto end;
962  SetWindowTextW(hDlg, szMsgText.GetString());
963 
965 
966  //TODO: issue an install operation separately so that the apps could be downloaded in the background
968  CloseHandle(shExInfo.hProcess);
969  }
970  else
971  {
973  }
974  }
975 
976 end:
977  if (hOut != INVALID_HANDLE_VALUE)
978  CloseHandle(hOut);
979 
980  if (hFile)
982  InternetCloseHandle(hOpen);
983 
984  if (bTempfile)
985  {
986  if (bCancelled || (SettingsInfo.bDelInstaller && (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)))
987  DeleteFileW(Path.GetString());
988  }
989 
990  if (!IsWindow(hDlg)) return 0;
992  }
993 
994  delete static_cast<DownloadParam*>(param);
995  if (!IsWindow(hDlg)) return 0;
996  SendMessageW(hDlg, WM_CLOSE, 0, 0);
997  return 0;
998 }
999 
1000 //TODO: Reuse the dialog
1002 {
1003  CDownloadManager::bModal = bIsModal;
1004  if (bIsModal)
1005  {
1006  DialogBoxW(hInst,
1008  hMainWnd,
1009  DownloadDlgProc);
1010  }
1011  else
1012  {
1015  hMainWnd,
1016  DownloadDlgProc);
1017  }
1018 }
1019 // CDownloadManager
1020 
1021 
1023 {
1024  if (AppsList.GetSize() == 0)
1025  return FALSE;
1026 
1027  // Initialize shared variables
1028  for (INT i = 0; i < AppsList.GetSize(); ++i)
1029  {
1030  CDownloadManager::Add(AppsList[i]); // implicit conversion to DownloadInfo
1031  }
1032 
1033  // Create a dialog and issue a download process
1035 
1036  return TRUE;
1037 }
1038 
1040 {
1041  if (!pAppInfo)
1042  return FALSE;
1043 
1044  CDownloadManager::Download(*pAppInfo, FALSE);
1045  return TRUE;
1046 }
1047 
1049 {
1050  static DownloadInfo DatabaseDLInfo;
1051  DatabaseDLInfo.szUrl = lpUrl;
1052  DatabaseDLInfo.szName.LoadStringW(IDS_DL_DIALOG_DB_DISP);
1053  DatabaseDLInfo.DLType = IsOfficial ? DLTYPE_DBUPDATE : DLTYPE_DBUPDATE_UNOFFICIAL;
1054  CDownloadManager::Download(DatabaseDLInfo, TRUE);
1055 }
1056 
#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 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:389
#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:365
#define free
Definition: debug_ros.c:5
static unsigned int WINAPI ThreadFunc(LPVOID Context)
Definition: loaddlg.cpp:556
#define MAKELPARAM(l, h)
Definition: winuser.h:3988
#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:532
_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:913
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:1001
#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:362
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
void EndPaint(LPPAINTSTRUCT lpPaint)
Definition: atlwin.h:495
#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)
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:1578
#define FILE_SHARE_READ
Definition: compat.h:136
#define COLOR_3DSHADOW
Definition: winuser.h:925
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:126
#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: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
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
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:350
#define L(x)
Definition: ntvdm.h:50
BOOL SubclassWindow(HWND hWnd)
Definition: atlwin.h:1518
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:507
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:363
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2343
ULONG SizeInBytes
Definition: loaddlg.cpp:99
BOOL UrlHasBeenCopied
Definition: loaddlg.cpp:492
#define DT_VCENTER
Definition: winuser.h:543
#define SW_SHOW
Definition: winuser.h:769
#define WM_SETTEXT
Definition: winuser.h:1604
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:420
VOID LoadList(ATL::CSimpleArray< DownloadInfo > arrInfo)
Definition: loaddlg.cpp:259
#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:4379
#define ICU_ESCAPE
Definition: winhttp.h:48
Status
Definition: gdiplustypes.h:24
VOID SetDownloadStatus(INT ItemIndex, DownloadStatus Status)
Definition: loaddlg.cpp:267
#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
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
_In_ WDFCOLLECTION _In_ ULONG Index
#define END_MSG_MAP()
Definition: atlwin.h:1883
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:1608
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:225
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:396
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#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:1607
#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:494
#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:1022
#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:4261
GLenum GLsizei len
Definition: glext.h:6722
VOID DownloadApplicationsDB(LPCWSTR lpUrl, BOOL IsOfficial)
Definition: loaddlg.cpp:1048
#define WM_COMMAND
Definition: winuser.h:1727
#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
#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:180
#define IDS_STATUS_WAITING
Definition: resource.h:201
#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:245
BOOL ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
Definition: atlwin.h:974
BOOL AddItem(INT ItemIndex, LPWSTR lpText)
Definition: loaddlg.cpp:273
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:5837
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:1864
#define DPRINT1
Definition: precomp.h:8
#define CreateFileW
Definition: compat.h:600
Definition: misc.h:45
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1892
static VOID Add(DownloadInfo info)
Definition: loaddlg.cpp:384
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:1082
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 ICU_DECODE
Definition: winhttp.h:291
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define WM_ERASEBKGND
Definition: winuser.h:1612
VOID AddRow(INT RowIndex, LPCWSTR szAppName, const DownloadStatus Status)
Definition: loaddlg.cpp:286
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:1039
#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:294
static BOOL bModal
Definition: loaddlg.cpp:366
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define GetClassLongPtrW
Definition: winuser.h:4544
#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
static CDownloaderProgress ProgressBar
Definition: loaddlg.cpp:364
#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