ReactOS 0.4.15-dev-8434-g155a7c7
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 <shlwapi_undoc.h>
46#include <process.h>
47#undef SubclassWindow
48
49#include "rosui.h"
50#include "dialogs.h"
51#include "misc.h"
52#include "unattended.h"
53
54#ifdef USE_CERT_PINNING
55#define CERT_ISSUER_INFO_OLD "US\r\nLet's Encrypt\r\nR3"
56#define CERT_ISSUER_INFO_NEW "US\r\nLet's Encrypt\r\nR11"
57#define CERT_SUBJECT_INFO "rapps.reactos.org"
58#endif
59
61{
65};
66
68{
75};
76
79{
80 CStringW szString;
81 szString.LoadStringW(StatusParam);
82 return szString;
83}
84
85#define FILENAME_VALID_CHAR ( \
86 PATH_CHAR_CLASS_LETTER | \
87 PATH_CHAR_CLASS_DOT | \
88 PATH_CHAR_CLASS_SEMICOLON | \
89 PATH_CHAR_CLASS_COMMA | \
90 PATH_CHAR_CLASS_SPACE | \
91 PATH_CHAR_CLASS_OTHER_VALID)
92
93VOID
95{
97 DWORD cchPath = _countof(szPath);
98 UrlUnescapeW(const_cast<LPWSTR>((LPCWSTR)str), szPath, &cchPath, 0);
99
100 for (PWCHAR pch = szPath; *pch; ++pch)
101 {
103 *pch = L'_';
104 }
105
106 str = szPath;
107}
108
110{
112 {
113 }
115 {
117 szName = AppInfo.szDisplayName;
118 IType = AppInfo.GetInstallerType();
120 {
121 szPackageName = AppInfo.szIdentifier;
122 }
123 }
124
132};
133
135{
137 {
138 }
140 : Dialog(dlg), AppInfo(info), szCaption(caption)
141 {
142 }
143
147};
148
149class CDownloaderProgress : public CWindowImpl<CDownloaderProgress, CWindow, CControlWinTraits>
150{
152
153 public:
155 {
156 }
157
158 VOID
160 {
161 if (Enable)
163 else
165
167 }
168
169 VOID
170 SetProgress(ULONG ulProgress, ULONG ulProgressMax)
171 {
172 WCHAR szProgress[100];
173
174 /* format the bits and bytes into pretty and accessible units... */
175 StrFormatByteSizeW(ulProgress, szProgress, _countof(szProgress));
176
177 /* use our subclassed progress bar text subroutine */
178 CStringW ProgressText;
179
180 if (ulProgressMax)
181 {
182 /* total size is known */
183 WCHAR szProgressMax[100];
184 UINT uiPercentage = ((ULONGLONG)ulProgress * 100) / ulProgressMax;
185
186 /* send the current progress to the progress bar */
187 if (!IsWindow())
188 return;
189 SendMessage(PBM_SETPOS, uiPercentage, 0);
190
191 /* format total download size */
192 StrFormatByteSizeW(ulProgressMax, szProgressMax, _countof(szProgressMax));
193
194 /* generate the text on progress bar */
195 ProgressText.Format(L"%u%% \x2014 %ls / %ls", uiPercentage, szProgress, szProgressMax);
196 }
197 else
198 {
199 /* send the current progress to the progress bar */
200 if (!IsWindow())
201 return;
202 SendMessage(PBM_SETPOS, 0, 0);
203
204 /* total size is not known, display only current size */
205 ProgressText.Format(L"%ls...", szProgress);
206 }
207
208 /* and finally display it */
209 if (!IsWindow())
210 return;
211 SetWindowText(ProgressText.GetString());
212 }
213
214 LRESULT
216 {
217 return TRUE;
218 }
219
220 LRESULT
222 {
223 PAINTSTRUCT ps;
224 HDC hDC = BeginPaint(&ps), hdcMem;
225 HBITMAP hbmMem;
226 HANDLE hOld;
227 RECT myRect;
228 UINT win_width, win_height;
229
230 GetClientRect(&myRect);
231
232 /* grab the progress bar rect size */
233 win_width = myRect.right - myRect.left;
234 win_height = myRect.bottom - myRect.top;
235
236 /* create an off-screen DC for double-buffering */
238 hbmMem = CreateCompatibleBitmap(hDC, win_width, win_height);
239
240 hOld = SelectObject(hdcMem, hbmMem);
241
242 /* call the original draw code and redirect it to our memory buffer */
244
245 /* draw our nifty progress text over it */
251
252 /* transfer the off-screen DC to the screen */
253 BitBlt(hDC, 0, 0, win_width, win_height, hdcMem, 0, 0, SRCCOPY);
254
255 /* free the off-screen DC */
256 SelectObject(hdcMem, hOld);
257 DeleteObject(hbmMem);
259
260 EndPaint(&ps);
261 return 0;
262 }
263
264 LRESULT
266 {
267 PCWSTR pszText = (PCWSTR)lParam;
268 if (pszText)
269 {
270 if (m_szProgressText != pszText)
271 {
272 m_szProgressText = pszText;
274 }
275 }
276 else
277 {
279 {
282 }
283 }
284 return TRUE;
285 }
286
292};
293
295{
296 public:
297 HWND
299 {
300 RECT r;
302 r.top = (2 * r.top + 1 * r.bottom) / 3; /* The vertical position at ratio 1 : 2 */
303#define MARGIN 10
305
308
310
311 AddColumn(0, 150, LVCFMT_LEFT);
312 AddColumn(1, 120, LVCFMT_LEFT);
313
314 return hwnd;
315 }
316
317 VOID
319 {
320 for (INT i = 0; i < arrInfo.GetSize(); ++i)
321 {
322 AddRow(i, arrInfo[i].szName.GetString(), DLSTATUS_WAITING);
323 }
324 }
325
326 VOID
328 {
329 CStringW szBuffer = LoadStatusString(Status);
330 SetItemText(ItemIndex, 1, szBuffer.GetString());
331 }
332
333 BOOL
334 AddItem(INT ItemIndex, LPWSTR lpText)
335 {
337
338 ZeroMemory(&Item, sizeof(Item));
339
340 Item.mask = LVIF_TEXT | LVIF_STATE;
341 Item.pszText = lpText;
342 Item.iItem = ItemIndex;
343
344 return InsertItem(&Item);
345 }
346
347 VOID
349 {
350 CStringW szStatus = LoadStatusString(Status);
351 AddItem(RowIndex, const_cast<LPWSTR>(szAppName));
352 SetDownloadStatus(RowIndex, Status);
353 }
354
355 BOOL
357 {
358 LVCOLUMNW Column;
359 ZeroMemory(&Column, sizeof(Column));
360
362 Column.iSubItem = Index;
363 Column.cx = Width;
364 Column.fmt = Format;
365
366 return (InsertColumn(Index, &Column) == -1) ? FALSE : TRUE;
367 }
368};
369
370#ifdef USE_CERT_PINNING
371static BOOL
372CertGetSubjectAndIssuer(HINTERNET hFile, CLocalPtr<char> &subjectInfo, CLocalPtr<char> &issuerInfo)
373{
374 DWORD certInfoLength;
377
378 size = sizeof(flags);
380 {
381 return FALSE;
382 }
383
385 {
386 return FALSE;
387 }
388
389 /* Despite what the header indicates, the implementation of INTERNET_CERTIFICATE_INFO is not Unicode-aware. */
390 certInfoLength = sizeof(certInfo);
392 {
393 return FALSE;
394 }
395
396 subjectInfo.Attach(certInfo.lpszSubjectInfo);
397 issuerInfo.Attach(certInfo.lpszIssuerInfo);
398
399 if (certInfo.lpszProtocolName)
400 LocalFree(certInfo.lpszProtocolName);
401 if (certInfo.lpszSignatureAlgName)
403 if (certInfo.lpszEncryptionAlgName)
405
406 return certInfo.lpszSubjectInfo && certInfo.lpszIssuerInfo;
407}
408#endif
409
410inline VOID
411MessageBox_LoadString(HWND hOwnerWnd, INT StringID)
412{
413 CStringW szMsgText;
414 if (szMsgText.LoadStringW(StringID))
415 {
416 MessageBoxW(hOwnerWnd, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
417 }
418}
419
420// Download dialog (loaddlg.cpp)
422{
427 static BOOL bModal;
428 static VOID
429 UpdateProgress(HWND hDlg, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText);
430
431 public:
432 static VOID
434 static VOID
435 Download(const DownloadInfo &DLInfo, BOOL bIsModal = FALSE);
436 static INT_PTR CALLBACK
438 static unsigned int WINAPI
441};
442
443// CDownloadManager
449
450VOID
452{
454}
455
456VOID
458{
460 AppsDownloadList.Add(DLInfo);
461 LaunchDownloadDialog(bIsModal);
462}
463
466{
467 static WCHAR szCaption[MAX_PATH];
468
469 switch (uMsg)
470 {
471 case WM_INITDIALOG:
472 {
473 HICON hIconSm, hIconBg;
474 CStringW szTempCaption;
475
477
478 if (hMainWnd)
479 {
482 }
483 if (!hMainWnd || (!hIconBg || !hIconSm))
484 {
485 /* Load the default icon */
487 }
488
489 if (hIconBg && hIconSm)
490 {
491 SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM)hIconBg);
492 SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
493 }
494
496 if (Item)
497 {
498 // initialize the default values for our nifty progress bar
499 // and subclass it so that it learns to print a status text
503 if (AppsDownloadList.GetSize() > 0)
504 ProgressBar.SetProgress(0, AppsDownloadList[0].SizeInBytes);
505 }
506
507 // Add a ListView
508 HWND hListView = DownloadsListView.Create(Dlg);
509 if (!hListView)
510 {
511 return FALSE;
512 }
514
515 // Get a dlg string for later use
516 GetWindowTextW(Dlg, szCaption, _countof(szCaption));
517
518 // Hide a placeholder from displaying
519 szTempCaption = szCaption;
520 szTempCaption.Replace(L"%ls", L"");
521 SetWindowText(Dlg, szTempCaption.GetString());
522
523 ShowWindow(Dlg, SW_SHOW);
524
525 // Start download process
526 DownloadParam *param = new DownloadParam(Dlg, AppsDownloadList, szCaption);
527 unsigned int ThreadId;
528 HANDLE Thread = (HANDLE)_beginthreadex(NULL, 0, ThreadFunc, (void *)param, 0, &ThreadId);
529 if (!Thread)
530 {
531 return FALSE;
532 }
533
536 return TRUE;
537 }
538
539 case WM_COMMAND:
540 if (wParam == IDCANCEL)
541 {
543 PostMessageW(Dlg, WM_CLOSE, 0, 0);
544 }
545 return FALSE;
546
547 case WM_CLOSE:
548 if (ProgressBar)
551 {
552 ::EndDialog(Dlg, 0);
553 }
554 else
555 {
556 ::DestroyWindow(Dlg);
557 }
558 return TRUE;
559
560 default:
561 return FALSE;
562 }
563}
564
566
567VOID
569 HWND hDlg,
570 ULONG ulProgress,
571 ULONG ulProgressMax,
572 ULONG ulStatusCode,
573 LPCWSTR szStatusText)
574{
575 HWND Item;
576
577 if (!IsWindow(hDlg))
578 return;
579 ProgressBar.SetProgress(ulProgress, ulProgressMax);
580
581 if (!IsWindow(hDlg))
582 return;
584 if (Item && szStatusText && wcslen(szStatusText) > 0 && UrlHasBeenCopied == FALSE)
585 {
586 SIZE_T len = wcslen(szStatusText) + 1;
588 DWORD dummyLen;
589
590 /* beautify our url for display purposes */
591 if (!InternetCanonicalizeUrlW(szStatusText, buf.GetBuffer(len), &dummyLen, ICU_DECODE | ICU_NO_ENCODE))
592 {
593 /* just use the original */
594 buf.ReleaseBuffer();
595 buf = szStatusText;
596 }
597 else
598 {
599 buf.ReleaseBuffer();
600 }
601
602 /* paste it into our dialog and don't do it again in this instance */
603 ::SetWindowText(Item, buf.GetString());
605 }
606}
607
608BOOL
609ShowLastError(HWND hWndOwner, BOOL bInetError, DWORD dwLastError)
610{
611 CLocalPtr<WCHAR> lpMsg;
612
613 if (!FormatMessageW(
616 (bInetError ? GetModuleHandleW(L"wininet.dll") : NULL), dwLastError, LANG_USER_DEFAULT, (LPWSTR)&lpMsg, 0,
617 NULL))
618 {
619 DPRINT1("FormatMessageW unexpected failure (err %d)\n", GetLastError());
620 return FALSE;
621 }
622
623 MessageBoxW(hWndOwner, lpMsg, NULL, MB_OK | MB_ICONERROR);
624 return TRUE;
625}
626
627unsigned int WINAPI
629{
630 CPathW Path;
631 PWSTR p, q;
632
633 HWND hDlg = static_cast<DownloadParam *>(param)->Dialog;
634 HWND Item;
635 INT iAppId;
636
637 ULONG dwContentLen, dwBytesWritten, dwBytesRead, dwStatus;
638 ULONG dwCurrentBytesRead = 0;
639 ULONG dwStatusLen = sizeof(dwStatus);
640
641 BOOL bTempfile = FALSE;
642
643 HINTERNET hOpen = NULL;
646
647 unsigned char lpBuffer[4096];
648 LPCWSTR lpszAgent = L"RApps/1.1";
649 URL_COMPONENTSW urlComponents;
650 size_t urlLength, filenameLength;
651
652 const ATL::CSimpleArray<DownloadInfo> &InfoArray = static_cast<DownloadParam *>(param)->AppInfo;
653 LPCWSTR szCaption = static_cast<DownloadParam *>(param)->szCaption;
654 CStringW szNewCaption;
655
656 const DWORD dwUrlConnectFlags =
658
659 if (InfoArray.GetSize() <= 0)
660 {
662 goto end;
663 }
664
665 for (iAppId = 0; iAppId < InfoArray.GetSize(); ++iAppId)
666 {
667 // Reset progress bar
668 if (!IsWindow(hDlg))
669 break;
671 if (Item)
672 {
675 ProgressBar.SetProgress(0, InfoArray[iAppId].SizeInBytes);
676 }
677
678 // is this URL an update package for RAPPS? if so store it in a different place
679 if (InfoArray[iAppId].DLType != DLTYPE_APPLICATION)
680 {
682 {
684 goto end;
685 }
686 }
687 else
688 {
690 }
691
692 // Change caption to show the currently downloaded app
693 switch (InfoArray[iAppId].DLType)
694 {
696 szNewCaption.Format(szCaption, InfoArray[iAppId].szName.GetString());
697 break;
698 case DLTYPE_DBUPDATE:
699 szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_DOWNLOAD_DISP);
700 break;
702 szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP);
703 break;
704 }
705
706 if (!IsWindow(hDlg))
707 goto end;
708 SetWindowTextW(hDlg, szNewCaption.GetString());
709
710 // build the path for the download
711 p = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'/');
712 q = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'?');
713
714 // do we have a final slash separator?
715 if (!p)
716 {
718 goto end;
719 }
720
721 // prepare the tentative length of the filename, maybe we've to remove part of it later on
722 filenameLength = wcslen(p) * sizeof(WCHAR);
723
724 /* do we have query arguments in the target URL after the filename? account for them
725 (e.g. https://example.org/myfile.exe?no_adware_plz) */
726 if (q && q > p && (q - p) > 0)
727 filenameLength -= wcslen(q - 1) * sizeof(WCHAR);
728
729 // is the path valid? can we access it?
731 {
733 {
735 goto end;
736 }
737 }
738
739 switch (InfoArray[iAppId].DLType)
740 {
741 case DLTYPE_DBUPDATE:
744 break;
746 {
747 CStringW str = p + 1; // use the filename retrieved from URL
749 Path += str;
750 break;
751 }
752 }
753
754 if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] &&
756 {
757 // only open it in case of total correctness
758 if (VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path))
759 goto run;
760 }
761
762 // Add the download URL
763 if (!IsWindow(hDlg))
764 goto end;
765 SetDlgItemTextW(hDlg, IDC_DOWNLOAD_STATUS, InfoArray[iAppId].szUrl.GetString());
766
768
769 // download it
771 bTempfile = TRUE;
772
773 /* FIXME: this should just be using the system-wide proxy settings */
774 switch (SettingsInfo.Proxy)
775 {
776 case 0: // preconfig
777 default:
778 hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
779 break;
780 case 1: // direct (no proxy)
781 hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
782 break;
783 case 2: // use proxy
784 hOpen = InternetOpenW(
786 break;
787 }
788
789 if (!hOpen)
790 {
792 goto end;
793 }
794
795 dwStatusLen = sizeof(dwStatus);
796
797 memset(&urlComponents, 0, sizeof(urlComponents));
798 urlComponents.dwStructSize = sizeof(urlComponents);
799
800 urlLength = InfoArray[iAppId].szUrl.GetLength();
801 urlComponents.dwSchemeLength = urlLength + 1;
802 urlComponents.lpszScheme = (LPWSTR)malloc(urlComponents.dwSchemeLength * sizeof(WCHAR));
803
804 if (!InternetCrackUrlW(InfoArray[iAppId].szUrl, urlLength + 1, ICU_DECODE | ICU_ESCAPE, &urlComponents))
805 {
807 goto end;
808 }
809
810 dwContentLen = 0;
811
812 if (urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme == INTERNET_SCHEME_HTTPS)
813 {
814 hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl.GetString(), NULL, 0, dwUrlConnectFlags, 0);
815 if (!hFile)
816 {
818 {
819 /* Workaround for CORE-17377 */
821 }
822 goto end;
823 }
824
825 // query connection
827 {
829 goto end;
830 }
831
833 {
835 goto end;
836 }
837
838 // query content length
840 hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwStatusLen, NULL);
841 }
842 else if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
843 {
844 // force passive mode on FTP
845 hFile =
846 InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl, NULL, 0, dwUrlConnectFlags | INTERNET_FLAG_PASSIVE, 0);
847 if (!hFile)
848 {
850 {
851 /* Workaround for CORE-17377 */
853 }
854 goto end;
855 }
856
857 dwContentLen = FtpGetFileSize(hFile, &dwStatus);
858 }
859 else if (urlComponents.nScheme == INTERNET_SCHEME_FILE)
860 {
861 // Add support for the file scheme so testing locally is simpler
862 WCHAR LocalFilePath[MAX_PATH];
863 DWORD cchPath = _countof(LocalFilePath);
864 // Ideally we would use PathCreateFromUrlAlloc here, but that is not exported (yet)
865 HRESULT hr = PathCreateFromUrlW(InfoArray[iAppId].szUrl, LocalFilePath, &cchPath, 0);
866 if (SUCCEEDED(hr))
867 {
868 if (CopyFileW(LocalFilePath, Path, FALSE))
869 {
870 goto run;
871 }
872 else
873 {
875 goto end;
876 }
877 }
878 else
879 {
881 goto end;
882 }
883 }
884
885 if (!dwContentLen)
886 {
887 // Someone was nice enough to add this, let's use it
888 if (InfoArray[iAppId].SizeInBytes)
889 {
890 dwContentLen = InfoArray[iAppId].SizeInBytes;
891 }
892 else
893 {
894 // content-length is not known, enable marquee mode
896 }
897 }
898
899 free(urlComponents.lpszScheme);
900
901#ifdef USE_CERT_PINNING
902 // are we using HTTPS to download the RAPPS update package? check if the certificate is original
903 if ((urlComponents.nScheme == INTERNET_SCHEME_HTTPS) && (InfoArray[iAppId].DLType == DLTYPE_DBUPDATE))
904 {
905 CLocalPtr<char> subjectName, issuerName;
906 CStringA szMsgText;
907 bool bAskQuestion = false;
908 if (!CertGetSubjectAndIssuer(hFile, subjectName, issuerName))
909 {
910 szMsgText.LoadStringW(IDS_UNABLE_TO_QUERY_CERT);
911 bAskQuestion = true;
912 }
913 else
914 {
915 if (strcmp(subjectName, CERT_SUBJECT_INFO) ||
916 (strcmp(issuerName, CERT_ISSUER_INFO_OLD) && strcmp(issuerName, CERT_ISSUER_INFO_NEW)))
917 {
918 szMsgText.Format(IDS_MISMATCH_CERT_INFO, (char *)subjectName, (const char *)issuerName);
919 bAskQuestion = true;
920 }
921 }
922
923 if (bAskQuestion)
924 {
926 {
927 goto end;
928 }
929 }
930 }
931#endif
932
934
935 if (hOut == INVALID_HANDLE_VALUE)
936 {
938 goto end;
939 }
940
941 dwCurrentBytesRead = 0;
942 do
943 {
944 if (!InternetReadFile(hFile, lpBuffer, _countof(lpBuffer), &dwBytesRead))
945 {
947 goto end;
948 }
949
950 if (!WriteFile(hOut, &lpBuffer[0], dwBytesRead, &dwBytesWritten, NULL))
951 {
953 goto end;
954 }
955
956 dwCurrentBytesRead += dwBytesRead;
957 if (!IsWindow(hDlg))
958 goto end;
959 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
960 } while (dwBytesRead && !bCancelled);
961
962 CloseHandle(hOut);
964
965 if (bCancelled)
966 {
967 DPRINT1("Operation cancelled\n");
968 goto end;
969 }
970
971 if (!dwContentLen)
972 {
973 // set progress bar to 100%
975
976 dwContentLen = dwCurrentBytesRead;
977 if (!IsWindow(hDlg))
978 goto end;
979 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
980 }
981
982 /* if this thing isn't a RAPPS update and it has a SHA-1 checksum
983 verify its integrity by using the native advapi32.A_SHA1 functions */
984 if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] != 0)
985 {
986 CStringW szMsgText;
987
988 // change a few strings in the download dialog to reflect the verification process
989 if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_TITLE))
990 {
991 DPRINT1("Unable to load string\n");
992 goto end;
993 }
994
995 if (!IsWindow(hDlg))
996 goto end;
997 SetWindowTextW(hDlg, szMsgText.GetString());
999
1000 // this may take a while, depending on the file size
1001 if (!VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path))
1002 {
1003 if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_FAIL))
1004 {
1005 DPRINT1("Unable to load string\n");
1006 goto end;
1007 }
1008
1009 if (!IsWindow(hDlg))
1010 goto end;
1011 MessageBoxW(hDlg, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
1012 goto end;
1013 }
1014 }
1015
1016 run:
1018
1019 // run it
1020 if (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)
1021 {
1022 CStringW app, params;
1023 SHELLEXECUTEINFOW shExInfo = {0};
1024 shExInfo.cbSize = sizeof(shExInfo);
1025 shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
1026 shExInfo.lpVerb = L"open";
1027 shExInfo.lpFile = Path;
1028 shExInfo.lpParameters = L"";
1029 shExInfo.nShow = SW_SHOW;
1030
1031 if (InfoArray[iAppId].IType == INSTALLER_GENERATE)
1032 {
1033 params = L"/" + CStringW(CMD_KEY_GENINST) + L" \"" +
1034 InfoArray[iAppId].szPackageName + L"\" \"" +
1035 CStringW(shExInfo.lpFile) + L"\"";
1036 shExInfo.lpParameters = params;
1037 shExInfo.lpFile = app.GetBuffer(MAX_PATH);
1038 GetModuleFileNameW(NULL, const_cast<LPWSTR>(shExInfo.lpFile), MAX_PATH);
1039 app.ReleaseBuffer();
1040 }
1041
1042 /* FIXME: Do we want to log installer status? */
1043 WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_INSTALL, InfoArray[iAppId].szName);
1044
1045 if (ShellExecuteExW(&shExInfo))
1046 {
1047 // reflect installation progress in the titlebar
1048 // TODO: make a separate string with a placeholder to include app name?
1050 if (!IsWindow(hDlg))
1051 goto end;
1052 SetWindowTextW(hDlg, szMsgText.GetString());
1053
1055
1056 // TODO: issue an install operation separately so that the apps could be downloaded in the background
1058 CloseHandle(shExInfo.hProcess);
1059 }
1060 else
1061 {
1063 }
1064 }
1065
1066 end:
1067 if (hOut != INVALID_HANDLE_VALUE)
1068 CloseHandle(hOut);
1069
1070 if (hFile)
1072 InternetCloseHandle(hOpen);
1073
1074 if (bTempfile)
1075 {
1076 if (bCancelled || (SettingsInfo.bDelInstaller && (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)))
1078 }
1079
1080 if (!IsWindow(hDlg))
1081 return 0;
1083 }
1084
1085 delete static_cast<DownloadParam *>(param);
1086 if (!IsWindow(hDlg))
1087 return 0;
1088 SendMessageW(hDlg, WM_CLOSE, 0, 0);
1089 return 0;
1090}
1091
1092// TODO: Reuse the dialog
1093VOID
1095{
1096 CDownloadManager::bModal = bIsModal;
1097 if (bIsModal)
1098 {
1100 }
1101 else
1102 {
1104 }
1105}
1106// CDownloadManager
1107
1108BOOL
1110{
1111 if (AppsList.IsEmpty())
1112 return FALSE;
1113
1114 POSITION CurrentListPosition = AppsList.GetHeadPosition();
1115 while (CurrentListPosition)
1116 {
1117 const CAppInfo *Info = AppsList.GetNext(CurrentListPosition);
1119 }
1120
1121 // Create a dialog and issue a download process
1123
1124 return TRUE;
1125}
1126
1127BOOL
1129{
1130 if (!pAppInfo)
1131 return FALSE;
1132
1134 return TRUE;
1135}
1136
1137VOID
1139{
1140 static DownloadInfo DatabaseDLInfo;
1141 DatabaseDLInfo.szUrl = lpUrl;
1142 DatabaseDLInfo.szName.LoadStringW(IDS_DL_DIALOG_DB_DISP);
1143 DatabaseDLInfo.DLType = IsOfficial ? DLTYPE_DBUPDATE : DLTYPE_DBUPDATE_UNOFFICIAL;
1144 CDownloadManager::Download(DatabaseDLInfo, TRUE);
1145}
static HDC hDC
Definition: 3dtext.c:33
PRTL_UNICODE_STRING_BUFFER Path
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
Arabic default style
Definition: afstyles.h:94
InstallerType
Definition: appinfo.h:74
@ INSTALLER_UNKNOWN
Definition: appinfo.h:75
@ INSTALLER_GENERATE
Definition: appinfo.h:76
#define IDI_MAIN
Definition: resource.h:4
#define APPLICATION_DATABASE_NAME
Definition: defines.h:41
BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPCWSTR lpMsg)
Definition: misc.cpp:224
BOOL GetStorageDirectory(CStringW &lpDirectory)
Definition: misc.cpp:142
#define IDD_DOWNLOAD_DIALOG
Definition: resource.h:65
#define IDS_UNABLE_TO_DOWNLOAD
Definition: resource.h:108
#define IDS_MISMATCH_CERT_INFO
Definition: resource.h:118
#define IDS_STATUS_FINISHED
Definition: resource.h:201
#define IDS_STATUS_WAITING
Definition: resource.h:200
#define IDS_DL_DIALOG_DB_DISP
Definition: resource.h:217
#define IDS_STATUS_INSTALLING
Definition: resource.h:199
#define IDS_UNABLE_TO_DOWNLOAD2
Definition: resource.h:109
#define IDC_DOWNLOAD_PROGRESS
Definition: resource.h:41
#define IDS_UNABLE_PATH
Definition: resource.h:119
#define IDS_STATUS_DOWNLOADED
Definition: resource.h:196
#define IDS_STATUS_DOWNLOADING
Definition: resource.h:198
#define IDS_UNABLE_TO_QUERY_CERT
Definition: resource.h:110
#define IDC_DOWNLOAD_STATUS
Definition: resource.h:42
#define IDS_STATUS_INSTALLED
Definition: resource.h:194
#define IDS_INTEG_CHECK_TITLE
Definition: resource.h:111
#define IDS_DL_DIALOG_DB_DOWNLOAD_DISP
Definition: resource.h:218
#define IDS_INTEG_CHECK_FAIL
Definition: resource.h:112
#define IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP
Definition: resource.h:219
SETTINGS_INFO SettingsInfo
Definition: winmain.cpp:20
#define DPRINT1
Definition: precomp.h:8
bool IsEmpty() const
Definition: atlcoll.h:545
POSITION GetHeadPosition() const
Definition: atlcoll.h:551
E & GetNext(_Inout_ POSITION &pos)
Definition: atlcoll.h:563
int GetSize() const
Definition: atlsimpcoll.h:104
BOOL Add(const T &t)
Definition: atlsimpcoll.h:58
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:387
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
int GetLength() const noexcept
Definition: atlsimpstr.h:362
void Empty() noexcept
Definition: atlsimpstr.h:253
int Replace(PCXSTR pszOld, PCXSTR pszNew)
Definition: cstringt.h:886
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
BOOL SubclassWindow(HWND hWnd)
Definition: atlwin.h:1552
HWND UnsubclassWindow(BOOL bForce=FALSE)
Definition: atlwin.h:1575
BOOL ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
Definition: atlwin.h:1008
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1116
BOOL IsWindow() const
Definition: atlwin.h:947
virtual VOID GetDownloadInfo(CStringW &Url, CStringW &Sha1, ULONG &SizeInBytes) const =0
virtual InstallerType GetInstallerType() const
Definition: appinfo.h:121
CStringW szDisplayName
Definition: appinfo.h:102
const CStringW szIdentifier
Definition: appinfo.h:98
HWND Create(HWND hwndParent)
Definition: loaddlg.cpp:298
VOID LoadList(ATL::CSimpleArray< DownloadInfo > arrInfo)
Definition: loaddlg.cpp:318
VOID SetDownloadStatus(INT ItemIndex, DownloadStatus Status)
Definition: loaddlg.cpp:327
VOID AddRow(INT RowIndex, LPCWSTR szAppName, const DownloadStatus Status)
Definition: loaddlg.cpp:348
BOOL AddColumn(INT Index, INT Width, INT Format)
Definition: loaddlg.cpp:356
BOOL AddItem(INT ItemIndex, LPWSTR lpText)
Definition: loaddlg.cpp:334
static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: loaddlg.cpp:465
static BOOL bCancelled
Definition: loaddlg.cpp:426
static ATL::CSimpleArray< DownloadInfo > AppsDownloadList
Definition: loaddlg.cpp:423
static BOOL bModal
Definition: loaddlg.cpp:427
static VOID UpdateProgress(HWND hDlg, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: loaddlg.cpp:568
static VOID Download(const DownloadInfo &DLInfo, BOOL bIsModal=FALSE)
Definition: loaddlg.cpp:457
static CDownloaderProgress ProgressBar
Definition: loaddlg.cpp:425
static CDowloadingAppsListView DownloadsListView
Definition: loaddlg.cpp:424
static VOID Add(DownloadInfo info)
Definition: loaddlg.cpp:451
static unsigned int WINAPI ThreadFunc(LPVOID Context)
Definition: loaddlg.cpp:628
static VOID LaunchDownloadDialog(BOOL)
Definition: loaddlg.cpp:1094
VOID SetMarquee(BOOL Enable)
Definition: loaddlg.cpp:159
VOID SetProgress(ULONG ulProgress, ULONG ulProgressMax)
Definition: loaddlg.cpp:170
CStringW m_szProgressText
Definition: loaddlg.cpp:151
LRESULT OnEraseBkgnd(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: loaddlg.cpp:215
LRESULT OnSetText(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: loaddlg.cpp:265
LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: loaddlg.cpp:221
void Attach(T *lp)
Definition: atlalloc.h:162
int InsertItem(const LV_ITEM *pitem)
Definition: rosctrls.h:96
int InsertColumn(int iCol, LV_COLUMN *pcol)
Definition: rosctrls.h:52
BOOL SetItemText(int i, int subItem, LPCWSTR text)
Definition: rosctrls.h:186
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
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
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
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define wcsrchr
Definition: compat.h:16
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define CALLBACK
Definition: compat.h:35
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:439
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
HRESULT WINAPI PathCreateFromUrlW(LPCWSTR pszUrl, LPWSTR pszPath, LPDWORD pcchPath, DWORD dwReserved)
Definition: path.c:3355
BOOL WINAPI PathIsValidCharW(WCHAR c, DWORD class)
Definition: path.c:4419
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2388
HRESULT WINAPI UrlUnescapeW(LPWSTR pszUrl, LPWSTR pszUnescaped, LPDWORD pcchUnescaped, DWORD dwFlags)
Definition: url.c:1367
DWORD WINAPI FtpGetFileSize(HINTERNET hFile, LPDWORD lpdwFileSizeHigh)
Definition: ftp.c:1757
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:3870
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2730
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1625
BOOL WINAPI InternetCanonicalizeUrlW(LPCWSTR lpszUrl, LPWSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
Definition: internet.c:2004
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
Definition: internet.c:2154
HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3722
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1414
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:979
static VOID 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:57
#define INFINITE
Definition: serial.h:102
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
pKey DeleteObject()
Status
Definition: gdiplustypes.h:25
GLuint GLuint end
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLsizeiptr size
Definition: glext.h:5919
GLenum const GLfloat * params
Definition: glext.h:5645
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLfloat GLfloat p
Definition: glext.h:8902
GLfloat param
Definition: glext.h:5796
GLenum GLsizei len
Definition: glext.h:6722
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
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1926
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1898
#define END_MSG_MAP()
Definition: atlwin.h:1917
BOOL DownloadApplication(CAppInfo *pAppInfo)
Definition: loaddlg.cpp:1128
BOOL UrlHasBeenCopied
Definition: loaddlg.cpp:565
VOID UrlUnescapeAndMakeFileNameValid(CStringW &str)
Definition: loaddlg.cpp:94
BOOL ShowLastError(HWND hWndOwner, BOOL bInetError, DWORD dwLastError)
Definition: loaddlg.cpp:609
BOOL DownloadListOfApplications(const CAtlList< CAppInfo * > &AppsList, BOOL bIsModal)
Definition: loaddlg.cpp:1109
DownloadStatus
Definition: loaddlg.cpp:68
@ DLSTATUS_DOWNLOADING
Definition: loaddlg.cpp:70
@ DLSTATUS_FINISHED
Definition: loaddlg.cpp:74
@ DLSTATUS_WAITING_INSTALL
Definition: loaddlg.cpp:71
@ DLSTATUS_WAITING
Definition: loaddlg.cpp:69
@ DLSTATUS_INSTALLED
Definition: loaddlg.cpp:73
@ DLSTATUS_INSTALLING
Definition: loaddlg.cpp:72
VOID MessageBox_LoadString(HWND hOwnerWnd, INT StringID)
Definition: loaddlg.cpp:411
CStringW LoadStatusString(DownloadStatus StatusParam)
Definition: loaddlg.cpp:78
#define FILENAME_VALID_CHAR
Definition: loaddlg.cpp:85
#define MARGIN
DownloadType
Definition: loaddlg.cpp:61
@ DLTYPE_DBUPDATE_UNOFFICIAL
Definition: loaddlg.cpp:64
@ DLTYPE_DBUPDATE
Definition: loaddlg.cpp:63
@ DLTYPE_APPLICATION
Definition: loaddlg.cpp:62
VOID DownloadApplicationsDB(LPCWSTR lpUrl, BOOL IsOfficial)
Definition: loaddlg.cpp:1138
HWND hMainWnd
Definition: magnifier.c:32
#define pch(ap)
Definition: match.c:418
#define CREATE_ALWAYS
Definition: disk.h:72
LPCWSTR szPath
Definition: env.c:37
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
static HICON
Definition: imagelist.c:84
static BYTE subjectName[]
Definition: cert.c:63
HICON hIconSm
Definition: msconfig.c:44
_In_ HANDLE hFile
Definition: mswsock.h:90
CAtlStringW CStringW
Definition: atlstr.h:130
unsigned int UINT
Definition: ndis.h:50
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define GENERIC_WRITE
Definition: nt_native.h:90
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
#define L(x)
Definition: ntvdm.h:50
#define WS_CHILD
Definition: pedump.c:617
#define WS_VISIBLE
Definition: pedump.c:620
static const WCHAR szName[]
Definition: powrprof.c:45
#define LVS_SINGLESEL
Definition: commctrl.h:2266
#define LVS_NOCOLUMNHEADER
Definition: commctrl.h:2284
#define PBS_MARQUEE
Definition: commctrl.h:2198
#define LVIF_STATE
Definition: commctrl.h:2312
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2267
#define LVS_REPORT
Definition: commctrl.h:2262
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define PBM_SETPOS
Definition: commctrl.h:2184
#define PBM_SETRANGE
Definition: commctrl.h:2183
#define LVS_NOSORTHEADER
Definition: commctrl.h:2285
#define LVIF_TEXT
Definition: commctrl.h:2309
#define LVCF_FMT
Definition: commctrl.h:2586
#define LVCF_SUBITEM
Definition: commctrl.h:2589
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define PBM_SETMARQUEE
Definition: commctrl.h:2199
DWORD dwStatus
Definition: mediaobj.idl:95
#define DefWindowProc
Definition: ros2win.h:31
const WCHAR * str
_CRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security, _In_ unsigned _StackSize, _In_ unsigned(__stdcall *_StartAddress)(void *), _In_opt_ void *_ArgList, _In_ unsigned _InitFlag, _Out_opt_ unsigned *_ThrdAddr)
#define memset(x, y, z)
Definition: compat.h:39
#define SEE_MASK_NOCLOSEPROCESS
Definition: shellapi.h:31
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2455
HRESULT hr
Definition: shlfolder.c:183
#define _countof(array)
Definition: sndvol32.h:70
TCHAR szAppName[128]
Definition: solitaire.cpp:18
Definition: window.h:372
CStringW szName
Definition: loaddlg.cpp:128
DownloadType DLType
Definition: loaddlg.cpp:125
CStringW szPackageName
Definition: loaddlg.cpp:130
CStringW szUrl
Definition: loaddlg.cpp:127
ULONG SizeInBytes
Definition: loaddlg.cpp:131
InstallerType IType
Definition: loaddlg.cpp:126
CStringW szSHA1
Definition: loaddlg.cpp:129
DownloadInfo(const CAppInfo &AppInfo)
Definition: loaddlg.cpp:114
DownloadParam(HWND dlg, const ATL::CSimpleArray< DownloadInfo > &info, LPCWSTR caption)
Definition: loaddlg.cpp:139
ATL::CSimpleArray< DownloadInfo > AppInfo
Definition: loaddlg.cpp:145
LPCWSTR szCaption
Definition: loaddlg.cpp:146
WCHAR szDownloadDir[MAX_PATH]
Definition: settings.h:10
BOOL bDelInstaller
Definition: settings.h:11
WCHAR szNoProxyFor[MAX_PATH]
Definition: settings.h:21
WCHAR szProxyServer[MAX_PATH]
Definition: settings.h:20
DWORD dwStructSize
Definition: wininet.h:211
INTERNET_SCHEME nScheme
Definition: wininet.h:214
LPWSTR lpszScheme
Definition: wininet.h:212
DWORD dwSchemeLength
Definition: wininet.h:213
LPCWSTR lpParameters
Definition: shellapi.h:333
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT_PTR
Definition: typedefs.h:64
const uint16_t * PCWSTR
Definition: typedefs.h:57
PVOID HANDLE
Definition: typedefs.h:73
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
#define CMD_KEY_GENINST
Definition: unattended.h:4
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
#define AddItem
Definition: userenv.h:209
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
HDC hdcMem
Definition: welcome.c:104
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1384
#define ZeroMemory
Definition: winbase.h:1712
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:420
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:423
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:419
#define FORMAT_MESSAGE_FROM_HMODULE
Definition: winbase.h:422
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define SelectFont(hdc, hfont)
Definition: windowsx.h:516
#define GetStockFont(i)
Definition: windowsx.h:308
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define SRCCOPY
Definition: wingdi.h:333
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
BOOL WINAPI DeleteDC(_In_ HDC)
#define HTTP_STATUS_OK
Definition: winhttp.h:240
#define INTERNET_SCHEME_FTP
Definition: winhttp.h:44
#define ICU_DECODE
Definition: winhttp.h:291
#define INTERNET_SCHEME_HTTP
Definition: winhttp.h:42
#define SECURITY_FLAG_SECURE
Definition: winhttp.h:285
#define ICU_NO_ENCODE
Definition: winhttp.h:290
#define INTERNET_SCHEME_HTTPS
Definition: winhttp.h:43
#define ICU_ESCAPE
Definition: winhttp.h:48
#define INTERNET_FLAG_PRAGMA_NOCACHE
Definition: wininet.h:85
#define INTERNET_OPTION_SECURITY_FLAGS
Definition: wininet.h:725
#define INTERNET_FLAG_DONT_CACHE
Definition: wininet.h:67
#define INTERNET_FLAG_KEEP_CONNECTION
Definition: wininet.h:72
#define INTERNET_FLAG_PASSIVE
Definition: wininet.h:65
#define HTTP_QUERY_FLAG_NUMBER
Definition: wininet.h:1606
#define INTERNET_OPEN_TYPE_DIRECT
Definition: wininet.h:522
@ INTERNET_SCHEME_FILE
Definition: wininet.h:143
#define INTERNET_OPEN_TYPE_PROXY
Definition: wininet.h:523
#define HTTP_QUERY_STATUS_CODE
Definition: wininet.h:1542
#define INTERNET_OPEN_TYPE_PRECONFIG
Definition: wininet.h:521
#define INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT
Definition: wininet.h:726
#define HTTP_QUERY_CONTENT_LENGTH
Definition: wininet.h:1528
BOOL VerifyInteg(LPCWSTR lpSHA1Hash, LPCWSTR lpFileName)
Definition: integrity.cpp:14
#define EVENTLOG_SUCCESS
Definition: winnt_old.h:2833
#define WM_PAINT
Definition: winuser.h:1620
#define WM_ERASEBKGND
Definition: winuser.h:1625
DWORD WINAPI GetSysColor(_In_ int)
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define WM_CLOSE
Definition: winuser.h:1621
#define DT_NOPREFIX
Definition: winuser.h:537
#define GCLP_HICONSM
Definition: winuser.h:675
#define MAKELPARAM(l, h)
Definition: winuser.h:4008
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define DT_CENTER
Definition: winuser.h:527
#define IDCANCEL
Definition: winuser.h:831
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define GCLP_HICON
Definition: winuser.h:674
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4399
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_COMMAND
Definition: winuser.h:1740
#define COLOR_3DDKSHADOW
Definition: winuser.h:939
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_INITDIALOG
Definition: winuser.h:1739
#define MB_YESNO
Definition: winuser.h:817
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define MB_ICONERROR
Definition: winuser.h:787
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define WM_SETTEXT
Definition: winuser.h:1617
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define SendMessage
Definition: winuser.h:5852
#define MB_OK
Definition: winuser.h:790
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4281
#define DT_VCENTER
Definition: winuser.h:543
#define GetClassLongPtrW
Definition: winuser.h:4564
#define SW_SHOW
Definition: winuser.h:775
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define SetWindowText
Definition: winuser.h:5866
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDYES
Definition: winuser.h:835
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define COLOR_CAPTIONTEXT
Definition: winuser.h:922
BOOL WINAPI DestroyWindow(_In_ HWND)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2119
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185