| 1 | #define INCL_DOS
 | 
|---|
| 2 | #define INCL_DOSERRORS
 | 
|---|
| 3 | #define INCL_WIN
 | 
|---|
| 4 | 
 | 
|---|
| 5 | #include <os2.h>
 | 
|---|
| 6 | #include <stdarg.h>
 | 
|---|
| 7 | #include <stdio.h>
 | 
|---|
| 8 | #include <stdlib.h>
 | 
|---|
| 9 | #include <string.h>
 | 
|---|
| 10 | #include <ctype.h>
 | 
|---|
| 11 | #include "fm3dll.h"
 | 
|---|
| 12 | #include "fm3str.h"
 | 
|---|
| 13 | 
 | 
|---|
| 14 | #pragma data_seg(DATA1)
 | 
|---|
| 15 | #pragma alloc_text(FLESH,Flesh,FleshEnv,Unflesh,Stubby)
 | 
|---|
| 16 | 
 | 
|---|
| 17 | 
 | 
|---|
| 18 | BOOL FleshEnv (HWND hwndCnr,PCNRITEM pciParent) {
 | 
|---|
| 19 | 
 | 
|---|
| 20 |   PCNRITEM    pciL;
 | 
|---|
| 21 |   DIRCNRDATA *dcd;
 | 
|---|
| 22 |   CHAR        path[CCHMAXPATH + 12],
 | 
|---|
| 23 |               fullpath[CCHMAXPATH + 12],
 | 
|---|
| 24 |               *env,
 | 
|---|
| 25 |               *p,
 | 
|---|
| 26 |               *pp,
 | 
|---|
| 27 |               *var = NULL;
 | 
|---|
| 28 | 
 | 
|---|
| 29 |   if(!pciParent ||
 | 
|---|
| 30 |      (INT)pciParent == -1 ||
 | 
|---|
| 31 |      !hwndCnr)
 | 
|---|
| 32 |     return FALSE;
 | 
|---|
| 33 |   dcd = (DIRCNRDATA *)WinQueryWindowPtr(hwndCnr,0);
 | 
|---|
| 34 |   if(!dcd)
 | 
|---|
| 35 |     return FALSE;
 | 
|---|
| 36 | 
 | 
|---|
| 37 |   strcpy(path,
 | 
|---|
| 38 |          pciParent->szFileName + 1);
 | 
|---|
| 39 |   if(stricmp(path,GetPString(IDS_ENVVARSTEXT) + 1))
 | 
|---|
| 40 |     UnFlesh(hwndCnr,pciParent);
 | 
|---|
| 41 |   if(*path) {
 | 
|---|
| 42 |     path[strlen(path) - 1] = 0;
 | 
|---|
| 43 |     if(!stricmp(path,"LIBPATH")) {
 | 
|---|
| 44 |       var = malloc(65536);
 | 
|---|
| 45 |       if(var)
 | 
|---|
| 46 |         LoadLibPath(var,65536);
 | 
|---|
| 47 |       env = var;
 | 
|---|
| 48 |     }
 | 
|---|
| 49 |     else
 | 
|---|
| 50 |       env = getenv(path);
 | 
|---|
| 51 |     if(env && *env) {
 | 
|---|
| 52 |       p = env;
 | 
|---|
| 53 |       while(*p) {
 | 
|---|
| 54 |         pp = path;
 | 
|---|
| 55 |         while(*p == ';')
 | 
|---|
| 56 |           p++;
 | 
|---|
| 57 |         while(*p && *p != ';') {
 | 
|---|
| 58 |           *pp = *p;
 | 
|---|
| 59 |           p++;
 | 
|---|
| 60 |           pp++;
 | 
|---|
| 61 |         }
 | 
|---|
| 62 |         *pp = 0;
 | 
|---|
| 63 |         if(*path &&
 | 
|---|
| 64 |            strcmp(path,".") &&
 | 
|---|
| 65 |            strcmp(path,".\\") &&
 | 
|---|
| 66 |            strcmp(path,"..") &&
 | 
|---|
| 67 |            strcmp(path,"..\\") &&
 | 
|---|
| 68 |            strncmp(path,".\\",2) &&
 | 
|---|
| 69 |            strncmp(path,"..\\",3)) {
 | 
|---|
| 70 |           if(!DosQueryPathInfo(path,
 | 
|---|
| 71 |                                FIL_QUERYFULLNAME,
 | 
|---|
| 72 |                                fullpath,
 | 
|---|
| 73 |                                sizeof(fullpath)) &&
 | 
|---|
| 74 |              IsValidDir(fullpath)) {
 | 
|---|
| 75 |             pciL = FindCnrRecord(hwndCnr,
 | 
|---|
| 76 |                                  fullpath,
 | 
|---|
| 77 |                                  pciParent,
 | 
|---|
| 78 |                                  FALSE,
 | 
|---|
| 79 |                                  FALSE,
 | 
|---|
| 80 |                                  FALSE);
 | 
|---|
| 81 |             if(pciL) {
 | 
|---|
| 82 |               while(pciL && pciL != (PCNRITEM)-1 && pciL != pciParent)
 | 
|---|
| 83 |                 pciL = WinSendMsg(hwndCnr,
 | 
|---|
| 84 |                                   CM_QUERYRECORD,
 | 
|---|
| 85 |                                   MPFROMP(pciL),
 | 
|---|
| 86 |                                   MPFROM2SHORT(CMA_PARENT,CMA_ITEMORDER));
 | 
|---|
| 87 |             }
 | 
|---|
| 88 |             if(!pciL) {
 | 
|---|
| 89 | 
 | 
|---|
| 90 |               RECORDINSERT ri;
 | 
|---|
| 91 | 
 | 
|---|
| 92 |               pciL = WinSendMsg(hwndCnr,
 | 
|---|
| 93 |                                 CM_ALLOCRECORD,
 | 
|---|
| 94 |                                 MPFROMLONG(EXTRA_RECORD_BYTES2),
 | 
|---|
| 95 |                                 MPFROMLONG(1));
 | 
|---|
| 96 |               if(pciL) {
 | 
|---|
| 97 |                 strcpy(pciL->szFileName,fullpath);
 | 
|---|
| 98 |                 pciL->pszFileName = pciL->szFileName;
 | 
|---|
| 99 |                 pciL->rc.pszIcon = pciL->pszFileName;
 | 
|---|
| 100 |                 if(!fNoIconsDirs &&
 | 
|---|
| 101 |                    (!isalpha(*fullpath) ||
 | 
|---|
| 102 |                    !(driveflags[toupper(*fullpath) - 'A'] & DRIVE_NOLOADICONS)))
 | 
|---|
| 103 |                   pciL->rc.hptrIcon = WinLoadFileIcon(fullpath,FALSE);
 | 
|---|
| 104 |                 if(!pciL->rc.hptrIcon)
 | 
|---|
| 105 |                   pciL->rc.hptrIcon = hptrDir;
 | 
|---|
| 106 |                 pciL->attrFile = FILE_DIRECTORY;
 | 
|---|
| 107 |                 strcpy(pciL->szDispAttr,"----D-");
 | 
|---|
| 108 |                 pciL->pszDispAttr = pciL->szDispAttr;
 | 
|---|
| 109 |                 memset(&ri,0,sizeof(ri));
 | 
|---|
| 110 |                 ri.cb                 = sizeof(ri);
 | 
|---|
| 111 |                 ri.pRecordOrder       = (PRECORDCORE)CMA_END;
 | 
|---|
| 112 |                 ri.pRecordParent      = (PRECORDCORE)pciParent;
 | 
|---|
| 113 |                 ri.zOrder             = (ULONG)CMA_TOP;
 | 
|---|
| 114 |                 ri.cRecordsInsert     = 1;
 | 
|---|
| 115 |                 ri.fInvalidateRecord  = FALSE;
 | 
|---|
| 116 |                 if(!WinSendMsg(hwndCnr,
 | 
|---|
| 117 |                                CM_INSERTRECORD,
 | 
|---|
| 118 |                                MPFROMP(pciL),
 | 
|---|
| 119 |                                MPFROMP(&ri)))
 | 
|---|
| 120 |                   WinSendMsg(hwndCnr,
 | 
|---|
| 121 |                              CM_FREERECORD,
 | 
|---|
| 122 |                              MPFROMP(&pciL),
 | 
|---|
| 123 |                              MPFROMSHORT(1));
 | 
|---|
| 124 |               }
 | 
|---|
| 125 |             }
 | 
|---|
| 126 |           }
 | 
|---|
| 127 |         }
 | 
|---|
| 128 |       }
 | 
|---|
| 129 |     }
 | 
|---|
| 130 |     if(var)
 | 
|---|
| 131 |       free(var);
 | 
|---|
| 132 |     pciL = (PCNRITEM)WinSendMsg(hwndCnr,
 | 
|---|
| 133 |                                 CM_QUERYRECORD,
 | 
|---|
| 134 |                                 MPFROMP(pciParent),
 | 
|---|
| 135 |                                 MPFROM2SHORT(CMA_FIRSTCHILD,
 | 
|---|
| 136 |                                              CMA_ITEMORDER));
 | 
|---|
| 137 |     while(pciL && (INT)pciL != -1) {
 | 
|---|
| 138 |       pciL->flags |= (RECFLAGS_NODRAG | RECFLAGS_UNDERENV);
 | 
|---|
| 139 |       WinSendMsg(hwndCnr,
 | 
|---|
| 140 |                  CM_INVALIDATERECORD,
 | 
|---|
| 141 |                  MPFROMP(&pciL),
 | 
|---|
| 142 |                  MPFROM2SHORT(1,0));
 | 
|---|
| 143 |       pciL = WinSendMsg(hwndCnr,
 | 
|---|
| 144 |                         CM_QUERYRECORD,
 | 
|---|
| 145 |                         MPFROMP(pciL),
 | 
|---|
| 146 |                         MPFROM2SHORT(CMA_NEXT,
 | 
|---|
| 147 |                                      CMA_ITEMORDER));
 | 
|---|
| 148 |     }
 | 
|---|
| 149 |   }
 | 
|---|
| 150 |   return TRUE;
 | 
|---|
| 151 | }
 | 
