ReactOS  0.4.15-dev-1397-g19779b3
Registry.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

NTSTATUS FltpOpenFilterServicesKey (_In_ PFLT_FILTER Filter, _In_ ACCESS_MASK DesiredAccess, _In_opt_ PUNICODE_STRING SubKey, _Out_ PHANDLE Handle)
 
NTSTATUS FltpReadRegistryValue (_In_ HANDLE KeyHandle, _In_ PUNICODE_STRING ValueName, _In_opt_ ULONG Type, _Out_writes_bytes_(BufferSize) PVOID Buffer, _In_ ULONG BufferSize, _Out_opt_ PULONG BytesRequired)
 

Function Documentation

◆ FltpOpenFilterServicesKey()

NTSTATUS FltpOpenFilterServicesKey ( _In_ PFLT_FILTER  Filter,
_In_ ACCESS_MASK  DesiredAccess,
_In_opt_ PUNICODE_STRING  SubKey,
_Out_ PHANDLE  Handle 
)

Definition at line 28 of file Registry.c.

33 {
35  UNICODE_STRING ServicesKey;
38 
39  /* Setup a local buffer to hold the services key path */
40  Path.Length = 0;
41  Path.MaximumLength = REG_PATH_LENGTH;
42  Path.Buffer = Buffer;
43 
44  /* Build up the serices key name */
46  RtlCopyUnicodeString(&Path, &ServicesKey);
48 
49  if (SubKey)
50  {
51  /* Tag on any child key */
54  }
55 
57  &Path,
59  NULL,
60  NULL);
61 
62  /* Open and return the key handle param*/
63  return ZwOpenKey(Handle, DesiredAccess, &ObjectAttributes);
64 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2654
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
Definition: bufpool.h:45
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR L[]
Definition: oid.c:1250
UNICODE_STRING Name
Definition: fltmgrint.h:100
PRTL_UNICODE_STRING_BUFFER Path
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define NULL
Definition: types.h:112
_In_ HANDLE Handle
Definition: extypes.h:390
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define REG_SERVICES_KEY
Definition: Registry.c:20
#define REG_PATH_LENGTH
Definition: Registry.c:21

Referenced by GetFilterAltitude().

◆ FltpReadRegistryValue()

NTSTATUS FltpReadRegistryValue ( _In_ HANDLE  KeyHandle,
_In_ PUNICODE_STRING  ValueName,
_In_opt_ ULONG  Type,
_Out_writes_bytes_(BufferSize) PVOID  Buffer,
_In_ ULONG  BufferSize,
_Out_opt_ PULONG  BytesRequired 
)

Definition at line 67 of file Registry.c.

73 {
75  ULONG ValueLength = 0;
77 
78  PAGED_CODE();
79 
80  /* Get the size of the buffer required to hold the string */
81  Status = ZwQueryValueKey(KeyHandle,
82  ValueName,
84  NULL,
85  0,
86  &ValueLength);
88  {
89  return Status;
90  }
91 
92  /* Allocate the buffer */
96  if (Value == NULL)
97  {
99  goto Quit;
100  }
101 
102  /* Now read in the value */
103  Status = ZwQueryValueKey(KeyHandle,
104  ValueName,
106  Value,
107  ValueLength,
108  &ValueLength);
109  if (!NT_SUCCESS(Status))
110  {
111  goto Quit;
112  }
113 
114  /* Make sure we got the type expected */
115  if (Value->Type != Type)
116  {
118  goto Quit;
119  }
120 
121  if (BytesRequired)
122  {
123  *BytesRequired = Value->DataLength;
124  }
125 
126  /* Make sure the caller buffer is big enough to hold the data */
128  {
130  goto Quit;
131  }
132 
133  /* Copy the data into the caller buffer */
134  RtlCopyMemory(Buffer, Value->Data, Value->DataLength);
135 
136 Quit:
137 
138  if (Value)
140 
141  return Status;
142 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define FM_TAG_TEMP_REGISTRY
Definition: fltmgr.h:22
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1437
Definition: bufpool.h:45
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _KEY_VALUE_PARTIAL_INFORMATION * PKEY_VALUE_PARTIAL_INFORMATION
Type
Definition: Type.h:6
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:240
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251
#define PAGED_CODE()
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG ValueLength
Definition: wdfregistry.h:271

Referenced by GetFilterAltitude().