ReactOS 0.4.15-dev-7788-g1ad9096
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
53#ifdef USE_CERT_PINNING
54#define CERT_ISSUER_INFO_OLD "US\r\nLet's Encrypt\r\nLet's Encrypt Authority X3"
55#define CERT_ISSUER_INFO_NEW "US\r\nLet's Encrypt\r\nR3"
56#define CERT_SUBJECT_INFO "rapps.reactos.org"
57#endif
58
60{
64};
65
67{
74};
75
78{
79 CStringW szString;
80 szString.LoadStringW(StatusParam);
81 return szString;
82}
83
84#define FILENAME_VALID_CHAR ( \
85 PATH_CHAR_CLASS_LETTER | \
86 PATH_CHAR_CLASS_DOT | \
87 PATH_CHAR_CLASS_SEMICOLON | \
88 PATH_CHAR_CLASS_COMMA | \
89 PATH_CHAR_CLASS_SPACE | \
90 PATH_CHAR_CLASS_OTHER_VALID)
91
92VOID
94{
96 DWORD cchPath = _countof(szPath);
97 UrlUnescapeW(const_cast<LPWSTR>((LPCWSTR)str), szPath, &cchPath, 0);
98
99 for (PWCHAR pch = szPath; *pch; ++pch)
100 {
102 *pch = L'_';
103 }
104
105 str = szPath;
106}
107
109{
111 {
112 }
114 {
116 szName = AppInfo.szDisplayName;
117 }
118
124};
125
127{
129 {
130 }
132 : Dialog(dlg), AppInfo(info), szCaption(caption)
133 {
134 }
135
139};
140
141class CDownloaderProgress : public CWindowImpl<CDownloaderProgress, CWindow, CControlWinTraits>
142{
144
145 public:
147 {
148 }
149
150 VOID
152 {
153 if (Enable)
155 else
157
159 }
160
161 VOID
162 SetProgress(ULONG ulProgress, ULONG ulProgressMax)
163 {
164 WCHAR szProgress[100];
165
166 /* format the bits and bytes into pretty and accessible units... */
167 StrFormatByteSizeW(ulProgress, szProgress, _countof(szProgress));
168
169 /* use our subclassed progress bar text subroutine */
170 CStringW ProgressText;
171
172 if (ulProgressMax)
173 {
174 /* total size is known */
175 WCHAR szProgressMax[100];
176 UINT uiPercentage = ((ULONGLONG)ulProgress * 100) / ulProgressMax;
177
178 /* send the current progress to the progress bar */
179 if (!IsWindow())
180 return;
181 SendMessage(PBM_SETPOS, uiPercentage, 0);
182
183 /* format total download size */
184 StrFormatByteSizeW(ulProgressMax, szProgressMax, _countof(szProgressMax));
185
186 /* generate the text on progress bar */
187 ProgressText.Format(L"%u%% \x2014 %ls / %ls", uiPercentage, szProgress, szProgressMax);
188 }
189 else
190 {
191 /* send the current progress to the progress bar */
192 if (!IsWindow())
193 return;
194 SendMessage(PBM_SETPOS, 0, 0);
195
196 /* total size is not known, display only current size */
197 ProgressText.Format(L"%ls...", szProgress);
198 }
199
200 /* and finally display it */
201 if (!IsWindow())
202 return;
203 SetWindowText(ProgressText.GetString());
204 }
205
206 LRESULT
208 {
209 return TRUE;
210 }
211
212 LRESULT
214 {
215 PAINTSTRUCT ps;
216 HDC hDC = BeginPaint(&ps), hdcMem;
217 HBITMAP hbmMem;
218 HANDLE hOld;
219 RECT myRect;
220 UINT win_width, win_height;
221
222 GetClientRect(&myRect);
223
224 /* grab the progress bar rect size */
225 win_width = myRect.right - myRect.left;
226 win_height = myRect.bottom - myRect.top;
227
228 /* create an off-screen DC for double-buffering */
230 hbmMem = CreateCompatibleBitmap(hDC, win_width, win_height);
231
232 hOld = SelectObject(hdcMem, hbmMem);
233
234 /* call the original draw code and redirect it to our memory buffer */
236
237 /* draw our nifty progress text over it */
243
244 /* transfer the off-screen DC to the screen */
245 BitBlt(hDC, 0, 0, win_width, win_height, hdcMem, 0, 0, SRCCOPY);
246
247 /* free the off-screen DC */
248 SelectObject(hdcMem, hOld);
249 DeleteObject(hbmMem);
251
252 EndPaint(&ps);
253 return 0;
254 }
255
256 LRESULT
258 {
259 PCWSTR pszText = (PCWSTR)lParam;
260 if (pszText)
261 {
262 if (m_szProgressText != pszText)
263 {
264 m_szProgressText = pszText;
266 }
267 }
268 else
269 {
271 {
274 }
275 }
276 return TRUE;
277 }
278
284};
285
287{
288 public:
289 HWND
291 {
292 RECT r;
294 r.top = (2 * r.top + 1 * r.bottom) / 3; /* The vertical position at ratio 1 : 2 */
295#define MARGIN 10
297
300
302
303 AddColumn(0, 150, LVCFMT_LEFT);
304 AddColumn(1, 120, LVCFMT_LEFT);
305
306 return hwnd;
307 }
308
309 VOID
311 {
312 for (INT i = 0; i < arrInfo.GetSize(); ++i)
313 {
314 AddRow(i, arrInfo[i].szName.GetString(), DLSTATUS_WAITING);
315 }
316 }
317
318 VOID
320 {
321 CStringW szBuffer = LoadStatusString(Status);
322 SetItemText(ItemIndex, 1, szBuffer.GetString());
323 }
324
325 BOOL
326 AddItem(INT ItemIndex, LPWSTR lpText)
327 {
329
330 ZeroMemory(&Item, sizeof(Item));
331
332 Item.mask = LVIF_TEXT | LVIF_STATE;
333 Item.pszText = lpText;
334 Item.iItem = ItemIndex;
335
336 return InsertItem(&Item);
337 }
338
339 VOID
341 {
342 CStringW szStatus = LoadStatusString(Status);
343 AddItem(RowIndex, const_cast<LPWSTR>(szAppName));
344 SetDownloadStatus(RowIndex, Status);
345 }
346
347 BOOL
349 {
350 LVCOLUMNW Column;
351 ZeroMemory(&Column, sizeof(Column));
352
354 Column.iSubItem = Index;
355 Column.cx = Width;
356 Column.fmt = Format;
357
358 return (InsertColumn(Index, &Column) == -1) ? FALSE : TRUE;
359 }
360};
361
362#ifdef USE_CERT_PINNING
363static BOOL
364CertGetSubjectAndIssuer(HINTERNET hFile, CLocalPtr<char> &subjectInfo, CLocalPtr<char> &issuerInfo)
365{
366 DWORD certInfoLength;
369
370 size = sizeof(flags);
372 {
373 return FALSE;
374 }
375
377 {
378 return FALSE;
379 }
380
381 /* Despite what the header indicates, the implementation of INTERNET_CERTIFICATE_INFO is not Unicode-aware. */
382 certInfoLength = sizeof(certInfo);
384 {
385 return FALSE;
386 }
387
388 subjectInfo.Attach(certInfo.lpszSubjectInfo);
389 issuerInfo.Attach(certInfo.lpszIssuerInfo);
390
391 if (certInfo.lpszProtocolName)
392 LocalFree(certInfo.lpszProtocolName);
393 if (certInfo.lpszSignatureAlgName)
395 if (certInfo.lpszEncryptionAlgName)
397
398 return certInfo.lpszSubjectInfo && certInfo.lpszIssuerInfo;
399}
400#endif
401
402inline VOID
404{
405 CStringW szMsgText;
406 if (szMsgText.LoadStringW(StringID))
407 {
409 }
410}
411
412// Download dialog (loaddlg.cpp)
414{
419 static BOOL bModal;
420 static VOID
421 UpdateProgress(HWND hDlg, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText);
422
423 public:
424 static VOID
426 static VOID
427 Download(const DownloadInfo &DLInfo, BOOL bIsModal = FALSE);
428 static INT_PTR CALLBACK
430 static unsigned int WINAPI
433};
434
435// CDownloadManager
441
442VOID
444{
446}
447
448VOID
450{
452 AppsDownloadList.Add(DLInfo);
453 LaunchDownloadDialog(bIsModal);
454}
455
458{
459 static WCHAR szCaption[MAX_PATH];
460
461 switch (uMsg)
462 {
463 case WM_INITDIALOG:
464 {
465 HICON hIconSm, hIconBg;
466 CStringW szTempCaption;
467
469
470 if (hMainWnd)
471 {
474 }
475 if (!hMainWnd || (!hIconBg || !hIconSm))
476 {
477 /* Load the default icon */
479 }
480
481 if (hIconBg && hIconSm)
482 {
483 SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM)hIconBg);
484 SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
485 }
486
488 if (Item)
489 {
490 // initialize the default values for our nifty progress bar
491 // and subclass it so that it learns to print a status text
495 if (AppsDownloadList.GetSize() > 0)
496 ProgressBar.SetProgress(0, AppsDownloadList[0].SizeInBytes);
497 }
498
499 // Add a ListView
500 HWND hListView = DownloadsListView.Create(Dlg);
501 if (!hListView)
502 {
503 return FALSE;
504 }
506
507 // Get a dlg string for later use
508 GetWindowTextW(Dlg, szCaption, _countof(szCaption));
509
510 // Hide a placeholder from displaying
511 szTempCaption = szCaption;
512 szTempCaption.Replace(L"%ls", L"");
513 SetWindowText(Dlg, szTempCaption.GetString());
514
515 ShowWindow(Dlg, SW_SHOW);
516
517 // Start download process
518 DownloadParam *param = new DownloadParam(Dlg, AppsDownloadList, szCaption);
519 unsigned int ThreadId;
520 HANDLE Thread = (HANDLE)_beginthreadex(NULL, 0, ThreadFunc, (void *)param, 0, &ThreadId);
521 if (!Thread)
522 {
523 return FALSE;
524 }
525
528 return TRUE;
529 }
530
531 case WM_COMMAND:
532 if (wParam == IDCANCEL)
533 {
535 PostMessageW(Dlg, WM_CLOSE, 0, 0);
536 }
537 return FALSE;
538
539 case WM_CLOSE:
540 if (ProgressBar)
543 {
544 ::EndDialog(Dlg, 0);
545 }
546 else
547 {
548 ::DestroyWindow(Dlg);
549 }
550 return TRUE;
551
552 default:
553 return FALSE;
554 }
555}
556
558
559VOID
561 HWND hDlg,
562 ULONG ulProgress,
563 ULONG ulProgressMax,
564 ULONG ulStatusCode,
565 LPCWSTR szStatusText)
566{
567 HWND Item;
568
569 if (!IsWindow(hDlg))
570 return;
571 ProgressBar.SetProgress(ulProgress, ulProgressMax);
572
573 if (!IsWindow(hDlg))
574 return;
576 if (Item && szStatusText && wcslen(szStatusText) > 0 && UrlHasBeenCopied == FALSE)
577 {
578 SIZE_T len = wcslen(szStatusText) + 1;
580 DWORD dummyLen;
581
582 /* beautify our url for display purposes */
583 if (!InternetCanonicalizeUrlW(szStatusText, buf.GetBuffer(len), &dummyLen, ICU_DECODE | ICU_NO_ENCODE))
584 {
585 /* just use the original */
586 buf.ReleaseBuffer();
587 buf = szStatusText;
588 }
589 else
590 {
591 buf.ReleaseBuffer();
592 }
593
594 /* paste it into our dialog and don't do it again in this instance */
595 ::SetWindowText(Item, buf.GetString());
597 }
598}
599
600BOOL
601ShowLastError(HWND hWndOwner, BOOL bInetError, DWORD dwLastError)
602{
603 CLocalPtr<WCHAR> lpMsg;
604
605 if (!FormatMessageW(
608 (bInetError ? GetModuleHandleW(L"wininet.dll") : NULL), dwLastError, LANG_USER_DEFAULT, (LPWSTR)&lpMsg, 0,
609 NULL))
610 {
611 DPRINT1("FormatMessageW unexpected failure (err %d)\n", GetLastError());
612 return FALSE;
613 }
614
615 MessageBoxW(hWndOwner, lpMsg, NULL, MB_OK | MB_ICONERROR);
616 return TRUE;
617}
618
619unsigned int WINAPI
621{
622 CPathW Path;
623 PWSTR p, q;
624
625 HWND hDlg = static_cast<DownloadParam *>(param)->Dialog;
626 HWND Item;
627 INT iAppId;
628
629 ULONG dwContentLen, dwBytesWritten, dwBytesRead, dwStatus;
630 ULONG dwCurrentBytesRead = 0;
631 ULONG dwStatusLen = sizeof(dwStatus);
632
633 BOOL bTempfile = FALSE;
634
635 HINTERNET hOpen = NULL;
638
639 unsigned char lpBuffer[4096];
640 LPCWSTR lpszAgent = L"RApps/1.1";
641 URL_COMPONENTSW urlComponents;
642 size_t urlLength, filenameLength;
643
644 const ATL::CSimpleArray<DownloadInfo> &InfoArray = static_cast<DownloadParam *>(param)->AppInfo;
645 LPCWSTR szCaption = static_cast<DownloadParam *>(param)->szCaption;
646 CStringW szNewCaption;
647
648 const DWORD dwUrlConnectFlags =
650
651 if (InfoArray.GetSize() <= 0)
652 {
654 goto end;
655 }
656
657 for (iAppId = 0; iAppId < InfoArray.GetSize(); ++iAppId)
658 {
659 // Reset progress bar
660 if (!IsWindow(hDlg))
661 break;
663 if (Item)
664 {
667 ProgressBar.SetProgress(0, InfoArray[iAppId].SizeInBytes);
668 }
669
670 // is this URL an update package for RAPPS? if so store it in a different place
671 if (InfoArray[iAppId].DLType != DLTYPE_APPLICATION)
672 {
674 {
676 goto end;
677 }
678 }
679 else
680 {
682 }
683
684 // Change caption to show the currently downloaded app
685 switch (InfoArray[iAppId].DLType)
686 {
688 szNewCaption.Format(szCaption, InfoArray[iAppId].szName.GetString());
689 break;
690 case DLTYPE_DBUPDATE:
691 szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_DOWNLOAD_DISP);
692 break;
694 szNewCaption.LoadStringW(IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP);
695 break;
696 }
697
698 if (!IsWindow(hDlg))
699 goto end;
700 SetWindowTextW(hDlg, szNewCaption.GetString());
701
702 // build the path for the download
703 p = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'/');
704 q = wcsrchr(InfoArray[iAppId].szUrl.GetString(), L'?');
705
706 // do we have a final slash separator?
707 if (!p)
708 {
710 goto end;
711 }
712
713 // prepare the tentative length of the filename, maybe we've to remove part of it later on
714 filenameLength = wcslen(p) * sizeof(WCHAR);
715
716 /* do we have query arguments in the target URL after the filename? account for them
717 (e.g. https://example.org/myfile.exe?no_adware_plz) */
718 if (q && q > p && (q - p) > 0)
719 filenameLength -= wcslen(q - 1) * sizeof(WCHAR);
720
721 // is the path valid? can we access it?
723 {
725 {
727 goto end;
728 }
729 }
730
731 switch (InfoArray[iAppId].DLType)
732 {
733 case DLTYPE_DBUPDATE:
736 break;
738 {
739 CStringW str = p + 1; // use the filename retrieved from URL
741 Path += str;
742 break;
743 }
744 }
745
746 if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] &&
748 {
749 // only open it in case of total correctness
750 if (VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path))
751 goto run;
752 }
753
754 // Add the download URL
755 if (!IsWindow(hDlg))
756 goto end;
757 SetDlgItemTextW(hDlg, IDC_DOWNLOAD_STATUS, InfoArray[iAppId].szUrl.GetString());
758
760
761 // download it
763 bTempfile = TRUE;
764
765 /* FIXME: this should just be using the system-wide proxy settings */
766 switch (SettingsInfo.Proxy)
767 {
768 case 0: // preconfig
769 default:
770 hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
771 break;
772 case 1: // direct (no proxy)
773 hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
774 break;
775 case 2: // use proxy
776 hOpen = InternetOpenW(
778 break;
779 }
780
781 if (!hOpen)
782 {
784 goto end;
785 }
786
787 dwStatusLen = sizeof(dwStatus);
788
789 memset(&urlComponents, 0, sizeof(urlComponents));
790 urlComponents.dwStructSize = sizeof(urlComponents);
791
792 urlLength = InfoArray[iAppId].szUrl.GetLength();
793 urlComponents.dwSchemeLength = urlLength + 1;
794 urlComponents.lpszScheme = (LPWSTR)malloc(urlComponents.dwSchemeLength * sizeof(WCHAR));
795
796 if (!InternetCrackUrlW(InfoArray[iAppId].szUrl, urlLength + 1, ICU_DECODE | ICU_ESCAPE, &urlComponents))
797 {
799 goto end;
800 }
801
802 dwContentLen = 0;
803
804 if (urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme == INTERNET_SCHEME_HTTPS)
805 {
806 hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl.GetString(), NULL, 0, dwUrlConnectFlags, 0);
807 if (!hFile)
808 {
810 {
811 /* Workaround for CORE-17377 */
813 }
814 goto end;
815 }
816
817 // query connection
819 {
821 goto end;
822 }
823
825 {
827 goto end;
828 }
829
830 // query content length
832 hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwStatusLen, NULL);
833 }
834 else if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
835 {
836 // force passive mode on FTP
837 hFile =
838 InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl, NULL, 0, dwUrlConnectFlags | INTERNET_FLAG_PASSIVE, 0);
839 if (!hFile)
840 {
842 {
843 /* Workaround for CORE-17377 */
845 }
846 goto end;
847 }
848
849 dwContentLen = FtpGetFileSize(hFile, &dwStatus);
850 }
851 else if (urlComponents.nScheme == INTERNET_SCHEME_FILE)
852 {
853 // Add support for the file scheme so testing locally is simpler
854 WCHAR LocalFilePath[MAX_PATH];
855 DWORD cchPath = _countof(LocalFilePath);
856 // Ideally we would use PathCreateFromUrlAlloc here, but that is not exported (yet)
857 HRESULT hr = PathCreateFromUrlW(InfoArray[iAppId].szUrl, LocalFilePath, &cchPath, 0);
858 if (SUCCEEDED(hr))
859 {
860 if (CopyFileW(LocalFilePath, Path, FALSE))
861 {
862 goto run;
863 }
864 else
865 {
867 goto end;
868 }
869 }
870 else
871 {
873 goto end;
874 }
875 }
876
877 if (!dwContentLen)
878 {
879 // Someone was nice enough to add this, let's use it
880 if (InfoArray[iAppId].SizeInBytes)
881 {
882 dwContentLen = InfoArray[iAppId].SizeInBytes;
883 }
884 else
885 {
886 // content-length is not known, enable marquee mode
888 }
889 }
890
891 free(urlComponents.lpszScheme);
892
893#ifdef USE_CERT_PINNING
894 // are we using HTTPS to download the RAPPS update package? check if the certificate is original
895 if ((urlComponents.nScheme == INTERNET_SCHEME_HTTPS) && (InfoArray[iAppId].DLType == DLTYPE_DBUPDATE))
896 {
897 CLocalPtr<char> subjectName, issuerName;
898 CStringA szMsgText;
899 bool bAskQuestion = false;
900 if (!CertGetSubjectAndIssuer(hFile, subjectName, issuerName))
901 {
902 szMsgText.LoadStringW(IDS_UNABLE_TO_QUERY_CERT);
903 bAskQuestion = true;
904 }
905 else
906 {
907 if (strcmp(subjectName, CERT_SUBJECT_INFO) ||
908 (strcmp(issuerName, CERT_ISSUER_INFO_OLD) && strcmp(issuerName, CERT_ISSUER_INFO_NEW)))
909 {
910 szMsgText.Format(IDS_MISMATCH_CERT_INFO, (char *)subjectName, (const char *)issuerName);
911 bAskQuestion = true;
912 }
913 }
914
915 if (bAskQuestion)
916 {
918 {
919 goto end;
920 }
921 }
922 }
923#endif
924
926
927 if (hOut == INVALID_HANDLE_VALUE)
928 {
930 goto end;
931 }
932
933 dwCurrentBytesRead = 0;
934 do
935 {
936 if (!InternetReadFile(hFile, lpBuffer, _countof(lpBuffer), &dwBytesRead))
937 {
939 goto end;
940 }
941
942 if (!WriteFile(hOut, &lpBuffer[0], dwBytesRead, &dwBytesWritten, NULL))
943 {
945 goto end;
946 }
947
948 dwCurrentBytesRead += dwBytesRead;
949 if (!IsWindow(hDlg))
950 goto end;
951 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
952 } while (dwBytesRead && !bCancelled);
953
954 CloseHandle(hOut);
956
957 if (bCancelled)
958 {
959 DPRINT1("Operation cancelled\n");
960 goto end;
961 }
962
963 if (!dwContentLen)
964 {
965 // set progress bar to 100%
967
968 dwContentLen = dwCurrentBytesRead;
969 if (!IsWindow(hDlg))
970 goto end;
971 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
972 }
973
974 /* if this thing isn't a RAPPS update and it has a SHA-1 checksum
975 verify its integrity by using the native advapi32.A_SHA1 functions */
976 if ((InfoArray[iAppId].DLType == DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] != 0)
977 {
978 CStringW szMsgText;
979
980 // change a few strings in the download dialog to reflect the verification process
981 if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_TITLE))
982 {
983 DPRINT1("Unable to load string\n");
984 goto end;
985 }
986
987 if (!IsWindow(hDlg))
988 goto end;
989 SetWindowTextW(hDlg, szMsgText.GetString());
991
992 // this may take a while, depending on the file size
993 if (!VerifyInteg(InfoArray[iAppId].szSHA1.GetString(), Path))
994 {
995 if (!szMsgText.LoadStringW(IDS_INTEG_CHECK_FAIL))
996 {
997 DPRINT1("Unable to load string\n");
998 goto end;
999 }
1000
1001 if (!IsWindow(hDlg))
1002 goto end;
1003 MessageBoxW(hDlg, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
1004 goto end;
1005 }
1006 }
1007
1008 run:
1010
1011 // run it
1012 if (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)
1013 {
1014 SHELLEXECUTEINFOW shExInfo = {0};
1015 shExInfo.cbSize = sizeof(shExInfo);
1016 shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
1017 shExInfo.lpVerb = L"open";
1018 shExInfo.lpFile = Path;
1019 shExInfo.lpParameters = L"";
1020 shExInfo.nShow = SW_SHOW;
1021
1022 /* FIXME: Do we want to log installer status? */
1023 WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_INSTALL, InfoArray[iAppId].szName);
1024
1025 if (ShellExecuteExW(&shExInfo))
1026 {
1027 // reflect installation progress in the titlebar
1028 // TODO: make a separate string with a placeholder to include app name?
1030 if (!IsWindow(hDlg))
1031 goto end;
1032 SetWindowTextW(hDlg, szMsgText.GetString());
1033
1035
1036 // TODO: issue an install operation separately so that the apps could be downloaded in the background
1038 CloseHandle(shExInfo.hProcess);
1039 }
1040 else
1041 {
1043 }
1044 }
1045
1046 end:
1047 if (hOut != INVALID_HANDLE_VALUE)
1048 CloseHandle(hOut);
1049
1050 if (hFile)
1052 InternetCloseHandle(hOpen);
1053
1054 if (bTempfile)
1055 {
1056 if (bCancelled || (SettingsInfo.bDelInstaller && (InfoArray[iAppId].DLType == DLTYPE_APPLICATION)))
1058 }
1059
1060 if (!IsWindow(hDlg))
1061 return 0;
1063 }
1064
1065 delete static_cast<DownloadParam *>(param);
1066 if (!IsWindow(hDlg))
1067 return 0;
1068 SendMessageW(hDlg, WM_CLOSE, 0, 0);
1069 return 0;
1070}
1071
1072// TODO: Reuse the dialog
1073VOID
1075{
1076 CDownloadManager::bModal = bIsModal;
1077 if (bIsModal)
1078 {
1080 }
1081 else
1082 {
1084 }
1085}
1086// CDownloadManager
1087
1088BOOL
1090{
1091 if (AppsList.IsEmpty())
1092 return FALSE;
1093
1094 POSITION CurrentListPosition = AppsList.GetHeadPosition();
1095 while (CurrentListPosition)
1096 {
1097 const CAppInfo *Info = AppsList.GetNext(CurrentListPosition);
1099 }
1100
1101 // Create a dialog and issue a download process
1103
1104 return TRUE;
1105}
1106
1107BOOL
1109{
1110 if (!pAppInfo)
1111 return FALSE;
1112
1114 return TRUE;
1115}
1116
1117VOID
1119{
1120 static DownloadInfo DatabaseDLInfo;
1121 DatabaseDLInfo.szUrl = lpUrl;
1122 DatabaseDLInfo.szName.LoadStringW(IDS_DL_DIALOG_DB_DISP);
1123 DatabaseDLInfo.DLType = IsOfficial ? DLTYPE_DBUPDATE : DLTYPE_DBUPDATE_UNOFFICIAL;
1124 CDownloadManager::Download(DatabaseDLInfo, TRUE);
1125}
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
#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:227
BOOL GetStorageDirectory(CStringW &lpDirectory)
Definition: misc.cpp:145
#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
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
CStringW szDisplayName
Definition: appinfo.h:78
HWND Create(HWND hwndParent)
Definition: loaddlg.cpp:290
VOID LoadList(ATL::CSimpleArray< DownloadInfo > arrInfo)
Definition: loaddlg.cpp:310
VOID SetDownloadStatus(INT ItemIndex, DownloadStatus Status)
Definition: loaddlg.cpp:319
VOID AddRow(INT RowIndex, LPCWSTR szAppName, const DownloadStatus Status)
Definition: loaddlg.cpp:340
BOOL AddColumn(INT Index, INT Width, INT Format)
Definition: loaddlg.cpp:348
BOOL AddItem(INT ItemIndex, LPWSTR lpText)
Definition: loaddlg.cpp:326
static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: loaddlg.cpp:457
static BOOL bCancelled
Definition: loaddlg.cpp:418
static ATL::CSimpleArray< DownloadInfo > AppsDownloadList
Definition: loaddlg.cpp:415
static BOOL bModal
Definition: loaddlg.cpp:419
static VOID UpdateProgress(HWND hDlg, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: loaddlg.cpp:560
static VOID Download(const DownloadInfo &DLInfo, BOOL bIsModal=FALSE)
Definition: loaddlg.cpp:449
static CDownloaderProgress ProgressBar
Definition: loaddlg.cpp:417
static CDowloadingAppsListView DownloadsListView
Definition: loaddlg.cpp:416
static VOID Add(DownloadInfo info)
Definition: loaddlg.cpp:443
static unsigned int WINAPI ThreadFunc(LPVOID Context)
Definition: loaddlg.cpp:620
static VOID LaunchDownloadDialog(BOOL)
Definition: loaddlg.cpp:1074
VOID SetMarquee(BOOL Enable)
Definition: loaddlg.cpp:151
VOID SetProgress(ULONG ulProgress, ULONG ulProgressMax)
Definition: loaddlg.cpp:162
CStringW m_szProgressText
Definition: loaddlg.cpp:143
LRESULT OnEraseBkgnd(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: loaddlg.cpp:207
LRESULT OnSetText(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: loaddlg.cpp:257
LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: loaddlg.cpp:213
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
Definition: misc.h:53
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
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:2380
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 NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49
#define 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 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:1108
BOOL UrlHasBeenCopied
Definition: loaddlg.cpp:557
VOID UrlUnescapeAndMakeFileNameValid(CStringW &str)
Definition: loaddlg.cpp:93
BOOL ShowLastError(HWND hWndOwner, BOOL bInetError, DWORD dwLastError)
Definition: loaddlg.cpp:601
BOOL DownloadListOfApplications(const CAtlList< CAppInfo * > &AppsList, BOOL bIsModal)
Definition: loaddlg.cpp:1089
DownloadStatus
Definition: loaddlg.cpp:67
@ DLSTATUS_DOWNLOADING
Definition: loaddlg.cpp:69
@ DLSTATUS_FINISHED
Definition: loaddlg.cpp:73
@ DLSTATUS_WAITING_INSTALL
Definition: loaddlg.cpp:70
@ DLSTATUS_WAITING
Definition: loaddlg.cpp:68
@ DLSTATUS_INSTALLED
Definition: loaddlg.cpp:72
@ DLSTATUS_INSTALLING
Definition: loaddlg.cpp:71
CStringW LoadStatusString(DownloadStatus StatusParam)
Definition: loaddlg.cpp:77
#define FILENAME_VALID_CHAR
Definition: loaddlg.cpp:84
#define MARGIN
VOID MessageBox_LoadString(HWND hMainWnd, INT StringID)
Definition: loaddlg.cpp:403
DownloadType
Definition: loaddlg.cpp:60
@ DLTYPE_DBUPDATE_UNOFFICIAL
Definition: loaddlg.cpp:63
@ DLTYPE_DBUPDATE
Definition: loaddlg.cpp:62
@ DLTYPE_APPLICATION
Definition: loaddlg.cpp:61
VOID DownloadApplicationsDB(LPCWSTR lpUrl, BOOL IsOfficial)
Definition: loaddlg.cpp:1118
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
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:2368
HRESULT hr
Definition: shlfolder.c:183
#define _countof(array)
Definition: sndvol32.h:68
TCHAR szAppName[128]
Definition: solitaire.cpp:18
Definition: window.h:372
CStringW szName
Definition: loaddlg.cpp:121
DownloadType DLType
Definition: loaddlg.cpp:119
CStringW szUrl
Definition: loaddlg.cpp:120
ULONG SizeInBytes
Definition: loaddlg.cpp:123
CStringW szSHA1
Definition: loaddlg.cpp:122
DownloadInfo(const CAppInfo &AppInfo)
Definition: loaddlg.cpp:113
DownloadParam(HWND dlg, const ATL::CSimpleArray< DownloadInfo > &info, LPCWSTR caption)
Definition: loaddlg.cpp:131
ATL::CSimpleArray< DownloadInfo > AppInfo
Definition: loaddlg.cpp:137
LPCWSTR szCaption
Definition: loaddlg.cpp:138
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:330
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
_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:1412
#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:1539
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:5843
#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:5857
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:2075
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