Changeset 1162
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/avv.c
r1119 r1162 42 42 #include "strutil.h" // GetPString 43 43 #include "errutil.h" // Runtime_Error 44 #include "avv.h" // ArcReviewDlgProc 45 #include "cmdline.h" // CmdLineDlgProc 46 #include "avv.h" 47 #include "literal.h" // fixup 44 48 #include "fm3dll.h" 45 49 #include "pathutil.h" // NormalizeCmdLine -
trunk/dll/newview.c
r1084 r1162 53 53 #include "strutil.h" // GetPString 54 54 #include "notebook.h" // httprun etc 55 #include "colors.h" // ColorDlgProc 56 #include "defview.h" // DefaultView 57 #include "draglist.h" // DragOne 58 #include "mainwnd.h" // FillClient, MakeBubble 59 #include "valid.h" // IsBinary 60 #include "saveclip.h" // ListToClipboardHab 61 #include "codepage.h" // PickCodepage 62 #include "fonts.h" // SetPresParamFromFattrs 63 #include "newview.h" 64 #include "strips.h" // chop_at_crnl, convert_nl_to_nul 65 // remove_first_occurence_of_character 66 #include "strips.h" // strip_lead_char, strip_trail_char 55 67 #include "fm3dll.h" 56 68 #include "fortify.h" -
trunk/dll/presparm.c
r1047 r1162 19 19 20 20 #define INCL_WIN 21 #define INCL_LONGLONG // dircnrs.h21 #define INCL_LONGLONG // dircnrs.h 22 22 23 23 #include "fm3dll.h" 24 #include "presparm.h" 24 25 #include "fortify.h" 25 26 26 27 // static PSZ pszSrcFile = __FILE__; 28 29 //static VOID IfNoParam(HWND hwnd, CHAR * keyroot, ULONG size, PVOID attrvalue); 30 31 //static VOID StoreWndPresParams(HWND hwnd, CHAR * tagname, HINI prof); 27 32 28 33 #ifdef NEVER … … 43 48 if (!ppresparams) 44 49 return; 45 ppresparams->cb = 0; /* no entries yet */46 pparam = ppresparams->aparam; /* cast structure onto memory */50 ppresparams->cb = 0; /* no entries yet */ 51 pparam = ppresparams->aparam; /* cast structure onto memory */ 47 52 48 53 /* … … 52 57 /* foreground color -- takes 12 bytes */ 53 58 pparam->cb = WinQueryPresParam(hwnd, 54 PP_FOREGROUNDCOLOR,55 PP_FOREGROUNDCOLORINDEX,56 &pparam->id,57 sizeof(LONG),58 (PVOID) pparam->ab, QPF_NOINHERIT);59 if (pparam->cb) { /* was the param found? */60 ppresparams->cb += 12; /* used 12 bytes */61 pparam = (PPARAM) (((ULONG) pparam) + 12); /* advance 12 bytes to next memory location */59 PP_FOREGROUNDCOLOR, 60 PP_FOREGROUNDCOLORINDEX, 61 &pparam->id, 62 sizeof(LONG), 63 (PVOID) pparam->ab, QPF_NOINHERIT); 64 if (pparam->cb) { /* was the param found? */ 65 ppresparams->cb += 12; /* used 12 bytes */ 66 pparam = (PPARAM) (((ULONG) pparam) + 12); /* advance 12 bytes to next memory location */ 62 67 } 63 68 64 69 /* background color -- takes 12 bytes */ 65 70 pparam->cb = WinQueryPresParam(hwnd, 66 PP_BACKGROUNDCOLOR,67 PP_BACKGROUNDCOLORINDEX,68 &pparam->id,69 sizeof(LONG),70 (PVOID) pparam->ab, QPF_NOINHERIT);71 PP_BACKGROUNDCOLOR, 72 PP_BACKGROUNDCOLORINDEX, 73 &pparam->id, 74 sizeof(LONG), 75 (PVOID) pparam->ab, QPF_NOINHERIT); 71 76 if (pparam->cb) { 72 77 ppresparams->cb += 12; … … 76 81 /* hilited foreground color -- takes 12 bytes */ 77 82 pparam->cb = WinQueryPresParam(hwnd, 78 PP_HILITEFOREGROUNDCOLOR,79 PP_HILITEFOREGROUNDCOLORINDEX,80 &pparam->id,81 sizeof(LONG),82 (PVOID) pparam->ab, QPF_NOINHERIT);83 PP_HILITEFOREGROUNDCOLOR, 84 PP_HILITEFOREGROUNDCOLORINDEX, 85 &pparam->id, 86 sizeof(LONG), 87 (PVOID) pparam->ab, QPF_NOINHERIT); 83 88 if (pparam->cb) { 84 89 ppresparams->cb += 12; … … 88 93 /* hilited background color -- takes 12 bytes */ 89 94 pparam->cb = WinQueryPresParam(hwnd, 90 PP_HILITEBACKGROUNDCOLOR,91 PP_HILITEBACKGROUNDCOLORINDEX,92 &pparam->id,93 sizeof(LONG),94 (PVOID) pparam->ab, QPF_NOINHERIT);95 PP_HILITEBACKGROUNDCOLOR, 96 PP_HILITEBACKGROUNDCOLORINDEX, 97 &pparam->id, 98 sizeof(LONG), 99 (PVOID) pparam->ab, QPF_NOINHERIT); 95 100 if (pparam->cb) { 96 101 ppresparams->cb += 12; … … 100 105 /* disabled foreground color -- takes 12 bytes */ 101 106 pparam->cb = WinQueryPresParam(hwnd, 102 PP_DISABLEDFOREGROUNDCOLOR,103 PP_DISABLEDFOREGROUNDCOLORINDEX,104 &pparam->id,105 sizeof(LONG),106 (PVOID) pparam->ab, QPF_NOINHERIT);107 PP_DISABLEDFOREGROUNDCOLOR, 108 PP_DISABLEDFOREGROUNDCOLORINDEX, 109 &pparam->id, 110 sizeof(LONG), 111 (PVOID) pparam->ab, QPF_NOINHERIT); 107 112 if (pparam->cb) { 108 113 ppresparams->cb += 12; … … 112 117 /* disabled background color -- takes 12 bytes */ 113 118 pparam->cb = WinQueryPresParam(hwnd, 114 PP_DISABLEDBACKGROUNDCOLOR,115 PP_DISABLEDBACKGROUNDCOLORINDEX,116 &pparam->id,117 sizeof(LONG),118 (PVOID) pparam->ab, QPF_NOINHERIT);119 PP_DISABLEDBACKGROUNDCOLOR, 120 PP_DISABLEDBACKGROUNDCOLORINDEX, 121 &pparam->id, 122 sizeof(LONG), 123 (PVOID) pparam->ab, QPF_NOINHERIT); 119 124 if (pparam->cb) { 120 125 ppresparams->cb += 12; … … 124 129 /* border color -- takes 12 bytes */ 125 130 pparam->cb = WinQueryPresParam(hwnd, 126 PP_BORDERCOLOR,127 PP_BORDERCOLORINDEX,128 &pparam->id,129 sizeof(LONG),130 (PVOID) pparam->ab, QPF_NOINHERIT);131 PP_BORDERCOLOR, 132 PP_BORDERCOLORINDEX, 133 &pparam->id, 134 sizeof(LONG), 135 (PVOID) pparam->ab, QPF_NOINHERIT); 131 136 if (pparam->cb) { 132 137 ppresparams->cb += 12; … … 136 141 /* font name & size -- maximum 44 bytes (32 for face name, 4 for point size) + 8 for data */ 137 142 pparam->cb = WinQueryPresParam(hwnd, 138 PP_FONTNAMESIZE,139 0,140 &pparam->id,141 36, (PVOID) pparam->ab, QPF_NOINHERIT);143 PP_FONTNAMESIZE, 144 0, 145 &pparam->id, 146 36, (PVOID) pparam->ab, QPF_NOINHERIT); 142 147 if (pparam->cb) { 143 148 ppresparams->cb += (pparam->cb + 8); … … 147 152 /* active color -- takes 12 bytes */ 148 153 pparam->cb = WinQueryPresParam(hwnd, 149 PP_ACTIVECOLOR,150 PP_ACTIVECOLORINDEX,151 &pparam->id,152 sizeof(LONG),153 (PVOID) pparam->ab, QPF_NOINHERIT);154 PP_ACTIVECOLOR, 155 PP_ACTIVECOLORINDEX, 156 &pparam->id, 157 sizeof(LONG), 158 (PVOID) pparam->ab, QPF_NOINHERIT); 154 159 if (pparam->cb) { 155 160 ppresparams->cb += 12; … … 159 164 /* inactive color -- takes 12 bytes */ 160 165 pparam->cb = WinQueryPresParam(hwnd, 161 PP_INACTIVECOLOR,162 PP_INACTIVECOLORINDEX,163 &pparam->id,164 sizeof(LONG),165 (PVOID) pparam->ab, QPF_NOINHERIT);166 PP_INACTIVECOLOR, 167 PP_INACTIVECOLORINDEX, 168 &pparam->id, 169 sizeof(LONG), 170 (PVOID) pparam->ab, QPF_NOINHERIT); 166 171 if (pparam->cb) { 167 172 ppresparams->cb += 12; … … 171 176 /* active text foreground color -- takes 12 bytes */ 172 177 pparam->cb = WinQueryPresParam(hwnd, 173 PP_ACTIVETEXTFGNDCOLOR,174 PP_ACTIVETEXTFGNDCOLORINDEX,175 &pparam->id,176 sizeof(LONG),177 (PVOID) pparam->ab,178 QPF_NOINHERIT | QPF_PURERGBCOLOR);178 PP_ACTIVETEXTFGNDCOLOR, 179 PP_ACTIVETEXTFGNDCOLORINDEX, 180 &pparam->id, 181 sizeof(LONG), 182 (PVOID) pparam->ab, 183 QPF_NOINHERIT | QPF_PURERGBCOLOR); 179 184 if (pparam->cb) { 180 185 ppresparams->cb += 12; … … 184 189 /* active text background color -- takes 12 bytes */ 185 190 pparam->cb = WinQueryPresParam(hwnd, 186 PP_ACTIVETEXTBGNDCOLOR,187 PP_ACTIVETEXTBGNDCOLORINDEX,188 &pparam->id,189 sizeof(LONG),190 (PVOID) pparam->ab,191 QPF_NOINHERIT | QPF_PURERGBCOLOR);191 PP_ACTIVETEXTBGNDCOLOR, 192 PP_ACTIVETEXTBGNDCOLORINDEX, 193 &pparam->id, 194 sizeof(LONG), 195 (PVOID) pparam->ab, 196 QPF_NOINHERIT | QPF_PURERGBCOLOR); 192 197 if (pparam->cb) { 193 198 ppresparams->cb += 12; … … 197 202 /* inactive text foreground color -- takes 12 bytes */ 198 203 pparam->cb = WinQueryPresParam(hwnd, 199 PP_INACTIVETEXTFGNDCOLOR,200 PP_INACTIVETEXTFGNDCOLORINDEX,201 &pparam->id,202 sizeof(LONG),203 (PVOID) pparam->ab,204 QPF_NOINHERIT | QPF_PURERGBCOLOR);204 PP_INACTIVETEXTFGNDCOLOR, 205 PP_INACTIVETEXTFGNDCOLORINDEX, 206 &pparam->id, 207 sizeof(LONG), 208 (PVOID) pparam->ab, 209 QPF_NOINHERIT | QPF_PURERGBCOLOR); 205 210 if (pparam->cb) { 206 211 ppresparams->cb += 12; … … 210 215 /* inactive text background color -- takes 12 bytes */ 211 216 pparam->cb = WinQueryPresParam(hwnd, 212 PP_INACTIVETEXTBGNDCOLOR,213 PP_INACTIVETEXTBGNDCOLORINDEX,214 &pparam->id,215 sizeof(LONG),216 (PVOID) pparam->ab,217 QPF_NOINHERIT | QPF_PURERGBCOLOR);217 PP_INACTIVETEXTBGNDCOLOR, 218 PP_INACTIVETEXTBGNDCOLORINDEX, 219 &pparam->id, 220 sizeof(LONG), 221 (PVOID) pparam->ab, 222 QPF_NOINHERIT | QPF_PURERGBCOLOR); 218 223 if (pparam->cb) { 219 224 ppresparams->cb += 12; … … 223 228 /* shadow color -- takes 12 bytes */ 224 229 pparam->cb = WinQueryPresParam(hwnd, 225 PP_SHADOW, 0,226 &pparam->id,227 sizeof(LONG),228 (PVOID) pparam->ab, QPF_NOINHERIT);230 PP_SHADOW, 0, 231 &pparam->id, 232 sizeof(LONG), 233 (PVOID) pparam->ab, QPF_NOINHERIT); 229 234 if (pparam->cb) { 230 235 ppresparams->cb += 12; … … 234 239 /* menu foreground color -- takes 12 bytes */ 235 240 pparam->cb = WinQueryPresParam(hwnd, 236 PP_MENUFOREGROUNDCOLOR,237 PP_MENUFOREGROUNDCOLORINDEX,238 &pparam->id,239 sizeof(LONG),240 (PVOID) pparam->ab, QPF_NOINHERIT);241 PP_MENUFOREGROUNDCOLOR, 242 PP_MENUFOREGROUNDCOLORINDEX, 243 &pparam->id, 244 sizeof(LONG), 245 (PVOID) pparam->ab, QPF_NOINHERIT); 241 246 if (pparam->cb) { 242 247 ppresparams->cb += 12; … … 246 251 /* menu background color -- takes 12 bytes */ 247 252 pparam->cb = WinQueryPresParam(hwnd, 248 PP_MENUBACKGROUNDCOLOR,249 PP_MENUBACKGROUNDCOLORINDEX,250 &pparam->id,251 sizeof(LONG),252 (PVOID) pparam->ab, QPF_NOINHERIT);253 PP_MENUBACKGROUNDCOLOR, 254 PP_MENUBACKGROUNDCOLORINDEX, 255 &pparam->id, 256 sizeof(LONG), 257 (PVOID) pparam->ab, QPF_NOINHERIT); 253 258 if (pparam->cb) { 254 259 ppresparams->cb += 12; … … 258 263 /* menu hilite foreground color -- takes 12 bytes */ 259 264 pparam->cb = WinQueryPresParam(hwnd, 260 PP_MENUHILITEFGNDCOLOR,261 PP_MENUHILITEFGNDCOLORINDEX,262 &pparam->id,263 sizeof(LONG),264 (PVOID) pparam->ab, QPF_NOINHERIT);265 PP_MENUHILITEFGNDCOLOR, 266 PP_MENUHILITEFGNDCOLORINDEX, 267 &pparam->id, 268 sizeof(LONG), 269 (PVOID) pparam->ab, QPF_NOINHERIT); 265 270 if (pparam->cb) { 266 271 ppresparams->cb += 12; … … 270 275 /* menu hilite background color -- takes 12 bytes */ 271 276 pparam->cb = WinQueryPresParam(hwnd, 272 PP_MENUHILITEBGNDCOLOR,273 PP_MENUHILITEBGNDCOLORINDEX,274 &pparam->id,275 sizeof(LONG),276 (PVOID) pparam->ab, QPF_NOINHERIT);277 PP_MENUHILITEBGNDCOLOR, 278 PP_MENUHILITEBGNDCOLORINDEX, 279 &pparam->id, 280 sizeof(LONG), 281 (PVOID) pparam->ab, QPF_NOINHERIT); 277 282 if (pparam->cb) { 278 283 ppresparams->cb += 12; … … 282 287 /* menu disabled foreground color -- takes 12 bytes */ 283 288 pparam->cb = WinQueryPresParam(hwnd, 284 PP_MENUDISABLEDFGNDCOLOR,285 PP_MENUDISABLEDFGNDCOLORINDEX,286 &pparam->id,287 sizeof(LONG),288 (PVOID) pparam->ab, QPF_NOINHERIT);289 PP_MENUDISABLEDFGNDCOLOR, 290 PP_MENUDISABLEDFGNDCOLORINDEX, 291 &pparam->id, 292 sizeof(LONG), 293 (PVOID) pparam->ab, QPF_NOINHERIT); 289 294 if (pparam->cb) { 290 295 ppresparams->cb += 12; … … 294 299 /* menu disabled background color -- takes 12 bytes */ 295 300 pparam->cb = WinQueryPresParam(hwnd, 296 PP_MENUDISABLEDBGNDCOLOR,297 PP_MENUDISABLEDBGNDCOLORINDEX,298 &pparam->id,299 sizeof(LONG),300 (PVOID) pparam->ab, QPF_NOINHERIT);301 PP_MENUDISABLEDBGNDCOLOR, 302 PP_MENUDISABLEDBGNDCOLORINDEX, 303 &pparam->id, 304 sizeof(LONG), 305 (PVOID) pparam->ab, QPF_NOINHERIT); 301 306 if (pparam->cb) { 302 307 ppresparams->cb += 12; … … 306 311 if (ppresparams->cb) 307 312 PrfWriteProfileData(prof, 308 appname, tagname, ppresparams, ppresparams->cb + 4);313 appname, tagname, ppresparams, ppresparams->cb + 4); 309 314 310 315 free(ppresparams); … … 351 356 while (AttrName[x]) { 352 357 cbRetLen = WinQueryPresParam(source, 353 AttrName[x],354 0,355 &AttrFound,358 AttrName[x], 359 0, 360 &AttrFound, 356 361 sizeof(AttrValue), 357 362 &AttrValue, 0); … … 365 370 366 371 VOID SetPresParams(HWND hwnd, RGB2 * back, RGB2 * fore, RGB2 * border, 367 CHAR * font)372 CHAR * font) 368 373 { 369 374 if (font) … … 377 382 } 378 383 384 #if 0 // JBS 379 385 VOID IfNoParam(HWND hwnd, CHAR * keyroot, ULONG size, PVOID attrvalue) 380 386 { … … 386 392 WinSetPresParam(hwnd, PP_FONTNAMESIZE, size, (PVOID) attrvalue); 387 393 } 394 #endif 388 395 389 396 VOID PresParamChanged(HWND hwnd, CHAR * keyroot, MPARAM mp1, MPARAM mp2) … … 392 399 393 400 cbRetLen = WinQueryPresParam(hwnd, (ULONG) mp1, 0, &AttrFound, 394 (ULONG) sizeof(AttrValue), &AttrValue, 0);401 (ULONG) sizeof(AttrValue), &AttrValue, 0); 395 402 if (cbRetLen) { 396 403 … … 458 465 sprintf(s, "%s.Fontnamesize", keyroot); 459 466 if (PrfQueryProfileData(fmprof, 460 appname, s, (PVOID) AttrValue, &size) && size)467 appname, s, (PVOID) AttrValue, &size) && size) 461 468 WinSetPresParam(hwnd, PP_FONTNAMESIZE, size, (PVOID) AttrValue); 462 469 } … … 476 483 while (AttrName[x]) { 477 484 cbRetLen = WinQueryPresParam(hwnd, 478 AttrName[x],479 0,480 &AttrFound,485 AttrName[x], 486 0, 487 &AttrFound, 481 488 sizeof(AttrValue), 482 489 &AttrValue, 0); … … 514 521 } 515 522 516 #pragma alloc_text(PRESPARAM,CopyPresParams,SetPresParams ,IfNoParam)523 #pragma alloc_text(PRESPARAM,CopyPresParams,SetPresParams) 517 524 #pragma alloc_text(PRESPARAM,PresParamChanged,RestorePresParams,SavePresParams) 518 525 #pragma alloc_text(PRESPARAM,StoreWndPresParams) -
trunk/dll/remap.c
r1119 r1162 33 33 #include "strutil.h" // GetPString 34 34 #include "pathutil.h" // BldFullPathName 35 #include "valid.h" // FillInDriveFlags 36 #include "remap.h" 35 37 #include "fm3dll.h" 36 38 #include "fortify.h" -
trunk/dll/systemf.c
r1104 r1162 35 35 #define INCL_DOSERRORS 36 36 #define INCL_WIN 37 #define INCL_LONGLONG // dircnrs.h37 #define INCL_LONGLONG // dircnrs.h 38 38 39 39 #include "fm3dlg.h" 40 40 #include "fm3str.h" 41 #include "errutil.h" // Dos_Error...42 #include "strutil.h" // GetPString41 #include "errutil.h" // Dos_Error... 42 #include "strutil.h" // GetPString 43 43 #include "notebook.h" //targetdirectory 44 44 #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 45 50 #include "fm3dll.h" 46 51 #include "fortify.h" 47 52 48 53 static PSZ pszSrcFile = __FILE__; 54 55 //static HAPP Exec(HWND hwndNotify, BOOL child, char *startdir, char *env, 56 // PROGTYPE * progt, ULONG fl, char *formatstring, ...); 49 57 50 58 /** … … 64 72 if (!rc) { 65 73 if (swctl.idProcess == pid && swctl.uchVisibility == SWL_VISIBLE) 66 rc = WinSwitchToProgram(hswitch);74 rc = WinSwitchToProgram(hswitch); 67 75 if (!rc) 68 return TRUE;76 return TRUE; 69 77 // else saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Failed: %lu/%lx",rc,rc); 70 78 … … 82 90 83 91 int 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) 85 93 { 86 94 /* executes the command once for all files in list */ … … 117 125 if (p) { 118 126 if (*p == ':') { 119 p++;120 *p = '\\';121 p++;127 p++; 128 *p = '\\'; 129 p++; 122 130 } 123 131 *p = 0; … … 134 142 if (p) { 135 143 if (*p == ':') { 136 p++;137 *p = '\\';138 p++;144 p++; 145 *p = '\\'; 146 p++; 139 147 } 140 148 *p = 0; … … 170 178 drive = 0; 171 179 172 p = command; // substitue for special % sequences180 p = command; // substitue for special % sequences 173 181 174 182 pp = commandline; … … 177 185 if (*p == '%') { 178 186 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; 183 191 184 192 … … 202 210 strcpy(pp, listfile); 203 211 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 else218 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 else236 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 */ 260 268 case 'u': 261 if (*modpath) {262 if (needs_quoting(modpath) && !strchr(modpath, '\"')) {263 spaces = TRUE;264 *pp = '\"';265 pp++;266 }267 else268 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 else296 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 */ 312 320 case 'p': 313 if (*path) {314 if (needs_quoting(path) && !strchr(path, '\"')) {315 spaces = TRUE;316 *pp = '\"';317 pp++;318 }319 else320 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 else348 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; 362 370 363 371 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 else381 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; 392 400 393 401 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 else424 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; 441 449 442 450 case '%': 443 *pp = '%';444 pp++;445 p += 2;446 break;451 *pp = '%'; 452 pp++; 453 p += 2; 454 break; 447 455 448 456 case 'R': … … 453 461 case 'a': 454 462 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 else464 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 else496 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 else519 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 else548 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; 568 576 569 577 default: 570 *pp = *p;571 p++;572 pp++;573 break;578 *pp = *p; 579 p++; 580 pp++; 581 break; 574 582 } 575 583 } … … 598 606 strcpy(ex.path, path); 599 607 if (prompt) 600 strcpy(ex.title, prompt);608 strcpy(ex.title, prompt); 601 609 ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle, 602 EXEC_FRAME, &ex);610 EXEC_FRAME, &ex); 603 611 if (ret != 1) { 604 612 free(commandline); … … 610 618 ex.flags &= (~PROMPT); 611 619 ret = runemf2(ex.flags, hwnd, pszCallingFile, uiLineNumber, path, 612 (*ex.environment) ? ex.environment : NULL,620 (*ex.environment) ? ex.environment : NULL, 613 621 "%s", commandline); 614 622 free(commandline); … … 622 630 623 631 int 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,...) 626 634 { 627 635 /** example: … … 678 686 if (pszDirectory && *pszDirectory) { 679 687 if (!DosQueryPathInfo(pszDirectory, 680 FIL_QUERYFULLNAME,681 szTempdir,682 sizeof(szTempdir)))688 FIL_QUERYFULLNAME, 689 szTempdir, 690 sizeof(szTempdir))) 683 691 pszDirectory = szTempdir; 684 692 } … … 688 696 689 697 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); 692 700 if (rc) { 693 701 Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY)); … … 699 707 *pszPgm = 0; 700 708 va_start(parguments, 701 formatstring);709 formatstring); 702 710 vsprintf(pszPgm, 703 formatstring,704 parguments);711 formatstring, 712 parguments); 705 713 va_end(parguments); 706 714 … … 732 740 temp = *p; 733 741 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)); 739 747 } 740 748 else 741 pszArgs = NULL;749 pszArgs = NULL; 742 750 *p = 0; 743 751 /* Find the handle of the WPS object */ … … 745 753 *p = temp; 746 754 if (hWPSObject != NULLHANDLE) { 747 if (pszArgs && *p) {748 sprintf(pszArgs,"OPEN=DEFAULT;PARAMETERS=\"%s\"",p);749 WinSetObjectData(hWPSObject,pszArgs);750 }751 else752 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; 754 762 } 755 763 goto ObjectInterrupt; … … 757 765 758 766 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) 761 769 { 762 770 strip_lead_char(" \t", pszPgm); … … 764 772 wasquote = FALSE; 765 773 while (*p && 766 (wasquote ||767 (*p != ' ' &&768 *p != '\t')))774 (wasquote || 775 (*p != ' ' && 776 *p != '\t'))) 769 777 { 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 else788 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++; 789 797 } 790 798 if (*p) { 791 *p = 0;792 p++;799 *p = 0; 800 p++; 793 801 } 794 802 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 */ 797 805 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 SHL816 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 SHL828 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 SHL840 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 SHL862 }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 } 863 871 } 864 872 } 865 873 else { 866 874 if (~type & FULLSCREEN) 867 type |= WINDOWED;875 type |= WINDOWED; 868 876 rc = DosAllocMem((PVOID) & pszArgs, MaxComLineStrg * 2, 869 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);877 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE); 870 878 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; 874 882 } 875 883 *pszArgs = 0; … … 879 887 wasquote = FALSE; 880 888 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 else894 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++; 895 903 } // while 896 904 if (*p) { 897 *p = 0;898 p++;905 *p = 0; 906 p++; 899 907 } 900 908 else 901 p = NullStr;909 p = NullStr; 902 910 if (*p) 903 strcpy(pszArgs, p);911 strcpy(pszArgs, p); 904 912 905 913 p = strrchr(pszPgm, '.'); 906 914 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));// DOS917 }918 else if (!stricmp(p, ".CMD") || !stricmp(p, ".BTM")) {919 // Assume 4OS2 is BTM920 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/2927 }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 } 928 936 } 929 937 … … 931 939 932 940 if (strlen(pszPgm) + strlen(pszArgs) > 1024) 933 pszArgs[1024 - strlen(pszPgm)] = 0;941 pszArgs[1024 - strlen(pszPgm)] = 0; 934 942 935 943 if (!strchr(pszPgm, '\\') && 936 !strchr(pszPgm, ':') &&937 pszDirectory &&938 *pszDirectory)944 !strchr(pszPgm, ':') && 945 pszDirectory && 946 *pszDirectory) 939 947 { 940 strcpy(szSavedir, pFM2SaveDirectory);941 switch_to(pszDirectory);948 strcpy(szSavedir, pFM2SaveDirectory); 949 switch_to(pszDirectory); 942 950 } 943 951 rc = DosQueryAppType(pszPgm,&ulAppType); 944 952 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); 949 957 if (rc) { 950 Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,951 GetPString(IDS_DOSQAPPTYPEFAILEDTEXT),952 pszPgm, pszCallingFile, uiLineNumber);// 26 May 08 SHL953 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; 957 965 } 958 966 959 967 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 SHL965 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 else1029 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 } 1041 1049 } 1042 1050 if (ulAppType == SSF_TYPE_WINDOWEDVDM && type & SEPARATEKEEP) { 1043 type &= ~SEPARATEKEEP;1044 type |= SEPARATE;1051 type &= ~SEPARATEKEEP; 1052 type |= SEPARATE; 1045 1053 } 1046 1054 … … 1048 1056 1049 1057 if (~type & WAIT) 1050 useTermQ = FALSE;1058 useTermQ = FALSE; 1051 1059 else { 1052 rc = 0;1053 DosEnterCritSec();1054 if (!hTermQ) {1055 // Create term queue and event semaphore just once1056 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 survive1060 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 survive1067 DosCloseQueue(hTermQ);1068 hTermQ = (HQUEUE)0;// Try to survive1069 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 time1075 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(); 1078 1086 } // if wait 1079 1087 … … 1081 1089 sdata.Length = sizeof(sdata); 1082 1090 sdata.Related = type & (WAIT | CHILD) ? SSF_RELATED_CHILD : 1083 SSF_RELATED_INDEPENDENT;1091 SSF_RELATED_INDEPENDENT; 1084 1092 sdata.FgBg = type & BACKGROUND ? SSF_FGBG_BACK : SSF_FGBG_FORE; 1085 1093 sdata.TraceOpt = SSF_TRACEOPT_NONE; 1086 1094 sdata.PgmName = pszPgm; 1087 1095 if (*pszArgs) 1088 sdata.PgmInputs = pszArgs;1096 sdata.PgmInputs = pszArgs; 1089 1097 if (useTermQ) 1090 sdata.TermQ = szTermQName;1098 sdata.TermQ = szTermQName; 1091 1099 sdata.Environment = pszEnvironment; 1092 1100 sdata.InheritOpt = SSF_INHERTOPT_PARENT; … … 1095 1103 sdata.ObjectBuffLen = sizeof(szObject); 1096 1104 if ((type & RUNTYPE_MASK) == SEPARATEKEEP) 1097 sdata.PgmControl |= SSF_CONTROL_NOAUTOCLOSE;1105 sdata.PgmControl |= SSF_CONTROL_NOAUTOCLOSE; 1098 1106 if (type & MAXIMIZED) 1099 sdata.PgmControl |= SSF_CONTROL_MAXIMIZE;1107 sdata.PgmControl |= SSF_CONTROL_MAXIMIZE; 1100 1108 if (type & MINIMIZED) 1101 sdata.PgmControl |= SSF_CONTROL_MINIMIZE;1109 sdata.PgmControl |= SSF_CONTROL_MINIMIZE; 1102 1110 if (type & INVISIBLE) 1103 sdata.PgmControl |= SSF_CONTROL_INVISIBLE;1111 sdata.PgmControl |= SSF_CONTROL_INVISIBLE; 1104 1112 1105 1113 if (pszDirectory && *pszDirectory) { 1106 strcpy(szSavedir, pFM2SaveDirectory);1107 switch_to(pszDirectory);1114 strcpy(szSavedir, pFM2SaveDirectory); 1115 switch_to(pszDirectory); 1108 1116 } 1109 1117 1110 1118 // printf("%s %d DosStartsession thread 0x%x data\n ", 1111 // __FILE__, __LINE__,ptib->tib_ordinal); fflush(stdout); // 10 Mar 07 SHL hang1119 // __FILE__, __LINE__,ptib->tib_ordinal); fflush(stdout); // 10 Mar 07 SHL hang 1112 1120 // printf(" %d %d %d %s %s %s %d %d\n %s %x %x\n", 1113 1121 // sdata.Length , sdata.Related, sdata.FgBg, sdata.PgmName, … … 1119 1127 // if (type & WAIT) { 1120 1128 // 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 hang1129 // __FILE__, __LINE__, ptib->tib_ordinal,ret, ulSessID, sessPID); fflush(stdout); // 10 Mar 07 SHL hang 1122 1130 // } 1123 1131 // else { 1124 1132 // printf("%s %d DosStartession thread 0x%x nowait rc = %d\n", 1125 // __FILE__, __LINE__, ptib->tib_ordinal,ret); fflush(stdout); // 10 Mar 07 SHL hang1133 // __FILE__, __LINE__, ptib->tib_ordinal,ret); fflush(stdout); // 10 Mar 07 SHL hang 1126 1134 // } 1127 1135 1128 1136 if (pszDirectory && *pszDirectory) 1129 switch_to(szSavedir);1137 switch_to(szSavedir); 1130 1138 1131 1139 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 SHL1140 Dos_Error(MB_CANCEL,ret,hwnd,pszSrcFile,__LINE__, 1141 GetPString(IDS_DOSSTARTSESSIONFAILEDTEXT),pszPgm,pszArgs, 1142 pszCallingFile, uiLineNumber); // 26 May 08 SHL 1135 1143 } 1136 1144 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 hang1144 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 2001152 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 SHL1157 ShowSession(hwnd, sessPID);// Show every 2 seconds1158 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 1001170 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 session1178 }1179 rc = DosReadQueue(hTermQ, &rq, &ulLength, (PPVOID)&pTermInfo, 0,1180 DCWW_WAIT, &bPriority, 0);1181 }1182 1183 if (rc) {1184 // Oh heck1185 Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosReadQueue");1186 DosSleep(100);//05 Aug 07 GKY 5001187 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 done1195 1196 // Requeue session for other thread1197 {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 5001204 ulLastSessID = pTermInfo->usSessID;1205 }1206 // requeue term report for other thread and do not free yet1207 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 entry1211 }1212 } // for1213 1214 ret = pTermInfo->usRC == 0;// Set 1 if rc 0 else 01215 // 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 } 1219 1227 } // if wait 1220 1228 else if (!(type & (BACKGROUND | MINIMIZED | INVISIBLE))) 1221 ShowSession(hwnd, sessPID);1229 ShowSession(hwnd, sessPID); 1222 1230 } 1223 1231 } … … 1234 1242 1235 1243 //== Exec() Start application with WinStartApp == 1236 1244 #if 0 //JBS 1237 1245 HAPP Exec(HWND hwndNotify, BOOL child, char *startdir, char *env, 1238 PROGTYPE *progt, ULONG fl, char *formatstring,...)1246 PROGTYPE *progt, ULONG fl, char *formatstring,...) 1239 1247 { 1240 1248 PROGDETAILS pgd; … … 1258 1266 parameters = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 1259 1267 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 else1276 p++;1277 }1278 if (*p) {1279 *p = 0;1280 p++;1281 }1282 else1283 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); 1325 1333 } 1326 1334 } … … 1329 1337 return happ; 1330 1338 } 1331 1339 #endif 1332 1340 #pragma alloc_text(SYSTEMF,ShowSession,ExecOnList,runemf2) -
trunk/dll/valid.c
r1104 r1162 41 41 #include "errutil.h" // Dos_Error... 42 42 #include "strutil.h" // GetPString 43 #include "valid.h" 43 44 #include "fm3dll.h" 44 45 45 46 static PSZ pszSrcFile = __FILE__; 47 48 //static BOOL IsDesktop(HAB hab, HWND hwnd); 49 //static BOOL IsFileSame(CHAR * filename1, CHAR * filename2); 46 50 47 51 APIRET MakeFullName(char *pszFileName) … … 180 184 } 181 185 186 #if 0 // JBS 182 187 BOOL IsDesktop(HAB hab, HWND hwnd) 183 188 { … … 191 196 return FALSE; 192 197 } 198 #endif 193 199 194 200 BOOL ParentIsDesktop(HWND hwnd, HWND hwndParent) … … 401 407 } 402 408 409 #if 0 // JBS 403 410 BOOL IsFileSame(CHAR * filename1, CHAR * filename2) 404 411 { … … 426 433 return FALSE; 427 434 } 435 #endif 428 436 429 437 INT IsFile(CHAR * filename) -
trunk/dll/viewer.c
r1063 r1162 34 34 #include "strutil.h" // GetPString 35 35 #include "notebook.h" // External viewers 36 #include "colors.h" // ColorDlgProc 37 #include "mainwnd.h" // FillClient 38 #include "viewer.h" 39 #include "codepage.h" // PickCodepage 40 #include "dirs.h" // switch_to 36 41 #include "fm3dll.h" 42 #include "misc.h" // SetMenuCheck, disable_menuitem 37 43 #include "fortify.h" 38 44 -
trunk/dll/walkem.c
r1119 r1162 54 54 #include "notebook.h" // targetdirectory 55 55 #include "pathutil.h" // BldFullPathName 56 #include "walkem.h" 56 57 #include "fm3dll.h" 57 58 #include "fortify.h" 58 #include "walkem.h"59 59 60 60 #pragma data_seg(DATA1) … … 62 62 static PSZ pszSrcFile = __FILE__; 63 63 64 static MRESULT EXPENTRY WalkTwoDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 65 static VOID load_setups(VOID); 66 static BOOL remove_ldir(PSZ path); 64 67 65 68 typedef struct -
trunk/dll/walkem.h
r1077 r1162 20 20 #endif 21 21 22 VOID FillPathListBox(HWND hwnd, HWND hwnddrive, HWND hwnddir, PSZ path, 23 BOOL nounwriteable); 24 MRESULT EXPENTRY WalkCopyDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, 25 MPARAM mp2); 26 MRESULT EXPENTRY WalkDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 27 MRESULT EXPENTRY WalkExtractDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, 28 MPARAM mp2); 29 MRESULT EXPENTRY WalkMoveDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, 30 MPARAM mp2); 31 MRESULT EXPENTRY WalkTargetDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, 32 MPARAM mp2); 33 MRESULT EXPENTRY WalkTwoCmpDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, 34 MPARAM mp2); 35 MRESULT EXPENTRY WalkTwoSetDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, 36 MPARAM mp2); 37 INT add_setup(PSZ stateName); 38 BOOL add_udir(BOOL userdirs, PSZ inpath); 39 VOID fill_setups_list(VOID); 40 VOID free_ldir(VOID); 41 VOID free_udirs(VOID); 42 VOID load_udirs(VOID); 43 INT remove_setup(PSZ stateName); 44 BOOL remove_udir(PSZ path); 45 VOID save_setups(VOID); 46 VOID save_udirs(VOID); 47 22 48 #ifdef FORTIFY 23 49 VOID free_setups(VOID); -
trunk/dll/winlist.c
r1047 r1162 23 23 #include "fm3dlg.h" 24 24 #include "fm3dll.h" 25 #include "winlist.h" 25 26 #include "fortify.h" 26 27 … … 40 41 if (Me || !mp2) { 41 42 if (Me) 42 PostMsg(Me, UM_FOCUSME, MPVOID, MPVOID);43 PostMsg(Me, UM_FOCUSME, MPVOID, MPVOID); 43 44 WinDismissDlg(hwnd, 0); 44 45 } … … 54 55 henum = WinBeginEnumWindows(*(HWND *) mp2); 55 56 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) { 56 id = WinQueryWindowUShort(hwndChild, QWS_ID);57 if (!id)58 continue;59 *wtext = ' ';60 WinQueryWindowText(hwndChild, CCHMAXPATH, wtext + 1);61 wtext[CCHMAXPATH] = 0;62 sSelect =63 (SHORT) WinSendDlgItemMsg(hwnd, WLIST_LISTBOX, LM_INSERTITEM,64 MPFROM2SHORT(LIT_SORTASCENDING, 0),65 MPFROMP(wtext));66 if (sSelect >= 0)67 WinSendDlgItemMsg(hwnd, WLIST_LISTBOX, LM_SETITEMHANDLE,68 MPFROM2SHORT(sSelect, 0),69 MPFROMLONG((ULONG) hwndChild));57 id = WinQueryWindowUShort(hwndChild, QWS_ID); 58 if (!id) 59 continue; 60 *wtext = ' '; 61 WinQueryWindowText(hwndChild, CCHMAXPATH, wtext + 1); 62 wtext[CCHMAXPATH] = 0; 63 sSelect = 64 (SHORT) WinSendDlgItemMsg(hwnd, WLIST_LISTBOX, LM_INSERTITEM, 65 MPFROM2SHORT(LIT_SORTASCENDING, 0), 66 MPFROMP(wtext)); 67 if (sSelect >= 0) 68 WinSendDlgItemMsg(hwnd, WLIST_LISTBOX, LM_SETITEMHANDLE, 69 MPFROM2SHORT(sSelect, 0), 70 MPFROMLONG((ULONG) hwndChild)); 70 71 } 71 72 WinEndEnumWindows(henum); 72 73 73 74 { 74 PSWBLOCK pswb;75 ULONG ulSize, ulcEntries;76 register INT i, y;77 78 /* Get the switch list information */79 ulcEntries = WinQuerySwitchList(0, NULL, 0);80 ulSize = sizeof(SWBLOCK) + sizeof(HSWITCH) + (ulcEntries + 4) *81 (LONG) sizeof(SWENTRY);82 /* Allocate memory for list */83 pswb = xmalloc((unsigned)ulSize, pszSrcFile, __LINE__);84 if (pswb) {85 /* Put the info in the list */86 ulcEntries = WinQuerySwitchList(0, pswb, ulSize - sizeof(SWENTRY));87 /* do the dirty deed */88 y = 0;89 for (i = 0; i < pswb->cswentry; i++) {90 if (pswb->aswentry[i].swctl.uchVisibility == SWL_VISIBLE &&91 pswb->aswentry[i].swctl.fbJump == SWL_JUMPABLE &&92 ((pswb->aswentry[i].swctl.idProcess == mypid &&93 (strnicmp(pswb->aswentry[i].swctl.szSwtitle,94 "FM/2", 4))) ||95 !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "AV/2", 4) ||96 !stricmp(pswb->aswentry[i].swctl.szSwtitle, "File Manager/2")97 || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "Collector")98 || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VTree", 5)99 || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VDir", 4)100 || (!strnicmp(pswb->aswentry[i].swctl.szSwtitle, FM2Str, 4)101 && strnicmp(pswb->aswentry[i].swctl.szSwtitle, "FM/2",102 4)))) {103 *wtext = '*';104 wtext[1] = 0;105 strcat(wtext, pswb->aswentry[i].swctl.szSwtitle);106 wtext[CCHMAXPATH] = 0;107 sSelect = (SHORT) WinSendDlgItemMsg(hwnd,108 WLIST_LISTBOX,109 LM_INSERTITEM,110 MPFROM2SHORT111 (LIT_SORTASCENDING, 0),112 MPFROMP(wtext));113 if (sSelect >= 0)114 WinSendDlgItemMsg(hwnd,115 WLIST_LISTBOX,116 LM_SETITEMHANDLE,117 MPFROM2SHORT(sSelect, 0),118 MPFROMLONG(pswb->aswentry[i].swctl.hwnd));119 }120 y++;121 }122 free(pswb);123 DosPostEventSem(CompactSem);124 }75 PSWBLOCK pswb; 76 ULONG ulSize, ulcEntries; 77 register INT i, y; 78 79 /* Get the switch list information */ 80 ulcEntries = WinQuerySwitchList(0, NULL, 0); 81 ulSize = sizeof(SWBLOCK) + sizeof(HSWITCH) + (ulcEntries + 4) * 82 (LONG) sizeof(SWENTRY); 83 /* Allocate memory for list */ 84 pswb = xmalloc((unsigned)ulSize, pszSrcFile, __LINE__); 85 if (pswb) { 86 /* Put the info in the list */ 87 ulcEntries = WinQuerySwitchList(0, pswb, ulSize - sizeof(SWENTRY)); 88 /* do the dirty deed */ 89 y = 0; 90 for (i = 0; i < pswb->cswentry; i++) { 91 if (pswb->aswentry[i].swctl.uchVisibility == SWL_VISIBLE && 92 pswb->aswentry[i].swctl.fbJump == SWL_JUMPABLE && 93 ((pswb->aswentry[i].swctl.idProcess == mypid && 94 (strnicmp(pswb->aswentry[i].swctl.szSwtitle, 95 "FM/2", 4))) || 96 !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "AV/2", 4) || 97 !stricmp(pswb->aswentry[i].swctl.szSwtitle, "File Manager/2") 98 || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "Collector") 99 || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VTree", 5) 100 || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VDir", 4) 101 || (!strnicmp(pswb->aswentry[i].swctl.szSwtitle, FM2Str, 4) 102 && strnicmp(pswb->aswentry[i].swctl.szSwtitle, "FM/2", 103 4)))) { 104 *wtext = '*'; 105 wtext[1] = 0; 106 strcat(wtext, pswb->aswentry[i].swctl.szSwtitle); 107 wtext[CCHMAXPATH] = 0; 108 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 109 WLIST_LISTBOX, 110 LM_INSERTITEM, 111 MPFROM2SHORT 112 (LIT_SORTASCENDING, 0), 113 MPFROMP(wtext)); 114 if (sSelect >= 0) 115 WinSendDlgItemMsg(hwnd, 116 WLIST_LISTBOX, 117 LM_SETITEMHANDLE, 118 MPFROM2SHORT(sSelect, 0), 119 MPFROMLONG(pswb->aswentry[i].swctl.hwnd)); 120 } 121 y++; 122 } 123 free(pswb); 124 DosPostEventSem(CompactSem); 125 } 125 126 } 126 127 127 128 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 128 WLIST_LISTBOX,129 LM_QUERYITEMCOUNT, MPVOID, MPVOID);129 WLIST_LISTBOX, 130 LM_QUERYITEMCOUNT, MPVOID, MPVOID); 130 131 if (sSelect <= 0) 131 WinDismissDlg(hwnd, 0);132 WinDismissDlg(hwnd, 0); 132 133 } 133 134 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); … … 155 156 switch (SHORT2FROMMP(mp1)) { 156 157 case LN_ENTER: 157 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID);158 break;158 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID); 159 break; 159 160 } 160 161 break; … … 168 169 case DID_OK: 169 170 { 170 HWND hwndActive = (HWND) WinQueryWindowULong(hwnd, QWL_USER);171 172 hwndActive = WinQueryActiveWindow(hwndActive);173 sSelect = (SHORT) WinSendDlgItemMsg(hwnd,174 WLIST_LISTBOX,175 LM_QUERYSELECTION,176 MPFROM2SHORT(LIT_FIRST, 0),177 MPVOID);178 while (sSelect >= 0) {179 180 HWND HwndC;181 182 HwndC = (HWND) WinSendDlgItemMsg(hwnd,183 WLIST_LISTBOX,184 LM_QUERYITEMHANDLE,185 MPFROM2SHORT(sSelect, 0), MPVOID);186 if (HwndC) {187 188 SWP swp;189 190 WinQueryWindowPos(HwndC, &swp);191 if (SHORT1FROMMP(mp1) == DID_OK) {192 if (!(swp.fl & SWP_MINIMIZE) && (swp.cx == 0 || swp.cy == 0)) {193 GetNextWindowPos((HWND) WinQueryWindowULong(hwnd, QWL_USER),194 &swp, NULL, NULL);195 WinSetWindowPos(HwndC, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,196 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER |197 SWP_ACTIVATE | SWP_FOCUSACTIVATE);198 }199 else200 WinSetWindowPos(HwndC, HWND_TOP, 0, 0, 0, 0,201 SWP_RESTORE | SWP_SHOW | SWP_ZORDER |202 SWP_ACTIVATE | SWP_FOCUSACTIVATE);203 }204 else if (SHORT1FROMMP(mp1) == WLIST_MINIMIZE) {205 WinSetWindowPos(HwndC, HWND_BOTTOM, 0, 0, 0, 0,206 SWP_MINIMIZE | SWP_DEACTIVATE |207 SWP_FOCUSDEACTIVATE | SWP_ZORDER);208 if (hwndActive == HwndC) {209 WinSetWindowPos(WinWindowFromID(WinQueryWindow(hwndActive,210 QW_PARENT),211 TREE_FRAME), HWND_TOP, 0, 0,212 0, 0,213 SWP_SHOW | SWP_RESTORE | SWP_ACTIVATE |214 SWP_FOCUSACTIVATE | SWP_ZORDER);215 hwndActive = (HWND) 0;216 }217 }218 else if (WinQueryWindowUShort(HwndC, QWS_ID) != TREE_FRAME)219 PostMsg(HwndC, WM_CLOSE, MPVOID, MPVOID);220 }221 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, WLIST_LISTBOX,222 LM_QUERYSELECTION,223 MPFROM2SHORT(sSelect, 0),224 MPVOID);225 }171 HWND hwndActive = (HWND) WinQueryWindowULong(hwnd, QWL_USER); 172 173 hwndActive = WinQueryActiveWindow(hwndActive); 174 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 175 WLIST_LISTBOX, 176 LM_QUERYSELECTION, 177 MPFROM2SHORT(LIT_FIRST, 0), 178 MPVOID); 179 while (sSelect >= 0) { 180 181 HWND HwndC; 182 183 HwndC = (HWND) WinSendDlgItemMsg(hwnd, 184 WLIST_LISTBOX, 185 LM_QUERYITEMHANDLE, 186 MPFROM2SHORT(sSelect, 0), MPVOID); 187 if (HwndC) { 188 189 SWP swp; 190 191 WinQueryWindowPos(HwndC, &swp); 192 if (SHORT1FROMMP(mp1) == DID_OK) { 193 if (!(swp.fl & SWP_MINIMIZE) && (swp.cx == 0 || swp.cy == 0)) { 194 GetNextWindowPos((HWND) WinQueryWindowULong(hwnd, QWL_USER), 195 &swp, NULL, NULL); 196 WinSetWindowPos(HwndC, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 197 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER | 198 SWP_ACTIVATE | SWP_FOCUSACTIVATE); 199 } 200 else 201 WinSetWindowPos(HwndC, HWND_TOP, 0, 0, 0, 0, 202 SWP_RESTORE | SWP_SHOW | SWP_ZORDER | 203 SWP_ACTIVATE | SWP_FOCUSACTIVATE); 204 } 205 else if (SHORT1FROMMP(mp1) == WLIST_MINIMIZE) { 206 WinSetWindowPos(HwndC, HWND_BOTTOM, 0, 0, 0, 0, 207 SWP_MINIMIZE | SWP_DEACTIVATE | 208 SWP_FOCUSDEACTIVATE | SWP_ZORDER); 209 if (hwndActive == HwndC) { 210 WinSetWindowPos(WinWindowFromID(WinQueryWindow(hwndActive, 211 QW_PARENT), 212 TREE_FRAME), HWND_TOP, 0, 0, 213 0, 0, 214 SWP_SHOW | SWP_RESTORE | SWP_ACTIVATE | 215 SWP_FOCUSACTIVATE | SWP_ZORDER); 216 hwndActive = (HWND) 0; 217 } 218 } 219 else if (WinQueryWindowUShort(HwndC, QWS_ID) != TREE_FRAME) 220 PostMsg(HwndC, WM_CLOSE, MPVOID, MPVOID); 221 } 222 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, WLIST_LISTBOX, 223 LM_QUERYSELECTION, 224 MPFROM2SHORT(sSelect, 0), 225 MPVOID); 226 } 226 227 } 227 228 WinDismissDlg(hwnd, 0); … … 230 231 case IDM_HELP: 231 232 if (hwndHelp) 232 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,233 MPFROM2SHORT(HELP_WINLIST, 0), MPFROMSHORT(HM_RESOURCEID));233 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 234 MPFROM2SHORT(HELP_WINLIST, 0), MPFROMSHORT(HM_RESOURCEID)); 234 235 break; 235 236 … … 245 246 else 246 247 WinSetWindowPos(Me, HWND_TOP, 0, 0, 0, 0, 247 SWP_SHOW | SWP_RESTORE | SWP_ZORDER | SWP_ACTIVATE);248 SWP_SHOW | SWP_RESTORE | SWP_ZORDER | SWP_ACTIVATE); 248 249 break; 249 250 } … … 254 255 { 255 256 WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, WinListDlgProc, FM3ModHandle, 256 WLIST_FRAME, MPFROMP(&hwnd));257 WLIST_FRAME, MPFROMP(&hwnd)); 257 258 } 258 259
Note:
See TracChangeset
for help on using the changeset viewer.
