TIP: Click on subject to list as thread! ANSI
echo: foxpro
to: ALL
from: CY WELCH
date: 1997-05-05 17:42:00
subject: Problem with CD-Rom and FPW 2.6

Hello All!
Do you remember the discussion that went on in here a while ago (probably 
about a year ago) about the dreaded "Read Error on Drive D:" (assuming D: is 
your cdrom and you don't have anything in it).  At the time, we found that MS 
answer to the problem is either move the cdrom drive to a higher letter, or 
to do your development on a machine with ONLY C:.  Well, I got tired of this 
runaround (it does require that if your working on a large project) and 
decided to see what I could do about it.  The following is the answer I have 
found to it.
What I found is that each .app or .exe contains in it the paths and filenames 
of each and every object in the program.  If any of these point to a drive 
that on the computer the code is being run on does not have, FP starts 
searching for the directory structure on each drive starting with drive C: 
until it hits a spot where there is no drive letter, thus causing the error.  
The fix, assuming you didn't encrypt your application (which with modern 
tools available is a waste of time anyways), I can find a tool to crack any 
FP app no matter what you use to protect it, is pretty simple, you just need 
to search for the drive letters, and change them ALL to c: and the problem 
goes away.  Below is a little program I wrote to do this.  I offer it to 
those in this echo who may have a need for this kind of functionality.
=== Cut Begin: fixapp.prg ===
* Program....: FIXAPP.PRG
* Version....: 1.0
* Author.....: Cy Welch
* Date.......: April 29, 1997
* Notice.....: Copyright (c) 1997 MetSYS Inc, All Rights Reserved.
* Compiler...: FoxPro 5.0
* Abstract...:
* Changes....:
cOldDir = SYS(5)+CURDIR()
cDirectory = getdir("r:\demo\metdemo","Find the Dist Files")
IF !EMPTY(cDirectory)
   SET DEFA TO (cDirectory)
ELSE
   WAIT WINDOW "You MUST select a directory to continue" TIMEOUT 25
   RETURN
ENDIF
nCount = ADIR(aApps,"*.APP")
IF nCount > 0
   FOR nCurApp = 1 to NCount
      WAIT WINDOW "Processing: "+aApps(nCurApp,1) NOWAIT
      DO fixpaths WITH aApps(nCurApp,1)
   ENDFOR &&* nCurApp = 1 to NCount
   DO fixpaths WITH "security.exe"
   DO fixpaths WITH "metsys.exe"
   DO fixpaths WITH "reindex.exe"
   SET DEFAULT TO (cOldDir)
ELSE
   WAIT WINDOW "There aren't any App's in this Directory" TIMEOUT 25
   SET DEFAULT TO (cOldDir)
   RETURN
ENDIF
WAIT CLEAR
CLOSE ALL
************************************************************
* Function....: fixpaths
* Called by...:
*
* Abstract....: Fixes Paths in Apps to point to C:
*
* Returns.....:
*
* Parameters..:
*
* Notes.......:
************************************************************
FUNCTION fixpaths
PARAMETERS cAppName
PRIVATE cChar1, cChar2, cChar3, nReadPos
STORE " " TO cChar1, cChar2, cChar3
STORE 0 TO nReadPos
nFile = FOPEN(cAppName,2)
IF nFile > 0
   DO WHILE !FEOF(nFile)
      nReadPos = nReadPos + 1
      cChar = FREAD(nFile,1)
      cChar1 = cChar2
      cChar2 = cChar3
      cChar3 = cChar
      IF cChar2 = ":" .AND. cChar3 = "\"
         = FSEEK(nFile,nReadPos -3)
         = FWRITE(nFile,"c")
         = FSEEK(nFile,nReadPos)
         STORE " " TO cChar1, cChar2, cChar3
      ENDIF && cChar2 = ":" .AND. cChar3 = "\"
   ENDDO && !FEOF(nFile)
   =FCLOSE(nFile)
ELSE
   WAIT WINDOW "Warning: File Not Found:"+cAppName
   RETURN
ENDIF && nFile > 0
RETURN
*EOF fixpaths
=== Cut End ===
Cy
Internet: Cy.Welch@pmra.gigo.com
          cwelch@calweb.com
Web Page: http:/www.calweb.com/~cwelch/
FTP  DIR: ftp:/ftp.calweb.com /users/c/cwelch/
... Press ESC to enter or ENTER to escape...
--- GoldED/386 2.50+
---------------
* Origin: PMRA Tech Support 916-448-5376 (FIDONET 1:203/123)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.