Beispiel #1
0
NTSTATUS
EvtWmiQueryPortName(
    IN  WDFWMIINSTANCE WmiInstance,
    IN  ULONG OutBufferSize,
    IN  PVOID OutBuffer,
    OUT PULONG BufferUsed
    )
{
    WDFDEVICE device;
    WCHAR pRegName[SYMBOLIC_NAME_LENGTH];
    UNICODE_STRING string;
    USHORT nameSize = sizeof(pRegName);
    NTSTATUS status;

    PAGED_CODE();

    device = WdfWmiInstanceGetDevice(WmiInstance);

    status = SerialReadSymName(device, pRegName, &nameSize);
    if (!NT_SUCCESS(status)) {
        return status;
    }

    RtlInitUnicodeString(&string, pRegName);

    return WDF_WMI_BUFFER_APPEND_STRING(OutBuffer,
                                        OutBufferSize,
                                        &string,
                                        BufferUsed);
}
Beispiel #2
0
Datei: wmi.c Projekt: ms-iot/bsp
/*++

Routine Description:

    WMI Call back functions

Arguments:

    WmiInstance
    OutBufferSize
    OutBuffer
    BufferUsed

Return Value:
    Status

--*/
_Use_decl_annotations_
NTSTATUS
EvtWmiQueryPortName(
    WDFWMIINSTANCE WmiInstance,
    ULONG OutBufferSize,
    PVOID OutBuffer,
    PULONG BufferUsed
    )
{
    WDFDEVICE device;
    WCHAR regName[SYMBOLIC_NAME_LENGTH];
    UNICODE_STRING string;
    USHORT nameSize = sizeof(regName);
    NTSTATUS status;

    PAGED_CODE();

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_WMI, "++EvtWmiQueryPortName()\r\n");

    device = WdfWmiInstanceGetDevice(WmiInstance);

    status = SerialReadSymName(device, regName, &nameSize);

    if (!NT_SUCCESS(status)) {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_WMI,
                    "EvtWmiQueryPortName() SerialReadSymName failed. Err=%Xh\r\n",
                    status);
        goto EndWmiPortname;
    }

    RtlInitUnicodeString(&string, regName);

    status = WDF_WMI_BUFFER_APPEND_STRING(OutBuffer,
                                        OutBufferSize,
                                        &string,
                                        BufferUsed);
    if (!NT_SUCCESS(status)) {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_WMI,
                    "EvtWmiQueryPortName() WMI_BUFFER_APPEND_STRING failed. Err=%Xh\r\n",
                    status);
    }

EndWmiPortname:

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_WMI, "--EvtWmiQueryPortName()=%Xh\r\n", status);
    return status;
}