2011-06-02 19:13:51 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
|
|
* FILE: drivers/usb/hidparse/hidparse.c
|
|
|
|
* PURPOSE: HID Parser
|
|
|
|
* PROGRAMMERS:
|
|
|
|
* Michael Martin (michael.martin@reactos.org)
|
|
|
|
* Johannes Anderwald (johannes.anderwald@reactos.org)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "hidparse.h"
|
2019-04-27 09:19:46 +00:00
|
|
|
#include "hidp.h"
|
2011-06-02 19:13:51 +00:00
|
|
|
|
2014-01-03 10:22:05 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2012-01-04 21:58:18 +00:00
|
|
|
PVOID
|
|
|
|
NTAPI
|
|
|
|
AllocFunction(
|
|
|
|
IN ULONG ItemSize)
|
2011-06-02 19:13:51 +00:00
|
|
|
{
|
2013-05-11 15:41:22 +00:00
|
|
|
PVOID Item = ExAllocatePoolWithTag(NonPagedPool, ItemSize, HIDPARSE_TAG);
|
2012-01-04 21:58:18 +00:00
|
|
|
if (Item)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
// zero item
|
|
|
|
//
|
|
|
|
RtlZeroMemory(Item, ItemSize);
|
|
|
|
}
|
2011-06-02 19:13:51 +00:00
|
|
|
|
|
|
|
//
|
2012-01-04 21:58:18 +00:00
|
|
|
// done
|
2011-06-02 19:13:51 +00:00
|
|
|
//
|
2012-01-04 21:58:18 +00:00
|
|
|
return Item;
|
|
|
|
}
|
2011-06-02 19:13:51 +00:00
|
|
|
|
|
|
|
VOID
|
2011-12-25 17:09:09 +00:00
|
|
|
NTAPI
|
2012-01-04 21:58:18 +00:00
|
|
|
FreeFunction(
|
|
|
|
IN PVOID Item)
|
2011-06-02 19:13:51 +00:00
|
|
|
{
|
|
|
|
//
|
2012-01-04 21:58:18 +00:00
|
|
|
// free item
|
2011-06-02 19:13:51 +00:00
|
|
|
//
|
2013-05-11 15:41:22 +00:00
|
|
|
ExFreePoolWithTag(Item, HIDPARSE_TAG);
|
2012-01-04 21:58:18 +00:00
|
|
|
}
|
2011-06-02 19:13:51 +00:00
|
|
|
|
2012-01-04 21:58:18 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ZeroFunction(
|
|
|
|
IN PVOID Item,
|
|
|
|
IN ULONG ItemSize)
|
|
|
|
{
|
2011-06-02 19:13:51 +00:00
|
|
|
//
|
2012-01-04 21:58:18 +00:00
|
|
|
// zero item
|
2011-06-02 19:13:51 +00:00
|
|
|
//
|
2012-01-04 21:58:18 +00:00
|
|
|
RtlZeroMemory(Item, ItemSize);
|
2011-06-02 19:13:51 +00:00
|
|
|
}
|
|
|
|
|
2012-01-04 21:58:18 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
CopyFunction(
|
|
|
|
IN PVOID Target,
|
|
|
|
IN PVOID Source,
|
|
|
|
IN ULONG Length)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
// copy item
|
|
|
|
//
|
|
|
|
RtlCopyMemory(Target, Source, Length);
|
2011-06-02 19:13:51 +00:00
|
|
|
}
|
|
|
|
|
2012-01-04 21:58:18 +00:00
|
|
|
VOID
|
2014-06-10 22:17:58 +00:00
|
|
|
__cdecl
|
2012-01-04 21:58:18 +00:00
|
|
|
DebugFunction(
|
|
|
|
IN LPCSTR FormatStr, ...)
|
2011-06-02 19:13:51 +00:00
|
|
|
{
|
2013-08-29 06:09:28 +00:00
|
|
|
#if HID_DBG
|
2012-01-04 21:58:18 +00:00
|
|
|
va_list args;
|
2013-05-11 15:39:50 +00:00
|
|
|
char printbuffer[1024];
|
2012-01-04 21:58:18 +00:00
|
|
|
|
2013-05-11 15:39:50 +00:00
|
|
|
va_start(args, FormatStr);
|
2013-06-15 06:18:02 +00:00
|
|
|
vsprintf(printbuffer, FormatStr, args);
|
2013-05-11 15:39:50 +00:00
|
|
|
va_end(args);
|
2012-01-04 21:58:18 +00:00
|
|
|
|
2013-05-11 15:39:50 +00:00
|
|
|
DbgPrint(printbuffer);
|
2013-08-29 06:09:28 +00:00
|
|
|
#endif
|
2011-06-02 19:13:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
DriverEntry(
|
|
|
|
IN PDRIVER_OBJECT DriverObject,
|
|
|
|
IN PUNICODE_STRING RegPath)
|
|
|
|
{
|
2012-02-12 02:53:34 +00:00
|
|
|
DPRINT("********* HID PARSE *********\n");
|
2011-06-02 19:13:51 +00:00
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|