ReactOS 0.4.15-dev-8093-g3285f69
loaddlg.cpp File Reference
#include "rapps.h"
#include <shlobj_undoc.h>
#include <shlguid_undoc.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <wininet.h>
#include <shellutils.h>
#include <debug.h>
#include <ui/rosctrls.h>
#include <windowsx.h>
#include <shlwapi_undoc.h>
#include <process.h>
#include "rosui.h"
#include "dialogs.h"
#include "misc.h"
#include "unattended.h"
Include dependency graph for loaddlg.cpp:

Go to the source code of this file.

Classes

struct  DownloadInfo
 
struct  DownloadParam
 
class  CDownloaderProgress
 
class  CDowloadingAppsListView
 
class  CDownloadManager
 

Macros

#define FILENAME_VALID_CHAR
 
#define MARGIN   10
 

Enumerations

enum  DownloadType { DLTYPE_APPLICATION , DLTYPE_DBUPDATE , DLTYPE_DBUPDATE_UNOFFICIAL }
 
enum  DownloadStatus {
  DLSTATUS_WAITING = IDS_STATUS_WAITING , DLSTATUS_DOWNLOADING = IDS_STATUS_DOWNLOADING , DLSTATUS_WAITING_INSTALL = IDS_STATUS_DOWNLOADED , DLSTATUS_INSTALLING = IDS_STATUS_INSTALLING ,
  DLSTATUS_INSTALLED = IDS_STATUS_INSTALLED , DLSTATUS_FINISHED = IDS_STATUS_FINISHED
}
 

Functions

CStringW LoadStatusString (DownloadStatus StatusParam)
 
VOID UrlUnescapeAndMakeFileNameValid (CStringW &str)
 
VOID MessageBox_LoadString (HWND hOwnerWnd, INT StringID)
 
BOOL ShowLastError (HWND hWndOwner, BOOL bInetError, DWORD dwLastError)
 
BOOL DownloadListOfApplications (const CAtlList< CAppInfo * > &AppsList, BOOL bIsModal)
 
BOOL DownloadApplication (CAppInfo *pAppInfo)
 
VOID DownloadApplicationsDB (LPCWSTR lpUrl, BOOL IsOfficial)
 

Variables

BOOL UrlHasBeenCopied
 

Macro Definition Documentation

◆ FILENAME_VALID_CHAR

