src/wfcomman.c
/* There are two sources of FileSysChange messages.  They can be sent from
 * the 386 WinOldAp or they can be posted by WINFILE's callback function (i.e.
 * from Kernel).  In both cases, we are free to do processing at this point.
 * For posted messages, we have to free the buffer passed to us as well.
 *
 * we are really in the other tasks context when we get entered here.
 * (this routine should be in a DLL)
 *
 * the file names are partially qualified, they have at least a drive
 * letter and initial directory part (c:\foo\..\bar.txt) so our
 * QualifyPath() calls should work.
 */
There are two sources of FileSysChange messages.  They can be sent from
the 386 WinOldAp or they can be posted by WINFILE's callback function .  In both cases, we are free to do processing at this point.
For posted messages, we have to free the buffer passed to us as well.

we are really in the other tasks context when we get entered here.
(this routine should be in a DLL)

the file names are partially qualified, they have at least a drive
letter and initial directory part (c:\foo\..\bar.txt) so our
QualifyPath() calls should work.
There are two sources of FileSysChange messages . They can be sent from the 386 WinOldAp or they can be posted by WINFILE ' s callback function . In both cases we are free to do processing at this point . For posted messages we have to free the buffer passed to us as well . we are really in the other tasks context when we get entered here . ( this routine should be in a DLL ) the file names are partially qualified they have at least a drive letter and initial directory part ( c : \ foo \ .. \ bar . txt ) so our QualifyPath () calls should work .
VOID
ChangeFileSystem(
   register DWORD dwFunction,
   LPTSTR lpszFile,
   LPTSTR lpszTo)
{
   HWND   hwnd, hwndTree, hwndOld;
   TCHAR  szFrom[MAXPATHLEN];
   TCHAR  szTo[MAXPATHLEN];
   TCHAR  szTemp[MAXPATHLEN];
   TCHAR  szPath[MAXPATHLEN + MAXPATHLEN];
   if (cDisableFSC == 0 || bFSCTimerSet)
   {
      if (bFSCTimerSet)
         KillTimer(hwndFrame, 1);                
      if (SetTimer(hwndFrame, 1, 1000, NULL))
      {
         bFSCTimerSet = TRUE;
         if (cDisableFSC == 0)                   
            SendMessage(hwndFrame, FS_DISABLEFSC, 0, 0L);
      }
   }
   lstrcpy(szFrom, lpszFile);
   QualifyPath(szFrom);            
   switch (dwFunction)
   {
      case ( FSC_RENAME ) :
      {
         lstrcpy(szTo, lpszTo);
         QualifyPath(szTo);    
         NotifySearchFSC(szFrom, dwFunction);
         if (hwndOld = LocateDirWindow(szFrom, FALSE, FALSE))
            SendMessage(hwndOld, WM_FSC, dwFunction, (LPARAM)szFrom);
         NotifySearchFSC(szTo, dwFunction);
         if ((hwnd = LocateDirWindow(szTo, FALSE, FALSE)) && (hwnd != hwndOld))
            SendMessage(hwnd, WM_FSC, dwFunction, (LPARAM)szTo);
         lstrcpy(szTemp, szTo);
         if (GetFileAttributes(szTemp) & ATTR_DIR)
         {
            for (hwnd = GetWindow(hwndMDIClient, GW_CHILD);
                 hwnd;
                 hwnd = GetWindow(hwnd, GW_HWNDNEXT))
            {
               if (hwndTree = HasTreeWindow(hwnd))
               {
                  SendMessage(hwndTree, WM_FSC, FSC_RMDIRQUIET, (LPARAM)szFrom);
                  SendMessage(hwnd, FS_GETDIRECTORY, COUNTOF(szPath), (LPARAM)szPath);
                  StripBackslash(szPath);
                  SendMessage(hwndTree, WM_FSC, FSC_MKDIRQUIET, (LPARAM)szTo);
                  if (!lstrcmpi(szPath, szFrom))
                  {
                     SendMessage(hwndTree, TC_SETDIRECTORY, FALSE, (LPARAM)szTo);
                     lstrcpy(szPath, szTo);
                     AddBackslash(szPath);
                     SendMessage(hwnd, FS_GETFILESPEC, MAXPATHLEN, (LPARAM)(szPath + lstrlen(szPath)));
                     SetMDIWindowText(hwnd, szPath);
                  }
               }
            }
#ifdef NETCHECK
            InvalidateAllNetTypes();
#endif
         }
         break;
      }
      case ( FSC_RMDIR ) :
      {
         if ( (hwnd = LocateDirWindow(szFrom, TRUE, FALSE)) &&
              !HasTreeWindow(hwnd) )
         {
            SendMessage(hwnd, WM_CLOSE, 0, 0L);
         }
      }
      case ( FSC_MKDIR ) :
      case ( FSC_MKDIRQUIET ) :
      {
         for (hwnd = GetWindow(hwndMDIClient, GW_CHILD);
              hwnd;
              hwnd = GetWindow(hwnd, GW_HWNDNEXT))
         {
            if (hwndTree = HasTreeWindow(hwnd))
            {
               SendMessage(hwndTree, WM_FSC, dwFunction, (LPARAM)szFrom);
            }
         }
      }
      case ( FSC_DELETE ) :
      case ( FSC_CREATE ) :
      case ( FSC_REFRESH ) :
      case ( FSC_ATTRIBUTES ) :
      {
         if (CHAR_COLON == szFrom[1])
            R_Space(DRIVEID(szFrom));
         SPC_SET_HITDISK(qFreeSpace);     
         UpdateAllDirWindows(szFrom, dwFunction, FALSE);
         NotifySearchFSC(szFrom, dwFunction);
         break;
      }
   }
}
VOID ChangeFileSystem ( register DWORD dwFunction , LPTSTR lpszFile , LPTSTR lpszTo ) { HWND hwnd , hwndTree , hwndOld ; TCHAR szFrom [ MAXPATHLEN ] ; TCHAR szTo [ MAXPATHLEN ] ; TCHAR szTemp [ MAXPATHLEN ] ; TCHAR szPath [ MAXPATHLEN + MAXPATHLEN ] ; if ( cDisableFSC == 0 || bFSCTimerSet ) { if ( bFSCTimerSet ) KillTimer ( hwndFrame , 1 ) ; if ( SetTimer ( hwndFrame , 1 , 1000 , NULL ) ) { bFSCTimerSet = TRUE ; if ( cDisableFSC == 0 ) SendMessage ( hwndFrame , FS_DISABLEFSC , 0 , 0L ) ; } } lstrcpy ( szFrom , lpszFile ) ; QualifyPath ( szFrom ) ; switch ( dwFunction ) { case ( FSC_RENAME ) : { lstrcpy ( szTo , lpszTo ) ; QualifyPath ( szTo ) ; NotifySearchFSC ( szFrom , dwFunction ) ; if ( hwndOld = LocateDirWindow ( szFrom , FALSE , FALSE ) ) SendMessage ( hwndOld , WM_FSC , dwFunction , ( LPARAM ) szFrom ) ; NotifySearchFSC ( szTo , dwFunction ) ; if ( ( hwnd = LocateDirWindow ( szTo , FALSE , FALSE ) ) && ( hwnd != hwndOld ) ) SendMessage ( hwnd , WM_FSC , dwFunction , ( LPARAM ) szTo ) ; lstrcpy ( szTemp , szTo ) ; if ( GetFileAttributes ( szTemp ) & ATTR_DIR ) { for ( hwnd = GetWindow ( hwndMDIClient , GW_CHILD ) ; hwnd ; hwnd = GetWindow ( hwnd , GW_HWNDNEXT ) ) { if ( hwndTree = HasTreeWindow ( hwnd ) ) { SendMessage ( hwndTree , WM_FSC , FSC_RMDIRQUIET , ( LPARAM ) szFrom ) ; SendMessage ( hwnd , FS_GETDIRECTORY , COUNTOF ( szPath ) , ( LPARAM ) szPath ) ; StripBackslash ( szPath ) ; SendMessage ( hwndTree , WM_FSC , FSC_MKDIRQUIET , ( LPARAM ) szTo ) ; if ( ! lstrcmpi ( szPath , szFrom ) ) { SendMessage ( hwndTree , TC_SETDIRECTORY , FALSE , ( LPARAM ) szTo ) ; lstrcpy ( szPath , szTo ) ; AddBackslash ( szPath ) ; SendMessage ( hwnd , FS_GETFILESPEC , MAXPATHLEN , ( LPARAM ) ( szPath + lstrlen ( szPath ) ) ) ; SetMDIWindowText ( hwnd , szPath ) ; } } } #ifdef NETCHECK InvalidateAllNetTypes ( ) ; #endif } break ; } case ( FSC_RMDIR ) : { if ( ( hwnd = LocateDirWindow ( szFrom , TRUE , FALSE ) ) && ! HasTreeWindow ( hwnd ) ) { SendMessage ( hwnd , WM_CLOSE , 0 , 0L ) ; } } case ( FSC_MKDIR ) : case ( FSC_MKDIRQUIET ) : { for ( hwnd = GetWindow ( hwndMDIClient , GW_CHILD ) ; hwnd ; hwnd = GetWindow ( hwnd , GW_HWNDNEXT ) ) { if ( hwndTree = HasTreeWindow ( hwnd ) ) { SendMessage ( hwndTree , WM_FSC , dwFunction , ( LPARAM ) szFrom ) ; } } } case ( FSC_DELETE ) : case ( FSC_CREATE ) : case ( FSC_REFRESH ) : case ( FSC_ATTRIBUTES ) : { if ( CHAR_COLON == szFrom [ 1 ] ) R_Space ( DRIVEID ( szFrom ) ) ; SPC_SET_HITDISK ( qFreeSpace ) ; UpdateAllDirWindows ( szFrom , dwFunction , FALSE ) ; NotifySearchFSC ( szFrom , dwFunction ) ; break ; } } }
There are two sources of FileSysChange messages.
There are two sources of FileSysChange messages .
// As FSC messages come in from outside winfile
 // we set a timer, and when that expires we
 // refresh everything.  If another FSC comes in while
 // we are waiting on this timer, we reset it so we
 // only refresh on the last operations.  This lets
 // the timer be much shorter.
 // reset the timer
 //
 // !! LATER !!
 // Move this info to the registry!
 //
 // only disable once
 // already partly qualified
 // already partly qualified
 // Update the original directory window (if any).
 // Update the new directory window (if any).
 // Are we renaming a directory?
 // if the current selection is szFrom, we update the
 // selection after the rename occurs
 // update the selection if necessary, also
 // change the window text in this case to
 // reflect the new name
 // update the window title
 // if (wTextAttribs & TA_LOWERCASE)
 //         CharLower(szPath);
 // Close any open directory window.
 /*** FALL THRU ***/ /* Update the tree. */ /*** FALL THRU ***/ // cause this stuff to be refreshed
