Ignore:
Timestamp:
Dec 20, 2002, 12:39:43 PM (23 years ago)
Author:
sandervl
Message:

Don't display message boxes for module load errors. Pass errors back to the PE loader.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/winexepeldr.cpp

    r9533 r9537  
    1 /* $Id: winexepeldr.cpp,v 1.20 2002-12-20 10:38:58 sandervl Exp $ */
     1/* $Id: winexepeldr.cpp,v 1.21 2002-12-20 11:39:41 sandervl Exp $ */
    22
    33/*
     
    4646
    4747
    48 extern char szErrorTitle[];
    4948extern char szErrorModule[];
    5049
     
    5857//   (not other options available at this time)
    5958//******************************************************************************
    60 BOOL WIN32API CreateWin32PeLdrExe(char *szFileName, char *szCmdLine,
    61                                   char *peoptions,
    62                                   ULONG reservedMem, ULONG ulPEOffset,
    63                                   BOOL fConsoleApp, BOOL fVioConsole)
     59DWORD WIN32API CreateWin32PeLdrExe(char *szFileName, char *szCmdLine,
     60                                   char *peoptions,
     61                                   ULONG reservedMem, ULONG ulPEOffset,
     62                                   BOOL fConsoleApp, BOOL fVioConsole,
     63                                   char *pszErrorModule, ULONG cbErrorModule)
    6464{
    6565 APIRET  rc;
     
    7676  rc = DosGetInfoBlocks(&ptib, &ppib);
    7777  if(rc) {
    78         WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szInteralErrorMsg, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE);
    79         delete WinExe;
    80         return FALSE;
     78      delete WinExe;
     79      return LDRERROR_INTERNAL;
    8180  }
    8281  //Handle special pe cmd line options here (/OPT:[x1=y,x2=z,..])
     
    123122  if(WinExe->isConsoleApp())
    124123  {
    125         dprintf(("Console application!\n"));
     124      dprintf(("Console application!\n"));
    126125
    127         APIRET rc = iConsoleInit(fVioConsole);                /* initialize console subsystem */
    128         if (rc != NO_ERROR)                                  /* check for errors */
    129                 dprintf(("KERNEL32:Win32Image:Init ConsoleInit failed with %u.\n", rc));
     126     rc = iConsoleInit(fVioConsole);                /* initialize console subsystem */
     127      if (rc != NO_ERROR)                                  /* check for errors */
     128          dprintf(("KERNEL32:Win32Image:Init ConsoleInit failed with %u.\n", rc));
    130129  }
    131130
    132131  OS2SetExceptionHandler(&exceptFrame);
    133   if(WinExe->init(reservedMem, ulPEOffset) == FALSE)
     132  rc = WinExe->init(reservedMem, ulPEOffset);
     133  if(rc != LDRERROR_SUCCESS)
    134134  {
    135135        if(szErrorModule[0] != 0) {
    136                 char szErrorMsg[128];
    137 
    138                 sprintf(szErrorMsg, "Can't execute %s due to bad or missing %s", OSLibStripPath(szFileName), szErrorModule);
    139                 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szErrorMsg, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE);
     136            strncpy(pszErrorModule, szErrorModule, cbErrorModule-1);
     137            pszErrorModule[cbErrorModule-1] = 0;
    140138        }
    141139        delete WinExe;
    142140        OS2UnsetExceptionHandler(&exceptFrame);
    143         return FALSE;
     141        return rc;
    144142  }
    145143  OS2UnsetExceptionHandler(&exceptFrame);
     
    158156  delete WinExe;
    159157
    160   return TRUE;
     158  return LDRERROR_SUCCESS;
    161159}
    162160//******************************************************************************
     
    167165                   Win32PeLdrImage(szFileName, TRUE)
    168166{
    169   dprintf(("Win32PeLdrExe ctor: %s", szFileName));
    170   this->fConsoleApp = fConsoleApp;
     167    dprintf(("Win32PeLdrExe ctor: %s", szFileName));
     168    this->fConsoleApp = fConsoleApp;
    171169
    172   //SvL: set temporary full path here as console init needs it
    173   setFullPath(szFileName);
     170    //SvL: set temporary full path here as console init needs it
     171    setFullPath(szFileName);
    174172}
    175173//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.