No need to define __USE_W32API
[reactos.git] / rosapps / green / green.c
1 /*
2 * PROJECT: ReactOS VT100 emulator
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/base/green/green.c
5 * PURPOSE: Driver entry point
6 * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
7 */
8
9 #include "green.h"
10
11 #define NDEBUG
12 #include <debug.h>
13
14 VOID NTAPI
15 DriverUnload(IN PDRIVER_OBJECT DriverObject)
16 {
17 // nothing to do here yet
18 }
19
20 /*
21 * Standard DriverEntry method.
22 */
23 NTSTATUS NTAPI
24 DriverEntry(
25 IN PDRIVER_OBJECT DriverObject,
26 IN PUNICODE_STRING RegistryPath)
27 {
28 PGREEN_DRIVER_EXTENSION DriverExtension;
29 ULONG i;
30 NTSTATUS Status;
31
32 Status = IoAllocateDriverObjectExtension(
33 DriverObject,
34 DriverObject,
35 sizeof(GREEN_DRIVER_EXTENSION),
36 (PVOID*)&DriverExtension);
37 if (!NT_SUCCESS(Status))
38 {
39 DPRINT("IoAllocateDriverObjectExtension() failed with status 0x%08lx\n", Status);
40 return Status;
41 }
42 RtlZeroMemory(DriverExtension, sizeof(GREEN_DRIVER_EXTENSION));
43
44 Status = RtlDuplicateUnicodeString(
45 0,
46 RegistryPath,
47 &DriverExtension->RegistryPath);
48 if (!NT_SUCCESS(Status))
49 {
50 DPRINT("RtlDuplicateUnicodeString() failed with status 0x%08lx\n", Status);
51 return Status;
52 }
53
54 Status = ReadRegistryEntries(RegistryPath, DriverExtension);
55 if (!NT_SUCCESS(Status))
56 {
57 DPRINT("ReadRegistryEntries() failed with status 0x%08lx\n", Status);
58 return Status;
59 }
60
61 DriverObject->DriverUnload = DriverUnload;
62 DriverObject->DriverExtension->AddDevice = GreenAddDevice;
63
64 for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
65 DriverObject->MajorFunction[i] = GreenDispatch;
66
67 return STATUS_SUCCESS;
68 }