home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HomeWare 14
/
HOMEWARE14.bin
/
os2
/
cenv2_19.arj
/
DEVIOCTL.LIB
< prev
next >
Wrap
Text File
|
1994-03-08
|
4KB
|
75 lines
// DevIOCtl.lib - Interface to the DosDevIOCtl call
// ver.1
DosDevIOCtl(DevHandle,Category,Function,
ParameterBLOb,MaxRetParameterSize,ParameterSize,
DataBLOb,MaxRetDataSize,DataSize)
// DevHandle: Device handle, such as returned by DosOpen()
// Category: Device Categoring for this IOCtl call
// Function: Function code within that Category
// ParameterBLOb: Command-specific argument for this Category and Function,
// or NULL if this function takes no arguments
// MaxRetParameterSize: For function calls that return arguments in ParameterBLOb,
// this is the maximum size those arguments can be. If this is
// not 0 then ParameterBLOb will be made big enough. If zero then
// this assumes that function returns no parameters in ParameterBLOb.
// ParameterSize: On input, this is the size of Parameters in ParameterBLOb, on
// output this is the size of bytes that Function returned in ParameterBlob.
// If MaxRetParameterSize is 0 then this value is not altered.
// If this function returns ERROR_BUFFER_OVERFLOW then this contains
// the size of the buffer required to hold parameters
// DataBLOb: Command-specific data for this Category and Function,
// or NULL if this function uses no data area
// MaxRetDataSize: For function calls that return data in this data area,
// this is the maximum size that data can be. If this is
// not 0 then DataBLOb will be made big enough. If zero then
// this assumes that function returns no data in DataBLOb.
// DataSize: On input, this is the size of data area DataBLOb, on
// output this is the size of bytes that Function returned in DataBlob.
// If MaxRetDataSize is 0 then this value is not altered.
// If this function returns ERROR_BUFFER_OVERFLOW then this contains
// the size of the buffer required to the data.
// Return: Returns 0 if no error; else error code, one of which may include:
#define ERROR_INVALID_FUNCTION 1
#define ERROR_INVALID_HANDLE 6
#define ERROR_INVALID_DRIVE 15
#define ERROR_GEN_FAILURE 31
#define ERROR_INVALID_PARAMETER 87
#define ERROR_BUFFER_OVERFLOW 111
#define ERROR_PROTECTION_VIOLATION 115
#define ERROR_INVALID_CATEGORY 117
#define ERROR_BAD_DRIVER_LEVEL 119
#define ERROR_UNCERTAIN_MEDIA 163
#define ERROR_MONITORS_NOT_SUPPORTED 165
{
// Make blobs to hold pointers to parameter size
BLObPut(_ParameterSize,defined(ParameterSize) ? ParameterSize : 0,UWORD32);
BLObPut(_DataSize,defined(DataSize) ? DataSize : 0,UWORD32);
// Make sure Parameter and Data blobs are bi enough for return data
if ( MaxRetParameterSize
&& ( !defined(ParameterBLOb) || NULL == ParameterBLOb || (BLObSize(ParameterBLOb) < MaxRetParameterSize) ) )
BLObSize(ParameterBLOb,MaxRetParameterSize);
if ( MaxRetDataSize
&& ( !defined(DataBLOb) || NULL == DataBLOb || (BLObSize(DataBLOb) < MaxRetDataSize) ) )
BLObSize(DataBLOb,MaxRetDataSize);
// Make call to DosDevIOCtl
#define ORD_DOS32DEVIOCTL 284
rc = DynamicLink("doscalls",ORD_DOS32DEVIOCTL,BIT32,CDECL,
DevHandle,Category,Function,
defined(ParameterBLOb) ? ParameterBLOb : NULL,
MaxRetParameterSize,_ParameterSize,
defined(DataBLOb) ? DataBLOb : NULL,
MaxRetDataSize,_DataSize);
// Return new parameter and data size if they were defined
if ( MaxRetParameterSize )
ParameterSize = BLObGet(_ParameterSize,0,UWORD32);
if ( MaxRetDataSize )
DataSize = BLObGet(_DataSize,0,UWORD32);
return(rc);
}