From b83306cd61308cde7e938b6d299cfbd25d23b03f Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sat, 19 Jan 2008 21:32:39 +0000 Subject: [PATCH] Fixed two bugs (this fixes Diablo II download) : - Check if returned structure for dependency is null, to avoid crash - Compare good fields to get dependency. According to xml file, it's regname that should be used. svn path=/trunk/; revision=31897 --- rosapps/downloader/main.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/rosapps/downloader/main.c b/rosapps/downloader/main.c index 3063b478e7a..f2f27ea2c56 100644 --- a/rosapps/downloader/main.c +++ b/rosapps/downloader/main.c @@ -654,7 +654,7 @@ struct Application* GetDependency(const WCHAR* Dependency) { while (Category->Apps) { - if(StrCmpW(Category->Apps->Name, Dependency) == 0) + if(StrCmpW(Category->Apps->RegName, Dependency) == 0) return Category->Apps; Category->Apps = Category->Apps->Next; } @@ -721,16 +721,17 @@ WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { AppToInstall = SelectedApplication; SelectedApplication = GetDependency(SelectedApplication->Depends); - if (!IsApplicationInstalled(SelectedApplication)) - { - LoadString(GetModuleHandle(NULL), IDS_INSTALL_DEP, InstallDep, sizeof(InstallDep) / sizeof(WCHAR)); - LoadString(GetModuleHandle(NULL), IDS_WINDOW_TITLE, Title, sizeof(Title) / sizeof(WCHAR)); - _snwprintf(InstallDepBuffer, sizeof(InstallDepBuffer) / sizeof(WCHAR), InstallDep, SelectedApplication->Name, AppToInstall->Name, SelectedApplication->Name); - if (MessageBox(hwnd, InstallDepBuffer, Title, MB_YESNO | MB_ICONINFORMATION) == IDYES) + if (SelectedApplication) + if (!IsApplicationInstalled(SelectedApplication)) { - DialogBoxW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_DOWNLOAD), 0, DownloadProc); + LoadString(GetModuleHandle(NULL), IDS_INSTALL_DEP, InstallDep, sizeof(InstallDep) / sizeof(WCHAR)); + LoadString(GetModuleHandle(NULL), IDS_WINDOW_TITLE, Title, sizeof(Title) / sizeof(WCHAR)); + _snwprintf(InstallDepBuffer, sizeof(InstallDepBuffer) / sizeof(WCHAR), InstallDep, SelectedApplication->Name, AppToInstall->Name, SelectedApplication->Name); + if (MessageBox(hwnd, InstallDepBuffer, Title, MB_YESNO | MB_ICONINFORMATION) == IDYES) + { + DialogBoxW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_DOWNLOAD), 0, DownloadProc); + } } - } SelectedApplication = AppToInstall; }