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