From 79093d88e345f28af1851f8317d9008bf07158bd Mon Sep 17 00:00:00 2001 From: "ssu%netscape.com" Date: Sun, 7 May 2000 07:07:01 +0000 Subject: [PATCH] mapped error values to strings when windows installer vails. affects only windows platforms. git-svn-id: svn://10.0.0.236/trunk@68573 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xpinstall/wizard/windows/setup/xperr.h | 72 +++++++++++++++++++ mozilla/xpinstall/wizard/windows/setup/xpi.c | 27 ++++++- 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 mozilla/xpinstall/wizard/windows/setup/xperr.h diff --git a/mozilla/xpinstall/wizard/windows/setup/xperr.h b/mozilla/xpinstall/wizard/windows/setup/xperr.h new file mode 100644 index 00000000000..6d26db0e84b --- /dev/null +++ b/mozilla/xpinstall/wizard/windows/setup/xperr.h @@ -0,0 +1,72 @@ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, + * released March 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Sean Su + */ + +#ifndef _XPERR_H_ +#define _XPERR_H_ + +char *XpErrorList[] = {"-200", "BAD_PACKAGE_NAME", + "-201", "UNEXPECTED_ERROR", + "-202", "ACCESS_DENIED", + "-203", "TOO_MANY_CERTIFICATES", + "-204", "NO_INSTALL_SCRIPT", + "-205", "NO_CERTIFICATE", + "-206", "NO_MATCHING_CERTIFICATE", + "-207", "CANT_READ_ARCHIVE", + "-208", "INVALID_ARGUMENTS", + "-209", "ILLEGAL_RELATIVE_PATH", + "-210", "USER_CANCELLED", + "-211", "INSTALL_NOT_STARTED", + "-212", "SILENT_MODE_DENIED", + "-213", "NO_SUCH_COMPONENT", + "-214", "DOES_NOT_EXIST", + "-215", "READ_ONLY", + "-216", "IS_DIRECTORY", + "-217", "NETWORK_FILE_IS_IN_USE", + "-218", "APPLE_SINGLE_ERR", + "-219", "INVALID_PATH_ERR", + "-220", "PATCH_BAD_DIFF", + "-221", "PATCH_BAD_CHECKSUM_TARGET", + "-222", "PATCH_BAD_CHECKSUM_RESULT", + "-223", "UNINSTALL_FAILED", + "-224", "PACKAGE_FOLDER_NOT_SET", + "-225", "EXTRACTION_FAILED", + "-226", "FILENAME_ALREADY_USED", + "-227", "ABORT_INSTALL", + "-228", "DOWNLOAD_ERROR", + "-229", "SCRIPT_ERROR", + "-230", "ALREADY_EXISTS", + "-231", "IS_FILE", + "-232", "SOURCE_DOES_NOT_EXIST", + "-233", "SOURCE_IS_DIRECTORY", + "-234", "SOURCE_IS_FILE", + "-235", "INSUFFICIENT_DISK_SPACE", + "-236", "FILENAME_TOO_LONG", + "-299", "OUT_OF_MEMORY", + "-322", "INIT_STUB_ERROR", + "-5550", "GESTALT_UNKNOWN_ERR", + "-5551", "GESTALT_INVALID_ARGUMENT", + ""}; + +#endif + diff --git a/mozilla/xpinstall/wizard/windows/setup/xpi.c b/mozilla/xpinstall/wizard/windows/setup/xpi.c index 99bea0bc8ce..d3e1bae225e 100644 --- a/mozilla/xpinstall/wizard/windows/setup/xpi.c +++ b/mozilla/xpinstall/wizard/windows/setup/xpi.c @@ -27,6 +27,7 @@ #include "extra.h" #include "xpistub.h" #include "xpi.h" +#include "xperr.h" #define BDIR_RIGHT 1 #define BDIR_LEFT 2 @@ -236,7 +237,31 @@ HRESULT SmartUpdateJars() { if(NS_LoadString(hSetupRscInst, IDS_ERROR_XPI_INSTALL, szEXpiInstall, MAX_BUF) == WIZ_OK) { - wsprintf(szBuf, "%d: %s", hrResult, szEXpiInstall); + int i = 0; + char szErrorString[MAX_BUF]; + char szErrorNumber[MAX_BUF]; + + ZeroMemory(szErrorString, MAX_BUF); + itoa(hrResult, szErrorNumber, 10); + + /* map the error value to a string */ + while(TRUE) + { + if(*XpErrorList[i] == '\0') + break; + + if(lstrcmpi(szErrorNumber, XpErrorList[i]) == 0) + { + if(*XpErrorList[i + 1] != '\0') + lstrcpy(szErrorString, XpErrorList[i + 1]); + + break; + } + + ++i; + } + + wsprintf(szBuf, "%s: %d %s", szEXpiInstall, hrResult, szErrorString); PrintError(szBuf, ERROR_CODE_HIDE); }