|---|
| 152 | 
 | 
|---|
| 153 | 
 | 
|---|
| 154 | BOOL Flesh (HWND hwndCnr,PCNRITEM pciParent) {
 | 
|---|
| 155 | 
 | 
|---|
| 156 |   PCNRITEM    pciL;
 | 
|---|
| 157 |   DIRCNRDATA *dcd;
 | 
|---|
| 158 |   ULONG       foundany;
 | 
|---|
| 159 |   BOOL        includefiles = fFilesInTree;
 | 
|---|
| 160 | 
 | 
|---|
| 161 |   if(!pciParent || (INT)pciParent == -1 || !hwndCnr)
 | 
|---|
| 162 |     return FALSE;
 | 
|---|
| 163 |   pciL = (PCNRITEM)WinSendMsg(hwndCnr,
 | 
|---|
| 164 |                               CM_QUERYRECORD,
 | 
|---|
| 165 |                               MPFROMP(pciParent),
 | 
|---|
| 166 |                               MPFROM2SHORT(CMA_FIRSTCHILD,
 | 
|---|
| 167 |                                            CMA_ITEMORDER));
 | 
|---|
| 168 |   if(!pciL || !*pciL->szFileName) {
 | 
|---|
| 169 |     if(pciL && (INT)pciL != -1)
 | 
|---|
| 170 |       WinSendMsg(hwndCnr,
 | 
|---|
| 171 |                  CM_REMOVERECORD,
 | 
|---|
| 172 |                  MPFROMP(&pciL),
 | 
|---|
| 173 |                  MPFROM2SHORT(1,CMA_FREE));
 | 
|---|
| 174 |     dcd = INSTDATA(hwndCnr);
 | 
|---|
| 175 |     if(dcd && dcd->size != sizeof(DIRCNRDATA))
 | 
|---|
| 176 |       dcd = NULL;
 | 
|---|
| 177 |     if(driveflags[toupper(*pciParent->szFileName) - 'A'] & DRIVE_INCLUDEFILES)
 | 
|---|
| 178 |       includefiles = TRUE;
 | 
|---|
| 179 |     ProcessDirectory(hwndCnr,
 | 
|---|
| 180 |                      pciParent,
 | 
|---|
| 181 |                      pciParent->szFileName,
 | 
|---|
| 182 |                      includefiles,
 | 
|---|
| 183 |                      TRUE,
 | 
|---|
| 184 |                      TRUE,
 | 
|---|
| 185 |                      NULL,
 | 
|---|
| 186 |                      dcd,
 | 
|---|
| 187 |                      &foundany);
 | 
|---|
| 188 |   }
 | 
|---|
| 189 |   return TRUE;
 | 
|---|
| 190 | }
 | 
