win-pvdrivers

view xenusb/xenusb.c @ 991:e9903455ba9d

Fix low gref resource handling. again.
Tidy up.
author James Harper <james.harper@bendigoit.com.au>
date Fri Sep 21 23:25:36 2012 +1000 (2012-09-21)
parents 5bdb7251370c
children 329b9b9d47ec
line source
1 /*
2 PV Drivers for Windows Xen HVM Domains
3 Copyright (C) 2009 James Harper
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
20 #define INITGUID
21 #include "xenusb.h"
22 #include <stdlib.h>
24 /* Not really necessary but keeps PREfast happy */
25 DRIVER_INITIALIZE DriverEntry;
27 NTSTATUS
28 DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
29 {
30 NTSTATUS status = STATUS_SUCCESS;
31 PVOID driver_extension;
32 PUCHAR ptr;
33 WDF_DRIVER_CONFIG config;
34 WDFDRIVER driver;
36 FUNCTION_ENTER();
38 IoAllocateDriverObjectExtension(DriverObject, UlongToPtr(XEN_INIT_DRIVER_EXTENSION_MAGIC), PAGE_SIZE, &driver_extension);
39 ptr = driver_extension;
40 ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_END, NULL, NULL, NULL);
42 WDF_DRIVER_CONFIG_INIT(&config, XenUsb_EvtDriverDeviceAdd);
43 status = WdfDriverCreate(DriverObject, RegistryPath, WDF_NO_OBJECT_ATTRIBUTES, &config, &driver);
45 if (!NT_SUCCESS(status)) {
46 KdPrint((__DRIVER_NAME " WdfDriverCreate failed with status 0x%x\n", status));
47 }
49 FUNCTION_EXIT();
51 return status;
52 }