// Release shared buffer

 KeReleaseSpinlock(&BufferLock,irql);

 DebugPrint('DeviceIoControl: %d bytes written', (int)BytesTxd);

 // Complete IRP

 return CompleteIrp(Irp,status.BytesTxd);

}

///////////////////////////////////////////////////////////////////////

//Wdm1SystemControl:

//

//Description:

//Handle IRP_MJ_SYSTEM_C0NTROL requests

//

//Arguments:

//Pointer to our FDO

//Pointer to the IRP

//Various minor parameters

//IrpStack->Parameters.WMI.xxx has WMI parameters

//

//Return Value:

//This function returns STATUS_XXX

NTSTATUS WdmlSystemControl(IN PDEVICE_OBJECT fdo, IN PIRP Irp) {

 DebugPrintMsg('SystemControl');

 // Just pass to lower driver

 IoSkipCurrentIrpStackLocation(Irp);

 PWDM1_DEVICE_EXTENSION dx = (PWDM1_DEVICE_EXTENSION)fdo->DeviceExtension;

 return IoCallDriver(dx->NextStackDevice, Irp);

}

///////////////////////////////////////////////////////////////////////

//Wdm1Cleanup:

//

//Description:

//Handle IRP_MJ_CLEANUP requests

//Cancel queued IRPs which match given FileObject

//

//Arguments:

//Pointer to our FDO

//Pointer to the IRP

//IrpStack->FileObject has handle to file

//

//Return Value:

//This function returns STATUS_XXX

//Not needed for Wdm1

///////////////////////////////////////////////////////////////////////

//CompleteIrp:Sets IoStatus and completes the IRP

NTSTATUS CompleteIrp(PIRP Irp, NTSTATUS status, ULONG info) {

 Irp->IoStatus.Status = status;

 Irp->IoStatus.Information = info;

 IoCompleteRequest(Irp,IO_NO_INCREMENT);

 return status;

}

///////////////////////////////////////////////////////////////////////

Listing 4.11 Wdm1.rc

//Microsoft Developer Studio generated resource script.

//

#include 'resource.h'

#define APSTUDIO_READONLY_SYMBOLS

///////////////////////////////////////////////////////////////////////

//

// Generated from the TEXTINCLUDE 2 resource.

//

#include 'afxres.h'

///////////////////////////////////////////////////////////////////////

#undef APSTUDIO_READONLY_SYMBOLS

///////////////////////////////////////////////////////////////////////

// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)

#ifdef _WIN32

LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

#pragma code_page(1252)

#endif //_WIN32

#ifndef _MAC

///////////////////////////////////////////////////////////////////////

//

// Version

//

VS_VERSION_INFO VERSIONINFO

 FILEVERSION 1,0,5,0

 PRODUCTVERSION 1,0,0,0

 FILEFLAGSMASK 0x3fL

#ifdef _DEBUG

 FILEFLAGS 0x1L

#else

 FILEFLAGS 0x0L

#endif

 FILEOS 0x4L

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату
×