#define FILENAME_VALID_CHAR
Value:
( \
#define PATH_CHAR_CLASS_OTHER_VALID
Definition: path.c:4326
#define PATH_CHAR_CLASS_SPACE
Definition: path.c:4325
#define PATH_CHAR_CLASS_LETTER
Definition: path.c:4318
#define PATH_CHAR_CLASS_SEMICOLON
Definition: path.c:4323
#define PATH_CHAR_CLASS_COMMA
Definition: path.c:4324
#define PATH_CHAR_CLASS_DOT
Definition: path.c:4320

Definition at line 85 of file loaddlg.cpp.

◆ MARGIN

#define MARGIN   10

Enumeration Type Documentation

◆ DownloadStatus

Enumerator
DLSTATUS_WAITING 
DLSTATUS_DOWNLOADING 
DLSTATUS_WAITING_INSTALL 
DLSTATUS_INSTALLING 
DLSTATUS_INSTALLED 
DLSTATUS_FINISHED 

Definition at line 67 of file loaddlg.cpp.

68{
75};
#define IDS_STATUS_FINISHED
Definition: resource.h:201
#define IDS_STATUS_WAITING
Definition: resource.h:200
#define IDS_STATUS_INSTALLING
Definition: resource.h:199
#define IDS_STATUS_DOWNLOADED
Definition: resource.h:196
#define IDS_STATUS_DOWNLOADING
Definition: resource.h:198
#define IDS_STATUS_INSTALLED
Definition: resource.h:194
@ 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

◆ DownloadType

Enumerator
DLTYPE_APPLICATION 
DLTYPE_DBUPDATE 
DLTYPE_DBUPDATE_UNOFFICIAL 

Definition at line 60 of file loaddlg.cpp.

61{
65};
@ DLTYPE_DBUPDATE_UNOFFICIAL
Definition: loaddlg.cpp:64
@ DLTYPE_DBUPDATE
Definition: loaddlg.cpp:63
@ DLTYPE_APPLICATION
Definition: loaddlg.cpp:62

Function Documentation

◆ DownloadApplication()

BOOL DownloadApplication ( CAppInfo pAppInfo)

Definition at line 1128 of file loaddlg.cpp.

1129{
1130 if (!pAppInfo)
1131 return FALSE;
1132
1134 return TRUE;
1135}
static VOID Download(const DownloadInfo &DLInfo, BOOL bIsModal=FALSE)
Definition: loaddlg.cpp:457
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117

Referenced by CMainWindow::InstallApplication().

◆ DownloadApplicationsDB()

VOID DownloadApplicationsDB ( LPCWSTR  lpUrl,
BOOL  IsOfficial 
)

Definition at line 1138 of file loaddlg.cpp.

1139{
1140 static DownloadInfo DatabaseDLInfo;
1141 DatabaseDLInfo.szUrl = lpUrl;
1142 DatabaseDLInfo.szName.LoadStringW(IDS_DL_DIALOG_DB_DISP);
1143 DatabaseDLInfo.DLType = IsOfficial ? DLTYPE_DBUPDATE : DLTYPE_DBUPDATE_UNOFFICIAL;
1144 CDownloadManager::Download(DatabaseDLInfo, TRUE);
1145}
#define IDS_DL_DIALOG_DB_DISP
Definition: resource.h:217
CStringW szName
Definition: loaddlg.cpp:128
DownloadType DLType
Definition: loaddlg.cpp:125
CStringW szUrl
Definition: loaddlg.cpp:127

Referenced by CAppDB::UpdateAvailable().

◆ DownloadListOfApplications()

BOOL DownloadListOfApplications ( const CAtlList< CAppInfo * > &  AppsList,
BOOL  bIsModal 
)

Definition at line 1109 of file loaddlg.cpp.

1110{
1111 if (AppsList.IsEmpty())
1112 return FALSE;
1113
1114 POSITION CurrentListPosition = AppsList.GetHeadPosition();
1115 while (CurrentListPosition)
1116 {
1117 const CAppInfo *Info = AppsList.GetNext(CurrentListPosition);
1119 }
1120
1121 // Create a dialog and issue a download process
1123
1124 return TRUE;
1125}
bool IsEmpty() const
Definition: atlcoll.h:545
POSITION GetHeadPosition() const
Definition: atlcoll.h:551
E & GetNext(_Inout_ POSITION &pos)
Definition: atlcoll.h:563
static VOID Add(DownloadInfo info)
Definition: loaddlg.cpp:451
static VOID LaunchDownloadDialog(BOOL)
Definition: loaddlg.cpp:1094
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690

Referenced by HandleInstallCommand(), HandleSetupCommand(), and CMainWindow::OnCommand().

◆ LoadStatusString()

CStringW LoadStatusString ( DownloadStatus  StatusParam)

Definition at line 78 of file loaddlg.cpp.

79{
80 CStringW szString;
81 szString.LoadStringW(StatusParam);
82 return szString;
83}

Referenced by CDowloadingAppsListView::AddRow(), CDowloadingAppsListView::SetDownloadStatus(), and CDownloadManager::ThreadFunc().

◆ MessageBox_LoadString()

VOID MessageBox_LoadString ( HWND  hOwnerWnd,
INT  StringID 
)
inline

Definition at line 411 of file loaddlg.cpp.

412{
413 CStringW szMsgText;
414 if (szMsgText.LoadStringW(StringID))
415 {
416 MessageBoxW(hOwnerWnd, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
417 }
418}
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
#define NULL
Definition: types.h:112
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONERROR
Definition: winuser.h:787
#define MB_OK
Definition: winuser.h:790

Referenced by CDownloadManager::ThreadFunc().

◆ ShowLastError()

BOOL ShowLastError ( HWND  hWndOwner,
BOOL  bInetError,
DWORD  dwLastError 
)

Definition at line 609 of file loaddlg.cpp.

610{
611 CLocalPtr<WCHAR> lpMsg;
612
613 if (!FormatMessageW(
616 (bInetError ? GetModuleHandleW(L"wininet.dll") : NULL), dwLastError, LANG_USER_DEFAULT, (LPWSTR)&lpMsg, 0,
617 NULL))
618 {
619 DPRINT1("FormatMessageW unexpected failure (err %d)\n", GetLastError());
620 return FALSE;
621 }
622
623 MessageBoxW(hWndOwner, lpMsg, NULL, MB_OK | MB_ICONERROR);
624 return TRUE;
625}
#define DPRINT1
Definition: precomp.h:8
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
#define L(x)
Definition: ntvdm.h:50
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50
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
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CDownloadManager::ThreadFunc().

◆ UrlUnescapeAndMakeFileNameValid()

VOID UrlUnescapeAndMakeFileNameValid ( CStringW str)

Definition at line 94 of file loaddlg.cpp.

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}
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI PathIsValidCharW(WCHAR c, DWORD class)
Definition: path.c:4419
HRESULT WINAPI UrlUnescapeW(LPWSTR pszUrl, LPWSTR pszUnescaped, LPDWORD pcchUnescaped, DWORD dwFlags)
Definition: url.c:1367
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILENAME_VALID_CHAR
Definition: loaddlg.cpp:85
#define pch(ap)
Definition: match.c:418
LPCWSTR szPath
Definition: env.c:37
const WCHAR * str
#define _countof(array)
Definition: sndvol32.h:70
uint16_t * PWCHAR
Definition: typedefs.h:56
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by CDownloadManager::ThreadFunc().

Variable Documentation

◆ UrlHasBeenCopied

BOOL UrlHasBeenCopied

Definition at line 565 of file loaddlg.cpp.

Referenced by CDownloadManager::ThreadFunc(), and CDownloadManager::UpdateProgress().