dos12.hlp (Table of Contents; Topic list)
DosFSAttach (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DOSFILEMGR
 
USHORT DosFSAttach(pszDevName, pszFSD, pData, cbData, fsOp,
    ulReserved);
PSZ pszDevName;      /* pointer to the device name                      */
PSZ pszFSD;          /* pointer to the file system                      */
PBYTE pData;         /* pointer to the buffer for file-system arguments */
USHORT cbData;       /* length of the argument buffer                   */
USHORT fsOp;         /* attach or the detach connection                 */
ULONG ulReserved;    /* must be zero                                    */
 
The DosFSAttach function attaches or detaches a drive or pseudo-character
device from a remote file system.
 
Parameter   Description
────────────────────────────────────────────────────────────────────────────
 
pszDevName  Points to a null-terminated string that specifies the drive
            letter followed by a colon or a pseudo-character device name. If
            this parameter is a pseudo-character device name, the format of
            the string is \device\filename, where filename is a valid MS
            OS/2 filename.
 
pszFSD      Points to a null-terminated string that specifies the name of
            the remote file system to attach to or detach from the device
            specified by the pszDevName parameter.
 
pData       Points to a buffer that contains the file-system arguments. The
            meaning of the arguments is specific to the file system. The
            first word of the buffer specifies the number of strings it
            contains; the rest of the buffer contains contiguous strings.
 
cbData      Specifies the length (in bytes) of the data pointed to by the
            pData parameter.
 
fsOp        Specifies the type of operation to perform. A value of FS_ATTACH
            attaches a file-system connection. A value of FS_DETACH detaches
            a file-system connection.
 
ulReserved  Specifies a reserved value; must be zero.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be one of the following:
 
     ERROR_ALREADY_ASSIGNED
     ERROR_INVALID_DRIVE
     ERROR_INVALID_FSD_NAME
     ERROR_INVALID_LEVEL
     ERROR_INVALID_PATH
     ERROR_NOT_ENOUGH_MEMORY
 
Comments
 
Drive letters that represent local drives cannot be redirected.
 
When a drive is attached to a file system, all requests to that drive are
routed to the file system. When a drive is detached from a file system, the
drive name can no longer be used.
 
When a pseudo-character device name is attached to a file system, all
requests to that name are routed to the file system. When a pseudo-character
device is detached from a file system, the device name can no longer be used
unless it overlaid the name of an existing device; in this case, the
previous device regains control.
 
Example
 
This example calls DosFSAttach to attach a LAN server to drive X, then calls
DosFSAttach again to detach the LAN server:
 
CHAR szShareName[] = { 1, 0,        /* number of strings              */
    "\\SERVER\SHARE" };             /* name of server and share point */
 
DosFSAttach("X:", "LAN", szShareName, sizeof(szShareName),
        FS_ATTACH, 0L);
    .
    .
    .
DosFSAttach("X:", "LAN", szShareName, sizeof(szShareName),
        FS_DETACH, 0L);
 
See Also
 
DosFSCtl, DosQFSAttach