DosFSCtl (OS/2 1.x)

From EDM2
Jump to: navigation, search

DosFSCtl provides an extended standard interface between an application and an FSD.

Syntax

DosFSCtl (DataArea, DataLengthMax, DataLength,
          ParmList, ParmLengthMax, ParmLength, FunctionCode,
          RouteName, FileHandle, RouteMethod, Reserved)

Parameters

DataArea (PBYTE) - input 
Address of the data area.
DataLengthMax (USHORT) - input 
The maximum length in bytes to be returned by the FSD in DataArea. DataLength may be longer than this on input, but not on output.
DataLength (PUSHORT) - input/output 
Address of the length in bytes of data in DataArea. On input, it is the length of data being sent, and on output is the length of the data that was returned by the FSD. If ERROR_BUFFER_OVERFLOW is returned from the call, then it is the size of the buffer required to hold the data returned by the FSD.
ParmList (PBYTE) - input 
Address of the command specific parameter list.
ParmLengthMax (USHORT) - input 
The maximum length in bytes of the data to be returned by the FSD in ParmList. ParmLength may be longer than this on input, but not on output.
ParmLength (PUSHORT) - input/output 
Address of, on input, the length in bytes of parameters passed in by the application, and on return it is the length of parameters returned by the FSD. If ERROR_BUFFER_OVERFLOW is returned from the call, then it is the size of the buffer required to hold the parameters returned by the FSD. No other data is returned in this case.
FunctionCode (USHORT) - input 
The file system-specific function code. For remote FSDs, there are two kinds of possible FsCtl calls: FsCtl calls that are handled locally, and FsCtl calls that are exported across the network. If bit 0x4000 is set in the function code, then this indicates to the remote FSD that the function should be exported. The range of function codes are split up as follows: Function codes between 0x0000 and 0x7FFF are reserved for use by OS/2. Function codes between 0x8000 and 0xBFFF are FSD defined FsCtl functions handled by the local FSD. Function codes between 0xC000 and 0xFFFF are FSD defined FsCtl functions exported to the server.
FunctionCode = 1: returns FSD error code information. Error code is passed to the FSD in the first word of ParmList. On return, the first word of the Data area contains the length of the following ASCIIZ string. The ASCIIZ string begins at the second word and is an explanation of the error code.
RouteName (PSZ) - input 
Address of the ASCIIZ name of the FSD, or the pathname of a file or directory the operation should apply to.
FileHandle (HFILE) - input 
The file or device specific handle.
RouteMethod (USHORT) - input 
Selects how the request is routed.
1 - FileHandle directs routing. RouteName must be a NUL pointer (0L). The FSD associated with the handle receives the request.
2 - RouteMethod refers to a pathname, that directs routing. FileHandle must be -1. The FSD associated with the drive that the pathname refers to at the time of the request receives the request. The pathname need not refer to a file or directory that actually exists, only to a drive. A relative pathname may be used, it is processed like any other pathname.
3 - RouteMethod refers to an FSD name, that directs routing. FileHandle must be -1. The named FSD receives the request.
Reserved (ULONG) - input 
Reserved, must be set to zero.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 1 ERROR_INVALID_FUNCTION
  • 6 ERROR_INVALID_HANDLE
  • 87 ERROR_INVALID_PARAMETER
  • 95 ERROR_INTERRUPT
  • 111 ERROR_BUFFER_OVERFLOW
  • 117 ERROR_INVALID_CATEGORY
  • 124 ERROR_INVALID_LEVEL
  • 252 ERROR_INVALID_FSD_NAME

Bindings

C

#define INCL_DOSFILEMGR

USHORT  rc = DosFSCtl(DataArea, DataLengthMax, DataLength, ParmList,
               ParmLengthMax, ParmLength, FunctionCode, RouteName,
               FileHandle, RouteMethod, 0);

PBYTE   DataArea;      /* Data area */
USHORT  DataLengthMax; /* Data area length */
PUSHORT DataLength;    /* Data area length (returned) */
PBYTE   ParmList;      /* Parameter list */
USHORT  ParmLengthMax; /* Parameter list length */
PUSHORT ParmLength;    /* Parameter list length (returned) */
USHORT  FunctionCode;  /* Function code */
PSZ     RouteName;     /* Path or FSD name */
HFILE   FileHandle;    /* File handle */
USHORT  RouteMethod;   /* Method for routing. */
ULONG   0;             /* Reserved (must be zero) */

USHORT  rc;            /* return code */

MASM

EXTRN DosFSCtl:FAR
INCL_DOSFILEMGR     EQU 1

PUSH@  OTHER  DataArea       ;Data area
PUSH   WORD   DataLengthMax  ;Data area length
PUSH@  WORD   DataLength     ;Data area length (returned)
PUSH@  OTHER  ParmList       ;Parameter list
PUSH   WORD   ParmLengthMax  ;Parameter list length
PUSH@  WORD   ParmLength     ;Parameter list length (returned)
PUSH   WORD   FunctionCode   ;Function code
PUSH@  ASCIIZ RouteName      ;Path or FSD name string
PUSH   WORD   FileHandle     ;File handle
PUSH   WORD   RouteMethod    ;Method for routing.
PUSH   DWORD  0              ;Reserved (must be zero)
CALL   DosFSCtl

Returns WORD