|---|
| 191 | 
 | 
|---|
| 192 | 
 | 
|---|
| 193 | BOOL UnFlesh (HWND hwndCnr,PCNRITEM pciParent) {
 | 
|---|
| 194 | 
 | 
|---|
| 195 |   BOOL     ret = FALSE;
 | 
|---|
| 196 |   PCNRITEM pciL;
 | 
|---|
| 197 | 
 | 
|---|
| 198 |   if(!pciParent || !hwndCnr)
 | 
|---|
| 199 |     return FALSE;
 | 
|---|
| 200 |   for(;;) {
 | 
|---|
| 201 |     pciL = (PCNRITEM)WinSendMsg(hwndCnr,
 | 
|---|
| 202 |                                 CM_QUERYRECORD,
 | 
|---|
| 203 |                                 MPFROMP(pciParent),
 | 
|---|
| 204 |                                 MPFROM2SHORT(CMA_FIRSTCHILD,
 | 
|---|
| 205 |                                              CMA_ITEMORDER));
 | 
|---|
| 206 |     if(pciL && (INT)pciL != -1) {
 | 
|---|
| 207 |       ret = TRUE;
 | 
|---|
| 208 |       WinSendMsg(hwndCnr,
 | 
|---|
| 209 |                  CM_REMOVERECORD,
 | 
|---|
| 210 |                  MPFROMP(&pciL),
 | 
|---|
| 211 |                  MPFROM2SHORT(1,CMA_FREE));
 | 
|---|
| 212 |     }
 | 
|---|
| 213 |     else
 | 
|---|
| 214 |       break;
 | 
|---|
| 215 |   }
 | 
|---|
| 216 |   if(ret)
 | 
|---|
| 217 |     WinSendMsg(hwndCnr,
 | 
|---|
| 218 |                CM_INVALIDATERECORD,
 | 
|---|
| 219 |                MPFROMP(&pciParent),
 | 
|---|
| 220 |                MPFROM2SHORT(1,
 | 
|---|
| 221 |                             CMA_ERASE | CMA_REPOSITION));
 | 
|---|
| 222 |   return ret;
 | 
|---|
| 223 | }
 | 
