📄 tapi.c
字号:
NumBytesWritten = NumBytesNeeded = InformationBufferLength;
Status = HtTapiOpen(Adapter,
(PNDIS_TAPI_OPEN) InformationBuffer);
break;
case OID_TAPI_PROVIDER_INITIALIZE:
if(InformationBufferLength < sizeof(OID_TAPI_PROVIDER_INITIALIZE))
{
NumBytesNeeded = sizeof(OID_TAPI_PROVIDER_INITIALIZE);
break;
}
NumBytesWritten = NumBytesNeeded = InformationBufferLength;
Status = HtTapiProviderInitialize(Adapter,
(PNDIS_TAPI_PROVIDER_INITIALIZE) InformationBuffer);
break;
default:
/*
// Unknown OID
*/
Status = NDIS_STATUS_INVALID_OID;
break;
}
/*
// Fill in the size fields before we leave as indicated by the
// status we are returning.
*/
if (Status == NDIS_STATUS_INVALID_LENGTH)
{
*BytesNeeded = NumBytesNeeded;
*BytesWritten = 0;
}
else
{
*BytesNeeded = *BytesWritten = NumBytesWritten;
}
DBG_FILTER(Adapter,DBG_REQUEST_ON,
("RETURN: Status=%Xh Needed=%d Written=%d\n",
Status, *BytesNeeded, *BytesWritten));
DBG_LEAVE(Adapter);
return (Status);
}
NDIS_STATUS
HtTapiSetInformation(
IN PHTDSU_ADAPTER Adapter,
IN NDIS_OID Oid,
IN PVOID InformationBuffer,
IN ULONG InformationBufferLength,
OUT PULONG BytesRead,
OUT PULONG BytesNeeded
)
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Functional Description:
The HtTapiQueryInformation request allows for control of the TAPI
portion of the driver's settings and current line status.
If the Miniport does not complete the call immediately (by returning
NDIS_STATUS_PENDING), it must call NdisMSetInformationComplete to
complete the call. The Miniport controls the buffers pointed to by
InformationBuffer, BytesRead, and BytesNeeded until the request completes.
Interrupts are in any state during the call, and no other requests will
be submitted to the Miniport until this request is completed.
Parameters:
MiniportAdapterContext _ The adapter handle passed to NdisMSetAttributes
during MiniportInitialize.
Oid _ The OID. (See section 2.2.2 of the Extensions to NDIS 3.0 Miniports
to support Telephonic Services specification for a complete
description of the OIDs.)
InformationBuffer _ The buffer that will receive the information.
InformationBufferLength _ The length in bytes of InformationBuffer.
BytesRead_ Returns the number of bytes read from InformationBuffer.
BytesNeeded _ This parameter returns the number of additional bytes
expected to satisfy the OID.
Return Values:
NDIS_STATUS_INVALID_DATA
NDIS_STATUS_INVALID_LENGTH
NDIS_STATUS_INVALID_OID
NDIS_STATUS_NOT_ACCEPTED
NDIS_STATUS_NOT_SUPPORTED
NDIS_STATUS_PENDING
NDIS_STATUS_RESOURCES
NDIS_STATUS_SUCCESS
---------------------------------------------------------------------------*/
{
DBG_FUNC("HtTapiSetInformation")
/*
// Assume the worst, and initialize to handle failure.
*/
NDIS_STATUS Status = NDIS_STATUS_INVALID_LENGTH;
ULONG NumBytesNeeded = 0;
ULONG NumBytesRead = 0;
DBG_ENTER(Adapter);
DBG_FILTER(Adapter,DBG_REQUEST_ON,
("(OID=%s=%08x)\n\t\tInfoLength=%d InfoBuffer=%Xh\n",
HtTapiGetOidString(Oid),Oid,
InformationBufferLength,
InformationBuffer
));
/*
// Determine which OID is being requested and do the right thing.
// The switch code will just call the approriate service function
// to do the real work, so there's not much to worry about here either.
*/
switch (Oid)
{
case OID_TAPI_ACCEPT: // OPTIONAL
if (InformationBufferLength < sizeof(NDIS_TAPI_ACCEPT))
{
NumBytesNeeded = sizeof(NDIS_TAPI_ACCEPT);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiAccept(Adapter,
(PNDIS_TAPI_ACCEPT) InformationBuffer);
break;
case OID_TAPI_ANSWER:
if (InformationBufferLength < sizeof(NDIS_TAPI_ANSWER))
{
NumBytesNeeded = sizeof(NDIS_TAPI_ANSWER);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiAnswer(Adapter,
(PNDIS_TAPI_ANSWER) InformationBuffer);
break;
case OID_TAPI_CLOSE:
if (InformationBufferLength < sizeof(NDIS_TAPI_CLOSE))
{
NumBytesNeeded = sizeof(NDIS_TAPI_CLOSE);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiClose(Adapter,
(PNDIS_TAPI_CLOSE) InformationBuffer);
break;
case OID_TAPI_CLOSE_CALL:
if (InformationBufferLength < sizeof(NDIS_TAPI_CLOSE_CALL))
{
NumBytesNeeded = sizeof(NDIS_TAPI_CLOSE_CALL);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiCloseCall(Adapter,
(PNDIS_TAPI_CLOSE_CALL) InformationBuffer);
break;
case OID_TAPI_CONDITIONAL_MEDIA_DETECTION:
if (InformationBufferLength < sizeof(NDIS_TAPI_CONDITIONAL_MEDIA_DETECTION))
{
NumBytesNeeded = sizeof(NDIS_TAPI_CONDITIONAL_MEDIA_DETECTION);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiConditionalMediaDetection(Adapter,
(PNDIS_TAPI_CONDITIONAL_MEDIA_DETECTION) InformationBuffer);
break;
case OID_TAPI_DIAL: // OPTIONAL
if (InformationBufferLength < sizeof(NDIS_TAPI_DIAL))
{
NumBytesNeeded = sizeof(NDIS_TAPI_DIAL);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiDial(Adapter,
(PNDIS_TAPI_DIAL) InformationBuffer);
break;
case OID_TAPI_DROP:
if (InformationBufferLength < sizeof(NDIS_TAPI_DROP))
{
NumBytesNeeded = sizeof(NDIS_TAPI_DROP);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiDrop(Adapter,
(PNDIS_TAPI_DROP) InformationBuffer);
break;
case OID_TAPI_PROVIDER_SHUTDOWN:
if (InformationBufferLength < sizeof(NDIS_TAPI_PROVIDER_SHUTDOWN))
{
NumBytesNeeded = sizeof(NDIS_TAPI_PROVIDER_SHUTDOWN);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiProviderShutdown(Adapter,
(PNDIS_TAPI_PROVIDER_SHUTDOWN) InformationBuffer);
break;
case OID_TAPI_SECURE_CALL: // OPTIONAL
if (InformationBufferLength < sizeof(NDIS_TAPI_SECURE_CALL))
{
NumBytesNeeded = sizeof(NDIS_TAPI_SECURE_CALL);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiSecureCall(Adapter,
(PNDIS_TAPI_SECURE_CALL) InformationBuffer);
break;
case OID_TAPI_SELECT_EXT_VERSION: // OPTIONAL
if (InformationBufferLength < sizeof(NDIS_TAPI_SELECT_EXT_VERSION))
{
NumBytesNeeded = sizeof(NDIS_TAPI_SELECT_EXT_VERSION);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiSelectExtVersion(Adapter,
(PNDIS_TAPI_SELECT_EXT_VERSION) InformationBuffer);
break;
case OID_TAPI_SEND_USER_USER_INFO: // OPTIONAL
if (InformationBufferLength < sizeof(NDIS_TAPI_SEND_USER_USER_INFO))
{
NumBytesNeeded = sizeof(NDIS_TAPI_SEND_USER_USER_INFO);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiSendUserUserInfo(Adapter,
(PNDIS_TAPI_SEND_USER_USER_INFO) InformationBuffer);
break;
case OID_TAPI_SET_APP_SPECIFIC:
if (InformationBufferLength < sizeof(NDIS_TAPI_SET_APP_SPECIFIC))
{
NumBytesNeeded = sizeof(NDIS_TAPI_SET_APP_SPECIFIC);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiSetAppSpecific(Adapter,
(PNDIS_TAPI_SET_APP_SPECIFIC) InformationBuffer);
break;
case OID_TAPI_SET_CALL_PARAMS:
if (InformationBufferLength < sizeof(NDIS_TAPI_SET_CALL_PARAMS))
{
NumBytesNeeded = sizeof(NDIS_TAPI_SET_CALL_PARAMS);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiSetCallParams(Adapter,
(PNDIS_TAPI_SET_CALL_PARAMS) InformationBuffer);
break;
case OID_TAPI_SET_DEFAULT_MEDIA_DETECTION:
if (InformationBufferLength < sizeof(NDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION))
{
NumBytesNeeded = sizeof(NDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiSetDefaultMediaDetection(Adapter,
(PNDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION) InformationBuffer);
break;
case OID_TAPI_SET_DEV_CONFIG:
if (InformationBufferLength < sizeof(NDIS_TAPI_SET_DEV_CONFIG))
{
NumBytesNeeded = sizeof(NDIS_TAPI_SET_DEV_CONFIG);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiSetDevConfig(Adapter,
(PNDIS_TAPI_SET_DEV_CONFIG) InformationBuffer);
break;
case OID_TAPI_SET_MEDIA_MODE:
if (InformationBufferLength < sizeof(NDIS_TAPI_SET_MEDIA_MODE))
{
NumBytesNeeded = sizeof(NDIS_TAPI_SET_MEDIA_MODE);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiSetMediaMode(Adapter,
(PNDIS_TAPI_SET_MEDIA_MODE) InformationBuffer);
break;
case OID_TAPI_SET_STATUS_MESSAGES:
if (InformationBufferLength < sizeof(NDIS_TAPI_SET_STATUS_MESSAGES))
{
NumBytesNeeded = sizeof(NDIS_TAPI_SET_STATUS_MESSAGES);
break;
}
NumBytesRead = NumBytesNeeded = InformationBufferLength;
Status = HtTapiSetStatusMessages(Adapter,
(PNDIS_TAPI_SET_STATUS_MESSAGES) InformationBuffer);
break;
default:
Status = NDIS_STATUS_INVALID_OID;
break;
}
/*
// Fill in the size fields before we leave as indicated by the
// status we are returning.
*/
if (Status == NDIS_STATUS_INVALID_LENGTH)
{
*BytesNeeded = NumBytesNeeded;
*BytesRead = 0;
}
else
{
*BytesNeeded = *BytesRead = NumBytesRead;
}
DBG_FILTER(Adapter,DBG_REQUEST_ON,
("RETURN: Status=%Xh Needed=%d Read=%d\n",
Status, *BytesNeeded, *BytesRead));
DBG_LEAVE(Adapter);
return (Status);
}
NDIS_STATUS
HtTapiGetID(
IN PHTDSU_ADAPTER Adapter,
IN PNDIS_TAPI_GET_ID Request
)
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Functional Description:
This request returns a device ID for the specified device class
associated with the selected line, address or call.
Parameters:
Adapter _ A pointer ot our adapter information structure.
Request _ A pointer to the NDIS_TAPI request structure for this call.
typedef struct _NDIS_TAPI_GET_ID
{
IN ULONG ulRequestID;
IN HDRV_LINE hdLine;
IN ULONG ulAddressID;
IN HDRV_CALL hdCall;
IN ULONG ulSelect;
IN ULONG ulDeviceClassSize;
IN ULONG ulDeviceClassOffset;
OUT VAR_STRING DeviceID;
} NDIS_TAPI_GET_ID, *PNDIS_TAPI_GET_ID;
typedef struct _VAR_STRING
{
ULONG ulTotalSize;
ULONG ulNeededSize;
ULONG ulUsedSize;
ULONG ulStringFormat;
ULONG ulStringSize;
ULONG ulStringOffset;
} VAR_STRING, *PVAR_STRING;
Return Values:
NDIS_STATUS_SUCCESS
NDIS_STATUS_FAILURE
NDIS_STATUS_TAPI_INVALDEVICECLASS
NDIS_STATUS_TAPI_INVALLINEHANDLE
NDIS_STATUS_TAPI_INVALADDRESSID
NDIS_STATUS_TAPI_INVALCALLHANDLE
NDIS_STATUS_TAPI_OPERATIONUNAVAIL
---------------------------------------------------------------------------*/
{
DBG_FUNC("HtTapiGetID")
/*
// A pointer to our link information structure for the selected line device.
*/
PHTDSU_LINK Link;
/*
// Remember which device class is being requested.
*/
UINT DeviceClass;
/*
// A pointer to the requested device ID, and its size in bytes.
*/
PUCHAR IDPtr;
UINT IDLength;
ULONG DeviceID;
DBG_ENTER(Adapter);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -