ReactOS 0.4.15-dev-7953-g1f49173
Lib.c
Go to the documentation of this file.
1/*
2* PROJECT: Filesystem Filter Manager
3* LICENSE: GPL - See COPYING in the top level directory
4* FILE: drivers/filters/fltmgr/Lib.c
5* PURPOSE: Miscellaneous library functions
6* PROGRAMMERS: Ged Murphy (gedmurphy@reactos.org)
7*/
8
9/* INCLUDES ******************************************************************/
10
11#include "fltmgr.h"
12
13#define NDEBUG
14#include <debug.h>
15
16
17/* DATA *********************************************************************/
18
19
20
21/* FUNCTIONS **********************************************/
22
23VOID
25{
26 /* Free up any existing buffer */
27 if (String->Buffer)
28 {
30 }
31
32 /* Empty the string */
33 String->Buffer = NULL;
34 String->Length = 0;
35 String->MaximumLength = 0;
36}
37
41 _In_ BOOLEAN CopyExisting)
42{
43 PWCH NewBuffer;
44
45 /* Don't bother reallocating if the buffer is smaller */
46 if (NewLength <= String->MaximumLength)
47 {
48 String->Length = 0;
49 return STATUS_SUCCESS;
50 }
51
52 /* Allocate a new buffer at the size requested */
54 if (NewBuffer == NULL) return STATUS_INSUFFICIENT_RESOURCES;
55
56 if (CopyExisting)
57 {
58 /* Copy the old data across */
59 RtlCopyMemory(NewBuffer, String->Buffer, String->Length);
60 }
61 else
62 {
63 /* Reset the length */
64 String->Length = 0;
65 }
66
67 /* Free any old buffer */
68 if (String->Buffer)
70
71 /* Update the lengths */
72 String->Buffer = NewBuffer;
73 String->MaximumLength = NewLength;
74
75 return STATUS_SUCCESS;
76}
77
80 _In_ PUNICODE_STRING StringTwo)
81{
82 return 0;
83}
static USHORT USHORT * NewLength
NTSTATUS FltpReallocateUnicodeString(_In_ PUNICODE_STRING String, _In_ SIZE_T NewLength, _In_ BOOLEAN CopyExisting)
Definition: Lib.c:39
NTSTATUS FltpCopyUnicodeString(_In_ PUNICODE_STRING StringOne, _In_ PUNICODE_STRING StringTwo)
Definition: Lib.c:79
VOID FltpFreeUnicodeString(_In_ PUNICODE_STRING String)
Definition: Lib.c:24
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
#define FM_TAG_UNICODE_STRING
Definition: fltmgr.h:20
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define _In_
Definition: ms_sal.h:308
WCHAR * PWCH
Definition: ntbasedef.h:410
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_In_ WDFDMATRANSACTION _In_ size_t MaximumLength