ReactOS 0.4.16-dev-91-g764881a
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 g_Busy++;
474 HICON hIconSm, hIconBg;
475 CStringW szTempCaption;
476
478
479 if (hMainWnd)
480 {
483 }
484 if (!hMainWnd || (!hIconBg || !hIconSm))
485 {
486 /* Load the default icon */
488 }
489
490 if (hIconBg && hIconSm)
491 {
492 SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM)hIconBg);
493 SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
494 }
495
497 if (Item)
498 {
499 // initialize the default values for our nifty progress bar
500 // and subclass it so that it learns to print a status text
504 if (AppsDownloadList.GetSize() > 0)
505 ProgressBar.SetProgress(0, AppsDownloadList[0].SizeInBytes);
506 }
507
508 // Add a ListView
509 HWND hListView = DownloadsListView.Create(Dlg);
510 if (!hListView)
511 {
512 return FALSE;
513 }
515
516 // Get a dlg string for later use
517 GetWindowTextW(Dlg, szCaption, _countof(szCaption));
518
519 // Hide a placeholder from displaying
520 szTempCaption = szCaption;
521 szTempCaption.Replace(L"%ls", L"");
522 SetWindowText(Dlg, szTempCaption.GetString());
523
524 ShowWindow(Dlg, SW_SHOW);
525
526 // Start download process
527 DownloadParam *param = new DownloadParam(Dlg, AppsDownloadList, szCaption);
528 unsigned int ThreadId;
529 HANDLE Thread = (HANDLE)_beginthreadex(NULL, 0, ThreadFunc, (void *)param, 0, &ThreadId);
530 if (!Thread)
531 {
532 return FALSE;
533 }
534
537 return TRUE;
538 }
539
540 case WM_COMMAND:
541 if (wParam == IDCANCEL)
542 {
544 PostMessageW(Dlg, WM_CLOSE, 0, 0);
545 }
546 return FALSE;
547
548 case WM_CLOSE:
549 if (ProgressBar)
552 {
553 ::EndDialog(Dlg, 0);
554 }
555 else
556 {
557 ::DestroyWindow(Dlg);
558 }
559 return TRUE;
560
561 case WM_DESTROY:
562 g_Busy--;
563 if (hMainWnd)
565 return FALSE;
566
567 default:
568 return FALSE;
569 }
570}
571
573
574VOID
576 HWND hDlg,
577 ULONG ulProgress,
578 ULONG ulProgressMax,
579 ULONG ulStatusCode,
580 LPCWSTR szStatusText)
581{
582 HWND Item;
583
584 if (!IsWindow(hDlg))
585 return;
586 ProgressBar.SetProgress(ulProgress, ulProgressMax);
587
588 if (!IsWindow(hDlg))
589 return;
591 if (Item && szStatusText && wcslen(szStatusText) > 0 && UrlHasBeenCopied == FALSE)
592 {
593 SIZE_T len = wcslen(szStatusText) + 1;
595 DWORD dummyLen;
596
597 /* beautify our url for display purposes */
598 if (!InternetCanonicalizeUrlW(szStatusText, buf.GetBuffer(len), &dummyLen, ICU_DECODE | ICU_NO_ENCODE))
599 {
600 /* just use the original */
601 buf.ReleaseBuffer();
602 buf = szStatusText;
603 }
604 else
605 {
606 buf.ReleaseBuffer();
607 }
608
609 /* paste it into our dialog and don't do it again in this instance */
610 ::SetWindowText(Item, buf.GetString());
612 }
613}
614
615BOOL
616ShowLastError(HWND hWndOwner, BOOL bInetError, DWORD dwLastError)
617{
618 CLocalPtr<WCHAR> lpMsg;
619
620 if (!FormatMessageW(
623 (bInetError ? GetModuleHandleW(L"wininet.dll") : NULL), dwLastError, LANG_USER_DEFAULT, (LPWSTR)&lpMsg, 0,
624 NULL))
625 {
626 DPRINT1("FormatMessageW unexpected failure (err %d)\n", GetLastError());
627 return FALSE;
628 }
629
630 MessageBoxW(hWndOwner, lpMsg, NULL, MB_OK | MB_ICONERROR);
631 return TRUE;
632}
633
634unsigned int WINAPI
636{
637 CPathW Path;
638 PWSTR p, q;
639
640 HWND hDlg = static_cast<DownloadParam *>(param)->Dialog;
641 HWND Item;
642 INT iAppId;
643
644 ULONG dwContentLen, dwBytesWritten, dwBytesRead, dwStatus;
645 ULONG dwCurrentBytesRead = 0;
646 ULONG dwStatusLen = sizeof(dwStatus);
647
648 BOOL bTempfile = FALSE;
649
650 HINTERNET hOpen = NULL;
653
654 unsigned char lpBuffer[4096];
655 LPCWSTR lpszAgent = L"RApps/1.1";
656 URL_COMPONENTSW urlComponents;
657 size_t urlLength, filenameLength;
658
659 const ATL::CSimpleArray<DownloadInfo> &InfoArray = static_cast<DownloadParam *>(param)->AppInfo;
660 LPCWSTR szCaption = static_cast<DownloadParam *>(param)->szCaption;
661 CStringW szNewCaption;
662
663 const DWORD dwUrlConnectFlags =
665
666 if (InfoArray.GetSize() <= 0)
667 {
669 goto end;
670 }
671
672 for (iAppId = 0; iAppId < InfoArray.GetSize(); ++iAppId)
673 {
674 // Reset progress bar
675 if (!IsWindow(hDlg))
676 break;
678 if (Item)
679 {
682 ProgressBar.SetProgress(0, InfoArray[iAppId].SizeInBytes);
683 }
684
685 // is this URL an update package for RAPPS? if so store it in a different place
686 if (InfoArray[iAppId].DLType != DLTYPE_APPLICATION)
687 {
689 {
691 goto end;
692 }
693 }
694 else
695 {
697 }
698
699 // Change caption to show the currently downloaded app
700 switch (InfoArray[iAppId].DLType)
701 {
703 szNewCaption.Format(szCaption, InfoArray[iAppId].szName.GetString());
704 break;
705 case DLTYPE_DBUPDATE:
706 szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_DOWNLOAD_DISP);
707 break;
709 szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP);
710 break;
711 }
712
713 if (!IsWindow(hDlg))
714 goto end;
715 SetWindowTextW(hDlg, szNewCaption.GetString());
716
717 // build the path for the download
718 p = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'/');
719 q = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'?');
720
721 // do we have a final slash separator?
722 if (!p)
723 {
725 goto end;
726 }
727
728 // prepare the tentative length of the filename, maybe we've to remove part of it later on
729 filenameLength = wcslen(p) * sizeof(WCHAR);
730
731 /* do we have query arguments in the target URL after the filename? account for them
732 (e.g. https://example.org/myfile.exe?no_adware_plz) */
733 if (q && q > p && (q - p) > 0)
734 filenameLength -= wcslen(q - 1) * sizeof(WCHAR);
735
736 // is the path valid? can we access it?
738 {
740 {
742 goto end;
743 }
744 }
745
746 switch (InfoArray[iAppId].DLType)
747 {
748 case DLTYPE_DBUPDATE:
751 break;
753 {
754 CStringW str = p + 1; // use the filename retrieved from URL
756 Path += str;
757 break;
758 }
759 }
760
761 if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] &&
763 {
764 // only open it in case of total correctness
765 if (VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path))
766 goto run;
767 }
768
769 // Add the download URL
770 if (!IsWindow(hDlg))
771 goto end;
772 SetDlgItemTextW(hDlg, IDC_DOWNLOAD_STATUS, InfoArray[iAppId].szUrl.GetString());
773
775
776 // download it
778 bTempfile = TRUE;
779
780 /* FIXME: this should just be using the system-wide proxy settings */
781 switch (SettingsInfo.Proxy)
782 {
783 case 0: // preconfig
784 default:
785 hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
786 break;
787 case 1: // direct (no proxy)
788 hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
789 break;
790 case 2: // use proxy
791 hOpen = InternetOpenW(
793 break;
794 }
795
796 if (!hOpen)
797 {
799 goto end;
800 }
801
802 dwStatusLen = sizeof(dwStatus);
803
804 memset(&urlComponents, 0, sizeof(urlComponents));
805 urlComponents.dwStructSize = sizeof(urlComponents);
806
807 urlLength = InfoArray[iAppId].szUrl.GetLength();
808 urlComponents.dwSchemeLength = urlLength + 1;
809 urlComponents.lpszScheme = (LPWSTR)malloc(urlComponents.dwSchemeLength * sizeof(WCHAR));
810
811 if (!InternetCrackUrlW(InfoArray[iAppId].szUrl, urlLength + 1, ICU_DECODE | ICU_ESCAPE, &urlComponents))
812 {
814 goto end;
815 }
816
817 dwContentLen = 0;
818
819 if (urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme == INTERNET_SCHEME_HTTPS)
820 {
821 hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl.GetString(), NULL, 0, dwUrlConnectFlags, 0);
822 if (!hFile)
823 {
825 {
826 /* Workaround for CORE-17377 */
828 }
829 goto end;
830 }
831
832 // query connection
834 {
836 goto end;
837 }
838
840 {
842 goto end;
843 }
844
845 // query content length
847 hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwStatusLen, NULL);
848 }
849 else if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
850 {
851 // force passive mode on FTP
852 hFile =
853 InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl, NULL, 0, dwUrlConnectFlags | INTERNET_FLAG_PASSIVE, 0);
854 if (!hFile)
855 {
857 {
858 /* Workaround for CORE-17377 */
860 }
861 goto end;
862 }
863
864 dwContentLen = FtpGetFileSize(hFile, &dwStatus);
865 }
866 else if (urlComponents.nScheme == INTERNET_SCHEME_FILE)
867 {
868 // Add support for the file scheme so testing locally is simpler
869 WCHAR LocalFilePath[MAX_PATH];
870 DWORD cchPath = _countof(LocalFilePath);
871 // Ideally we would use PathCreateFromUrlAlloc here, but that is not exported (yet)
872 HRESULT hr = PathCreateFromUrlW(InfoArray[iAppId].szUrl, LocalFilePath, &cchPath, 0);
873 if (SUCCEEDED(hr))
874 {
875 if (CopyFileW(LocalFilePath, Path, FALSE))
876 {
877 goto run;
878 }
879 else
880 {
882 goto end;
883 }
884 }
885 else
886 {
888 goto end;
889 }
890 }
891
892 if (!dwContentLen)
893 {
894 // Someone was nice enough to add this, let's use it
895 if (InfoArray[iAppId].SizeInBytes)
896 {
897 dwContentLen = InfoArray[iAppId].SizeInBytes;
898 }
899 else
900 {
901 // content-length is not known, enable marquee mode
903 }
904 }
905
906 free(urlComponents.lpszScheme);
907
908#ifdef USE_CERT_PINNING
909 // are we using HTTPS to download the RAPPS update package? check if the certificate is original
910 if ((urlComponents.nScheme == INTERNET_SCHEME_HTTPS) && (InfoArray[iAppId].DLType == DLTYPE_DBUPDATE))
911 {
912 CLocalPtr<char> subjectName, issuerName;
913 CStringA szMsgText;
914 bool bAskQuestion = false;
915 if (!CertGetSubjectAndIssuer(hFile, subjectName, issuerName))
916 {
917 szMsgText.LoadStringW(IDS_UNABLE_TO_QUERY_CERT);
918 bAskQuestion = true;
919 }
920 else
921 {
922 if (strcmp(subjectName, CERT_SUBJECT_INFO) ||
923 (strcmp(issuerName, CERT_ISSUER_INFO_OLD) && strcmp(issuerName, CERT_ISSUER_INFO_NEW)))
924 {
925 szMsgText.Format(IDS_MISMATCH_CERT_INFO, (char *)subjectName, (const char *)issuerName);
926 bAskQuestion = true;
927 }
928 }
929
930 if (bAskQuestion)
931 {
933 {
934 goto end;
935 }
936 }
937 }
938#endif
939
941
942 if (hOut == INVALID_HANDLE_VALUE)
943 {
945 goto end;
946 }
947
948 dwCurrentBytesRead = 0;
949 do
950 {
951 if (!InternetReadFile(hFile, lpBuffer, _countof(lpBuffer), &dwBytesRead))
952 {
954 goto end;
955 }
956
957 if (!WriteFile(hOut, &lpBuffer[0], dwBytesRead, &dwBytesWritten, NULL))
958 {
960 goto end;
961 }
962
963 dwCurrentBytesRead += dwBytesRead;
964 if (!IsWindow(hDlg))
965 goto end;
966 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
967 } while (dwBytesRead && !bCancelled);
968
969 CloseHandle(hOut);
971
972 if (bCancelled)
973 {
974 DPRINT1("Operation cancelled\n");
975 goto end;
976 }
977
978 if (!dwContentLen)
979 {
980 // set progress bar to 100%
982
983 dwContentLen = dwCurrentBytesRead;
984 if (!IsWindow(hDlg))
985 goto end;
986 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
987 }
988
989 /* if this thing isn't a RAPPS update and it has a SHA-1 checksum
990 verify its integrity by using the native advapi32.A_SHA1 functions */
991 if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] != 0)
992 {
993 CStringW szMsgText;
994
995 // change a few strings in the download dialog to reflect the verification process
996 if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_TITLE))
997 {
998 DPRINT1("Unable to load string\n");
999 goto end;
1000 }
1001
1002 if (!IsWindow(hDlg))
1003 goto end;
1004 SetWindowTextW(hDlg, szMsgText.GetString());
1006
1007 // this may take a while, depending on the file size
1008 if (!VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path))
1009 {
1010 if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_FAIL))
1011 {
1012 DPRINT1("Unable to load string\n");
1013 goto end;
1014 }
1015
1016 if (!IsWindow(hDlg))
1017 goto end;
1018 MessageBoxW(hDlg, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
1019 goto end;
1020 }
1021 }
1022
1023 run:
1025
1026 // run it
1027 if (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)
1028 {
1029 CStringW app, params;
1030 SHELLEXECUTEINFOW shExInfo = {0};
1031 shExInfo.cbSize = sizeof(shExInfo);
1032 shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
1033 shExInfo.lpVerb = L"open";
1034 shExInfo.lpFile = Path;
1035 shExInfo.lpParameters = L"";
1036 shExInfo.nShow = SW_SHOW;
1037
1038 if (InfoArray[iAppId].IType == INSTALLER_GENERATE)
1039 {
1040 params = L"/" + CStringW(CMD_KEY_GENINST) + L" \"" +
1041 InfoArray[iAppId].szPackageName + L"\" \"" +
1042 CStringW(shExInfo.lpFile) + L"\"";
1043 shExInfo.lpParameters = params;
1044 shExInfo.lpFile = app.GetBuffer(MAX_PATH);
1045 GetModuleFileNameW(NULL, const_cast<LPWSTR>(shExInfo.lpFile), MAX_PATH);
1046 app.ReleaseBuffer();
1047 }
1048
1049 /* FIXME: Do we want to log installer status? */
1050 WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_INSTALL, InfoArray[iAppId].szName);
1051
1052 if (ShellExecuteExW(&shExInfo))
1053 {
1054 // reflect installation progress in the titlebar
1055 // TODO: make a separate string with a placeholder to include app name?
1057 if (!IsWindow(hDlg))
1058 goto end;
1059 SetWindowTextW(hDlg, szMsgText.GetString());
1060
1062
1063 // TODO: issue an install operation separately so that the apps could be downloaded in the background
1065 CloseHandle(shExInfo.hProcess);
1066 }
1067 else
1068 {
1070 }
1071 }
1072
1073 end:
1074 if (hOut != INVALID_HANDLE_VALUE)
1075 CloseHandle(hOut);
1076
1077 if (hFile)
1079 InternetCloseHandle(hOpen);
1080
1081 if (bTempfile)
1082 {
1083 if (bCancelled || (SettingsInfo.bDelInstaller && (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)))
1085 }
1086
1087 if (!IsWindow(hDlg))
1088 return 0;
1090 }
1091
1092 delete static_cast<DownloadParam *>(param);
1093 if (!IsWindow(hDlg))
1094 return 0;
1095 SendMessageW(hDlg, WM_CLOSE, 0, 0);
1096 return 0;
1097}
1098
1099// TODO: Reuse the dialog
1100VOID
1102{
1103 CDownloadManager::bModal = bIsModal;
1104 if (bIsModal)
1105 {
1107 }
1108 else
1109 {
1111 }
1112}
1113// CDownloadManager
1114
1115BOOL
1117{
1118 if (AppsList.IsEmpty())
1119 return FALSE;
1120
1121 POSITION CurrentListPosition = AppsList.GetHeadPosition();
1122 while (CurrentListPosition)
1123 {
1124 const CAppInfo *Info = AppsList.GetNext(CurrentListPosition);
1126 }
1127
1128 // Create a dialog and issue a download process
1130
1131 return TRUE;
1132}
1133
1134BOOL
1136{
1137 if (!pAppInfo)
1138 return FALSE;
1139
1141 return TRUE;
1142}
1143
1144VOID
1146{
1147 static DownloadInfo DatabaseDLInfo;
1148 DatabaseDLInfo.szUrl = lpUrl;
1149 DatabaseDLInfo.szName.LoadStringW(IDS_DL_DIALOG_DB_DISP);
1150 DatabaseDLInfo.DLType = IsOfficial ? DLTYPE_DBUPDATE : DLTYPE_DBUPDATE_UNOFFICIAL;
1151 CDownloadManager::Download(DatabaseDLInfo, TRUE);
1152}
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:252
BOOL GetStorageDirectory(CStringW &lpDirectory)
Definition: misc.cpp:170
#define IDD_DOWNLOAD_DIALOG
Definition: resource.h:65
#define IDS_UNABLE_TO_DOWNLOAD
Definition: resource.h:114
#define IDS_MISMATCH_CERT_INFO
Definition: resource.h:124
#define IDS_STATUS_FINISHED
Definition: resource.h:206
#define IDS_STATUS_WAITING
Definition: resource.h:205
#define IDS_DL_DIALOG_DB_DISP
Definition: resource.h:222
#define IDS_STATUS_INSTALLING
Definition: resource.h:204
#define IDS_UNABLE_TO_DOWNLOAD2
Definition: resource.h:115
#define IDC_DOWNLOAD_PROGRESS
Definition: resource.h:41
#define IDS_UNABLE_PATH
Definition: resource.h:125
#define IDS_STATUS_DOWNLOADED
Definition: resource.h:201
#define IDS_STATUS_DOWNLOADING
Definition: resource.h:203
#define IDS_UNABLE_TO_QUERY_CERT
Definition: resource.h:116
#define IDC_DOWNLOAD_STATUS
Definition: resource.h:42
#define IDS_STATUS_INSTALLED
Definition: resource.h:199
#define IDS_INTEG_CHECK_TITLE
Definition: resource.h:117
#define IDS_DL_DIALOG_DB_DOWNLOAD_DISP
Definition: resource.h:223
#define IDS_INTEG_CHECK_FAIL
Definition: resource.h:118
#define IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP
Definition: resource.h:224
SETTINGS_INFO SettingsInfo
Definition: winmain.cpp:21
#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:575
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:635
static VOID LaunchDownloadDialog(BOOL)
Definition: loaddlg.cpp:1101
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:1852
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:1135
BOOL UrlHasBeenCopied
Definition: loaddlg.cpp:572
VOID UrlUnescapeAndMakeFileNameValid(CStringW &str)
Definition: loaddlg.cpp:94
BOOL ShowLastError(HWND hWndOwner, BOOL bInetError, DWORD dwLastError)
Definition: loaddlg.cpp:616
BOOL DownloadListOfApplications(const CAtlList< CAppInfo * > &AppsList, BOOL bIsModal)
Definition: loaddlg.cpp:1116
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:1145
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:88
static HICON
Definition: imagelist.c:80
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:2271
#define LVS_NOCOLUMNHEADER
Definition: commctrl.h:2289
#define PBS_MARQUEE
Definition: commctrl.h:2203
#define LVIF_STATE
Definition: commctrl.h:2317
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2272
#define LVS_REPORT
Definition: commctrl.h:2267
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define PBM_SETPOS
Definition: commctrl.h:2189
#define PBM_SETRANGE
Definition: commctrl.h:2188
#define LVS_NOSORTHEADER
Definition: commctrl.h:2290
#define LVIF_TEXT
Definition: commctrl.h:2314
#define LVCF_FMT
Definition: commctrl.h:2591
#define LVCF_SUBITEM
Definition: commctrl.h:2594
#define LVCFMT_LEFT
Definition: commctrl.h:2603
#define PBM_SETMARQUEE
Definition: commctrl.h:2204
DWORD dwStatus
Definition: mediaobj.idl:95
#define WM_NOTIFY_OPERATIONCOMPLETED
Definition: rapps.h:18
LONG g_Busy
Definition: winmain.cpp:17
#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:2424
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:1623
#define WM_ERASEBKGND
Definition: winuser.h:1628
DWORD WINAPI GetSysColor(_In_ int)
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define WM_CLOSE
Definition: winuser.h:1624
#define DT_NOPREFIX
Definition: winuser.h:537
#define GCLP_HICONSM
Definition: winuser.h:675
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define DT_CENTER
Definition: winuser.h:527
#define IDCANCEL
Definition: winuser.h:834
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:4402
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:1743
#define COLOR_3DDKSHADOW
Definition: winuser.h:942
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_INITDIALOG
Definition: winuser.h:1742
#define MB_YESNO
Definition: winuser.h:820
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:790
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define WM_SETTEXT
Definition: winuser.h:1620
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define SendMessage
Definition: winuser.h:5855
#define MB_OK
Definition: winuser.h:793
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4284
#define DT_VCENTER
Definition: winuser.h:543
#define PostMessage
Definition: winuser.h:5844
#define GetClassLongPtrW
Definition: winuser.h:4567
#define SW_SHOW
Definition: winuser.h:778
#define WM_DESTROY
Definition: winuser.h:1612
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define SetWindowText
Definition: winuser.h:5869
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDYES
Definition: winuser.h:838
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define COLOR_CAPTIONTEXT
Definition: winuser.h:925
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