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)
9 /* INCLUDES ******************************************************************/
17 /* DATA *********************************************************************/
21 /* FUNCTIONS **********************************************/
24 FltpFreeUnicodeString(_In_ PUNICODE_STRING String
)
26 /* Free up any existing buffer */
29 ExFreePoolWithTag(String
->Buffer
, FM_TAG_UNICODE_STRING
);
32 /* Empty the string */
33 String
->Buffer
= NULL
;
35 String
->MaximumLength
= 0;
39 FltpReallocateUnicodeString(_In_ PUNICODE_STRING String
,
40 _In_ SIZE_T NewLength
,
41 _In_ BOOLEAN CopyExisting
)
45 /* Don't bother reallocating if the buffer is smaller */
46 if (NewLength
<= String
->MaximumLength
)
49 return STATUS_SUCCESS
;
52 /* Allocate a new buffer at the size requested */
53 NewBuffer
= ExAllocatePoolWithTag(PagedPool
, NewLength
, FM_TAG_UNICODE_STRING
);
54 if (NewBuffer
== NULL
) return STATUS_INSUFFICIENT_RESOURCES
;
58 /* Copy the old data across */
59 RtlCopyMemory(NewBuffer
, String
->Buffer
, String
->Length
);
63 /* Reset the length */
67 /* Free any old buffer */
69 ExFreePoolWithTag(String
->Buffer
, FM_TAG_UNICODE_STRING
);
71 /* Update the lengths */
72 String
->Buffer
= NewBuffer
;
73 String
->MaximumLength
= NewLength
;
75 return STATUS_SUCCESS
;
79 FltpCopyUnicodeString(_In_ PUNICODE_STRING StringOne
,
80 _In_ PUNICODE_STRING StringTwo
)