Up: GEOS SDK TechDocs| Up | Prev: DBLock() ... | Next: DiskForEach() ...

DiskCheckInUse()

Boolean	DiskCheckInUse(
        DiskHandle		disk);

This routine checks if a registered disk is being used. If a file on that disk is open, or if a path on that disk is on some thread's directory stack, the routine will return true (i.e. non-zero); otherwise it will return false (i.e. zero). Note that a disk may be "in use" even if it is not currently in any drive.

Tips and Tricks: If you pass a standard path constant, this routine will return information about the disk containing the main geos.ini file (which is guaranteed to be in use).

Include: disk.h

DiskCheckUnnamed()

Boolean	DiskCheckUnnamed( /* returns true if disk is unnamed */
        DiskHandle		disk);

This routine checks if a registered disk has a permanent name. If the disk does not have a name, the routine returns true (i.e. non-zero); otherwise it returns false . Note that GEOS assigns a temporary name to unnamed disks when they are registered. To find out a disk's temporary or permanent name, call DiskGetVolumeName().

Tips and Tricks: If you pass a standard path constant, this routine will return information about the disk containing the main geos.ini file.

See Also: DiskGetVolumeName().

Include: disk.h

DiskCheckWritable()

Boolean	DiskCheckWritable(
        DiskHandle		disk);

DiskCheckWritable() checks if a disk is currently writable. It returns false (i.e. zero) if the disk is not writable, whether by nature (e.g. a CD-ROM disk) or because the write-protect tab is on; otherwise it returns true (i.e. non-zero).

Tips and Tricks: If you pass a standard path constant, this routine will return information about the disk containing the main geos.ini file.

Include: disk.h

DiskCopy()

DiskCopyError 	DiskCopy(
        word		source,
        word		dest,
        Boolean _pascal (*callback)
		(DiskCopyCallback					code,
		 DiskHandle					disk,
		 word					param));

This routine copies one disk onto another. The destination disk must be formattable to be the same type as the source disk. The first two arguments specify the source and destination drive. These drives may or may not be the same. If they are different, they must take compatible disks.

A disk copy requires frequent interaction with the user. For example, the copy routine must prompt the user to swap disks when necessary. For this reason, DiskCopy() is passed a pointer to a callback routine. This routine handles all interaction with the user. It must be declared _pascal. Each time it is called, it is passed three arguments. The first is a member of the DiskCopyCallback enumerated type; this argument specifies what the callback routine should do. The second argument is a disk handle; its significance depends on the value of the DiskCopyCallback argument. The third argument is a word-sized piece of data whose significance depends on the value of the DiskCopyCallback argument. Note that either of these arguments may be null values, depending on the value of the DiskCopyCallback argument.

The callback routine can abort the copy by returning true (i.e. non-zero); otherwise, it should return false (i.e. zero). The callback routine is called for several situations, identified by the value of DiskCopyCallback associated with them:

CALLBACK_GET_SOURCE_DISK
The callback routine should prompt the user to insert the source disk into the appropriate drive. The second argument is meaningless for this call. The third argument is the number identifying the drive; use DriveGetName() to find the name for this drive.
CALLBACK_GET_DEST_DISK
The callback routine should prompt the user to insert the destination disk into the appropriate drive. The second argument is meaningless for this call. The third argument is the number identifying the drive.
CALLBACK_REPORT_NUM_SWAPS
The second argument is meaningless for this call. The third argument is the number of disk swaps that will be necessary. The callback routine may wish to report this number to the user and ask for confirmation.
CALLBACK_VERIFY_DEST_DESTRUCTION
If the destination disk has already been formatted, the callback routine will be called with this parameter. The callback routine may wish to remind the user that the destination disk will be erased. The second argument is the handle of the destination disk; this is useful if, for example, you want to report the disk's name. The third argument is the destination drive's number. If the callback routine aborts the copy at this time by returning non-zero, the destination disk will not be harmed.
CALLBACK_REPORT_FORMAT_PCT
If the destination disk needs to be formatted, DiskCopy() will periodically call the callback routine with this parameter. The callback routine may wish to notify the user how the format is progressing. In this case, the second argument will be meaningless; the third parameter will be the percentage of the destination disk which has been formatted. The callback routine may wish to notify the user how the format is progressing.
CALLBACK_REPORT_COPY_PCT
While the copy is taking place, DiskCopy() will periodically call the callback routine with this parameter. The callback routine may wish to notify the user how the copy is progressing. In this case, the second parameter will be meaningless; the third parameter will be the percentage of the copy which has been completed.

If the copy was successful, DiskCopy() returns zero. Otherwise, it returns a member of the DiskCopyError enumerated type. That type has the following members:

ERR_DISKCOPY_INSUFFICIENT_MEM
This is returned if the routine was unable to get adequate memory.
ERR_CANT_COPY_FIXED_DISKS
ERR_CANT_READ_FROM_SOURCE
ERR_CANT_WRITE_TO_DEST
ERR_INCOMPATIBLE_FORMATS
The destination drive must be able to write disks in exactly the same format as the source disk. Note that the source and destination drives may be the same.
ERR_OPERATION_CANCELLED
This is returned if the callback routine ever returned a non-zero value, thus aborting the copy.
ERR_CANT_FORMAT_DEST

Include: disk.h

DiskFind()

DiskHandle 	DiskFind(
        const char *		fname,			/* Null-terminated volume name */
        DiskFindResult *		code);			/* DiskFindResult written here */

This routine returns the handle of the disk with the specified name. If there is no registered disk with the specified name, DiskFind() returns a null handle. Note that while disk handles are unique, volume names are not; therefore, there may be several registered disks with identical volume names. For this reason, DiskFind() writes a member of the DiskFindResults enumerated type (described below) into the space pointed to by the code pointer.

Structures: DiskFind() uses the DiskFindResult enumerated type, which has the following values:

DFR_UNIQUE
There is exactly one registered disk with the specified name; its handle was returned.
DFR_NOT_UNIQUE
There are two or more registered disks with the specified name; the handle of an arbitrary one of these disks was returned.
DFR_NOT_FOUND
There are no registered disks with the specified name; a null disk handle was returned.

Tips and Tricks: If you want to find all the disks with a given volume name, call DiskForEach() and have the callback routine check each disk's name with DiskGetVolumeName().

See Also: DiskRegisterDisk().

Include: disk.h


Up: GEOS SDK TechDocs| Up | Prev: DBLock() ... | Next: DiskForEach() ...