wined3d: Don't unnecessarily fallback to immediate mode for FFP draws with the PSIZE...
[wine.git] / dlls / hidclass.sys / main.c
blobe48448626096501776ef28a98bd39b7bf2fe2cf2
1 /*
2 * WINE Hid device services
4 * Copyright 2015 Aric Stewart
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define NONAMELESSUNION
22 #include <unistd.h>
23 #include <stdarg.h>
24 #include "hid.h"
25 #include "wine/debug.h"
26 #include "wine/unicode.h"
27 #include "wine/list.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(hid);
31 static struct list minidriver_list = LIST_INIT(minidriver_list);
33 static minidriver* find_minidriver(DRIVER_OBJECT *driver)
35 minidriver *md;
36 LIST_FOR_EACH_ENTRY(md, &minidriver_list, minidriver, entry)
38 if (md->minidriver.DriverObject == driver)
39 return md;
41 return NULL;
44 static VOID WINAPI UnloadDriver(DRIVER_OBJECT *driver)
46 minidriver *md;
48 TRACE("Driver Unload\n");
49 md = find_minidriver(driver);
50 if (md)
52 if (md->DriverUnload)
53 md->DriverUnload(md->minidriver.DriverObject);
54 list_remove(&md->entry);
55 HeapFree( GetProcessHeap(), 0, md );
59 NTSTATUS WINAPI HidRegisterMinidriver(HID_MINIDRIVER_REGISTRATION *registration)
61 minidriver *driver;
62 driver = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*driver));
64 if (!driver)
65 return STATUS_NO_MEMORY;
67 driver->DriverUnload = registration->DriverObject->DriverUnload;
68 registration->DriverObject->DriverUnload = UnloadDriver;
70 driver->minidriver = *registration;
71 list_add_tail(&minidriver_list, &driver->entry);
73 return STATUS_SUCCESS;