ReactOS 0.4.15-dev-7704-gc07eb9f
misc.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS VT100 emulator
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/base/green/misc.c
5 * PURPOSE: Misceallenous operations
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
17 IN ULONG CtlCode,
19 IN ULONG InputBufferSize,
21 IN OUT PULONG OutputBufferSize)
22{
24 PIRP Irp;
27
29
33 InputBufferSize,
35 (OutputBufferSize) ? *OutputBufferSize : 0,
36 FALSE,
37 &Event,
38 &IoStatus);
39 if (Irp == NULL)
40 {
41 DPRINT("IoBuildDeviceIoControlRequest() failed\n");
43 }
44
46
48 {
49 DPRINT("Operation pending\n");
51 Status = IoStatus.Status;
52 }
53
54 if (OutputBufferSize)
55 {
56 *OutputBufferSize = IoStatus.Information;
57 }
58
59 return Status;
60}
61
66{
67 UNICODE_STRING ParametersRegistryKey;
70
71 ULONG DefaultDeviceReported = 0;
72 ULONG DefaultSampleRate = 1200;
73
74 ParametersRegistryKey.Length = 0;
75 ParametersRegistryKey.MaximumLength = RegistryPath->Length + sizeof(L"\\Parameters") + sizeof(UNICODE_NULL);
76 ParametersRegistryKey.Buffer = ExAllocatePool(PagedPool, ParametersRegistryKey.MaximumLength);
77 if (!ParametersRegistryKey.Buffer)
78 {
79 DPRINT("ExAllocatePool() failed\n");
81 }
82 RtlCopyUnicodeString(&ParametersRegistryKey, RegistryPath);
83 RtlAppendUnicodeToString(&ParametersRegistryKey, L"\\Parameters");
84 ParametersRegistryKey.Buffer[ParametersRegistryKey.Length / sizeof(WCHAR)] = UNICODE_NULL;
85
87
89 Parameters[0].Name = L"AttachedDevice";
90 Parameters[0].EntryContext = &DriverExtension->AttachedDeviceName;
91
93 Parameters[1].Name = L"DeviceReported";
94 Parameters[1].EntryContext = &DriverExtension->DeviceReported;
95 Parameters[1].DefaultType = REG_DWORD;
96 Parameters[1].DefaultData = &DefaultDeviceReported;
97 Parameters[1].DefaultLength = sizeof(ULONG);
98
100 Parameters[2].Name = L"SampleRate";
101 Parameters[2].EntryContext = &DriverExtension->SampleRate;
102 Parameters[2].DefaultType = REG_DWORD;
103 Parameters[2].DefaultData = &DefaultSampleRate;
104 Parameters[2].DefaultLength = sizeof(ULONG);
105
108 ParametersRegistryKey.Buffer,
110 NULL,
111 NULL);
112
113 return Status;
114}
LONG NTSTATUS
Definition: precomp.h:26
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
#define PagedPool
Definition: env_spec_w32.h:308
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
Status
Definition: gdiplustypes.h:25
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
NTSTATUS ReadRegistryEntries(IN PUNICODE_STRING RegistryPath, IN PGREEN_DRIVER_EXTENSION DriverExtension)
Definition: misc.c:63
NTSTATUS GreenDeviceIoControl(IN PDEVICE_OBJECT DeviceObject, IN ULONG CtlCode, IN PVOID InputBuffer OPTIONAL, IN ULONG InputBufferSize, IN OUT PVOID OutputBuffer OPTIONAL, IN OUT PULONG OutputBufferSize)
Definition: misc.c:15
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
#define KernelMode
Definition: asm.h:34
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define RTL_REGISTRY_ABSOLUTE
Definition: nt_native.h:161
#define RTL_QUERY_REGISTRY_DIRECT
Definition: nt_native.h:144
#define RTL_REGISTRY_OPTIONAL
Definition: nt_native.h:169
#define UNICODE_NULL
@ NotificationEvent
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:881
#define IoCallDriver
Definition: irp.c:1225
#define STATUS_PENDING
Definition: ntstatus.h:82
#define L(x)
Definition: ntvdm.h:50
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:31
#define REG_DWORD
Definition: sdbapi.c:596
#define DPRINT
Definition: sndvol32.h:71
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
USHORT MaximumLength
Definition: env_spec_w32.h:370
uint32_t * PULONG
Definition: typedefs.h:59
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:869
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
@ Suspended
Definition: ketypes.h:420
__wchar_t WCHAR
Definition: xmlstorage.h:180