本文整理汇总了C++中AFD_DbgPrint函数的典型用法代码示例。如果您正苦于以下问题:C++ AFD_DbgPrint函数的具体用法?C++ AFD_DbgPrint怎么用?C++ AFD_DbgPrint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AFD_DbgPrint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DisplayBuffer
static VOID DisplayBuffer(
PVOID Buffer,
ULONG Size)
{
ULONG i;
PCHAR p;
if ((DebugTraceLevel & MAX_TRACE) == 0)
return;
if (!Buffer) {
AFD_DbgPrint(MIN_TRACE, ("Cannot display null buffer.\n"));
return;
}
AFD_DbgPrint(MID_TRACE, ("Displaying buffer at (0x%X) Size (%d).\n", Buffer, Size));
p = (PCHAR)Buffer;
for (i = 0; i < Size; i++) {
if (i % 16 == 0)
DbgPrint("\n");
DbgPrint("%02X ", (p[i]) & 0xFF);
}
DbgPrint("\n");
}
示例2: WarmSocketForBind
NTSTATUS WarmSocketForBind( PAFD_FCB FCB, ULONG ShareType ) {
NTSTATUS Status;
AFD_DbgPrint(MID_TRACE,("Called (AF %u)\n",
FCB->LocalAddress->Address[0].AddressType));
if( !FCB->TdiDeviceName.Length || !FCB->TdiDeviceName.Buffer ) {
AFD_DbgPrint(MIN_TRACE,("Null Device\n"));
return STATUS_NO_SUCH_DEVICE;
}
if( !FCB->LocalAddress ) {
AFD_DbgPrint(MIN_TRACE,("No local address\n"));
return STATUS_INVALID_PARAMETER;
}
Status = TdiOpenAddressFile(&FCB->TdiDeviceName,
FCB->LocalAddress,
ShareType,
&FCB->AddressFile.Handle,
&FCB->AddressFile.Object );
if (!NT_SUCCESS(Status))
return Status;
if (FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS)
{
if (!FCB->Recv.Size)
{
Status = TdiQueryMaxDatagramLength(FCB->AddressFile.Object,
&FCB->Recv.Size);
}
if (NT_SUCCESS(Status) && !FCB->Recv.Window)
{
FCB->Recv.Window = ExAllocatePool(PagedPool, FCB->Recv.Size);
if (!FCB->Recv.Window)
Status = STATUS_NO_MEMORY;
}
if (NT_SUCCESS(Status))
{
Status = TdiReceiveDatagram(&FCB->ReceiveIrp.InFlightRequest,
FCB->AddressFile.Object,
0,
FCB->Recv.Window,
FCB->Recv.Size,
FCB->AddressFrom,
&FCB->ReceiveIrp.Iosb,
PacketSocketRecvComplete,
FCB);
/* We don't want to wait for this read to complete. */
if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
}
}
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
return Status;
}
示例3: TdiQueryDeviceControl
NTSTATUS TdiQueryDeviceControl(
PFILE_OBJECT FileObject,
ULONG IoControlCode,
PVOID InputBuffer,
ULONG InputBufferLength,
PVOID OutputBuffer,
ULONG OutputBufferLength,
PULONG Return)
/*
* FUNCTION: Queries a device for information
* ARGUMENTS:
* FileObject = Pointer to file object
* IoControlCode = I/O control code
* InputBuffer = Pointer to buffer with input data
* InputBufferLength = Length of InputBuffer
* OutputBuffer = Address of buffer to place output data
* OutputBufferLength = Length of OutputBuffer
* RETURNS:
* Status of operation
*/
{
PDEVICE_OBJECT DeviceObject;
IO_STATUS_BLOCK Iosb;
NTSTATUS Status;
KEVENT Event;
PIRP Irp;
if (!FileObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad file object.\n"));
return STATUS_INVALID_PARAMETER;
}
DeviceObject = IoGetRelatedDeviceObject(FileObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
return STATUS_INVALID_PARAMETER;
}
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Irp = IoBuildDeviceIoControlRequest(IoControlCode,
DeviceObject,
InputBuffer,
InputBufferLength,
OutputBuffer,
OutputBufferLength,
FALSE,
&Event,
&Iosb);
if (!Irp)
return STATUS_INSUFFICIENT_RESOURCES;
Status = TdiCall(Irp, DeviceObject, &Event, &Iosb);
if (Return)
*Return = Iosb.Information;
return Status;
}
示例4: TdiSetEventHandler
NTSTATUS TdiSetEventHandler(
PFILE_OBJECT FileObject,
LONG EventType,
PVOID Handler,
PVOID Context)
/*
* FUNCTION: Sets or resets an event handler
* ARGUMENTS:
* FileObject = Pointer to file object
* EventType = Event code
* Handler = Event handler to be called when the event occurs
* Context = Context input to handler when the event occurs
* RETURNS:
* Status of operation
* NOTES:
* Specify NULL for Handler to stop calling event handler
*/
{
PDEVICE_OBJECT DeviceObject;
IO_STATUS_BLOCK Iosb;
KEVENT Event;
PIRP Irp;
AFD_DbgPrint(MAX_TRACE, ("Called\n"));
if (!FileObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad file object.\n"));
return STATUS_INVALID_PARAMETER;
}
DeviceObject = IoGetRelatedDeviceObject(FileObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
return STATUS_INVALID_PARAMETER;
}
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Irp = TdiBuildInternalDeviceControlIrp(TDI_SET_EVENT_HANDLER, /* Sub function */
DeviceObject, /* Device object */
FileObject, /* File object */
&Event, /* Event */
&Iosb); /* Status */
if (!Irp)
return STATUS_INSUFFICIENT_RESOURCES;
TdiBuildSetEventHandler(Irp,
DeviceObject,
FileObject,
NULL,
NULL,
EventType,
Handler,
Context);
return TdiCall(Irp, DeviceObject, &Event, &Iosb);
}
示例5: TryToSatisfyRecvRequestFromBuffer
static NTSTATUS TryToSatisfyRecvRequestFromBuffer( PAFD_FCB FCB,
PAFD_RECV_INFO RecvReq,
PUINT TotalBytesCopied ) {
UINT i, BytesToCopy = 0, FcbBytesCopied = FCB->Recv.BytesUsed,
BytesAvailable =
FCB->Recv.Content - FCB->Recv.BytesUsed;
PAFD_MAPBUF Map;
*TotalBytesCopied = 0;
AFD_DbgPrint(MID_TRACE,("Called, BytesAvailable = %u\n", BytesAvailable));
if( CantReadMore(FCB) ) return STATUS_SUCCESS;
if( !BytesAvailable ) return STATUS_PENDING;
Map = (PAFD_MAPBUF)(RecvReq->BufferArray + RecvReq->BufferCount);
AFD_DbgPrint(MID_TRACE,("Buffer Count: %u @ %p\n",
RecvReq->BufferCount,
RecvReq->BufferArray));
for( i = 0;
RecvReq->BufferArray &&
BytesAvailable &&
i < RecvReq->BufferCount;
i++ ) {
BytesToCopy =
MIN( RecvReq->BufferArray[i].len, BytesAvailable );
if( Map[i].Mdl ) {
Map[i].BufferAddress = MmMapLockedPages( Map[i].Mdl, KernelMode );
AFD_DbgPrint(MID_TRACE,("Buffer %u: %p:%u\n",
i,
Map[i].BufferAddress,
BytesToCopy));
RtlCopyMemory( Map[i].BufferAddress,
FCB->Recv.Window + FcbBytesCopied,
BytesToCopy );
MmUnmapLockedPages( Map[i].BufferAddress, Map[i].Mdl );
*TotalBytesCopied += BytesToCopy;
FcbBytesCopied += BytesToCopy;
BytesAvailable -= BytesToCopy;
if (!(RecvReq->TdiFlags & TDI_RECEIVE_PEEK))
FCB->Recv.BytesUsed += BytesToCopy;
}
}
/* Issue another receive IRP to keep the buffer well stocked */
RefillSocketBuffer(FCB);
return STATUS_SUCCESS;
}
示例6: TdiConnect
NTSTATUS TdiConnect(
PIRP *Irp,
PFILE_OBJECT ConnectionObject,
PTDI_CONNECTION_INFORMATION ConnectionCallInfo,
PTDI_CONNECTION_INFORMATION ConnectionReturnInfo,
PIO_COMPLETION_ROUTINE CompletionRoutine,
PVOID CompletionContext)
/*
* FUNCTION: Connect a connection endpoint to a remote peer
* ARGUMENTS:
* ConnectionObject = Pointer to connection endpoint file object
* RemoteAddress = Pointer to remote address
* RETURNS:
* Status of operation
*/
{
PDEVICE_OBJECT DeviceObject;
AFD_DbgPrint(MAX_TRACE, ("Called\n"));
ASSERT(*Irp == NULL);
if (!ConnectionObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad connection object.\n"));
return STATUS_INVALID_PARAMETER;
}
DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
return STATUS_INVALID_PARAMETER;
}
*Irp = TdiBuildInternalDeviceControlIrp(TDI_CONNECT, /* Sub function */
DeviceObject, /* Device object */
ConnectionObject, /* File object */
NULL, /* Event */
NULL); /* Status */
if (!*Irp) {
return STATUS_INSUFFICIENT_RESOURCES;
}
TdiBuildConnect(*Irp, /* IRP */
DeviceObject, /* Device object */
ConnectionObject, /* File object */
CompletionRoutine, /* Completion routine */
CompletionContext, /* Completion routine context */
NULL, /* Time */
ConnectionCallInfo, /* Request connection information */
ConnectionReturnInfo); /* Return connection information */
TdiCall(*Irp, DeviceObject, NULL, NULL);
return STATUS_PENDING;
}
示例7: TdiListen
NTSTATUS TdiListen(
PIRP *Irp,
PFILE_OBJECT ConnectionObject,
PTDI_CONNECTION_INFORMATION *RequestConnectionInfo,
PTDI_CONNECTION_INFORMATION *ReturnConnectionInfo,
PIO_COMPLETION_ROUTINE CompletionRoutine,
PVOID CompletionContext)
/*
* FUNCTION: Listen on a connection endpoint for a connection request from a remote peer
* ARGUMENTS:
* CompletionRoutine = Routine to be called when IRP is completed
* CompletionContext = Context for CompletionRoutine
* RETURNS:
* Status of operation
* May return STATUS_PENDING
*/
{
PDEVICE_OBJECT DeviceObject;
AFD_DbgPrint(MAX_TRACE, ("Called\n"));
ASSERT(*Irp == NULL);
if (!ConnectionObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad connection object.\n"));
return STATUS_INVALID_PARAMETER;
}
DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
return STATUS_INVALID_PARAMETER;
}
*Irp = TdiBuildInternalDeviceControlIrp(TDI_LISTEN, /* Sub function */
DeviceObject, /* Device object */
ConnectionObject, /* File object */
NULL, /* Event */
NULL); /* Status */
if (*Irp == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
TdiBuildListen(*Irp, /* IRP */
DeviceObject, /* Device object */
ConnectionObject, /* File object */
CompletionRoutine, /* Completion routine */
CompletionContext, /* Completion routine context */
0, /* Flags */
*RequestConnectionInfo, /* Request connection information */
*ReturnConnectionInfo); /* Return connection information */
TdiCall(*Irp, DeviceObject, NULL /* Don't wait for completion */, NULL);
return STATUS_PENDING;
}
示例8: AfdEventReceive
NTSTATUS AfdEventReceive(
IN PVOID TdiEventContext,
IN CONNECTION_CONTEXT ConnectionContext,
IN ULONG ReceiveFlags,
IN ULONG BytesIndicated,
IN ULONG BytesAvailable,
OUT ULONG *BytesTaken,
IN PVOID Tsdu,
OUT PIRP *IoRequestPacket)
{
PAFDFCB FCB = (PAFDFCB)TdiEventContext;
PVOID ReceiveBuffer;
PAFD_BUFFER Buffer;
KIRQL OldIrql;
AFD_DbgPrint(MAX_TRACE, ("Called.\n"));
AFD_DbgPrint(MID_TRACE, ("Receiving (%d) bytes on socket\n",
BytesAvailable));
ReceiveBuffer = ExAllocatePool(NonPagedPool, BytesAvailable);
if (!ReceiveBuffer)
return STATUS_INSUFFICIENT_RESOURCES;
/*Buffer = (PAFD_BUFFER)ExAllocateFromNPagedLookasideList(
&BufferLookasideList);*/
Buffer = (PAFD_BUFFER)ExAllocatePool(NonPagedPool, sizeof(AFD_BUFFER));
if (!Buffer) {
ExFreePool(ReceiveBuffer);
return STATUS_INSUFFICIENT_RESOURCES;
}
/* Copy the data to a local buffer */
RtlCopyMemory(ReceiveBuffer, Tsdu, BytesAvailable);
Buffer->Buffer.len = BytesAvailable;
Buffer->Buffer.buf = ReceiveBuffer;
Buffer->Offset = 0;
KeAcquireSpinLock(&FCB->ReceiveQueueLock, &OldIrql);
InsertTailList( &FCB->ReceiveQueue, &Buffer->ListEntry );
TryToSatisfyRecvRequest( FCB, TRUE );
KeReleaseSpinLock(&FCB->ReceiveQueueLock, OldIrql);
*BytesTaken = BytesAvailable;
AFD_DbgPrint(MAX_TRACE, ("Leaving.\n"));
return STATUS_SUCCESS;
}
示例9: TdiQueryInformation
NTSTATUS TdiQueryInformation(
PFILE_OBJECT FileObject,
LONG QueryType,
PMDL MdlBuffer)
/*
* FUNCTION: Query for information
* ARGUMENTS:
* FileObject = Pointer to file object
* QueryType = Query type
* MdlBuffer = Pointer to MDL buffer specific for query type
* RETURNS:
* Status of operation
*/
{
PDEVICE_OBJECT DeviceObject;
IO_STATUS_BLOCK Iosb;
KEVENT Event;
PIRP Irp;
if (!FileObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad file object.\n"));
return STATUS_INVALID_PARAMETER;
}
DeviceObject = IoGetRelatedDeviceObject(FileObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
return STATUS_INVALID_PARAMETER;
}
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Irp = TdiBuildInternalDeviceControlIrp(TDI_QUERY_INFORMATION, /* Sub function */
DeviceObject, /* Device object */
ConnectionObject, /* File object */
&Event, /* Event */
&Iosb); /* Status */
if (!Irp) {
return STATUS_INSUFFICIENT_RESOURCES;
}
TdiBuildQueryInformation(Irp,
DeviceObject,
FileObject,
NULL,
NULL,
QueryType,
MdlBuffer);
return TdiCall(Irp, DeviceObject, &Event, &Iosb);
}
示例10: TdiAssociateAddressFile
NTSTATUS TdiAssociateAddressFile(
HANDLE AddressHandle,
PFILE_OBJECT ConnectionObject)
/*
* FUNCTION: Associates a connection endpoint to an address file object
* ARGUMENTS:
* AddressHandle = Handle to address file object
* ConnectionObject = Connection endpoint file object
* RETURNS:
* Status of operation
*/
{
PDEVICE_OBJECT DeviceObject;
IO_STATUS_BLOCK Iosb;
KEVENT Event;
PIRP Irp;
AFD_DbgPrint(MAX_TRACE, ("Called. AddressHandle (%p) ConnectionObject (%p)\n",
AddressHandle, ConnectionObject));
if (!ConnectionObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad connection object.\n"));
return STATUS_INVALID_PARAMETER;
}
DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
return STATUS_INVALID_PARAMETER;
}
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Irp = TdiBuildInternalDeviceControlIrp(TDI_ASSOCIATE_ADDRESS, /* Sub function */
DeviceObject, /* Device object */
ConnectionObject, /* File object */
&Event, /* Event */
&Iosb); /* Status */
if (!Irp)
return STATUS_INSUFFICIENT_RESOURCES;
TdiBuildAssociateAddress(Irp,
DeviceObject,
ConnectionObject,
NULL,
NULL,
AddressHandle);
return TdiCall(Irp, DeviceObject, &Event, &Iosb);
}
示例11: UNREFERENCED_PARAMETER
NTSTATUS NTAPI ReceiveComplete
( PDEVICE_OBJECT DeviceObject,
PIRP Irp,
PVOID Context ) {
PAFD_FCB FCB = (PAFD_FCB)Context;
PLIST_ENTRY NextIrpEntry;
PIRP NextIrp;
PAFD_RECV_INFO RecvReq;
PIO_STACK_LOCATION NextIrpSp;
UNREFERENCED_PARAMETER(DeviceObject);
AFD_DbgPrint(MID_TRACE,("Called\n"));
if( !SocketAcquireStateLock( FCB ) )
return STATUS_FILE_CLOSED;
ASSERT(FCB->ReceiveIrp.InFlightRequest == Irp);
FCB->ReceiveIrp.InFlightRequest = NULL;
if( FCB->State == SOCKET_STATE_CLOSED ) {
/* Cleanup our IRP queue because the FCB is being destroyed */
while( !IsListEmpty( &FCB->PendingIrpList[FUNCTION_RECV] ) ) {
NextIrpEntry = RemoveHeadList(&FCB->PendingIrpList[FUNCTION_RECV]);
NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP, Tail.Overlay.ListEntry);
NextIrpSp = IoGetCurrentIrpStackLocation(NextIrp);
RecvReq = GetLockedData(NextIrp, NextIrpSp);
NextIrp->IoStatus.Status = STATUS_FILE_CLOSED;
NextIrp->IoStatus.Information = 0;
UnlockBuffers(RecvReq->BufferArray, RecvReq->BufferCount, FALSE);
if( NextIrp->MdlAddress ) UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) );
(void)IoSetCancelRoutine(NextIrp, NULL);
IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT );
}
SocketStateUnlock( FCB );
return STATUS_FILE_CLOSED;
} else if( FCB->State == SOCKET_STATE_LISTENING ) {
AFD_DbgPrint(MIN_TRACE,("!!! LISTENER GOT A RECEIVE COMPLETE !!!\n"));
SocketStateUnlock( FCB );
return STATUS_INVALID_PARAMETER;
}
HandleReceiveComplete( FCB, Irp->IoStatus.Status, Irp->IoStatus.Information );
ReceiveActivity( FCB, NULL );
SocketStateUnlock( FCB );
return STATUS_SUCCESS;
}
示例12: TdiDisconnect
NTSTATUS TdiDisconnect(
PIRP *Irp,
PFILE_OBJECT TransportObject,
PLARGE_INTEGER Time,
USHORT Flags,
PIO_COMPLETION_ROUTINE CompletionRoutine,
PVOID CompletionContext,
PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
PTDI_CONNECTION_INFORMATION ReturnConnectionInfo) {
PDEVICE_OBJECT DeviceObject;
if (!TransportObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad transport object.\n"));
return STATUS_INVALID_PARAMETER;
}
AFD_DbgPrint(MID_TRACE,("Called(TransportObject %p)\n", TransportObject));
DeviceObject = IoGetRelatedDeviceObject(TransportObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
return STATUS_INVALID_PARAMETER;
}
*Irp = TdiBuildInternalDeviceControlIrp(TDI_DISCONNECT, /* Sub function */
DeviceObject, /* Device object */
TransportObject, /* File object */
NULL, /* Event */
NULL); /* Status */
if (!*Irp) {
AFD_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
return STATUS_INSUFFICIENT_RESOURCES;
}
TdiBuildDisconnect(*Irp, /* I/O Request Packet */
DeviceObject, /* Device object */
TransportObject, /* File object */
CompletionRoutine, /* Completion routine */
CompletionContext, /* Completion context */
Time, /* Time */
Flags, /* Disconnect flags */
RequestConnectionInfo, /* Indication of who to disconnect */
ReturnConnectionInfo); /* Indication of who disconnected */
TdiCall(*Irp, DeviceObject, NULL, NULL);
return STATUS_PENDING;
}
示例13: AfdGetConnectOptions
NTSTATUS
NTAPI
AfdGetConnectOptions(PDEVICE_OBJECT DeviceObject, PIRP Irp,
PIO_STACK_LOCATION IrpSp)
{
PFILE_OBJECT FileObject = IrpSp->FileObject;
PAFD_FCB FCB = FileObject->FsContext;
UINT BufferSize = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
UNREFERENCED_PARAMETER(DeviceObject);
if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
if (FCB->ConnectOptionsSize == 0)
{
AFD_DbgPrint(MIN_TRACE,("Invalid parameter\n"));
return UnlockAndMaybeComplete(FCB, STATUS_INVALID_PARAMETER, Irp, 0);
}
ASSERT(FCB->ConnectOptions);
if (FCB->FilledConnectOptions < BufferSize) BufferSize = FCB->FilledConnectOptions;
RtlCopyMemory(Irp->UserBuffer,
FCB->ConnectOptions,
BufferSize);
return UnlockAndMaybeComplete(FCB, STATUS_SUCCESS, Irp, BufferSize);
}
示例14: TaLengthOfTransportAddressByType
NTSTATUS TdiBuildNullConnectionInfoInPlace
( PTDI_CONNECTION_INFORMATION ConnInfo,
ULONG Type )
/*
* FUNCTION: Builds a NULL TDI connection information structure
* ARGUMENTS:
* ConnectionInfo = Address of buffer to place connection information
* Type = TDI style address type (TDI_ADDRESS_TYPE_XXX).
* RETURNS:
* Status of operation
*/
{
ULONG TdiAddressSize;
PTRANSPORT_ADDRESS TransportAddress;
TdiAddressSize = TaLengthOfTransportAddressByType(Type);
if (!TdiAddressSize)
{
AFD_DbgPrint(MIN_TRACE,("Invalid parameter\n"));
return STATUS_INVALID_PARAMETER;
}
RtlZeroMemory(ConnInfo,
sizeof(TDI_CONNECTION_INFORMATION) +
TdiAddressSize);
ConnInfo->OptionsLength = sizeof(ULONG);
ConnInfo->RemoteAddressLength = TdiAddressSize;
ConnInfo->RemoteAddress = TransportAddress =
(PTRANSPORT_ADDRESS)&ConnInfo[1];
return TdiBuildNullTransportAddressInPlace(TransportAddress, Type);
}
示例15: AfdGetContext
NTSTATUS NTAPI
AfdGetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp,
PIO_STACK_LOCATION IrpSp ) {
NTSTATUS Status = STATUS_INVALID_PARAMETER;
PFILE_OBJECT FileObject = IrpSp->FileObject;
PAFD_FCB FCB = FileObject->FsContext;
UINT ContextSize = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
UNREFERENCED_PARAMETER(DeviceObject);
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( FCB->ContextSize < ContextSize ) ContextSize = FCB->ContextSize;
if( FCB->Context ) {
RtlCopyMemory( Irp->UserBuffer,
FCB->Context,
ContextSize );
Status = STATUS_SUCCESS;
}
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
return UnlockAndMaybeComplete( FCB, Status, Irp, ContextSize );
}