Changeset 441 for trunk/dll/systemf.c
- Timestamp:
- Aug 24, 2006, 6:46:38 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/systemf.c
r396 r441 14 14 17 Jul 06 SHL Use Runtime_Error 15 15 26 Jul 06 SHL Use convert_nl_to_nul 16 15 Aug 06 SHL More error popups 16 17 17 18 ***********************************************************************/ … … 49 50 50 51 hswitch = WinQuerySwitchHandle((pid) ? (HWND)0 : hwnd, pid); 51 if (hswitch) 52 { 52 if (hswitch) { 53 53 rc = WinQuerySwitchEntry(hswitch, &swctl); 54 if (!rc) 55 { 54 if (!rc) { 56 55 if (swctl.idProcess == pid && swctl.uchVisibility == SWL_VISIBLE) 57 56 rc = WinSwitchToProgram(hswitch); … … 75 74 BOOL spaces; 76 75 77 if (!command || !*command) 76 if (!command || !*command) { 77 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 78 78 return -1; 79 } 79 80 *listfile = 0; 80 81 bstrip(command); … … 83 84 if (tpath && *tpath) 84 85 strcpy(path, tpath); 85 else if (*command != '<' || !strchr(command, '>')) 86 { 86 else if (*command != '<' || !strchr(command, '>')) { 87 87 strcpy(path, command + (*command == '"')); 88 88 if (*command == '\"') … … 95 95 if (!p) 96 96 p = strrchr(path, ':'); 97 if (p) 98 { 99 if (*p == ':') 100 { 97 if (p) { 98 if (*p == ':') { 101 99 p++; 102 100 *p = '\\'; … … 108 106 *path = 0; 109 107 } 110 if (!*path) 111 { 108 if (!*path) { 112 109 if (list && list[0]) 113 110 strcpy(path, list[0]); … … 115 112 if (!p) 116 113 p = strrchr(path, ':'); 117 if (p) 118 { 119 if (*p == ':') 120 { 114 if (p) { 115 if (*p == ':') { 121 116 p++; 122 117 *p = '\\'; … … 134 129 if (!p) 135 130 p = strrchr(modpath, ':'); 136 if (p) 137 { 138 if (*p == ':') 139 { 131 if (p) { 132 if (*p == ':') { 140 133 p++; 141 134 *p = '\\'; … … 161 154 pp = commandline; 162 155 *commandline = 0; 163 while (*p) 164 { 165 if (*p == '%') 166 { 167 switch (*(p + 1)) 168 { 156 while (*p) { 157 if (*p == '%') { 158 switch (*(p + 1)) { 169 159 case '!': /* write list to file, add filename */ 170 if (list) 171 { 172 if (!*listfile) 173 { 174 160 if (list) { 161 if (!*listfile) { 175 162 FILE *fp; 176 163 … … 181 168 LISTTEMPROOT, (clock() & 4095L)); 182 169 fp = xfopen(listfile, "w",pszSrcFile,__LINE__); 183 if (fp) 184 { 170 if (fp) { 185 171 for (x = 0; list[x]; x++) 186 172 { … … 202 188 char *env = GetCmdSpec(FALSE); 203 189 204 if (needs_quoting(env) && !strchr(env, '\"')) 205 { 190 if (needs_quoting(env) && !strchr(env, '\"')) { 206 191 *pp = '\"'; 207 192 pp++; … … 213 198 p += 2; 214 199 pp += strlen(env); 215 if (spaces) 216 { 200 if (spaces) { 217 201 *pp = '\"'; 218 202 pp++; … … 222 206 223 207 case 't': /* add Target directory */ 224 if (needs_quoting(targetdir) && !strchr(targetdir, '\"')) 225 { 208 if (needs_quoting(targetdir) && !strchr(targetdir, '\"')) { 226 209 *pp = '\"'; 227 210 pp++; … … 233 216 p += 2; 234 217 pp += strlen(targetdir); 235 if (spaces) 236 { 218 if (spaces) { 237 219 *pp = '\"'; 238 220 pp++; … … 243 225 if (drive) 244 226 *pp = drive; 245 else 246 { 247 227 else { 248 228 ULONG ulDriveNum = 3L, ulDriveMap; 249 229 … … 257 237 case 'U': /* add path of first list component */ 258 238 case 'u': 259 if (*modpath) 260 { 261 if (needs_quoting(modpath) && !strchr(modpath, '\"')) 262 { 239 if (*modpath) { 240 if (needs_quoting(modpath) && !strchr(modpath, '\"')) { 263 241 spaces = TRUE; 264 242 *pp = '\"'; … … 267 245 else 268 246 spaces = FALSE; 269 if (*(p + 1) == 'u') 270 { 247 if (*(p + 1) == 'u') { 271 248 strcpy(pp, modpath); 272 249 pp += strlen(modpath); 273 250 } 274 else 275 { 251 else { 276 252 strcpy(pp, modpath + 2); 277 253 pp += strlen(modpath + 2); 278 254 } 279 if (spaces) 280 { 281 if (modpath[strlen(modpath) - 1] == '\\') 282 { 255 if (spaces) { 256 if (modpath[strlen(modpath) - 1] == '\\') { 283 257 *pp = '\\'; 284 258 pp++; … … 288 262 } 289 263 } 290 else 291 { 292 264 else { 293 265 char temp[CCHMAXPATH]; 294 266 295 267 save_dir2(temp); 296 if (needs_quoting(temp) && !strchr(temp, '\"')) 297 { 268 if (needs_quoting(temp) && !strchr(temp, '\"')) { 298 269 spaces = TRUE; 299 270 *pp = '\"'; … … 304 275 strcpy(pp, temp); 305 276 pp += strlen(temp); 306 if (spaces) 307 { 308 if (temp[strlen(temp) - 1] == '\\') 309 { 277 if (spaces) { 278 if (temp[strlen(temp) - 1] == '\\') { 310 279 *pp = '\\'; 311 280 pp++; … … 320 289 case 'P': /* add path of execution */ 321 290 case 'p': 322 if (*path) 323 { 324 if (needs_quoting(path) && !strchr(path, '\"')) 325 { 291 if (*path) { 292 if (needs_quoting(path) && !strchr(path, '\"')) { 326 293 spaces = TRUE; 327 294 *pp = '\"'; … … 330 297 else 331 298 spaces = FALSE; 332 if (*(p + 1) == 'p') 333 { 299 if (*(p + 1) == 'p') { 334 300 strcpy(pp, path); 335 301 pp += strlen(path); 336 302 } 337 else 338 { 303 else { 339 304 strcpy(pp, path + 2); 340 305 pp += strlen(path + 2); 341 306 } 342 if (spaces) 343 { 344 if (path[strlen(path) - 1] == '\\') 345 { 307 if (spaces) { 308 if (path[strlen(path) - 1] == '\\') { 346 309 *pp = '\\'; 347 310 pp++; … … 351 314 } 352 315 } 353 else 354 { 355 316 else { 356 317 char temp[CCHMAXPATH]; 357 318 358 319 save_dir2(temp); 359 if (needs_quoting(temp) && !strchr(temp, '\"')) 360 { 320 if (needs_quoting(temp) && !strchr(temp, '\"')) { 361 321 spaces = TRUE; 362 322 *pp = '\"'; … … 367 327 strcpy(pp, temp); 368 328 pp += strlen(temp); 369 if (spaces) 370 { 371 if (temp[strlen(temp) - 1] == '\\') 372 { 329 if (spaces) { 330 if (temp[strlen(temp) - 1] == '\\') { 373 331 *pp = '\\'; 374 332 pp++; … … 382 340 383 341 case 'D': 384 if (hwndMain) 385 { 386 342 if (hwndMain) { 387 343 PCNRITEM pci; 388 344 … … 392 348 MPFROMLONG(CMA_FIRST), 393 349 MPFROMSHORT(CRA_CURSORED)); 394 if (pci && (int) pci != -1 && *pci -> szFileName) 395 { 350 if (pci && (int) pci != -1 && *pci -> szFileName) { 396 351 if (needs_quoting(pci -> szFileName) && 397 352 !strchr(pci -> szFileName, '\"')) … … 405 360 strcpy(pp, pci -> szFileName); 406 361 pp += strlen(pci -> szFileName); 407 if (spaces) 408 { 362 if (spaces) { 409 363 *pp = '\"'; 410 364 pp++; … … 416 370 417 371 case 'd': 418 if (hwndMain) 419 { 420 372 if (hwndMain) { 421 373 HENUM henum; 422 374 char retstr[CCHMAXPATH]; … … 426 378 427 379 henum = WinBeginEnumWindows(hwndMain); 428 while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) 429 { 430 if (hwndC != hwndTree) 431 { 380 while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) { 381 if (hwndC != hwndTree) { 432 382 id = WinQueryWindowUShort(hwndC, QWS_ID); 433 if (id) 434 { 383 if (id) { 435 384 hwndDir = WinWindowFromID(hwndC, FID_CLIENT); 436 if (hwndDir) 437 { 385 if (hwndDir) { 438 386 hwndDir = WinWindowFromID(hwndDir, DIR_CNR); 439 if (hwndDir) 440 { 387 if (hwndDir) { 441 388 *retstr = 0; 442 389 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID); 443 if (*retstr) 444 { 445 if (!first) 446 { 390 if (*retstr) { 391 if (!first) { 447 392 *pp = ' '; 448 393 pp++; 449 394 } 450 395 first = FALSE; 451 if (needs_quoting(retstr) && !strchr(retstr, '\"')) 452 { 396 if (needs_quoting(retstr) && !strchr(retstr, '\"')) { 453 397 *pp = '\"'; 454 398 pp++; … … 459 403 strcpy(pp, retstr); 460 404 pp += strlen(retstr); 461 if (spaces) 462 { 405 if (spaces) { 463 406 *pp = '\"'; 464 407 pp++; … … 488 431 case 'a': 489 432 case 'e': 490 if (list) 491 { 433 if (list) { 492 434 for (x = 0; list[x]; x++) 493 435 { … … 503 445 if (ext) 504 446 ext++; 505 switch (*(p + 1)) 506 { 447 switch (*(p + 1)) { 507 448 case 'R': 508 449 case 'r': 509 450 if (pp + strlen(list[x]) > commandline + 1250) 510 451 goto BreakOut; 511 if (*(p + 1) == 'r') 512 { 452 if (*(p + 1) == 'r') { 513 453 strcpy(pp, list[x]); 514 454 pp += strlen(list[x]); 515 455 } 516 else 517 { 456 else { 518 457 strcpy(pp, list[x] + 2); 519 458 pp += strlen(list[x] + 2); … … 527 466 if (pp + strlen(file) > commandline + 1250) 528 467 goto BreakOut; 529 if (needs_quoting(file)) 530 { 468 if (needs_quoting(file)) { 531 469 spaces = TRUE; 532 470 *pp = '\"'; … … 539 477 if (*(p + 1) == 'F' && dot) 540 478 *dot = '.'; 541 if (spaces) 542 { 543 if (*(pp - 1) != '\"') 544 { 479 if (spaces) { 480 if (*(pp - 1) != '\"') { 545 481 *pp = '\"'; 546 482 pp++; … … 553 489 if (pp + strlen(list[x]) > commandline + 1250) 554 490 goto BreakOut; 555 if (needs_quoting(list[x]) && !strchr(list[x], '\"')) 556 { 491 if (needs_quoting(list[x]) && !strchr(list[x], '\"')) { 557 492 spaces = TRUE; 558 493 *pp = '\"'; … … 561 496 else 562 497 spaces = FALSE; 563 if (*(p + 1) == 'a') 564 { 498 if (*(p + 1) == 'a') { 565 499 strcpy(pp, list[x]); 566 500 pp += strlen(list[x]); 567 501 } 568 else 569 { 502 else { 570 503 strcpy(pp, list[x] + 2); 571 504 pp += strlen(list[x] + 2); 572 505 } 573 if (spaces) 574 { 575 if (list[x][strlen(list[x]) - 1] == '\\') 576 { 506 if (spaces) { 507 if (list[x][strlen(list[x]) - 1] == '\\') { 577 508 *pp = '\\'; 578 509 pp++; … … 584 515 585 516 case 'e': 586 if (ext) 587 { 517 if (ext) { 588 518 if (pp + strlen(ext) > commandline + 1250) 589 519 goto BreakOut; 590 if (needs_quoting(ext)) 591 { 520 if (needs_quoting(ext)) { 592 521 spaces = TRUE; 593 522 *pp = '\"'; … … 598 527 strcpy(pp, ext); 599 528 pp += strlen(ext); 600 if (spaces) 601 { 602 if (*(pp - 1) != '\"') 603 { 529 if (spaces) { 530 if (*(pp - 1) != '\"') { 604 531 *pp = '\"'; 605 532 pp++; … … 609 536 break; 610 537 } 611 if (list[x + 1]) 612 { 538 if (list[x + 1]) { 613 539 *pp = ' '; 614 540 pp++; … … 626 552 } 627 553 } 628 else 629 { 554 else { 630 555 *pp = *p; 631 556 pp++; … … 638 563 639 564 { 640 641 565 EXECARGS ex; 642 566 ULONG size; … … 646 570 size = sizeof(ex.environment) - 1; 647 571 PrfQueryProfileData(fmprof, FM3Str, command, ex.environment, &size); 648 if (flags & PROMPT) 649 {/* allow editing command line */572 if (flags & PROMPT) { 573 /* allow editing command line */ 650 574 ex.flags = (flags & (~PROMPT)); 651 575 ex.commandline = commandline; … … 667 591 } 668 592 593 //== runemf2() run requested app, return -1 if problem starting else return rc == 594 669 595 int runemf2(int type, HWND hwnd, char *directory, char *environment, 670 596 char *formatstring,...) … … 702 628 APIRET rc; 703 629 704 if (directory && 705 *directory) 706 { 630 if (directory && *directory) { 707 631 if (!DosQueryPathInfo(directory, 708 632 FIL_QUERYFULLNAME, … … 733 657 va_end(parguments); 734 658 735 if (environment) 736 { 659 if (environment) { 737 660 p = &environment[strlen(environment)] + 1; 738 661 *p = 0; … … 742 665 } 743 666 744 if (!*s) 745 { 667 if (!*s) { 746 668 p = GetCmdSpec(FALSE); 747 669 strcpy(s, p); 748 if (!*s) 670 if (!*s) { 671 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 749 672 return -1; 750 } 751 752 if (*s) 753 { 754 if (*s == '<' && 755 strchr(s, '>')) 756 { /* is a workplace object */ 757 673 } 674 } 675 676 if (*s) { 677 if (*s == '<' && strchr(s, '>')) { 678 /* is a workplace object */ 758 679 HOBJECT hWPSObject; 759 680 char temp; … … 775 696 hWPSObject = WinQueryObject(s); 776 697 *p = temp; 777 if (hWPSObject != NULLHANDLE) 778 { 779 if (s2 && *p) 780 { 781 sprintf(s2, 782 "OPEN=DEFAULT;PARAMETERS=\"%s\"", 783 p); 784 WinSetObjectData(hWPSObject, 785 s2); 698 if (hWPSObject != NULLHANDLE) { 699 if (s2 && *p) { 700 sprintf(s2,"OPEN=DEFAULT;PARAMETERS=\"%s\"",p); 701 WinSetObjectData(hWPSObject,s2); 786 702 } 787 703 else 788 WinSetObjectData(hWPSObject, 789 "OPEN=DEFAULT"); 704 WinSetObjectData(hWPSObject,"OPEN=DEFAULT"); 790 705 ret = 0; 791 706 } … … 805 720 *p != '\t'))) 806 721 { 807 if (*p == '\"') 808 { 809 if (!wasquote) 810 { 722 if (*p == '\"') { 723 if (!wasquote) { 811 724 wasquote = TRUE; 812 725 memmove(p, … … 817 730 p++; 818 731 } 819 else 820 { 732 else { 821 733 memmove(p, 822 734 p + 1, … … 828 740 p++; 829 741 } 830 if (*p) 831 { 742 if (*p) { 832 743 *p = 0; 833 744 p++; … … 836 747 p = s; 837 748 p[strlen(p) + 1] = 0; /* double-terminate args */ 838 if (*s) 839 { 749 if (*s) { 840 750 if (!strchr(s, '\\') && 841 751 !strchr(s, ':') && … … 846 756 switch_to(directory); 847 757 } 848 r et = (int)DosQAppType(s,&apptype);758 rc = DosQAppType(s,&apptype); 849 759 if (!strchr(s, '\\') && 850 760 !strchr(s, ':') && … … 852 762 *directory) 853 763 switch_to(savedir); 854 if (ret) 855 { 856 Dos_Error(MB_CANCEL,ret,hwnd,pszSrcFile,__LINE__,"DosQAppType"); 857 if (s) 858 DosFreeMem(s); 764 if (rc) { 765 // fixme to be in fm2dll.str 766 Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosQAppType failed for %s.", s); 767 DosFreeMem(s); 859 768 if (s2) 860 769 DosFreeMem(s2); 861 770 return -1; 862 771 } 863 if (apptype) 864 { 772 if (apptype) { 865 773 if ((apptype & FAPPTYP_DLL) || (apptype & FAPPTYP_VIRTDRV) || 866 774 (apptype & FAPPTYP_PHYSDRV) || (apptype & FAPPTYP_PROTDLL)) 867 775 { 868 Runtime_Error(pszSrcFile, __LINE__, "unexpected apptype"); 776 // fixme to be in fm2dll.str 777 Runtime_Error(pszSrcFile, __LINE__, "apptype 0x%x unexpected for %s.", apptype, s); 869 778 if (s) 870 779 DosFreeMem(s); … … 876 785 (apptype & FAPPTYP_WINDOWSPROT) || (apptype & 0x1000)) 877 786 { 878 Runtime_Error(pszSrcFile, __LINE__, " unexpected apptype");787 Runtime_Error(pszSrcFile, __LINE__, "apptype 0x%x unexpected for %s.", apptype, s); 879 788 if (s) 880 789 DosFreeMem(s); … … 885 794 } 886 795 memset(&rt, 0, sizeof(RESULTCODES)); 887 if (directory && *directory) 888 { 796 if (directory && *directory) { 889 797 save_dir2(savedir); 890 798 switch_to(directory); 891 799 } 892 ret = (int)DosExecPgm(object, 24L,800 ret = DosExecPgm(object, 24L, 893 801 (ULONG) (((type & 15) == ASYNCHRONOUS) * EXEC_ASYNC) + 894 802 (((type & 15) == DETACHED) * EXEC_BACKGROUND), … … 898 806 if (ret) { 899 807 Dos_Error(MB_ENTER,ret,hwnd,pszSrcFile,__LINE__, 900 GetPString(IDS_DOSEXECPGMFAILEDTEXT) );808 GetPString(IDS_DOSEXECPGMFAILEDTEXT), s); 901 809 } 902 810 } 903 811 } 904 else 905 { 812 else { 906 813 if (!(type & FULLSCREEN)) 907 814 type |= WINDOWED; 908 815 rc = DosAllocMem((PVOID) & s2, MAXSTRG * 2, 909 816 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE); 910 if (rc) 911 { 817 if (rc) { 912 818 Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY)); 913 819 DosFreeMem(s); … … 919 825 p = s; 920 826 wasquote = FALSE; 921 while (*p && (wasquote || (*p != ' ' && *p != '\t'))) 922 { 923 if (*p == '\"') 924 { 925 if (!wasquote) 926 { 827 while (*p && (wasquote || (*p != ' ' && *p != '\t'))) { 828 if (*p == '\"') { 829 if (!wasquote) { 927 830 wasquote = TRUE; 928 831 memmove(p, p + 1, strlen(p)); … … 930 833 p++; 931 834 } 932 else 933 { 835 else { 934 836 memmove(p, p + 1, strlen(p)); 935 837 break; … … 939 841 p++; 940 842 } 941 if (*p) 942 { 843 if (*p) { 943 844 *p = 0; 944 845 p++; … … 950 851 951 852 p = strrchr(s, '.'); 952 if (p) 953 { 954 853 if (p) { 955 854 char temp[CCHMAXPATH + 1]; 956 855 957 if (!stricmp(p, ".BAT")) 958 { 856 if (!stricmp(p, ".BAT")) { 959 857 strcpy(temp, s); 960 858 strcpy(s, s2); … … 965 863 strcpy(s, GetCmdSpec(TRUE)); 966 864 } 967 else if (!stricmp(p, ".CMD")) 968 { 865 else if (!stricmp(p, ".CMD")) { 969 866 strcpy(temp, s); 970 867 strcpy(s, s2); … … 990 887 switch_to(directory); 991 888 } 992 ret = (int) DosQAppType(s, 993 &apptype); 889 rc = DosQAppType(s,&apptype); 994 890 if (!strchr(s, '\\') && 995 891 !strchr(s, ':') && … … 997 893 *directory) 998 894 switch_to(savedir); 999 if (r et)1000 { 1001 if (s) 1002 895 if (rc) { 896 // fixme to be in fm2dll.str 897 Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosQAppType failed for %s.", s); 898 DosFreeMem(s); 1003 899 if (s2) 1004 900 DosFreeMem(s2); … … 1006 902 } 1007 903 1008 if (apptype) 1009 { 904 if (apptype) { 1010 905 if ((apptype & FAPPTYP_DLL) || (apptype & FAPPTYP_VIRTDRV) || 1011 906 (apptype & FAPPTYP_PHYSDRV) || (apptype & FAPPTYP_PROTDLL)) 1012 907 { 1013 if (s) 1014 DosFreeMem(s); 908 // fixme to be in fm2dll.str 909 Runtime_Error(pszSrcFile, __LINE__, "apptype %d unexpected for %s.", s); 910 DosFreeMem(s); 1015 911 if (s2) 1016 912 DosFreeMem(s2); … … 1032 928 if (s2) 1033 929 DosFreeMem(s2); 1034 return (ret) ? 0 : -1; 1035 } 1036 else 1037 { 930 return ret ? 0 : -1; 931 } 932 else { 1038 933 strcat(s, " "); 1039 934 strcat(s, s2); … … 1047 942 } 1048 943 } 1049 else 1050 { 1051 if (!(type & FULLSCREEN)) 1052 { 944 else { 945 if (!(type & FULLSCREEN)) { 1053 946 type |= WINDOWED; 1054 947 apptype = SSF_TYPE_WINDOWEDVDM; 1055 948 } 1056 else 1057 { 949 else { 1058 950 type &= (~WINDOWED); 1059 951 apptype = SSF_TYPE_VDM; … … 1061 953 } 1062 954 } 1063 else if (apptype & FAPPTYP_32BIT) 1064 { 955 else if (apptype & FAPPTYP_32BIT) { 1065 956 apptype &= (~FAPPTYP_32BIT); 1066 957 if (apptype == FAPPTYP_WINDOWAPI) … … 1068 959 else if (apptype == FAPPTYP_WINDOWCOMPAT) 1069 960 apptype = SSF_TYPE_WINDOWABLEVIO; 1070 else if (apptype == FAPPTYP_NOTWINDOWCOMPAT) 1071 { 961 else if (apptype == FAPPTYP_NOTWINDOWCOMPAT) { 1072 962 apptype = SSF_TYPE_FULLSCREEN; 1073 963 type &= (~WINDOWED); … … 1081 971 else if (apptype == FAPPTYP_WINDOWCOMPAT) 1082 972 apptype = SSF_TYPE_WINDOWABLEVIO; 1083 else if (apptype == FAPPTYP_NOTWINDOWCOMPAT) 1084 { 973 else if (apptype == FAPPTYP_NOTWINDOWCOMPAT) { 1085 974 type &= (~WINDOWED); 1086 975 apptype = SSF_TYPE_FULLSCREEN; … … 1097 986 apptype = SSF_TYPE_VDM; 1098 987 } 1099 if (apptype == SSF_TYPE_WINDOWEDVDM && (type & SEPARATEKEEP)) 1100 { 988 if (apptype == SSF_TYPE_WINDOWEDVDM && (type & SEPARATEKEEP)) { 1101 989 type &= (~SEPARATEKEEP); 1102 990 type |= SEPARATE; 1103 991 } 1104 992 1105 if (type & WAIT) 1106 { 993 if (type & WAIT) { 1107 994 if (DosCreateQueue(&hque, QUE_FIFO | QUE_CONVERT_ADDRESS, queue_name)) 1108 995 hque = (HQUEUE) 0; … … 1134 1021 (SSF_CONTROL_MINIMIZE * ((type & MINIMIZED) != 0)) | 1135 1022 (SSF_CONTROL_INVISIBLE * ((type & INVISIBLE) != 0))); 1136 if (directory && *directory) 1137 { 1023 if (directory && *directory) { 1138 1024 save_dir2(savedir); 1139 1025 switch_to(directory); 1140 1026 } 1141 ret = (int)DosStartSession(&start, &sessID, &sessPID);1027 ret = DosStartSession(&start, &sessID, &sessPID); 1142 1028 if (directory && *directory) 1143 1029 switch_to(savedir); … … 1146 1032 GetPString(IDS_DOSSTARTSESSIONFAILEDTEXT),s,s2); 1147 1033 } 1148 else if (type & WAIT) 1149 { 1034 else if (type & WAIT) { 1150 1035 if (!(type & (BACKGROUND | MINIMIZED | INVISIBLE))) 1151 1036 ShowSession(hwnd, sessPID); 1152 1037 1153 if (!hque) 1154 { 1038 if (!hque) { 1155 1039 STATUSDATA sd; 1156 1040 … … 1168 1052 } 1169 1053 } 1170 else 1171 { 1054 else { 1172 1055 for (ctr = 0;; ctr++) 1173 1056 { … … 1175 1058 rc = DosReadQueue(hque, &rq, &ulLength, (PPVOID) & pusInfo, 0, 1176 1059 DCWW_NOWAIT, &bPriority, 0); 1177 if (rc == ERROR_QUE_EMPTY) 1178 { 1179 if (ctr > 20) 1180 { 1060 if (rc == ERROR_QUE_EMPTY) { 1061 if (ctr > 20) { 1181 1062 ShowSession(hwnd, sessPID); 1182 1063 ulLength = sizeof(rq); … … 1187 1068 DosSleep(100L); 1188 1069 } 1189 else 1190 { 1070 else { 1191 1071 ulLength = sizeof(rq); 1192 1072 if (rc) … … 1196 1076 } 1197 1077 } 1198 if (pusInfo) 1199 { 1078 if (pusInfo) { 1200 1079 ret = (!(!pusInfo[1])); 1201 1080 DosFreeMem(pusInfo); … … 1238 1117 va_end(parguments); 1239 1118 strip_lead_char(" \t", executable); 1240 if (*executable) 1241 { 1119 if (*executable) { 1242 1120 parameters = xmalloc(MAXSTRG,pszSrcFile,__LINE__); 1243 if (parameters) 1244 { 1121 if (parameters) { 1245 1122 p = executable; 1246 1123 wasquote = FALSE; 1247 while (*p && (wasquote || (*p != ' ' && *p != '\t'))) 1248 { 1249 if (*p == '\"') 1250 { 1251 if (!wasquote) 1252 { 1124 while (*p && (wasquote || (*p != ' ' && *p != '\t'))) { 1125 if (*p == '\"') { 1126 if (!wasquote) { 1253 1127 wasquote = TRUE; 1254 1128 memmove(p, p + 1, strlen(p)); … … 1256 1130 p++; 1257 1131 } 1258 else 1259 { 1132 else { 1260 1133 memmove(p, p + 1, strlen(p)); 1261 1134 break; … … 1265 1138 p++; 1266 1139 } 1267 if (*p) 1268 { 1140 if (*p) { 1269 1141 *p = 0; 1270 1142 p++; … … 1275 1147 strcpy(parameters, p); 1276 1148 1277 if (p && (!stricmp(p, ".BAT") || !stricmp(p, ".CMD"))) 1278 { 1279 1149 if (p && (!stricmp(p, ".BAT") || !stricmp(p, ".CMD"))) { 1280 1150 char *temp; 1281 1151 1282 1152 temp = xmalloc(CCHMAXPATH * 2,pszSrcFile,__LINE__); 1283 if (temp) 1284 { 1285 if (!stricmp(p, ".BAT")) 1286 { 1153 if (temp) { 1154 if (!stricmp(p, ".BAT")) { 1287 1155 strcpy(temp, executable); 1288 1156 strcpy(executable, parameters); … … 1293 1161 strcpy(executable, GetCmdSpec(TRUE)); 1294 1162 } 1295 else if (!stricmp(p, ".CMD")) 1296 { 1163 else if (!stricmp(p, ".CMD")) { 1297 1164 strcpy(temp, executable); 1298 1165 strcpy(executable, parameters);
Note:
See TracChangeset
for help on using the changeset viewer.