|---|
| 224 | 
 | 
|---|
| 225 | #define DDEPTH 16
 | 
|---|
| 226 | 
 | 
|---|
| 227 | BOOL Stubby (HWND hwndCnr,PCNRITEM pciParent) {
 | 
|---|
| 228 | 
 | 
|---|
| 229 |   /*
 | 
|---|
| 230 |    * this code is full of workarounds for screwed up LANs.
 | 
|---|
| 231 |    * let's hope all the current LAN programmers fall into
 | 
|---|
| 232 |    * a black hole and make way for people who can get it right...
 | 
|---|
| 233 |    */
 | 
|---|
| 234 | 
 | 
|---|
| 235 |   BOOL          ret = FALSE;
 | 
|---|
| 236 |   FILEFINDBUF3  ffb[DDEPTH];
 | 
|---|
| 237 |   PFILEFINDBUF3 pffb;
 | 
|---|
| 238 |   HDIR          hDir = HDIR_CREATE;
 | 
|---|
| 239 |   ULONG         nm,ulM = 1L,total = 0L,fl = MUST_HAVE_DIRECTORY;
 | 
|---|
| 240 |   CHAR          str[CCHMAXPATH];
 | 
|---|
| 241 |   register INT  len;
 | 
|---|
| 242 |   APIRET        rc,prc;
 | 
|---|
| 243 |   BOOL          isadir = FALSE,isremote = FALSE,includefiles = fFilesInTree;
 | 
|---|
| 244 |   ULONG         ddepth = 3L;
 | 
|---|
| 245 |   static BOOL   brokenlan = FALSE,isbroken = FALSE;
 | 
|---|
| 246 | 
 | 
|---|
| 247 |   if(!pciParent || !*pciParent->szFileName || !hwndCnr)
 | 
|---|
| 248 |     return FALSE;
 | 
|---|
| 249 | 
 | 
|---|
| 250 |   len = strlen(pciParent->szFileName);
 | 
|---|
| 251 |   memcpy(str,pciParent->szFileName,len + 1);
 | 
|---|
| 252 |   if(str[len - 1] != '\\')
 | 
|---|
| 253 |     str[len++] = '\\';
 | 
|---|
| 254 |   str[len++] = '*';
 | 
|---|
| 255 |   str[len] = 0;
 | 
|---|
| 256 | 
 | 
|---|
| 257 |   if(!isalpha(*str) ||
 | 
|---|
| 258 |      str[1] != ':' ||
 | 
|---|
| 259 |      str[2] != '\\')
 | 
|---|
| 260 |     MakeFullName(str);
 | 
|---|
| 261 | 
 | 
|---|
| 262 |   if(!isalpha(*str) ||
 | 
|---|
| 263 |      str[1] != ':' ||
 | 
|---|
| 264 |      str[2] != '\\' ||
 | 
|---|
| 265 |      ((driveflags[toupper(*str) - 'A'] & DRIVE_IGNORE)))
 | 
|---|
| 266 |     return FALSE;
 | 
|---|
| 267 | 
 | 
|---|
| 268 |   if(isalpha(*str) &&
 | 
|---|
| 269 |      driveflags[toupper(*str) - 'A'] & DRIVE_INCLUDEFILES)
 | 
|---|
| 270 |     includefiles = TRUE;
 | 
|---|
| 271 | 
 | 
|---|
| 272 |   if(!isalpha(*str) ||
 | 
|---|
| 273 |      str[1] != ':' ||
 | 
|---|
| 274 |      str[2] != '\\' ||
 | 
|---|
| 275 |      ((driveflags[toupper(*str) - 'A'] & DRIVE_REMOTE)))
 | 
|---|
| 276 |     isremote = TRUE;
 | 
|---|
| 277 | 
 | 
|---|
| 278 |   if(isremote) {
 | 
|---|
| 279 |     ddepth = 14;
 | 
|---|
| 280 |     if(fRemoteBug) {
 | 
|---|
| 281 |       if(brokenlan) {
 | 
|---|
| 282 |         ddepth = (ULONG)-1;
 | 
|---|
| 283 |         ddepth--;
 | 
|---|
| 284 |       }
 | 
|---|
| 285 |       ulM = 1L;
 | 
|---|
| 286 |     }
 | 
|---|
| 287 |   }
 | 
|---|
| 288 |   else if(isbroken)
 | 
|---|
| 289 |     ddepth = 14;
 | 
|---|
| 290 | 
 | 
|---|
| 291 |   if(!isremote || !fRemoteBug)
 | 
|---|
| 292 |     ulM = (ddepth < 16L) ? ddepth : 1L;
 | 
|---|
| 293 | 
 | 
|---|
| 294 |   nm = ulM;
 | 
|---|
| 295 | 
 | 
|---|
| 296 | // WinSetWindowText(hwndStatus,str);
 | 
|---|
| 297 | 
 | 
|---|
| 298 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 299 |   if(includefiles)
 | 
|---|
| 300 |     fl = FILE_DIRECTORY;
 | 
|---|
| 301 |   rc = DosFindFirst(str,
 | 
|---|
| 302 |                     &hDir,
 | 
|---|
| 303 |                     FILE_NORMAL   | fl            |
 | 
|---|
| 304 |                     FILE_READONLY | FILE_ARCHIVED |
 | 
|---|
| 305 |                     FILE_SYSTEM   | FILE_HIDDEN,
 | 
|---|
| 306 |                     &ffb,
 | 
|---|
| 307 |                     ulM * sizeof(FILEFINDBUF3),
 | 
|---|
| 308 |                     &nm,
 | 
|---|
| 309 |                     FIL_STANDARD);
 | 
|---|
| 310 |   if(ulM == 1L && !rc) {
 | 
|---|
| 311 |     do {
 | 
|---|
| 312 |       pffb = &ffb[0];
 | 
|---|
| 313 |       if(!includefiles && !(pffb->attrFile & FILE_DIRECTORY) && !brokenlan) {
 | 
|---|
| 314 |         brokenlan = TRUE;
 | 
|---|
| 315 |         ddepth = (ULONG)-1L;
 | 
|---|
| 316 |         ddepth--;
 | 
|---|
| 317 |         if(!NoBrokenNotify) {
 | 
|---|
| 318 |           prc = saymsg(MB_YESNO | MB_ICONEXCLAMATION,
 | 
|---|
| 319 |                        HWND_DESKTOP,
 | 
|---|
| 320 |                        GetPString(IDS_LANERRORTITLETEXT),
 | 
|---|
| 321 |                        GetPString(IDS_LANERRORTEXT));
 | 
|---|
| 322 |           if(prc == MBID_NO) {
 | 
|---|
| 323 |             saymsg(MB_ENTER,
 | 
|---|
| 324 |                    HWND_DESKTOP,
 | 
|---|
| 325 |                    GetPString(IDS_LANERROR2TITLETEXT),
 | 
|---|
| 326 |                    GetPString(IDS_LANERROR2TEXT));
 | 
|---|
| 327 |             NoBrokenNotify = 255L;
 | 
|---|
| 328 |             PrfWriteProfileData(fmprof,
 | 
|---|
| 329 |                                 FM3Str,
 | 
|---|
| 330 |                                 "NoBrokenNotify",
 | 
|---|
| 331 |                                 &NoBrokenNotify,
 | 
|---|
| 332 |                                 sizeof(ULONG));
 | 
|---|
| 333 |           }
 | 
|---|
| 334 |         }
 | 
|---|
| 335 |         else {
 | 
|---|
| 336 |           NoBrokenNotify--;
 | 
|---|
| 337 |           PrfWriteProfileData(fmprof,
 | 
|---|
| 338 |                               FM3Str,
 | 
|---|
| 339 |                               "NoBrokenNotify",
 | 
|---|
| 340 |                               &NoBrokenNotify,
 | 
|---|
| 341 |                               sizeof(ULONG));
 | 
|---|
| 342 |         }
 | 
|---|
| 343 |       }
 | 
|---|
| 344 |       if(*pffb->achName &&
 | 
|---|
| 345 |          (includefiles || (pffb->attrFile & FILE_DIRECTORY)) &&
 | 
|---|
| 346 |          (*pffb->achName != '.' || (pffb->achName[1] &&
 | 
|---|
| 347 |           pffb->achName[1] != '.'))) {
 | 
|---|
| 348 |         DosFindClose(hDir);
 | 
|---|
| 349 |         isadir = TRUE;
 | 
|---|
| 350 |         goto Interruptus;
 | 
|---|
| 351 |       }
 | 
|---|
| 352 |       nm = 1L;
 | 
|---|
| 353 |       DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 354 |     } while(++total < ddepth && !(rc = (DosFindNext(hDir,
 | 
|---|
| 355 |                                                     &ffb,
 | 
|---|
| 356 |                                                     sizeof(FILEFINDBUF3),
 | 
|---|
| 357 |                                                     &nm))));
 | 
|---|
| 358 |     DosFindClose(hDir);
 | 
|---|
| 359 |     if(toupper(*pciParent->szFileName) > 'B' &&
 | 
|---|
| 360 |        pciParent->szFileName[1] == ':' &&
 | 
|---|
| 361 |        pciParent->szFileName[2] == '\\' &&
 | 
|---|
| 362 |        !pciParent->szFileName[3]) {
 | 
|---|
| 363 | 
 | 
|---|
| 364 |       CHAR s[132];
 | 
|---|
| 365 | 
 | 
|---|
| 366 |       sprintf(s,
 | 
|---|
| 367 |               GetPString(IDS_NOSUBDIRSTEXT),
 | 
|---|
| 368 |               total,
 | 
|---|
| 369 |               toupper(*pciParent->szFileName));
 | 
|---|
| 370 |       if(rc && rc != ERROR_NO_MORE_FILES)
 | 
|---|
| 371 |         sprintf(&s[strlen(s)],
 | 
|---|
| 372 |                 GetPString(IDS_SEARCHERRORTEXT),
 | 
|---|
| 373 |                 rc,
 | 
|---|
| 374 |                 str);
 | 
|---|
| 375 |       else if(ddepth < 16L)
 | 
|---|
| 376 |         brokenlan = TRUE;
 | 
|---|
| 377 |       Notify(s);
 | 
|---|
| 378 |     }
 | 
|---|
| 379 |     goto None;
 | 
|---|
| 380 |   }
 | 
|---|
| 381 | 
 | 
|---|
| 382 |   if(!rc) {
 | 
|---|
| 383 |     DosFindClose(hDir);
 | 
|---|
| 384 |     if(nm) {
 | 
|---|
| 385 | 
 | 
|---|
| 386 |       register PBYTE fb = (PBYTE)&ffb[0];
 | 
|---|
| 387 | 
 | 
|---|
| 388 |       for(len = 0;len < nm;len++) {
 | 
|---|
| 389 |         pffb = (PFILEFINDBUF3)fb;
 | 
|---|
| 390 |         if(!includefiles && !(pffb->attrFile & FILE_DIRECTORY)) {
 | 
|---|
| 391 |           if(!isbroken) {
 | 
|---|
| 392 |             isbroken = TRUE;
 | 
|---|
| 393 |             if(!NoBrokenNotify) {
 | 
|---|
| 394 |               prc = saymsg(MB_YESNO | MB_ICONEXCLAMATION,
 | 
|---|
| 395 |                            HWND_DESKTOP,
 | 
|---|
| 396 |                            GetPString(IDS_FSDERRORTITLETEXT),
 | 
|---|
| 397 |                            GetPString(IDS_FSDERRORTEXT),
 | 
|---|
| 398 |                            (isremote) ?
 | 
|---|
| 399 |                             GetPString(IDS_REMOTETEXT) :
 | 
|---|
| 400 |                             GetPString(IDS_LOCALTEXT),
 | 
|---|
| 401 |                            *str);
 | 
|---|
| 402 |               if(prc == MBID_NO) {
 | 
|---|
| 403 |                 saymsg(MB_ENTER,
 | 
|---|
| 404 |                        HWND_DESKTOP,
 | 
|---|
| 405 |                        GetPString(IDS_FSDERROR2TITLETEXT),
 | 
|---|
| 406 |                        GetPString(IDS_FSDERROR2TEXT));
 | 
|---|
| 407 |                 NoBrokenNotify = 255L;
 | 
|---|
| 408 |                 PrfWriteProfileData(fmprof,
 | 
|---|
| 409 |                                     FM3Str,
 | 
|---|
| 410 |                                     "NoBrokenNotify",
 | 
|---|
| 411 |                                     &NoBrokenNotify,
 | 
|---|
| 412 |                                     sizeof(ULONG));
 | 
|---|
| 413 |               }
 | 
|---|
| 414 |             }
 | 
|---|
| 415 |             else {
 | 
|---|
| 416 |               NoBrokenNotify--;
 | 
|---|
| 417 |               PrfWriteProfileData(fmprof,
 | 
|---|
| 418 |                                   FM3Str,
 | 
|---|
| 419 |                                   "NoBrokenNotify",
 | 
|---|
| 420 |                                   &NoBrokenNotify,
 | 
|---|
| 421 |                                   sizeof(ULONG));
 | 
|---|
| 422 |             }
 | 
|---|
| 423 |           }
 | 
|---|
| 424 |         }
 | 
|---|
| 425 |         if(*pffb->achName &&
 | 
|---|
| 426 |            (includefiles || (pffb->attrFile & FILE_DIRECTORY)) &&
 | 
|---|
| 427 |            (*pffb->achName != '.' || (pffb->achName[1] &&
 | 
|---|
| 428 |             pffb->achName[1] != '.'))) {
 | 
|---|
| 429 |           isadir = TRUE;
 | 
|---|
| 430 |           break;
 | 
|---|
| 431 |         }
 | 
|---|
| 432 |         fb += pffb->oNextEntryOffset;
 | 
|---|
| 433 |       }
 | 
|---|
| 434 | 
 | 
|---|
| 435 | Interruptus:
 | 
|---|
| 436 | 
 | 
|---|
| 437 |       if(isadir) {
 | 
|---|
| 438 | 
 | 
|---|
| 439 |         PCNRITEM pci;
 | 
|---|
| 440 | 
 | 
|---|
| 441 | // WinSetWindowText(hwndStatus2,"Found a dir");
 | 
|---|
| 442 | 
 | 
|---|
| 443 |         pci = WinSendMsg(hwndCnr,
 | 
|---|
| 444 |                          CM_ALLOCRECORD,
 | 
|---|
| 445 |                          MPFROMLONG(EXTRA_RECORD_BYTES2),
 | 
|---|
| 446 |                          MPFROMLONG(1L));
 | 
|---|
| 447 |         if(pci) {
 | 
|---|
| 448 | 
 | 
|---|
| 449 |           RECORDINSERT ri;
 | 
|---|
| 450 | 
 | 
|---|
| 451 |           *pci->szFileName = 0;
 | 
|---|
| 452 |           pci->pszFileName = pci->szFileName;
 | 
|---|
| 453 |           pci->rc.pszIcon = pci->pszFileName;
 | 
|---|
| 454 |           memset(&ri,0,sizeof(RECORDINSERT));
 | 
|---|
| 455 |           ri.cb                 = sizeof(RECORDINSERT);
 | 
|---|
| 456 |           ri.pRecordOrder       = (PRECORDCORE)CMA_END;
 | 
|---|
| 457 |           ri.pRecordParent      = (PRECORDCORE)pciParent;
 | 
|---|
| 458 |           ri.zOrder             = (ULONG)CMA_TOP;
 | 
|---|
| 459 |           ri.cRecordsInsert     = 1L;
 | 
|---|
| 460 |           ri.fInvalidateRecord  = TRUE;
 | 
|---|
| 461 |           if(!WinSendMsg(hwndCnr,
 | 
|---|
| 462 |                          CM_INSERTRECORD,
 | 
|---|
| 463 |                          MPFROMP(pci),
 | 
|---|
| 464 |                          MPFROMP(&ri))) {
 | 
|---|
| 465 |             DosSleep(100L);
 | 
|---|
| 466 |             WinSetFocus(HWND_DESKTOP,hwndCnr);
 | 
|---|
| 467 |             if(WinIsWindow((HAB)0,hwndCnr)) {
 | 
|---|
| 468 |               if(WinSendMsg(hwndCnr,
 | 
|---|
| 469 |                             CM_INSERTRECORD,
 | 
|---|
| 470 |                             MPFROMP(pci),
 | 
|---|
| 471 |                             MPFROMP(&ri)))
 | 
|---|
| 472 |                 ret = TRUE;
 | 
|---|
| 473 |               else {
 | 
|---|
| 474 |                 General_Error(WinQueryAnchorBlock(hwndCnr),
 | 
|---|
| 475 |                               HWND_DESKTOP,
 | 
|---|
| 476 |                               __FILE__,
 | 
|---|
| 477 |                               __LINE__,
 | 
|---|
| 478 |                               GetPString(IDS_RECORDINSERTFAILEDTEXT));
 | 
|---|
| 479 |                 WinSendMsg(hwndCnr,
 | 
|---|
| 480 |                            CM_FREERECORD,
 | 
|---|
| 481 |                            MPFROMP(&pci),
 | 
|---|
| 482 |                            MPFROMSHORT(1));
 | 
|---|
| 483 |               }
 | 
|---|
| 484 |             }
 | 
|---|
| 485 |           }
 | 
|---|
| 486 |           else
 | 
|---|
| 487 |             ret = TRUE;
 | 
|---|
| 488 | // WinSetWindowText(hwndStatus2,NullStr);
 | 
|---|
| 489 |         }
 | 
|---|
| 490 |         else
 | 
|---|
| 491 |           General_Error(WinQueryAnchorBlock(hwndCnr),
 | 
|---|
| 492 |                         HWND_DESKTOP,
 | 
|---|
| 493 |                         __FILE__,
 | 
|---|
| 494 |                         __LINE__,
 | 
|---|
| 495 |                         GetPString(IDS_RECORDALLOCFAILEDTEXT));
 | 
|---|
| 496 |       }
 | 
|---|
| 497 |       else if(toupper(*str) > 'B' && str[1] == ':' && str[2] == '\\' &&
 | 
|---|
| 498 |               !str[3]) {
 | 
|---|
| 499 | 
 | 
|---|
| 500 |         CHAR s[162];
 | 
|---|
| 501 | 
 | 
|---|
| 502 |         sprintf(s,
 | 
|---|
| 503 |                 GetPString(IDS_NOSUBDIRS2TEXT),
 | 
|---|
| 504 |                 nm,
 | 
|---|
| 505 |                 toupper(*pciParent->szFileName),
 | 
|---|
| 506 |                 (isremote) ? GetPString(IDS_NOSUBDIRS3TEXT) : NullStr);
 | 
|---|
| 507 |         Notify(s);
 | 
|---|
| 508 |       }
 | 
|---|
| 509 |     }
 | 
|---|
| 510 |   }
 | 
|---|
| 511 |   else if(toupper(*str) > 'B' &&
 | 
|---|
| 512 |           rc != ERROR_NO_MORE_FILES) {
 | 
|---|
| 513 | 
 | 
|---|
| 514 |     CHAR s[CCHMAXPATH + 80];
 | 
|---|
| 515 | 
 | 
|---|
| 516 |     sprintf(s,
 | 
|---|
| 517 |             GetPString(IDS_SEARCHERRORTEXT),
 | 
|---|
| 518 |             rc,
 | 
|---|
| 519 |             str);
 | 
|---|
| 520 |     Notify(s);
 | 
|---|
| 521 |   }
 | 
|---|
| 522 | 
 | 
|---|
| 523 | None:
 | 
|---|
| 524 | 
 | 
|---|
| 525 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 526 |   return ret;
 | 
|---|
| 527 | }
 | 
|---|
| 528 | 
 | 
|---|