Ignore:
Timestamp:
Jan 8, 2002, 7:29:57 PM (24 years ago)
Author:
umoeller
Message:

Executable updates, mostly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/apps.c

    r127 r129  
    12001200                ProgDetails.pszParameters = strParamsPatched.psz;
    12011201
    1202                 /*  _Pmpf(("progt.progc: %d", ProgDetails.progt.progc));
    1203                 _Pmpf(("progt.fbVisible: 0x%lX", ProgDetails.progt.fbVisible));
    1204                 _Pmpf(("progt.pszTitle: \"%s\"", (ProgDetails.pszTitle) ? ProgDetails.pszTitle : "NULL"));
    1205                 _Pmpf(("exec: \"%s\"", (ProgDetails.pszExecutable) ? ProgDetails.pszExecutable : "NULL"));
    1206                 _Pmpf(("params: \"%s\"", (ProgDetails.pszParameters) ? ProgDetails.pszParameters : "NULL"));
    1207                 _Pmpf(("startup: \"%s\"", (ProgDetails.pszStartupDir) ? ProgDetails.pszStartupDir : "NULL"));
    1208                 _Pmpf(("pszIcon: \"%s\"", (ProgDetails.pszIcon) ? ProgDetails.pszIcon : "NULL"));
    1209                 _Pmpf(("environment: "));
     1202                _Pmpf((__FUNCTION__ ": progt.progc: %d", ProgDetails.progt.progc));
     1203                _Pmpf(("    progt.fbVisible: 0x%lX", ProgDetails.progt.fbVisible));
     1204                _Pmpf(("    progt.pszTitle: \"%s\"", (ProgDetails.pszTitle) ? ProgDetails.pszTitle : "NULL"));
     1205                _Pmpf(("    exec: \"%s\"", (ProgDetails.pszExecutable) ? ProgDetails.pszExecutable : "NULL"));
     1206                _Pmpf(("    params: \"%s\"", (ProgDetails.pszParameters) ? ProgDetails.pszParameters : "NULL"));
     1207                _Pmpf(("    startup: \"%s\"", (ProgDetails.pszStartupDir) ? ProgDetails.pszStartupDir : "NULL"));
     1208                _Pmpf(("    pszIcon: \"%s\"", (ProgDetails.pszIcon) ? ProgDetails.pszIcon : "NULL"));
     1209                /* _Pmpf(("    environment: "));
    12101210                {
    12111211                    PSZ pszThis = ProgDetails.pszEnvironment;
    12121212                    while (pszThis && *pszThis)
    12131213                    {
    1214                         _Pmpf(("  \"%s\"", pszThis));
     1214                        _Pmpf(("      \"%s\"", pszThis));
    12151215                        pszThis += strlen(pszThis) + 1;
    12161216                    }
    12171217                }
    1218 
    1219                 _Pmpf(("swpInitial.fl = 0x%lX, x = %d, y = %d, cx = %d, cy = %d:",
     1218                   */
     1219
     1220                _Pmpf(("    swpInitial.fl = 0x%lX, x = %d, y = %d, cx = %d, cy = %d:",
    12201221                            ProgDetails.swpInitial.fl,
    12211222                            ProgDetails.swpInitial.x,
     
    12231224                            ProgDetails.swpInitial.cx,
    12241225                            ProgDetails.swpInitial.cy));
    1225                 _Pmpf(("  behind = %d, hwnd = %d, res1 = %d, res2 = %d",
     1226                _Pmpf(("    behind = %d, hwnd = %d, res1 = %d, res2 = %d",
    12261227                            ProgDetails.swpInitial.hwndInsertBehind,
    12271228                            ProgDetails.swpInitial.hwnd,
    12281229                            ProgDetails.swpInitial.ulReserved1,
    12291230                            ProgDetails.swpInitial.ulReserved2));
    1230                     */
     1231
     1232                if (pszFailingName)
     1233                    strhncpy0(pszFailingName, ProgDetails.pszExecutable, cbFailingName);
    12311234
    12321235                /* if (WinMessageBox(HWND_DESKTOP,
     
    12361239                                  0,
    12371240                                  MB_YESNO | MB_MOVEABLE)
    1238                           == MBID_YES) */
    1239 
    1240                 if (pszFailingName)
    1241                     strhncpy0(pszFailingName, ProgDetails.pszExecutable, cbFailingName);
    1242 
    1243                 if (!(*phapp = WinStartApp(hwndNotify,
    1244                                                     // receives WM_APPTERMINATENOTIFY
    1245                                            &ProgDetails,
    1246                                            strParamsPatched.psz,
    1247                                            NULL,            // "reserved", PMREF says...
    1248                                            SAF_INSTALLEDCMDLINE)))
    1249                                                 // we MUST use SAF_INSTALLEDCMDLINE
    1250                                                 // or no Win-OS/2 session will start...
    1251                                                 // whatever is going on here... Warp 4 FP11
    1252 
    1253                                                 // do not use SAF_STARTCHILDAPP, or the
    1254                                                 // app will be terminated automatically
    1255                                                 // when the WPS terminates!
     1241                          != MBID_YES)
     1242                    arc = ERROR_INTERRUPT;
     1243                else */
    12561244                {
    1257                     // cannot start app: unfortunately WinStartApp doesn't
    1258                     // return meaningful codes like DosStartSession, so
    1259                     // try to see what happened
    1260                     switch (ERRORIDERROR(WinGetLastError(0)))
     1245                    if (!(*phapp = WinStartApp(hwndNotify,
     1246                                                        // receives WM_APPTERMINATENOTIFY
     1247                                               &ProgDetails,
     1248                                               strParamsPatched.psz,
     1249                                               NULL,            // "reserved", PMREF says...
     1250                                               SAF_INSTALLEDCMDLINE)))
     1251                                                    // we MUST use SAF_INSTALLEDCMDLINE
     1252                                                    // or no Win-OS/2 session will start...
     1253                                                    // whatever is going on here... Warp 4 FP11
     1254
     1255                                                    // do not use SAF_STARTCHILDAPP, or the
     1256                                                    // app will be terminated automatically
     1257                                                    // when the WPS terminates!
    12611258                    {
    1262                         case PMERR_DOS_ERROR: //  (0x1200)
     1259                        // cannot start app:
     1260                        _Pmpf((__FUNCTION__ ": WinStartApp failed"));
     1261                        arc = ERROR_FILE_NOT_FOUND;
     1262                        // unfortunately WinStartApp doesn't
     1263                        // return meaningful codes like DosStartSession, so
     1264                        // try to see what happened
     1265                        /*
     1266                        switch (ERRORIDERROR(WinGetLastError(0)))
    12631267                        {
    1264                             // this is probably the case where the module
    1265                             // couldn't be loaded, so try DosStartSession
    1266                             // to get a meaningful return code... note that
    1267                             // this cannot handle hwndNotify then
    1268                             RESULTCODES result;
    1269                             arc = DosExecPgm(pszFailingName,
    1270                                              cbFailingName,
    1271                                              EXEC_ASYNC,
    1272                                              NULL, // ProgDetails.pszParameters,
    1273                                              NULL, // ProgDetails.pszEnvironment,
    1274                                              &result,
    1275                                              ProgDetails.pszExecutable);
    1276 
    1277                             /* ULONG sid, pid;
    1278                             STARTDATA   SData;
    1279                             SData.Length  = sizeof(STARTDATA);
    1280                             SData.Related = SSF_RELATED_CHILD; //INDEPENDENT;
    1281                             SData.FgBg    = SSF_FGBG_FORE;
    1282                             SData.TraceOpt = SSF_TRACEOPT_NONE;
    1283 
    1284                             SData.PgmTitle = ProgDetails.pszTitle;
    1285                             SData.PgmName = ProgDetails.pszExecutable;
    1286                             SData.PgmInputs = ProgDetails.pszParameters;
    1287 
    1288                             SData.TermQ = NULL;
    1289                             SData.Environment = ProgDetails.pszEnvironment;
    1290                             SData.InheritOpt = SSF_INHERTOPT_PARENT;    // ignored
    1291                             SData.SessionType = SSF_TYPE_DEFAULT;
    1292                             SData.IconFile = 0;
    1293                             SData.PgmHandle = 0;
    1294 
    1295                             SData.PgmControl = SSF_CONTROL_VISIBLE;
    1296 
    1297                             SData.InitXPos  = 30;
    1298                             SData.InitYPos  = 40;
    1299                             SData.InitXSize = 200;
    1300                             SData.InitYSize = 140;
    1301                             SData.Reserved = 0;
    1302                             SData.ObjectBuffer  = pszFailingName;
    1303                             SData.ObjectBuffLen = cbFailingName;
    1304 
    1305                             arc = DosStartSession(&SData, &sid, &pid);
    1306                             */
     1268                            case PMERR_DOS_ERROR: //  (0x1200)
     1269                            {
     1270                                arc = ERROR_FILE_NOT_FOUND;
     1271
     1272                                // this is probably the case where the module
     1273                                // couldn't be loaded, so try DosStartSession
     1274                                // to get a meaningful return code... note that
     1275                                // this cannot handle hwndNotify then
     1276                                /* RESULTCODES result;
     1277                                arc = DosExecPgm(pszFailingName,
     1278                                                 cbFailingName,
     1279                                                 EXEC_ASYNC,
     1280                                                 NULL, // ProgDetails.pszParameters,
     1281                                                 NULL, // ProgDetails.pszEnvironment,
     1282                                                 &result,
     1283                                                 ProgDetails.pszExecutable);
     1284                                   */
     1285                                /* ULONG sid, pid;
     1286                                STARTDATA   SData;
     1287                                SData.Length  = sizeof(STARTDATA);
     1288                                SData.Related = SSF_RELATED_CHILD; //INDEPENDENT;
     1289                                SData.FgBg    = SSF_FGBG_FORE;
     1290                                SData.TraceOpt = SSF_TRACEOPT_NONE;
     1291
     1292                                SData.PgmTitle = ProgDetails.pszTitle;
     1293                                SData.PgmName = ProgDetails.pszExecutable;
     1294                                SData.PgmInputs = ProgDetails.pszParameters;
     1295
     1296                                SData.TermQ = NULL;
     1297                                SData.Environment = ProgDetails.pszEnvironment;
     1298                                SData.InheritOpt = SSF_INHERTOPT_PARENT;    // ignored
     1299                                SData.SessionType = SSF_TYPE_DEFAULT;
     1300                                SData.IconFile = 0;
     1301                                SData.PgmHandle = 0;
     1302
     1303                                SData.PgmControl = SSF_CONTROL_VISIBLE;
     1304
     1305                                SData.InitXPos  = 30;
     1306                                SData.InitYPos  = 40;
     1307                                SData.InitXSize = 200;
     1308                                SData.InitYSize = 140;
     1309                                SData.Reserved = 0;
     1310                                SData.ObjectBuffer  = pszFailingName;
     1311                                SData.ObjectBuffLen = cbFailingName;
     1312
     1313                                arc = DosStartSession(&SData, &sid, &pid);
     1314                            }
     1315                            break;
     1316
     1317                            case PMERR_INVALID_APPL: //  (0x1530)
     1318                                    // Attempted to start an application whose type is not
     1319                                    // recognized by OS/2.
     1320                                arc = ERROR_INVALID_EXE_SIGNATURE;
     1321                            break;
     1322
     1323                            case PMERR_INVALID_PARAMETERS: //  (0x1208)
     1324                                    // An application parameter value is invalid for
     1325                                    // its converted PM type. For  example: a 4-byte
     1326                                    // value outside the range -32 768 to +32 767 cannot be
     1327                                    // converted to a SHORT, and a negative number cannot
     1328                                    // be converted to a ULONG or USHORT.
     1329                                arc = ERROR_INVALID_DATA;
     1330                            break;
     1331
     1332                            case PMERR_STARTED_IN_BACKGROUND: //  (0x1532)
     1333                                    // The application started a new session in the
     1334                                    // background.
     1335                                arc = ERROR_SMG_START_IN_BACKGROUND;
     1336                            break;
     1337
     1338                            case PMERR_INVALID_WINDOW: // (0x1206)
     1339                                    // The window specified with a Window List call
     1340                                    // is not a valid frame window.
     1341
     1342                            default:
     1343                                arc = ERROR_BAD_FORMAT;
     1344                            break;
    13071345                        }
    1308                         break;
    1309 
    1310                         case PMERR_INVALID_APPL: //  (0x1530)
    1311                                 // Attempted to start an application whose type is not
    1312                                 // recognized by OS/2.
    1313                             arc = ERROR_INVALID_EXE_SIGNATURE;
    1314                         break;
    1315 
    1316                         case PMERR_INVALID_PARAMETERS: //  (0x1208)
    1317                                 // An application parameter value is invalid for
    1318                                 // its converted PM type. For  example: a 4-byte
    1319                                 // value outside the range -32 768 to +32 767 cannot be
    1320                                 // converted to a SHORT, and a negative number cannot
    1321                                 // be converted to a ULONG or USHORT.
    1322                             arc = ERROR_INVALID_DATA;
    1323                         break;
    1324 
    1325                         case PMERR_STARTED_IN_BACKGROUND: //  (0x1532)
    1326                                 // The application started a new session in the
    1327                                 // background.
    1328                             arc = ERROR_SMG_START_IN_BACKGROUND;
    1329                         break;
    1330 
    1331                         case PMERR_INVALID_WINDOW: // (0x1206)
    1332                                 // The window specified with a Window List call
    1333                                 // is not a valid frame window.
    1334 
    1335                         default:
    1336                             arc = ERROR_BAD_FORMAT;
    1337                         break;
     1346                        */
    13381347                    }
    13391348                }
Note: See TracChangeset for help on using the changeset viewer.