Changeset 1162 for trunk/dll/systemf.c


Ignore:
Timestamp:
Sep 5, 2008, 11:43:09 PM (17 years ago)
Author:
John Small
Message:

Ticket 187: Draft 1: Functions only

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/systemf.c

    r1104 r1162  
    3535#define INCL_DOSERRORS
    3636#define INCL_WIN
    37 #define INCL_LONGLONG                   // dircnrs.h
     37#define INCL_LONGLONG                   // dircnrs.h
    3838
    3939#include "fm3dlg.h"
    4040#include "fm3str.h"
    41 #include "errutil.h"                    // Dos_Error...
    42 #include "strutil.h"                    // GetPString
     41#include "errutil.h"                    // Dos_Error...
     42#include "strutil.h"                    // GetPString
    4343#include "notebook.h"                   //targetdirectory
    4444#include "pathutil.h"
     45#include "cmdline.h"                    // CmdLineDlgProc
     46#include "shadow.h"                     // RunSeamless
     47#include "systemf.h"
     48#include "strips.h"                     // convert_nl_to_nul, strip_lead_char
     49#include "dirs.h"                       // switch_to
    4550#include "fm3dll.h"
    4651#include "fortify.h"
    4752
    4853static PSZ pszSrcFile = __FILE__;
     54
     55//static HAPP Exec(HWND hwndNotify, BOOL child, char *startdir, char *env,
     56//          PROGTYPE * progt, ULONG fl, char *formatstring, ...);
    4957
    5058/**
     
    6472    if (!rc) {
    6573      if (swctl.idProcess == pid && swctl.uchVisibility == SWL_VISIBLE)
    66         rc = WinSwitchToProgram(hswitch);
     74        rc = WinSwitchToProgram(hswitch);
    6775      if (!rc)
    68         return TRUE;
     76        return TRUE;
    6977      // else saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Failed: %lu/%lx",rc,rc);
    7078
     
    8290
    8391int ExecOnList(HWND hwnd, char *command, int flags, char *tpath,
    84                char **list, char *prompt, PCSZ pszCallingFile, UINT uiLineNumber)
     92               char **list, char *prompt, PCSZ pszCallingFile, UINT uiLineNumber)
    8593{
    8694  /* executes the command once for all files in list */
     
    117125    if (p) {
    118126      if (*p == ':') {
    119         p++;
    120         *p = '\\';
    121         p++;
     127        p++;
     128        *p = '\\';
     129        p++;
    122130      }
    123131      *p = 0;
     
    134142    if (p) {
    135143      if (*p == ':') {
    136         p++;
    137         *p = '\\';
    138         p++;
     144        p++;
     145        *p = '\\';
     146        p++;
    139147      }
    140148      *p = 0;
     
    170178    drive = 0;
    171179
    172   p = command;                          // substitue for special % sequences
     180  p = command;                          // substitue for special % sequences
    173181
    174182  pp = commandline;
     
    177185    if (*p == '%') {
    178186      switch (*(p + 1)) {
    179       case '!':                 /* write list to file, add filename */
    180         if (list) {
    181           if (!*listfile) {
    182             FILE *fp;
     187      case '!':                 /* write list to file, add filename */
     188        if (list) {
     189          if (!*listfile) {
     190            FILE *fp;
    183191
    184192
     
    202210          strcpy(pp, listfile);
    203211          pp += strlen(listfile);
    204         }
    205         p += 2;
    206         break;
    207 
    208       case 'c':                 /* add name of command processor */
    209         {
    210           char *env = GetCmdSpec(FALSE);
    211 
    212           if (needs_quoting(env) && !strchr(env, '\"')) {
    213             *pp = '\"';
    214             pp++;
    215             spaces = TRUE;
    216           }
    217           else
    218             spaces = FALSE;
    219           strcpy(pp, env);
    220           p += 2;
    221           pp += strlen(env);
    222           if (spaces) {
    223             *pp = '\"';
    224             pp++;
    225           }
    226         }
    227         break;
    228 
    229       case 't':                 /* add Target directory */
    230         if (needs_quoting(targetdir) && !strchr(targetdir, '\"')) {
    231           *pp = '\"';
    232           pp++;
    233           spaces = TRUE;
    234         }
    235         else
    236           spaces = FALSE;
    237         strcpy(pp, targetdir);
    238         p += 2;
    239         pp += strlen(targetdir);
    240         if (spaces) {
    241           *pp = '\"';
    242           pp++;
    243         }
    244         break;
    245 
    246       case '$':                 /* add drive letter */
    247         if (drive)
    248           *pp = drive;
    249         else {
    250           ULONG ulDriveNum = 3, ulDriveMap;
    251 
    252           DosQCurDisk(&ulDriveNum, &ulDriveMap);
    253           *pp = (char) (ulDriveNum + '@');
    254         }
    255         pp++;
    256         p += 2;
    257         break;
    258 
    259       case 'U':                 /* add path of first list component */
     212        }
     213        p += 2;
     214        break;
     215
     216      case 'c':                 /* add name of command processor */
     217        {
     218          char *env = GetCmdSpec(FALSE);
     219
     220          if (needs_quoting(env) && !strchr(env, '\"')) {
     221            *pp = '\"';
     222            pp++;
     223            spaces = TRUE;
     224          }
     225          else
     226            spaces = FALSE;
     227          strcpy(pp, env);
     228          p += 2;
     229          pp += strlen(env);
     230          if (spaces) {
     231            *pp = '\"';
     232            pp++;
     233          }
     234        }
     235        break;
     236
     237      case 't':                 /* add Target directory */
     238        if (needs_quoting(targetdir) && !strchr(targetdir, '\"')) {
     239          *pp = '\"';
     240          pp++;
     241          spaces = TRUE;
     242        }
     243        else
     244          spaces = FALSE;
     245        strcpy(pp, targetdir);
     246        p += 2;
     247        pp += strlen(targetdir);
     248        if (spaces) {
     249          *pp = '\"';
     250          pp++;
     251        }
     252        break;
     253
     254      case '$':                 /* add drive letter */
     255        if (drive)
     256          *pp = drive;
     257        else {
     258          ULONG ulDriveNum = 3, ulDriveMap;
     259
     260          DosQCurDisk(&ulDriveNum, &ulDriveMap);
     261          *pp = (char) (ulDriveNum + '@');
     262        }
     263        pp++;
     264        p += 2;
     265        break;
     266
     267      case 'U':                 /* add path of first list component */
    260268      case 'u':
    261         if (*modpath) {
    262           if (needs_quoting(modpath) && !strchr(modpath, '\"')) {
    263             spaces = TRUE;
    264             *pp = '\"';
    265             pp++;
    266           }
    267           else
    268             spaces = FALSE;
    269           if (*(p + 1) == 'u') {
    270             strcpy(pp, modpath);
    271             pp += strlen(modpath);
    272           }
    273           else {
    274             strcpy(pp, modpath + 2);
    275             pp += strlen(modpath + 2);
    276           }
    277           if (spaces) {
    278             if (modpath[strlen(modpath) - 1] == '\\') {
    279               *pp = '\\';
    280               pp++;
    281             }
    282             *pp = '\"';
    283             pp++;
    284           }
    285         }
    286         else {
    287           char temp[CCHMAXPATH];
    288 
    289           strcpy(temp, pFM2SaveDirectory);
    290           if (needs_quoting(temp) && !strchr(temp, '\"')) {
    291             spaces = TRUE;
    292             *pp = '\"';
    293             pp++;
    294           }
    295           else
    296             spaces = FALSE;
    297           strcpy(pp, temp);
    298           pp += strlen(temp);
    299           if (spaces) {
    300             if (temp[strlen(temp) - 1] == '\\') {
    301               *pp = '\\';
    302               pp++;
    303             }
    304             *pp = '\"';
    305             pp++;
    306           }
    307         }
    308         p += 2;
    309         break;
    310 
    311       case 'P':                 /* add path of execution */
     269        if (*modpath) {
     270          if (needs_quoting(modpath) && !strchr(modpath, '\"')) {
     271            spaces = TRUE;
     272            *pp = '\"';
     273            pp++;
     274          }
     275          else
     276            spaces = FALSE;
     277          if (*(p + 1) == 'u') {
     278            strcpy(pp, modpath);
     279            pp += strlen(modpath);
     280          }
     281          else {
     282            strcpy(pp, modpath + 2);
     283            pp += strlen(modpath + 2);
     284          }
     285          if (spaces) {
     286            if (modpath[strlen(modpath) - 1] == '\\') {
     287              *pp = '\\';
     288              pp++;
     289            }
     290            *pp = '\"';
     291            pp++;
     292          }
     293        }
     294        else {
     295          char temp[CCHMAXPATH];
     296
     297          strcpy(temp, pFM2SaveDirectory);
     298          if (needs_quoting(temp) && !strchr(temp, '\"')) {
     299            spaces = TRUE;
     300            *pp = '\"';
     301            pp++;
     302          }
     303          else
     304            spaces = FALSE;
     305          strcpy(pp, temp);
     306          pp += strlen(temp);
     307          if (spaces) {
     308            if (temp[strlen(temp) - 1] == '\\') {
     309              *pp = '\\';
     310              pp++;
     311            }
     312            *pp = '\"';
     313            pp++;
     314          }
     315        }
     316        p += 2;
     317        break;
     318
     319      case 'P':                 /* add path of execution */
    312320      case 'p':
    313         if (*path) {
    314           if (needs_quoting(path) && !strchr(path, '\"')) {
    315             spaces = TRUE;
    316             *pp = '\"';
    317             pp++;
    318           }
    319           else
    320             spaces = FALSE;
    321           if (*(p + 1) == 'p') {
    322             strcpy(pp, path);
    323             pp += strlen(path);
    324           }
    325           else {
    326             strcpy(pp, path + 2);
    327             pp += strlen(path + 2);
    328           }
    329           if (spaces) {
    330             if (path[strlen(path) - 1] == '\\') {
    331               *pp = '\\';
    332               pp++;
    333             }
    334             *pp = '\"';
    335             pp++;
    336           }
    337         }
    338         else {
    339           char temp[CCHMAXPATH];
    340 
    341           strcpy(temp, pFM2SaveDirectory);
    342           if (needs_quoting(temp) && !strchr(temp, '\"')) {
    343             spaces = TRUE;
    344             *pp = '\"';
    345             pp++;
    346           }
    347           else
    348             spaces = FALSE;
    349           strcpy(pp, temp);
    350           pp += strlen(temp);
    351           if (spaces) {
    352             if (temp[strlen(temp) - 1] == '\\') {
    353               *pp = '\\';
    354               pp++;
    355             }
    356             *pp = '\"';
    357             pp++;
    358           }
    359         }
    360         p += 2;
    361         break;
     321        if (*path) {
     322          if (needs_quoting(path) && !strchr(path, '\"')) {
     323            spaces = TRUE;
     324            *pp = '\"';
     325            pp++;
     326          }
     327          else
     328            spaces = FALSE;
     329          if (*(p + 1) == 'p') {
     330            strcpy(pp, path);
     331            pp += strlen(path);
     332          }
     333          else {
     334            strcpy(pp, path + 2);
     335            pp += strlen(path + 2);
     336          }
     337          if (spaces) {
     338            if (path[strlen(path) - 1] == '\\') {
     339              *pp = '\\';
     340              pp++;
     341            }
     342            *pp = '\"';
     343            pp++;
     344          }
     345        }
     346        else {
     347          char temp[CCHMAXPATH];
     348
     349          strcpy(temp, pFM2SaveDirectory);
     350          if (needs_quoting(temp) && !strchr(temp, '\"')) {
     351            spaces = TRUE;
     352            *pp = '\"';
     353            pp++;
     354          }
     355          else
     356            spaces = FALSE;
     357          strcpy(pp, temp);
     358          pp += strlen(temp);
     359          if (spaces) {
     360            if (temp[strlen(temp) - 1] == '\\') {
     361              *pp = '\\';
     362              pp++;
     363            }
     364            *pp = '\"';
     365            pp++;
     366          }
     367        }
     368        p += 2;
     369        break;
    362370
    363371      case 'D':
    364         if (hwndMain) {
    365           PCNRITEM pci;
    366 
    367           pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(
    368                                            hwndTree, FID_CLIENT), TREE_CNR),
    369                                       CM_QUERYRECORDEMPHASIS,
    370                                       MPFROMLONG(CMA_FIRST),
    371                                       MPFROMSHORT(CRA_CURSORED));
    372           if (pci && (int) pci != -1 && *pci->pszFileName) {
    373             if (needs_quoting(pci->pszFileName) &&
    374                 !strchr(pci->pszFileName, '\"'))
    375             {
    376               *pp = '\"';
    377               pp++;
    378               spaces = TRUE;
    379             }
    380             else
    381               spaces = FALSE;
    382             strcpy(pp, pci->pszFileName);
    383             pp += strlen(pci->pszFileName);
    384             if (spaces) {
    385               *pp = '\"';
    386               pp++;
    387             }
    388           }
    389         }
    390         p += 2;
    391         break;
     372        if (hwndMain) {
     373          PCNRITEM pci;
     374
     375          pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(
     376                                           hwndTree, FID_CLIENT), TREE_CNR),
     377                                      CM_QUERYRECORDEMPHASIS,
     378                                      MPFROMLONG(CMA_FIRST),
     379                                      MPFROMSHORT(CRA_CURSORED));
     380          if (pci && (int) pci != -1 && *pci->pszFileName) {
     381            if (needs_quoting(pci->pszFileName) &&
     382                !strchr(pci->pszFileName, '\"'))
     383            {
     384              *pp = '\"';
     385              pp++;
     386              spaces = TRUE;
     387            }
     388            else
     389              spaces = FALSE;
     390            strcpy(pp, pci->pszFileName);
     391            pp += strlen(pci->pszFileName);
     392            if (spaces) {
     393              *pp = '\"';
     394              pp++;
     395            }
     396          }
     397        }
     398        p += 2;
     399        break;
    392400
    393401      case 'd':
    394         if (hwndMain) {
    395           HENUM henum;
    396           char retstr[CCHMAXPATH];
    397           HWND hwndC, hwndDir;
    398           USHORT id;
    399           BOOL first = TRUE;
    400 
    401           henum = WinBeginEnumWindows(hwndMain);
    402           while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
    403             if (hwndC != hwndTree) {
    404               id = WinQueryWindowUShort(hwndC, QWS_ID);
    405               if (id) {
    406                 hwndDir = WinWindowFromID(hwndC, FID_CLIENT);
    407                 if (hwndDir) {
    408                   hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
    409                   if (hwndDir) {
    410                     *retstr = 0;
    411                     WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID);
    412                     if (*retstr) {
    413                       if (!first) {
    414                         *pp = ' ';
    415                         pp++;
    416                       }
    417                       first = FALSE;
    418                       if (needs_quoting(retstr) && !strchr(retstr, '\"')) {
    419                         *pp = '\"';
    420                         pp++;
    421                         spaces = TRUE;
    422                       }
    423                       else
    424                         spaces = FALSE;
    425                       strcpy(pp, retstr);
    426                       pp += strlen(retstr);
    427                       if (spaces) {
    428                         *pp = '\"';
    429                         pp++;
    430                       }
    431                     }
    432                   }
    433                 }
    434               }
    435             }
    436           }
    437           WinEndEnumWindows(henum);
    438         }
    439         p += 2;
    440         break;
     402        if (hwndMain) {
     403          HENUM henum;
     404          char retstr[CCHMAXPATH];
     405          HWND hwndC, hwndDir;
     406          USHORT id;
     407          BOOL first = TRUE;
     408
     409          henum = WinBeginEnumWindows(hwndMain);
     410          while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
     411            if (hwndC != hwndTree) {
     412              id = WinQueryWindowUShort(hwndC, QWS_ID);
     413              if (id) {
     414                hwndDir = WinWindowFromID(hwndC, FID_CLIENT);
     415                if (hwndDir) {
     416                  hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
     417                  if (hwndDir) {
     418                    *retstr = 0;
     419                    WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID);
     420                    if (*retstr) {
     421                      if (!first) {
     422                        *pp = ' ';
     423                        pp++;
     424                      }
     425                      first = FALSE;
     426                      if (needs_quoting(retstr) && !strchr(retstr, '\"')) {
     427                        *pp = '\"';
     428                        pp++;
     429                        spaces = TRUE;
     430                      }
     431                      else
     432                        spaces = FALSE;
     433                      strcpy(pp, retstr);
     434                      pp += strlen(retstr);
     435                      if (spaces) {
     436                        *pp = '\"';
     437                        pp++;
     438                      }
     439                    }
     440                  }
     441                }
     442              }
     443            }
     444          }
     445          WinEndEnumWindows(henum);
     446        }
     447        p += 2;
     448        break;
    441449
    442450      case '%':
    443         *pp = '%';
    444         pp++;
    445         p += 2;
    446         break;
     451        *pp = '%';
     452        pp++;
     453        p += 2;
     454        break;
    447455
    448456      case 'R':
     
    453461      case 'a':
    454462      case 'e':
    455         if (list) {
    456           for (x = 0; list[x]; x++)
    457           {
    458             file = strrchr(list[x], '\\');
    459             if (!file)
    460               file = strrchr(list[x], ':');
    461             if (file)
    462               file++;
    463             else
    464               file = list[x];
    465             ext = strrchr(file, '.');
    466             dot = ext;
    467             if (ext)
    468               ext++;
    469             switch (*(p + 1)) {
    470             case 'R':
    471             case 'r':
    472               if (pp + strlen(list[x]) > commandline + MaxComLineStrg)
    473                 goto BreakOut;
    474               if (*(p + 1) == 'r') {
    475                 strcpy(pp, list[x]);
    476                 pp += strlen(list[x]);
    477               }
    478               else {
    479                 strcpy(pp, list[x] + 2);
    480                 pp += strlen(list[x] + 2);
    481               }
    482               break;
    483 
    484             case 'F':
    485             case 'f':
    486               if (*(p + 1) == 'F' && dot)
    487                 *dot = 0;
    488               if (pp + strlen(file) > commandline + MaxComLineStrg)
    489                 goto BreakOut;
    490               if (needs_quoting(file)) {
    491                 spaces = TRUE;
    492                 *pp = '\"';
    493                 pp++;
    494               }
    495               else
    496                 spaces = FALSE;
    497               strcpy(pp, file);
    498               pp += strlen(file);
    499               if (*(p + 1) == 'F' && dot)
    500                 *dot = '.';
    501               if (spaces) {
    502                 if (*(pp - 1) != '\"') {
    503                   *pp = '\"';
    504                   pp++;
    505                 }
    506               }
    507               break;
    508 
    509             case 'A':
    510             case 'a':
    511               if (pp + strlen(list[x]) > commandline + MaxComLineStrg)
    512                 goto BreakOut;
    513               if (needs_quoting(list[x]) && !strchr(list[x], '\"')) {
    514                 spaces = TRUE;
    515                 *pp = '\"';
    516                 pp++;
    517               }
    518               else
    519                 spaces = FALSE;
    520               if (*(p + 1) == 'a') {
    521                 strcpy(pp, list[x]);
    522                 pp += strlen(list[x]);
    523               }
    524               else {
    525                 strcpy(pp, list[x] + 2);
    526                 pp += strlen(list[x] + 2);
    527               }
    528               if (spaces) {
    529                 if (list[x][strlen(list[x]) - 1] == '\\') {
    530                   *pp = '\\';
    531                   pp++;
    532                 }
    533                 *pp = '\"';
    534                 pp++;
    535               }
    536               break;
    537 
    538             case 'e':
    539               if (ext) {
    540                 if (pp + strlen(ext) > commandline + MaxComLineStrg)
    541                   goto BreakOut;
    542                 if (needs_quoting(ext)) {
    543                   spaces = TRUE;
    544                   *pp = '\"';
    545                   pp++;
    546                 }
    547                 else
    548                   spaces = FALSE;
    549                 strcpy(pp, ext);
    550                 pp += strlen(ext);
    551                 if (spaces) {
    552                   if (*(pp - 1) != '\"') {
    553                     *pp = '\"';
    554                     pp++;
    555                   }
    556                 }
    557               }
    558               break;
    559             }
    560             if (list[x + 1]) {
    561               *pp = ' ';
    562               pp++;
    563             }
    564           }
    565         }
    566         p += 2;
    567         break;
     463        if (list) {
     464          for (x = 0; list[x]; x++)
     465          {
     466            file = strrchr(list[x], '\\');
     467            if (!file)
     468              file = strrchr(list[x], ':');
     469            if (file)
     470              file++;
     471            else
     472              file = list[x];
     473            ext = strrchr(file, '.');
     474            dot = ext;
     475            if (ext)
     476              ext++;
     477            switch (*(p + 1)) {
     478            case 'R':
     479            case 'r':
     480              if (pp + strlen(list[x]) > commandline + MaxComLineStrg)
     481                goto BreakOut;
     482              if (*(p + 1) == 'r') {
     483                strcpy(pp, list[x]);
     484                pp += strlen(list[x]);
     485              }
     486              else {
     487                strcpy(pp, list[x] + 2);
     488                pp += strlen(list[x] + 2);
     489              }
     490              break;
     491
     492            case 'F':
     493            case 'f':
     494              if (*(p + 1) == 'F' && dot)
     495                *dot = 0;
     496              if (pp + strlen(file) > commandline + MaxComLineStrg)
     497                goto BreakOut;
     498              if (needs_quoting(file)) {
     499                spaces = TRUE;
     500                *pp = '\"';
     501                pp++;
     502              }
     503              else
     504                spaces = FALSE;
     505              strcpy(pp, file);
     506              pp += strlen(file);
     507              if (*(p + 1) == 'F' && dot)
     508                *dot = '.';
     509              if (spaces) {
     510                if (*(pp - 1) != '\"') {
     511                  *pp = '\"';
     512                  pp++;
     513                }
     514              }
     515              break;
     516
     517            case 'A':
     518            case 'a':
     519              if (pp + strlen(list[x]) > commandline + MaxComLineStrg)
     520                goto BreakOut;
     521              if (needs_quoting(list[x]) && !strchr(list[x], '\"')) {
     522                spaces = TRUE;
     523                *pp = '\"';
     524                pp++;
     525              }
     526              else
     527                spaces = FALSE;
     528              if (*(p + 1) == 'a') {
     529                strcpy(pp, list[x]);
     530                pp += strlen(list[x]);
     531              }
     532              else {
     533                strcpy(pp, list[x] + 2);
     534                pp += strlen(list[x] + 2);
     535              }
     536              if (spaces) {
     537                if (list[x][strlen(list[x]) - 1] == '\\') {
     538                  *pp = '\\';
     539                  pp++;
     540                }
     541                *pp = '\"';
     542                pp++;
     543              }
     544              break;
     545
     546            case 'e':
     547              if (ext) {
     548                if (pp + strlen(ext) > commandline + MaxComLineStrg)
     549                  goto BreakOut;
     550                if (needs_quoting(ext)) {
     551                  spaces = TRUE;
     552                  *pp = '\"';
     553                  pp++;
     554                }
     555                else
     556                  spaces = FALSE;
     557                strcpy(pp, ext);
     558                pp += strlen(ext);
     559                if (spaces) {
     560                  if (*(pp - 1) != '\"') {
     561                    *pp = '\"';
     562                    pp++;
     563                  }
     564                }
     565              }
     566              break;
     567            }
     568            if (list[x + 1]) {
     569              *pp = ' ';
     570              pp++;
     571            }
     572          }
     573        }
     574        p += 2;
     575        break;
    568576
    569577      default:
    570         *pp = *p;
    571         p++;
    572         pp++;
    573         break;
     578        *pp = *p;
     579        p++;
     580        pp++;
     581        break;
    574582      }
    575583    }
     
    598606      strcpy(ex.path, path);
    599607      if (prompt)
    600         strcpy(ex.title, prompt);
     608        strcpy(ex.title, prompt);
    601609      ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle,
    602                       EXEC_FRAME, &ex);
     610                      EXEC_FRAME, &ex);
    603611      if (ret != 1) {
    604612        free(commandline);
     
    610618    ex.flags &= (~PROMPT);
    611619    ret = runemf2(ex.flags, hwnd, pszCallingFile, uiLineNumber, path,
    612                    (*ex.environment) ? ex.environment : NULL,
     620                   (*ex.environment) ? ex.environment : NULL,
    613621                   "%s", commandline);
    614622    free(commandline);
     
    622630
    623631int runemf2(int type, HWND hwnd, PCSZ pszCallingFile, UINT uiLineNumber,
    624             char *pszDirectory, char *pszEnvironment,
    625             char *formatstring,...)
     632            char *pszDirectory, char *pszEnvironment,
     633            char *formatstring,...)
    626634{
    627635  /** example:
     
    678686  if (pszDirectory && *pszDirectory) {
    679687    if (!DosQueryPathInfo(pszDirectory,
    680                           FIL_QUERYFULLNAME,
    681                           szTempdir,
    682                           sizeof(szTempdir)))
     688                          FIL_QUERYFULLNAME,
     689                          szTempdir,
     690                          sizeof(szTempdir)))
    683691      pszDirectory = szTempdir;
    684692  }
     
    688696
    689697  rc = DosAllocMem((PVOID)&pszPgm,
    690                    MaxComLineStrg,
    691                    PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     698                   MaxComLineStrg,
     699                   PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    692700  if (rc) {
    693701    Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
     
    699707  *pszPgm = 0;
    700708  va_start(parguments,
    701            formatstring);
     709           formatstring);
    702710  vsprintf(pszPgm,
    703            formatstring,
    704            parguments);
     711           formatstring,
     712           parguments);
    705713  va_end(parguments);
    706714
     
    732740      temp = *p;
    733741      if (temp) {
    734         rc = DosAllocMem((PVOID)&pszArgs,
    735                         MaxComLineStrg * 2,
    736                         PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    737         if (rc)
    738           Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
     742        rc = DosAllocMem((PVOID)&pszArgs,
     743                        MaxComLineStrg * 2,
     744                        PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     745        if (rc)
     746          Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
    739747      }
    740748      else
    741         pszArgs = NULL;
     749        pszArgs = NULL;
    742750      *p = 0;
    743751      /* Find the handle of the WPS object */
     
    745753      *p = temp;
    746754      if (hWPSObject != NULLHANDLE) {
    747         if (pszArgs && *p) {
    748           sprintf(pszArgs,"OPEN=DEFAULT;PARAMETERS=\"%s\"",p);
    749           WinSetObjectData(hWPSObject,pszArgs);
    750         }
    751         else
    752           WinSetObjectData(hWPSObject,"OPEN=DEFAULT");
    753         ret = 0;
     755        if (pszArgs && *p) {
     756          sprintf(pszArgs,"OPEN=DEFAULT;PARAMETERS=\"%s\"",p);
     757          WinSetObjectData(hWPSObject,pszArgs);
     758        }
     759        else
     760          WinSetObjectData(hWPSObject,"OPEN=DEFAULT");
     761        ret = 0;
    754762      }
    755763      goto ObjectInterrupt;
     
    757765
    758766    if ((type & RUNTYPE_MASK) == SYNCHRONOUS ||
    759         (type & RUNTYPE_MASK) == ASYNCHRONOUS ||
    760         (type & RUNTYPE_MASK) == DETACHED)
     767        (type & RUNTYPE_MASK) == ASYNCHRONOUS ||
     768        (type & RUNTYPE_MASK) == DETACHED)
    761769    {
    762770      strip_lead_char(" \t", pszPgm);
     
    764772      wasquote = FALSE;
    765773      while (*p &&
    766              (wasquote ||
    767               (*p != ' ' &&
    768                *p != '\t')))
     774             (wasquote ||
     775              (*p != ' ' &&
     776               *p != '\t')))
    769777      {
    770         if (*p == '\"') {
    771           if (!wasquote) {
    772             wasquote = TRUE;
    773             memmove(p,
    774                     p + 1,
    775                     strlen(p));
    776             while (*p == ' ' ||
    777                    *p == '\t')
    778               p++;
    779           }
    780           else {
    781             memmove(p,
    782                     p + 1,
    783                     strlen(p));
    784             break;
    785           }
    786         }
    787         else
    788           p++;
     778        if (*p == '\"') {
     779          if (!wasquote) {
     780            wasquote = TRUE;
     781            memmove(p,
     782                    p + 1,
     783                    strlen(p));
     784            while (*p == ' ' ||
     785                   *p == '\t')
     786              p++;
     787          }
     788          else {
     789            memmove(p,
     790                    p + 1,
     791                    strlen(p));
     792            break;
     793          }
     794        }
     795        else
     796          p++;
    789797      }
    790798      if (*p) {
    791         *p = 0;
    792         p++;
     799        *p = 0;
     800        p++;
    793801      }
    794802      else
    795         p = pszPgm;
    796       p[strlen(p) + 1] = 0;             /* double-terminate args */
     803        p = pszPgm;
     804      p[strlen(p) + 1] = 0;             /* double-terminate args */
    797805      if (*pszPgm) {
    798         if (!strchr(pszPgm, '\\') &&
    799             !strchr(pszPgm, ':') &&
    800             pszDirectory &&
    801             *pszDirectory)
    802         {
    803           strcpy(szSavedir, pFM2SaveDirectory);
    804           switch_to(pszDirectory);
    805         }
    806         rc = DosQueryAppType(pszPgm,&ulAppType);
    807         if (!strchr(pszPgm, '\\') &&
    808             !strchr(pszPgm, ':') &&
    809             pszDirectory &&
    810             *pszDirectory)
    811           switch_to(szSavedir);
    812         if (rc) {
    813           Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,
    814                     GetPString(IDS_DOSQAPPTYPEFAILEDTEXT),
    815                     pszPgm, pszCallingFile, uiLineNumber);      // 26 May 08 SHL
    816           DosFreeMem(pszPgm);
    817           if (pszArgs)
    818             DosFreeMem(pszArgs);
    819           return -1;
    820         }
    821         if (ulAppType) {
    822           if (ulAppType & FAPPTYP_DLL || ulAppType & FAPPTYP_VIRTDRV ||
    823               ulAppType & FAPPTYP_PHYSDRV || ulAppType & FAPPTYP_PROTDLL)
    824           {
    825             Runtime_Error(pszSrcFile, __LINE__,
    826                           GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
    827                           ulAppType, pszPgm, pszCallingFile, uiLineNumber);     // 26 May 08 SHL
    828             if (pszPgm)
    829               DosFreeMem(pszPgm);
    830             if (pszArgs)
    831               DosFreeMem(pszArgs);
    832             return -1;
    833           }
    834           if (ulAppType & FAPPTYP_DOS || ulAppType & FAPPTYP_WINDOWSREAL ||
    835               ulAppType & FAPPTYP_WINDOWSPROT || ulAppType & FAPPTYP_WINDOWSPROT31)
    836           {
    837             Runtime_Error(pszSrcFile, __LINE__,
    838                           GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
    839                           ulAppType, pszPgm, pszCallingFile, uiLineNumber);     // 26 May 08 SHL
    840             if (pszPgm)
    841               DosFreeMem(pszPgm);
    842             if (pszArgs)
    843               DosFreeMem(pszArgs);
    844             return -1;
    845           }
    846         }
    847         memset(&results, 0, sizeof(results));
    848         if (pszDirectory && *pszDirectory) {
    849           strcpy(szSavedir, pFM2SaveDirectory);
    850           switch_to(pszDirectory);
    851         }
    852         ret = DosExecPgm(szObject, sizeof(szObject),
    853                         ((type & RUNTYPE_MASK) == ASYNCHRONOUS ?  EXEC_ASYNC : 0) +
    854                         ((type & RUNTYPE_MASK) == DETACHED ? EXEC_BACKGROUND : 0),
    855                         pszPgm, pszEnvironment, &results, pszPgm);
    856         if (pszDirectory && *pszDirectory)
    857           switch_to(szSavedir);
    858         if (ret) {
    859           Dos_Error(MB_ENTER,ret,hwnd,pszSrcFile,__LINE__,
    860                     GetPString(IDS_DOSEXECPGMFAILEDTEXT), pszPgm,
    861                     pszCallingFile, uiLineNumber);      // 26 May 08 SHL
    862         }
     806        if (!strchr(pszPgm, '\\') &&
     807            !strchr(pszPgm, ':') &&
     808            pszDirectory &&
     809            *pszDirectory)
     810        {
     811          strcpy(szSavedir, pFM2SaveDirectory);
     812          switch_to(pszDirectory);
     813        }
     814        rc = DosQueryAppType(pszPgm,&ulAppType);
     815        if (!strchr(pszPgm, '\\') &&
     816            !strchr(pszPgm, ':') &&
     817            pszDirectory &&
     818            *pszDirectory)
     819          switch_to(szSavedir);
     820        if (rc) {
     821          Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,
     822                    GetPString(IDS_DOSQAPPTYPEFAILEDTEXT),
     823                    pszPgm, pszCallingFile, uiLineNumber);      // 26 May 08 SHL
     824          DosFreeMem(pszPgm);
     825          if (pszArgs)
     826            DosFreeMem(pszArgs);
     827          return -1;
     828        }
     829        if (ulAppType) {
     830          if (ulAppType & FAPPTYP_DLL || ulAppType & FAPPTYP_VIRTDRV ||
     831              ulAppType & FAPPTYP_PHYSDRV || ulAppType & FAPPTYP_PROTDLL)
     832          {
     833            Runtime_Error(pszSrcFile, __LINE__,
     834                          GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
     835                          ulAppType, pszPgm, pszCallingFile, uiLineNumber);     // 26 May 08 SHL
     836            if (pszPgm)
     837              DosFreeMem(pszPgm);
     838            if (pszArgs)
     839              DosFreeMem(pszArgs);
     840            return -1;
     841          }
     842          if (ulAppType & FAPPTYP_DOS || ulAppType & FAPPTYP_WINDOWSREAL ||
     843              ulAppType & FAPPTYP_WINDOWSPROT || ulAppType & FAPPTYP_WINDOWSPROT31)
     844          {
     845            Runtime_Error(pszSrcFile, __LINE__,
     846                          GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
     847                          ulAppType, pszPgm, pszCallingFile, uiLineNumber);     // 26 May 08 SHL
     848            if (pszPgm)
     849              DosFreeMem(pszPgm);
     850            if (pszArgs)
     851              DosFreeMem(pszArgs);
     852            return -1;
     853          }
     854        }
     855        memset(&results, 0, sizeof(results));
     856        if (pszDirectory && *pszDirectory) {
     857          strcpy(szSavedir, pFM2SaveDirectory);
     858          switch_to(pszDirectory);
     859        }
     860        ret = DosExecPgm(szObject, sizeof(szObject),
     861                        ((type & RUNTYPE_MASK) == ASYNCHRONOUS ?  EXEC_ASYNC : 0) +
     862                        ((type & RUNTYPE_MASK) == DETACHED ? EXEC_BACKGROUND : 0),
     863                        pszPgm, pszEnvironment, &results, pszPgm);
     864        if (pszDirectory && *pszDirectory)
     865          switch_to(szSavedir);
     866        if (ret) {
     867          Dos_Error(MB_ENTER,ret,hwnd,pszSrcFile,__LINE__,
     868                    GetPString(IDS_DOSEXECPGMFAILEDTEXT), pszPgm,
     869                    pszCallingFile, uiLineNumber);      // 26 May 08 SHL
     870        }
    863871      }
    864872    }
    865873    else {
    866874      if (~type & FULLSCREEN)
    867         type |= WINDOWED;
     875        type |= WINDOWED;
    868876      rc = DosAllocMem((PVOID) & pszArgs, MaxComLineStrg * 2,
    869                        PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     877                       PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    870878      if (rc) {
    871         Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
    872         DosFreeMem(pszPgm);
    873         return -1;
     879        Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
     880        DosFreeMem(pszPgm);
     881        return -1;
    874882      }
    875883      *pszArgs = 0;
     
    879887      wasquote = FALSE;
    880888      while (*p && (wasquote || (*p != ' ' && *p != '\t'))) {
    881         if (*p == '\"') {
    882           if (!wasquote) {
    883             wasquote = TRUE;
    884             memmove(p, p + 1, strlen(p));
    885             while (*p == ' ' || *p == '\t')
    886               p++;
    887           }
    888           else {
    889             memmove(p, p + 1, strlen(p));
    890             break;
    891           }
    892         }
    893         else
    894           p++;
     889        if (*p == '\"') {
     890          if (!wasquote) {
     891            wasquote = TRUE;
     892            memmove(p, p + 1, strlen(p));
     893            while (*p == ' ' || *p == '\t')
     894              p++;
     895          }
     896          else {
     897            memmove(p, p + 1, strlen(p));
     898            break;
     899          }
     900        }
     901        else
     902          p++;
    895903      } // while
    896904      if (*p) {
    897         *p = 0;
    898         p++;
     905        *p = 0;
     906        p++;
    899907      }
    900908      else
    901         p = NullStr;
     909        p = NullStr;
    902910      if (*p)
    903         strcpy(pszArgs, p);
     911        strcpy(pszArgs, p);
    904912
    905913      p = strrchr(pszPgm, '.');
    906914      if (p) {
    907         char temp[CCHMAXPATH + 1];
    908 
    909         if (!stricmp(p, ".BAT")) {
    910           strcpy(temp, pszPgm);
    911           strcpy(pszPgm, pszArgs);
    912           strcpy(pszArgs, "/C ");
    913           strcat(pszArgs, temp);
    914           strcat(pszArgs, " ");
    915           strcat(pszArgs, pszPgm);
    916           strcpy(pszPgm, GetCmdSpec(TRUE));             // DOS
    917         }
    918         else if (!stricmp(p, ".CMD") || !stricmp(p, ".BTM")) {
    919           // Assume 4OS2 is BTM
    920           strcpy(temp, pszPgm);
    921           strcpy(pszPgm, pszArgs);
    922           strcpy(pszArgs, "/C ");
    923           strcat(pszArgs, temp);
    924           strcat(pszArgs, " ");
    925           strcat(pszArgs, pszPgm);
    926           strcpy(pszPgm, GetCmdSpec(FALSE));            // OS/2
    927         }
     915        char temp[CCHMAXPATH + 1];
     916
     917        if (!stricmp(p, ".BAT")) {
     918          strcpy(temp, pszPgm);
     919          strcpy(pszPgm, pszArgs);
     920          strcpy(pszArgs, "/C ");
     921          strcat(pszArgs, temp);
     922          strcat(pszArgs, " ");
     923          strcat(pszArgs, pszPgm);
     924          strcpy(pszPgm, GetCmdSpec(TRUE));             // DOS
     925        }
     926        else if (!stricmp(p, ".CMD") || !stricmp(p, ".BTM")) {
     927          // Assume 4OS2 is BTM
     928          strcpy(temp, pszPgm);
     929          strcpy(pszPgm, pszArgs);
     930          strcpy(pszArgs, "/C ");
     931          strcat(pszArgs, temp);
     932          strcat(pszArgs, " ");
     933          strcat(pszArgs, pszPgm);
     934          strcpy(pszPgm, GetCmdSpec(FALSE));            // OS/2
     935        }
    928936      }
    929937
     
    931939
    932940      if (strlen(pszPgm) + strlen(pszArgs) > 1024)
    933         pszArgs[1024 - strlen(pszPgm)] = 0;
     941        pszArgs[1024 - strlen(pszPgm)] = 0;
    934942
    935943      if (!strchr(pszPgm, '\\') &&
    936           !strchr(pszPgm, ':') &&
    937           pszDirectory &&
    938           *pszDirectory)
     944          !strchr(pszPgm, ':') &&
     945          pszDirectory &&
     946          *pszDirectory)
    939947      {
    940         strcpy(szSavedir, pFM2SaveDirectory);
    941         switch_to(pszDirectory);
     948        strcpy(szSavedir, pFM2SaveDirectory);
     949        switch_to(pszDirectory);
    942950      }
    943951      rc = DosQueryAppType(pszPgm,&ulAppType);
    944952      if (!strchr(pszPgm, '\\') &&
    945           !strchr(pszPgm, ':') &&
    946           pszDirectory &&
    947           *pszDirectory)
    948         switch_to(szSavedir);
     953          !strchr(pszPgm, ':') &&
     954          pszDirectory &&
     955          *pszDirectory)
     956        switch_to(szSavedir);
    949957      if (rc) {
    950         Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,
    951                   GetPString(IDS_DOSQAPPTYPEFAILEDTEXT),
    952                   pszPgm, pszCallingFile, uiLineNumber);        // 26 May 08 SHL
    953         DosFreeMem(pszPgm);
    954         if (pszArgs)
    955           DosFreeMem(pszArgs);
    956         return -1;
     958        Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,
     959                  GetPString(IDS_DOSQAPPTYPEFAILEDTEXT),
     960                  pszPgm, pszCallingFile, uiLineNumber);        // 26 May 08 SHL
     961        DosFreeMem(pszPgm);
     962        if (pszArgs)
     963          DosFreeMem(pszArgs);
     964        return -1;
    957965      }
    958966
    959967      if (ulAppType) {
    960         if (ulAppType & (FAPPTYP_DLL | FAPPTYP_VIRTDRV | FAPPTYP_PHYSDRV | FAPPTYP_PROTDLL))
    961         {
    962           Runtime_Error(pszSrcFile, __LINE__,
    963                         GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
    964                         pszPgm, pszCallingFile, uiLineNumber);  // 26 May 08 SHL
    965           DosFreeMem(pszPgm);
    966           if (pszArgs)
    967             DosFreeMem(pszArgs);
    968           return -1;
    969         }
    970         ulAppType &= ~FAPPTYP_BOUND;
    971         if (ulAppType & (FAPPTYP_DOS | FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSPROT31))
    972         {
    973           if (ulAppType & (FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSPROT31))
    974           {
    975             if (~type & FULLSCREEN &&
    976                 ulAppType & (FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSPROT31))
    977             {
    978               ret = RunSeamless(pszPgm, pszArgs, hwnd);
    979               if (pszPgm)
    980                 DosFreeMem(pszPgm);
    981               if (pszArgs)
    982                 DosFreeMem(pszArgs);
    983               return ret ? 0 : -1;
    984             }
    985             else {
    986               strcat(pszPgm, " ");
    987               strcat(pszPgm, pszArgs);
    988               *pszArgs = 0;
    989               if (ulAppType & (FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT31))
    990                 strcat(pszArgs, "/3 ");
    991               strcat(pszArgs, pszPgm);
    992               strcpy(pszPgm, "WINOS2.COM");
    993             }
    994           }
    995           else {
    996             if (~type & FULLSCREEN) {
    997               type |= WINDOWED;
    998               ulAppType = SSF_TYPE_WINDOWEDVDM;
    999             }
    1000             else {
    1001               type &= ~WINDOWED;
    1002               ulAppType = SSF_TYPE_VDM;
    1003             }
    1004           }
    1005         }
    1006         else if (ulAppType & FAPPTYP_32BIT) {
    1007           ulAppType &= ~FAPPTYP_32BIT;
    1008           if (ulAppType == FAPPTYP_WINDOWAPI)
    1009             ulAppType = SSF_TYPE_PM;
    1010           else if (ulAppType == FAPPTYP_WINDOWCOMPAT)
    1011             ulAppType = SSF_TYPE_WINDOWABLEVIO;
    1012           else if (ulAppType == FAPPTYP_NOTWINDOWCOMPAT) {
    1013             ulAppType = SSF_TYPE_FULLSCREEN;
    1014             type &= ~WINDOWED;
    1015             type |= FULLSCREEN;
    1016           }
    1017           else                          /* ? */
    1018             ulAppType = SSF_TYPE_WINDOWABLEVIO;
    1019         }
    1020         else if (ulAppType == FAPPTYP_WINDOWAPI)
    1021           ulAppType = SSF_TYPE_PM;
    1022         else if (ulAppType == FAPPTYP_WINDOWCOMPAT)
    1023           ulAppType = SSF_TYPE_WINDOWABLEVIO;
    1024         else if (ulAppType == FAPPTYP_NOTWINDOWCOMPAT) {
    1025           type &= ~WINDOWED;
    1026           ulAppType = SSF_TYPE_FULLSCREEN;
    1027         }
    1028         else
    1029           ulAppType = SSF_TYPE_DEFAULT;
    1030         if ((type & FULLSCREEN || ~type & WINDOWED) &&
    1031             ulAppType == SSF_TYPE_WINDOWABLEVIO)
    1032         {
    1033           ulAppType = SSF_TYPE_FULLSCREEN;
    1034         }
    1035         // fixme parens?
    1036         else if (type & FULLSCREEN ||
    1037                 (type & WINDOWED && ulAppType == SSF_TYPE_WINDOWEDVDM))
    1038         {
    1039           ulAppType = SSF_TYPE_VDM;
    1040         }
     968        if (ulAppType & (FAPPTYP_DLL | FAPPTYP_VIRTDRV | FAPPTYP_PHYSDRV | FAPPTYP_PROTDLL))
     969        {
     970          Runtime_Error(pszSrcFile, __LINE__,
     971                        GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
     972                        pszPgm, pszCallingFile, uiLineNumber);  // 26 May 08 SHL
     973          DosFreeMem(pszPgm);
     974          if (pszArgs)
     975            DosFreeMem(pszArgs);
     976          return -1;
     977        }
     978        ulAppType &= ~FAPPTYP_BOUND;
     979        if (ulAppType & (FAPPTYP_DOS | FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSPROT31))
     980        {
     981          if (ulAppType & (FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSPROT31))
     982          {
     983            if (~type & FULLSCREEN &&
     984                ulAppType & (FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSPROT31))
     985            {
     986              ret = RunSeamless(pszPgm, pszArgs, hwnd);
     987              if (pszPgm)
     988                DosFreeMem(pszPgm);
     989              if (pszArgs)
     990                DosFreeMem(pszArgs);
     991              return ret ? 0 : -1;
     992            }
     993            else {
     994              strcat(pszPgm, " ");
     995              strcat(pszPgm, pszArgs);
     996              *pszArgs = 0;
     997              if (ulAppType & (FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT31))
     998                strcat(pszArgs, "/3 ");
     999              strcat(pszArgs, pszPgm);
     1000              strcpy(pszPgm, "WINOS2.COM");
     1001            }
     1002          }
     1003          else {
     1004            if (~type & FULLSCREEN) {
     1005              type |= WINDOWED;
     1006              ulAppType = SSF_TYPE_WINDOWEDVDM;
     1007            }
     1008            else {
     1009              type &= ~WINDOWED;
     1010              ulAppType = SSF_TYPE_VDM;
     1011            }
     1012          }
     1013        }
     1014        else if (ulAppType & FAPPTYP_32BIT) {
     1015          ulAppType &= ~FAPPTYP_32BIT;
     1016          if (ulAppType == FAPPTYP_WINDOWAPI)
     1017            ulAppType = SSF_TYPE_PM;
     1018          else if (ulAppType == FAPPTYP_WINDOWCOMPAT)
     1019            ulAppType = SSF_TYPE_WINDOWABLEVIO;
     1020          else if (ulAppType == FAPPTYP_NOTWINDOWCOMPAT) {
     1021            ulAppType = SSF_TYPE_FULLSCREEN;
     1022            type &= ~WINDOWED;
     1023            type |= FULLSCREEN;
     1024          }
     1025          else                          /* ? */
     1026            ulAppType = SSF_TYPE_WINDOWABLEVIO;
     1027        }
     1028        else if (ulAppType == FAPPTYP_WINDOWAPI)
     1029          ulAppType = SSF_TYPE_PM;
     1030        else if (ulAppType == FAPPTYP_WINDOWCOMPAT)
     1031          ulAppType = SSF_TYPE_WINDOWABLEVIO;
     1032        else if (ulAppType == FAPPTYP_NOTWINDOWCOMPAT) {
     1033          type &= ~WINDOWED;
     1034          ulAppType = SSF_TYPE_FULLSCREEN;
     1035        }
     1036        else
     1037          ulAppType = SSF_TYPE_DEFAULT;
     1038        if ((type & FULLSCREEN || ~type & WINDOWED) &&
     1039            ulAppType == SSF_TYPE_WINDOWABLEVIO)
     1040        {
     1041          ulAppType = SSF_TYPE_FULLSCREEN;
     1042        }
     1043        // fixme parens?
     1044        else if (type & FULLSCREEN ||
     1045                (type & WINDOWED && ulAppType == SSF_TYPE_WINDOWEDVDM))
     1046        {
     1047          ulAppType = SSF_TYPE_VDM;
     1048        }
    10411049      }
    10421050      if (ulAppType == SSF_TYPE_WINDOWEDVDM && type & SEPARATEKEEP) {
    1043         type &= ~SEPARATEKEEP;
    1044         type |= SEPARATE;
     1051        type &= ~SEPARATEKEEP;
     1052        type |= SEPARATE;
    10451053      }
    10461054
     
    10481056
    10491057      if (~type & WAIT)
    1050         useTermQ = FALSE;
     1058        useTermQ = FALSE;
    10511059      else {
    1052         rc = 0;
    1053         DosEnterCritSec();
    1054         if (!hTermQ) {
    1055           // Create term queue and event semaphore just once
    1056           sprintf(szTermQName, TERMQ_BASE_NAME "_%x", ppib->pib_ulpid);
    1057           rc = DosCreateQueue(&hTermQ, QUE_FIFO | QUE_CONVERT_ADDRESS, szTermQName);
    1058           if (rc) {
    1059             hTermQ = (HQUEUE)0;         // Try to survive
    1060             DosExitCritSec();
    1061             Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosCreateQueue");
    1062           }
    1063           else {
    1064             rc = DosCreateEventSem(NULL,(PHEV)&hTermQSem,0,FALSE);
    1065             if (rc) {
    1066                 hTermQSem = (HEV)0;     // Try to survive
    1067                 DosCloseQueue(hTermQ);
    1068                 hTermQ = (HQUEUE)0;     // Try to survive
    1069                 DosExitCritSec();
    1070                 Dos_Error(MB_ENTER,rc,HWND_DESKTOP,pszSrcFile,__LINE__,"DoCreateEventSem");
    1071             }
    1072             // if (!rc) fprintf(stderr,"%s %d qcreated ptib %x hTermQ %x\n",__FILE__, __LINE__,ptib,hTermQ);
    1073           }
    1074         } // if 1st time
    1075         useTermQ = hTermQ && hTermQSem;
    1076         if (!rc)
    1077           DosExitCritSec();
     1060        rc = 0;
     1061        DosEnterCritSec();
     1062        if (!hTermQ) {
     1063          // Create term queue and event semaphore just once
     1064          sprintf(szTermQName, TERMQ_BASE_NAME "_%x", ppib->pib_ulpid);
     1065          rc = DosCreateQueue(&hTermQ, QUE_FIFO | QUE_CONVERT_ADDRESS, szTermQName);
     1066          if (rc) {
     1067            hTermQ = (HQUEUE)0;         // Try to survive
     1068            DosExitCritSec();
     1069            Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosCreateQueue");
     1070          }
     1071          else {
     1072            rc = DosCreateEventSem(NULL,(PHEV)&hTermQSem,0,FALSE);
     1073            if (rc) {
     1074                hTermQSem = (HEV)0;     // Try to survive
     1075                DosCloseQueue(hTermQ);
     1076                hTermQ = (HQUEUE)0;     // Try to survive
     1077                DosExitCritSec();
     1078                Dos_Error(MB_ENTER,rc,HWND_DESKTOP,pszSrcFile,__LINE__,"DoCreateEventSem");
     1079            }
     1080            // if (!rc) fprintf(stderr,"%s %d qcreated ptib %x hTermQ %x\n",__FILE__, __LINE__,ptib,hTermQ);
     1081          }
     1082        } // if 1st time
     1083        useTermQ = hTermQ && hTermQSem;
     1084        if (!rc)
     1085          DosExitCritSec();
    10781086      } // if wait
    10791087
     
    10811089      sdata.Length = sizeof(sdata);
    10821090      sdata.Related = type & (WAIT | CHILD) ? SSF_RELATED_CHILD :
    1083                                               SSF_RELATED_INDEPENDENT;
     1091                                              SSF_RELATED_INDEPENDENT;
    10841092      sdata.FgBg = type & BACKGROUND ? SSF_FGBG_BACK : SSF_FGBG_FORE;
    10851093      sdata.TraceOpt = SSF_TRACEOPT_NONE;
    10861094      sdata.PgmName = pszPgm;
    10871095      if (*pszArgs)
    1088         sdata.PgmInputs = pszArgs;
     1096        sdata.PgmInputs = pszArgs;
    10891097      if (useTermQ)
    1090         sdata.TermQ = szTermQName;
     1098        sdata.TermQ = szTermQName;
    10911099      sdata.Environment = pszEnvironment;
    10921100      sdata.InheritOpt = SSF_INHERTOPT_PARENT;
     
    10951103      sdata.ObjectBuffLen = sizeof(szObject);
    10961104      if ((type & RUNTYPE_MASK) == SEPARATEKEEP)
    1097         sdata.PgmControl |= SSF_CONTROL_NOAUTOCLOSE;
     1105        sdata.PgmControl |= SSF_CONTROL_NOAUTOCLOSE;
    10981106      if (type & MAXIMIZED)
    1099         sdata.PgmControl |= SSF_CONTROL_MAXIMIZE;
     1107        sdata.PgmControl |= SSF_CONTROL_MAXIMIZE;
    11001108      if (type & MINIMIZED)
    1101         sdata.PgmControl |= SSF_CONTROL_MINIMIZE;
     1109        sdata.PgmControl |= SSF_CONTROL_MINIMIZE;
    11021110      if (type & INVISIBLE)
    1103         sdata.PgmControl |= SSF_CONTROL_INVISIBLE;
     1111        sdata.PgmControl |= SSF_CONTROL_INVISIBLE;
    11041112
    11051113      if (pszDirectory && *pszDirectory) {
    1106         strcpy(szSavedir, pFM2SaveDirectory);
    1107         switch_to(pszDirectory);
     1114        strcpy(szSavedir, pFM2SaveDirectory);
     1115        switch_to(pszDirectory);
    11081116      }
    11091117
    11101118      // printf("%s %d DosStartsession thread 0x%x data\n ",
    1111       //       __FILE__, __LINE__,ptib->tib_ordinal); fflush(stdout);   // 10 Mar 07 SHL hang
     1119      //       __FILE__, __LINE__,ptib->tib_ordinal); fflush(stdout);   // 10 Mar 07 SHL hang
    11121120      // printf(" %d %d %d %s %s %s %d %d\n %s %x %x\n",
    11131121      //       sdata.Length , sdata.Related, sdata.FgBg, sdata.PgmName,
     
    11191127      // if (type & WAIT) {
    11201128      // printf("%s %d DosStartession thread 0x%x rc = %d sess = %u pid = 0x%x\n",
    1121       //        __FILE__, __LINE__, ptib->tib_ordinal,ret, ulSessID, sessPID); fflush(stdout);  // 10 Mar 07 SHL hang
     1129      //        __FILE__, __LINE__, ptib->tib_ordinal,ret, ulSessID, sessPID); fflush(stdout);  // 10 Mar 07 SHL hang
    11221130      // }
    11231131      // else {
    11241132      // printf("%s %d DosStartession thread 0x%x nowait rc = %d\n",
    1125       //      __FILE__, __LINE__, ptib->tib_ordinal,ret); fflush(stdout);       // 10 Mar 07 SHL hang
     1133      //      __FILE__, __LINE__, ptib->tib_ordinal,ret); fflush(stdout);       // 10 Mar 07 SHL hang
    11261134      // }
    11271135
    11281136      if (pszDirectory && *pszDirectory)
    1129         switch_to(szSavedir);
     1137        switch_to(szSavedir);
    11301138
    11311139      if (ret && ret != ERROR_SMG_START_IN_BACKGROUND) {
    1132         Dos_Error(MB_CANCEL,ret,hwnd,pszSrcFile,__LINE__,
    1133                   GetPString(IDS_DOSSTARTSESSIONFAILEDTEXT),pszPgm,pszArgs,
    1134                   pszCallingFile, uiLineNumber);        // 26 May 08 SHL
     1140        Dos_Error(MB_CANCEL,ret,hwnd,pszSrcFile,__LINE__,
     1141                  GetPString(IDS_DOSSTARTSESSIONFAILEDTEXT),pszPgm,pszArgs,
     1142                  pszCallingFile, uiLineNumber);        // 26 May 08 SHL
    11351143      }
    11361144      else if (type & WAIT) {
    1137         if (!(type & (BACKGROUND | MINIMIZED | INVISIBLE)))
    1138           ShowSession(hwnd, sessPID);
    1139 
    1140         if (!useTermQ) {
    1141           STATUSDATA sd;
    1142           // Could not create queue - fallback - fixme to be gone?
    1143           // printf("%s %d waiting wo/termq\n", __FILE__, __LINE__); fflush(stdout);    // 12 Mar 07 SHL hang
    1144 
    1145           memset(&sd, 0, sizeof(sd));
    1146           sd.Length = (USHORT) sizeof(sd);
    1147           sd.SelectInd = SET_SESSION_UNCHANGED;
    1148           sd.BondInd = SET_SESSION_UNCHANGED;
    1149           for (ctr = 0;; ctr++)
    1150           {
    1151             DosSleep(100);//05 Aug 07 GKY 200
    1152             if (DosSetSession(ulSessID, &sd))   // Check if session gone (i.e. finished)
    1153               break;
    1154             if (ctr > 10) {
    1155               //   printf("%s %d thread 0x%x showing slow sess %u pid 0x%x\n",
    1156               //        __FILE__, __LINE__,ptib->tib_ordinal,ulSessID,sessPID); fflush(stdout); // 12 Mar 07 SHL
    1157               ShowSession(hwnd, sessPID);       // Show every 2 seconds
    1158               ctr = 0;
    1159             }
    1160           }
    1161         }
    1162         else {
    1163           for (ctr = 0;; ctr++)
    1164           {
    1165             if (ctr < 20) {
    1166               rc = DosReadQueue(hTermQ, &rq, &ulLength, (PPVOID)&pTermInfo, 0,
    1167                                 DCWW_NOWAIT, &bPriority, hTermQSem);
    1168               if (rc == ERROR_QUE_EMPTY) {
    1169                 DosSleep(50);//05 Aug 07 GKY 100
    1170                 continue;
    1171               }
    1172             }
    1173             else {
    1174               if (ctr == 20) {
    1175                 // printf("%s %d thread 0x%x showing slow sess %u pid 0x%x\n",
    1176                 //       __FILE__, __LINE__,ptib->tib_ordinal,ulSessID,sessPID); fflush(stdout);
    1177                 ShowSession(hwnd, sessPID);             // Show long running session
    1178               }
    1179               rc = DosReadQueue(hTermQ, &rq, &ulLength, (PPVOID)&pTermInfo, 0,
    1180                                 DCWW_WAIT, &bPriority, 0);
    1181             }
    1182 
    1183             if (rc) {
    1184               // Oh heck
    1185               Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosReadQueue");
    1186               DosSleep(100);//05 Aug 07 GKY 500
    1187               continue;
    1188             }
    1189 
    1190             //  printf("%s %d DosReadQueue thread 0x%x sess %u sessRC %u rq.pid 0x%x rq.data 0x%x\n",
    1191             //       __FILE__, __LINE__,ptib->tib_ordinal,pTermInfo->usSessID,pTermInfo->usRC,rq.pid, rq.ulData); fflush(stdout);
    1192 
    1193             if (pTermInfo->usSessID == ulSessID)
    1194               break;                    // Our session is done
    1195 
    1196             // Requeue session for other thread
    1197             {
    1198               static ULONG ulLastSessID;
    1199               // printf("%s %d requeue thread 0x%x our sess %u term sess %u term rc %u\n",
    1200               //       __FILE__, __LINE__,ptib->tib_ordinal,ulSessID,pTermInfo->usSessID,pTermInfo->usRC); fflush(stdout);
    1201               // fixme to be gone when no longer needed for debug?
    1202               if (ulLastSessID) {
    1203                 DosSleep(100);//05 Aug 07 GKY 500
    1204                 ulLastSessID = pTermInfo->usSessID;
    1205               }
    1206               // requeue term report for other thread and do not free yet
    1207               rc = DosWriteQueue(hTermQ, rq.ulData, ulLength,(PVOID)pTermInfo, bPriority);
    1208               if (rc)
    1209                 Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosWriteQueue");
    1210               DosSleep(50); //05 Aug 07 GKY 100         // Let other thread see queue entry
    1211             }
    1212           } // for
    1213 
    1214           ret = pTermInfo->usRC == 0;           // Set 1 if rc 0 else 0
    1215           // printf("%s %d thread 0x%x term for sess %u\n",
    1216           //      __FILE__, __LINE__,ptib->tib_ordinal,ulSessID);fflush(stdout);
    1217           DosFreeMem(pTermInfo);
    1218         }
     1145        if (!(type & (BACKGROUND | MINIMIZED | INVISIBLE)))
     1146          ShowSession(hwnd, sessPID);
     1147
     1148        if (!useTermQ) {
     1149          STATUSDATA sd;
     1150          // Could not create queue - fallback - fixme to be gone?
     1151          // printf("%s %d waiting wo/termq\n", __FILE__, __LINE__); fflush(stdout);    // 12 Mar 07 SHL hang
     1152
     1153          memset(&sd, 0, sizeof(sd));
     1154          sd.Length = (USHORT) sizeof(sd);
     1155          sd.SelectInd = SET_SESSION_UNCHANGED;
     1156          sd.BondInd = SET_SESSION_UNCHANGED;
     1157          for (ctr = 0;; ctr++)
     1158          {
     1159            DosSleep(100);//05 Aug 07 GKY 200
     1160            if (DosSetSession(ulSessID, &sd))   // Check if session gone (i.e. finished)
     1161              break;
     1162            if (ctr > 10) {
     1163              //   printf("%s %d thread 0x%x showing slow sess %u pid 0x%x\n",
     1164              //        __FILE__, __LINE__,ptib->tib_ordinal,ulSessID,sessPID); fflush(stdout); // 12 Mar 07 SHL
     1165              ShowSession(hwnd, sessPID);       // Show every 2 seconds
     1166              ctr = 0;
     1167            }
     1168          }
     1169        }
     1170        else {
     1171          for (ctr = 0;; ctr++)
     1172          {
     1173            if (ctr < 20) {
     1174              rc = DosReadQueue(hTermQ, &rq, &ulLength, (PPVOID)&pTermInfo, 0,
     1175                                DCWW_NOWAIT, &bPriority, hTermQSem);
     1176              if (rc == ERROR_QUE_EMPTY) {
     1177                DosSleep(50);//05 Aug 07 GKY 100
     1178                continue;
     1179              }
     1180            }
     1181            else {
     1182              if (ctr == 20) {
     1183                // printf("%s %d thread 0x%x showing slow sess %u pid 0x%x\n",
     1184                //       __FILE__, __LINE__,ptib->tib_ordinal,ulSessID,sessPID); fflush(stdout);
     1185                ShowSession(hwnd, sessPID);             // Show long running session
     1186              }
     1187              rc = DosReadQueue(hTermQ, &rq, &ulLength, (PPVOID)&pTermInfo, 0,
     1188                                DCWW_WAIT, &bPriority, 0);
     1189            }
     1190
     1191            if (rc) {
     1192              // Oh heck
     1193              Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosReadQueue");
     1194              DosSleep(100);//05 Aug 07 GKY 500
     1195              continue;
     1196            }
     1197
     1198            //  printf("%s %d DosReadQueue thread 0x%x sess %u sessRC %u rq.pid 0x%x rq.data 0x%x\n",
     1199            //       __FILE__, __LINE__,ptib->tib_ordinal,pTermInfo->usSessID,pTermInfo->usRC,rq.pid, rq.ulData); fflush(stdout);
     1200
     1201            if (pTermInfo->usSessID == ulSessID)
     1202              break;                    // Our session is done
     1203
     1204            // Requeue session for other thread
     1205            {
     1206              static ULONG ulLastSessID;
     1207              // printf("%s %d requeue thread 0x%x our sess %u term sess %u term rc %u\n",
     1208              //       __FILE__, __LINE__,ptib->tib_ordinal,ulSessID,pTermInfo->usSessID,pTermInfo->usRC); fflush(stdout);
     1209              // fixme to be gone when no longer needed for debug?
     1210              if (ulLastSessID) {
     1211                DosSleep(100);//05 Aug 07 GKY 500
     1212                ulLastSessID = pTermInfo->usSessID;
     1213              }
     1214              // requeue term report for other thread and do not free yet
     1215              rc = DosWriteQueue(hTermQ, rq.ulData, ulLength,(PVOID)pTermInfo, bPriority);
     1216              if (rc)
     1217                Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosWriteQueue");
     1218              DosSleep(50); //05 Aug 07 GKY 100         // Let other thread see queue entry
     1219            }
     1220          } // for
     1221
     1222          ret = pTermInfo->usRC == 0;           // Set 1 if rc 0 else 0
     1223          // printf("%s %d thread 0x%x term for sess %u\n",
     1224          //      __FILE__, __LINE__,ptib->tib_ordinal,ulSessID);fflush(stdout);
     1225          DosFreeMem(pTermInfo);
     1226        }
    12191227      } // if wait
    12201228      else if (!(type & (BACKGROUND | MINIMIZED | INVISIBLE)))
    1221         ShowSession(hwnd, sessPID);
     1229        ShowSession(hwnd, sessPID);
    12221230    }
    12231231  }
     
    12341242
    12351243//== Exec() Start application with WinStartApp ==
    1236 
     1244#if 0  //JBS
    12371245HAPP Exec(HWND hwndNotify, BOOL child, char *startdir, char *env,
    1238           PROGTYPE *progt, ULONG fl, char *formatstring,...)
     1246          PROGTYPE *progt, ULONG fl, char *formatstring,...)
    12391247{
    12401248  PROGDETAILS pgd;
     
    12581266      parameters = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
    12591267      if (parameters) {
    1260         p = executable;
    1261         wasquote = FALSE;
    1262         while (*p && (wasquote || (*p != ' ' && *p != '\t'))) {
    1263           if (*p == '\"') {
    1264             if (!wasquote) {
    1265               wasquote = TRUE;
    1266               memmove(p, p + 1, strlen(p));
    1267               while (*p == ' ' || *p == '\t')
    1268                 p++;
    1269             }
    1270             else {
    1271               memmove(p, p + 1, strlen(p));
    1272               break;
    1273             }
    1274           }
    1275           else
    1276             p++;
    1277         }
    1278         if (*p) {
    1279           *p = 0;
    1280           p++;
    1281         }
    1282         else
    1283           p = NullStr;
    1284         if (*p)
    1285           strcpy(parameters, p);
    1286 
    1287         if (p && (!stricmp(p, ".BAT") || !stricmp(p, ".CMD"))) {
    1288           char *temp;
    1289 
    1290           temp = xmalloc(CCHMAXPATH * 2,pszSrcFile,__LINE__);
    1291           if (temp) {
    1292             if (!stricmp(p, ".BAT")) {
    1293               strcpy(temp, executable);
    1294               strcpy(executable, parameters);
    1295               strcpy(parameters, "/C ");
    1296               strcat(parameters, temp);
    1297               strcat(parameters, " ");
    1298               strcat(parameters, executable);
    1299               strcpy(executable, GetCmdSpec(TRUE));
    1300             }
    1301             else if (!stricmp(p, ".CMD")) {
    1302               strcpy(temp, executable);
    1303               strcpy(executable, parameters);
    1304               strcpy(parameters, "/C ");
    1305               strcat(parameters, temp);
    1306               strcat(parameters, " ");
    1307               strcat(parameters, executable);
    1308               strcpy(executable, GetCmdSpec(FALSE));
    1309             }
    1310             free(temp);
    1311           }
    1312         }
    1313 
    1314         memset(&pgd, 0, sizeof(pgd));
    1315         pgd.Length = sizeof(pgd);
    1316         pgd.progt = *progt;
    1317         pgd.swpInitial.fl = fl;
    1318         pgd.pszEnvironment = env;
    1319         pgd.pszStartupDir = startdir;
    1320         pgd.pszParameters = *parameters ? parameters : NULL;
    1321         pgd.pszExecutable = executable;
    1322         pgd.swpInitial.hwndInsertBehind = HWND_TOP;
    1323         happ = WinStartApp(hwndNotify, &pgd, NULL, NULL, ulOptions);
    1324         free(parameters);
     1268        p = executable;
     1269        wasquote = FALSE;
     1270        while (*p && (wasquote || (*p != ' ' && *p != '\t'))) {
     1271          if (*p == '\"') {
     1272            if (!wasquote) {
     1273              wasquote = TRUE;
     1274              memmove(p, p + 1, strlen(p));
     1275              while (*p == ' ' || *p == '\t')
     1276                p++;
     1277            }
     1278            else {
     1279              memmove(p, p + 1, strlen(p));
     1280              break;
     1281            }
     1282          }
     1283          else
     1284            p++;
     1285        }
     1286        if (*p) {
     1287          *p = 0;
     1288          p++;
     1289        }
     1290        else
     1291          p = NullStr;
     1292        if (*p)
     1293          strcpy(parameters, p);
     1294
     1295        if (p && (!stricmp(p, ".BAT") || !stricmp(p, ".CMD"))) {
     1296          char *temp;
     1297
     1298          temp = xmalloc(CCHMAXPATH * 2,pszSrcFile,__LINE__);
     1299          if (temp) {
     1300            if (!stricmp(p, ".BAT")) {
     1301              strcpy(temp, executable);
     1302              strcpy(executable, parameters);
     1303              strcpy(parameters, "/C ");
     1304              strcat(parameters, temp);
     1305              strcat(parameters, " ");
     1306              strcat(parameters, executable);
     1307              strcpy(executable, GetCmdSpec(TRUE));
     1308            }
     1309            else if (!stricmp(p, ".CMD")) {
     1310              strcpy(temp, executable);
     1311              strcpy(executable, parameters);
     1312              strcpy(parameters, "/C ");
     1313              strcat(parameters, temp);
     1314              strcat(parameters, " ");
     1315              strcat(parameters, executable);
     1316              strcpy(executable, GetCmdSpec(FALSE));
     1317            }
     1318            free(temp);
     1319          }
     1320        }
     1321
     1322        memset(&pgd, 0, sizeof(pgd));
     1323        pgd.Length = sizeof(pgd);
     1324        pgd.progt = *progt;
     1325        pgd.swpInitial.fl = fl;
     1326        pgd.pszEnvironment = env;
     1327        pgd.pszStartupDir = startdir;
     1328        pgd.pszParameters = *parameters ? parameters : NULL;
     1329        pgd.pszExecutable = executable;
     1330        pgd.swpInitial.hwndInsertBehind = HWND_TOP;
     1331        happ = WinStartApp(hwndNotify, &pgd, NULL, NULL, ulOptions);
     1332        free(parameters);
    13251333      }
    13261334    }
     
    13291337  return happ;
    13301338}
    1331 
     1339#endif
    13321340#pragma alloc_text(SYSTEMF,ShowSession,ExecOnList,runemf2)
Note: See TracChangeset for help on using the changeset viewer.