52 #ifdef USE_CERT_PINNING 53 #define CERT_ISSUER_INFO_OLD "US\r\nLet's Encrypt\r\nLet's Encrypt Authority X3" 54 #define CERT_ISSUER_INFO_NEW "US\r\nLet's Encrypt\r\nR3" 55 #define CERT_SUBJECT_INFO "rapps.reactos.org" 79 szString.LoadStringW(StatusParam);
88 ,
szUrl(AppInfo.m_szUrlDownload)
117 :
public CWindowImpl<CDownloaderProgress, CWindow, CControlWinTraits>
138 WCHAR szProgress[100];
149 WCHAR szProgressMax[100];
150 UINT uiPercentage = ((
ULONGLONG) ulProgress * 100) / ulProgressMax;
160 ProgressText.
Format(
L"%u%% \x2014 %ls / %ls",
172 ProgressText.
Format(
L"%ls...", szProgress);
192 UINT win_width, win_height;
265 RECT r = {10, 150, 320, 350};
298 Item.pszText = lpText;
299 Item.iItem = ItemIndex;
326 #ifdef USE_CERT_PINNING 329 DWORD certInfoLength;
345 certInfoLength =
sizeof(certInfo);
371 if (szMsgText.LoadStringW(StringID))
468 szTempCaption = szCaption;
476 unsigned int ThreadId;
583 HWND hDlg = static_cast<DownloadParam*>(
param)->Dialog;
588 ULONG dwCurrentBytesRead = 0;
600 size_t urlLength, filenameLength;
603 LPCWSTR szCaption = static_cast<DownloadParam*>(
param)->szCaption;
614 for (iAppId = 0; iAppId < InfoArray.
GetSize(); ++iAppId)
641 switch(InfoArray[iAppId].DLType)
644 szNewCaption.
Format(szCaption, InfoArray[iAppId].
szName.GetString());
658 p =
wcsrchr(InfoArray[iAppId].szUrl.GetString(),
L'/');
659 q =
wcsrchr(InfoArray[iAppId].szUrl.GetString(),
L'?');
673 if (
q &&
q >
p && (
q -
p) > 0)
689 switch (InfoArray[iAppId].DLType)
699 Path.ReleaseBuffer();
741 memset(&urlComponents, 0,
sizeof(urlComponents));
744 urlLength = InfoArray[iAppId].szUrl.GetLength();
835 if (InfoArray[iAppId].SizeInBytes)
837 dwContentLen = InfoArray[iAppId].SizeInBytes;
848 #ifdef USE_CERT_PINNING 855 bool bAskQuestion =
false;
864 (
strcmp(issuerName, CERT_ISSUER_INFO_OLD) &&
865 strcmp(issuerName, CERT_ISSUER_INFO_NEW)))
890 dwCurrentBytesRead = 0;
905 dwCurrentBytesRead += dwBytesRead;
907 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
915 DPRINT1(
"Operation cancelled\n");
924 dwContentLen = dwCurrentBytesRead;
926 UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
931 if ((InfoArray[iAppId].DLType ==
DLTYPE_APPLICATION) && InfoArray[iAppId].szSHA1[0] != 0)
938 DPRINT1(
"Unable to load string\n");
947 if (!
VerifyInteg(InfoArray[iAppId].szSHA1.GetString(),
Path.GetString()))
951 DPRINT1(
"Unable to load string\n");
968 shExInfo.
cbSize =
sizeof(shExInfo);
1016 delete static_cast<DownloadParam*>(
param);
1073 DatabaseDLInfo.
szUrl = lpUrl;
#define HTTP_QUERY_CONTENT_LENGTH
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
HWND UnsubclassWindow(BOOL bForce=FALSE)
static const WCHAR szName[]
HRESULT WINAPI PathCreateFromUrlW(LPCWSTR pszUrl, LPWSTR pszPath, LPDWORD pcchPath, DWORD dwReserved)
#define IDS_DL_DIALOG_DB_DOWNLOAD_DISP
#define IDS_STATUS_INSTALLED
BOOL VerifyInteg(LPCWSTR lpSHA1Hash, LPCWSTR lpFileName)
#define IDS_DL_DIALOG_DB_DISP
BOOL WINAPI IsWindow(_In_opt_ HWND)
static VOID Download(const DownloadInfo &DLInfo, BOOL bIsModal=FALSE)
#define LVS_NOCOLUMNHEADER
#define IDD_DOWNLOAD_DIALOG
#define LVS_SHOWSELALWAYS
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define SEE_MASK_NOCLOSEPROCESS
static BYTE subjectName[]
GLdouble GLdouble GLdouble r
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
static unsigned int WINAPI ThreadFunc(LPVOID Context)
#define IDS_MISMATCH_CERT_INFO
#define INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT
LPSTR lpszEncryptionAlgName
BOOL ShowLastError(HWND hWndOwner, BOOL bInetError, DWORD dwLastError)
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
#define INTERNET_OPEN_TYPE_PROXY
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
static VOID LaunchDownloadDialog(BOOL)
#define INVALID_HANDLE_VALUE
#define COLOR_CAPTIONTEXT
DWORD WINAPI GetLastError(VOID)
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
VOID SetProgress(ULONG ulProgress, ULONG ulProgressMax)
void __cdecl Format(UINT nFormatID,...)
static ATL::CSimpleArray< DownloadInfo > AppsDownloadList
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI InternetCanonicalizeUrlW(LPCWSTR lpszUrl, LPWSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
#define IDS_STATUS_DOWNLOADING
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
void EndPaint(LPPAINTSTRUCT lpPaint)
#define IDS_STATUS_INSTALLING
#define IDS_UNABLE_TO_DOWNLOAD
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
_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)
BOOL SetWindowText(LPCTSTR lpszString)
BOOL WINAPI DestroyWindow(_In_ HWND)
HWND Create(HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
#define INTERNET_FLAG_DONT_CACHE
DownloadInfo(const CAvailableApplicationInfo &AppInfo)
DWORD WINAPI GetSysColor(_In_ int)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
LPSTR lpszSignatureAlgName
BOOL InvalidateRect(LPCRECT lpRect, BOOL bErase=TRUE)
#define IDC_DOWNLOAD_STATUS
WCHAR szDownloadDir[MAX_PATH]
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
GLenum GLuint GLenum GLsizei const GLchar * buf
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
DownloadParam(HWND dlg, const ATL::CSimpleArray< DownloadInfo > &info, LPCWSTR caption)
VOID MessageBox_LoadString(HWND hMainWnd, INT StringID)
BOOL SubclassWindow(HWND hWnd)
BOOL SetItemText(int i, int subItem, LPCWSTR text)
DWORD WINAPI FtpGetFileSize(HINTERNET hFile, LPDWORD lpdwFileSizeHigh)
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
BOOL GetClientRect(LPRECT lpRect) const
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
#define IDS_INTEG_CHECK_FAIL
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, RECT *prc, DWORD dwFlags, COLORREF crText, COLORREF crShadow, int ixOffset, int iyOffset)
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
static CDowloadingAppsListView DownloadsListView
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
#define FORMAT_MESSAGE_FROM_SYSTEM
VOID LoadList(ATL::CSimpleArray< DownloadInfo > arrInfo)
#define IDS_STATUS_FINISHED
#define FORMAT_MESSAGE_FROM_HMODULE
#define DialogBoxW(i, t, p, f)
VOID SetDownloadStatus(INT ItemIndex, DownloadStatus Status)
BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPCWSTR lpMsg)
SETTINGS_INFO SettingsInfo
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HDC BeginPaint(LPPAINTSTRUCT lpPaint)
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
_In_ WDFCOLLECTION _In_ ULONG Index
#define IDS_UNABLE_TO_QUERY_CERT
#define IDS_STATUS_DOWNLOADED
VOID SetMarquee(BOOL Enable)
LRESULT OnSetText(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
BOOL GetStorageDirectory(ATL::CStringW &lpDirectory)
GLdouble GLdouble GLdouble GLdouble q
static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define INVALID_FILE_ATTRIBUTES
#define IDS_UNABLE_TO_DOWNLOAD2
#define IDC_DOWNLOAD_PROGRESS
static VOID UpdateProgress(HWND hDlg, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
#define INTERNET_OPEN_TYPE_DIRECT
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
#define IDS_INTEG_CHECK_TITLE
int InsertItem(const LV_ITEM *pitem)
BOOL DownloadListOfApplications(const ATL::CSimpleArray< CAvailableApplicationInfo > &AppsList, BOOL bIsModal)
#define CreateDialogW(h, n, w, f)
VOID DownloadApplicationsDB(LPCWSTR lpUrl, BOOL IsOfficial)
#define IDS_DL_DIALOG_DB_UNOFFICIAL_DOWNLOAD_DISP
LRESULT OnEraseBkgnd(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
#define SelectFont(hdc, hfont)
#define HTTP_QUERY_STATUS_CODE
LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
#define IDS_STATUS_WAITING
#define FORMAT_MESSAGE_IGNORE_INSERTS
int Replace(PCXSTR pszOld, PCXSTR pszNew)
#define INTERNET_FLAG_PASSIVE
#define INTERNET_FLAG_PRAGMA_NOCACHE
WCHAR szProxyServer[MAX_PATH]
PRTL_UNICODE_STRING_BUFFER Path
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
#define INTERNET_OPEN_TYPE_PRECONFIG
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
BOOL WINAPI DeleteDC(_In_ HDC)
#define INTERNET_OPTION_SECURITY_FLAGS
HWND Create(HWND hwndParent)
BOOL ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
BOOL AddItem(INT ItemIndex, LPWSTR lpText)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
ATL::CStringW m_szProgressText
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HTTP_QUERY_FLAG_NUMBER
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
#define BEGIN_MSG_MAP(theClass)
#define MESSAGE_HANDLER(msg, func)
static VOID Add(DownloadInfo info)
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
ATL::CStringW LoadStatusString(DownloadStatus StatusParam)
#define APPLICATION_DATABASE_NAME
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
int strcmp(const char *String1, const char *String2)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
int InsertColumn(int iCol, LV_COLUMN *pcol)
WCHAR szNoProxyFor[MAX_PATH]
#define SECURITY_FLAG_SECURE
#define MAKEINTRESOURCEW(i)
VOID AddRow(INT RowIndex, LPCWSTR szAppName, const DownloadStatus Status)
ATL::CSimpleArray< DownloadInfo > AppInfo
BOOL DownloadApplication(CAvailableApplicationInfo *pAppInfo)
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
BOOL AddColumn(INT Index, INT Width, INT Format)
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)
#define LANG_USER_DEFAULT
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
static CDownloaderProgress ProgressBar
#define INTERNET_FLAG_KEEP_CONNECTION
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char * Format