device.c
Go to the documentation of this file.
1 /*
2  * Bareflank Hypervisor
3  *
4  * Copyright (C) 2015 Assured Information Security, Inc.
5  * Author: Rian Quinn <quinnr@ainfosec.com>
6  * Author: Brendan Kerrigan <kerriganb@ainfosec.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include <debug.h>
24 #include <driver.h>
25 
26 NTSTATUS
28  _Inout_ PWDFDEVICE_INIT DeviceInit
29 )
30 {
31  NTSTATUS status;
32  WDFDEVICE device;
33  WDF_OBJECT_ATTRIBUTES deviceAttributes;
34 
35  WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&deviceAttributes, DEVICE_CONTEXT);
36 
37  status = WdfDeviceCreate(&DeviceInit, &deviceAttributes, &device);
38  if (!NT_SUCCESS(status))
39  return status;
40 
41  status = WdfDeviceCreateDeviceInterface(device, &GUID_DEVINTERFACE_bareflank, NULL);
42  if (!NT_SUCCESS(status))
43  return status;
44 
45  status = bareflankQueueInitialize(device);
46  if (!NT_SUCCESS(status))
47  return status;
48 
49  DEBUG("bareflankCreateDevice: success\n");
50  return status;
51 }
NTSTATUS bareflankCreateDevice(_Inout_ PWDFDEVICE_INIT DeviceInit)
Definition: device.c:27
NTSTATUS bareflankQueueInitialize(_In_ WDFDEVICE Device)
Definition: queue.c:268
EXTERN_C_START struct _DEVICE_CONTEXT DEVICE_CONTEXT
#define DEBUG(...)
Definition: debug.h:155