다음을 통해 공유


WdfRequestWdmFormatUsingStackLocation 함수(wdfrequest.h)

[KMDF에만 적용]

WdfRequestWdmFormatUsingStackLocation 메서드는 지정된 WDM I/O 스택 위치 구조체의 내용을 요청의 다음 스택 위치로 복사하여 I/O 요청의 형식을 지정합니다.

구문

void WdfRequestWdmFormatUsingStackLocation(
  [in] WDFREQUEST         Request,
  [in] PIO_STACK_LOCATION Stack
);

매개 변수

[in] Request

프레임워크 요청 개체에 대한 핸들입니다.

[in] Stack

드라이버 제공 정보를 포함하는 IO_STACK_LOCATION 구조체에 대한 포인터입니다.

반환 값

없음

설명

드라이버가 잘못된 개체 핸들을 제공하는 경우 버그 검사 발생합니다.

WdfRequestWdmFormatUsingStackLocation 메서드는 Stack 매개 변수에서 제공하는 정보를 요청의 다음 IRP 스택 위치에 복사합니다.

WdfRequestWdmFormatUsingStackLocation 은 요청의 I/O 대상 개체가 로컬 또는 원격인지 여부에 관계없이 요청의 형식을 지정합니다.

요청에 대한 완료 루틴을 설정하려면 드라이버가 WdfRequestWdmFormatUsingStackLocation을 호출한 후 WdfRequestSetCompletionRoutine을 호출해야 합니다.

WdfRequestWdmFormatUsingStackLocation에 대한 자세한 내용은 I/O 요청 전달을 참조하세요.

예제

다음 코드 예제에서는 I/O 요청에 대한 IO_STACK_LOCATION 구조를 제공하고 , CompletionRoutine 콜백 함수를 설정한 다음, 요청을 I/O 대상으로 보냅니다.

IO_STACK_LOCATION  ioStackLocation;
BOOLEAN sendStatus;
...
//
// Initialize the IO_STACK_LOCATION structure here.
//
...
//
// Assign the IO_STACK_LOCATION structure to the request.
//
WdfRequestWdmFormatUsingStackLocation(
                                      request,
                                      &ioStackLocation
                                      );
//
// Assign a CompletionRoutine callback function.
//
WdfRequestSetCompletionRoutine(
                               Request,
                               RequestTimeoutComplete,
                               NULL
                               );
//
// Send the request.
//
sendStatus = WdfRequestSend(
                            Request,
                            target,
                            NULL
                            );

다음 코드 예제에서는 PnP IRP_MN_QUERY_CAPABILITIES IRP를 IO 대상에 보내는 방법을 보여 줍니다.

target = WdfDeviceGetIoTarget(Device);
status = WdfRequestCreate(WDF_NO_OBJECT_ATTRIBUTES,
                          target,
                          &request);

if (!NT_SUCCESS(status)) {
    // Log failure and leave
}

//
// PnP IRPs must be initialized with STATUS_NOT_SUPPORTED
//
WDF_REQUEST_REUSE_PARAMS_INIT(&reuse,
                              WDF_REQUEST_REUSE_NO_FLAGS,
                              STATUS_NOT_SUPPORTED);

WdfRequestReuse(request, &reuse);


//
// Initialize device capabilities
//
RtlZeroMemory(Capabilities, sizeof(DEVICE_CAPABILITIES));
Capabilities->Size = sizeof(DEVICE_CAPABILITIES);
Capabilities->Version  =  1;
Capabilities->Address  = (ULONG) -1;
Capabilities->UINumber = (ULONG) -1;
RtlZeroMemory(&stack, sizeof(stack));
stack.MajorFunction = IRP_MJ_PNP;
stack.MinorFunction = IRP_MN_QUERY_CAPABILITIES;
stack.Parameters.DeviceCapabilities.Capabilities = Capabilities;

WdfRequestWdmFormatUsingStackLocation(request, &stack);

WDF_REQUEST_SEND_OPTIONS_INIT(&options,
                              WDF_REQUEST_SEND_OPTION_SYNCHRONOUS);

if (WdfRequestSend(request, target, &options) == FALSE) {
    // Log failure
}

status = WdfRequestGetStatus(request);

if (!NT_SUCCESS(status)) {
    // Log failure
}

// Remember to delete the WDFREQUEST after creating it
if (request != NULL) {
    WdfObjectDelete(request);
}

요구 사항

요구 사항
대상 플랫폼 유니버설
최소 KMDF 버전 1.0
머리글 wdfrequest.h(Wdf.h 포함)
라이브러리 Wdf01000.sys(프레임워크 라이브러리 버전 관리 참조)
IRQL <=DISPATCH_LEVEL
DDI 규정 준수 규칙 DriverCreate(kmdf), InvalidReqAccess(kmdf), InvalidReqAccessLocal(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), RequestFormattedValid(kmdf)

추가 정보

WdfRequestSetCompletionRoutine