ReactOS  0.4.15-dev-1150-g593bcce
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 
23 VOID
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 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LONG NTSTATUS
Definition: precomp.h:26
static WCHAR String[]
Definition: stringtable.c:55
static USHORT USHORT * NewLength
#define FM_TAG_UNICODE_STRING
Definition: fltmgr.h:18
NTSTATUS FltpReallocateUnicodeString(_In_ PUNICODE_STRING String, _In_ SIZE_T NewLength, _In_ BOOLEAN CopyExisting)
Definition: Lib.c:39
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS FltpCopyUnicodeString(_In_ PUNICODE_STRING StringOne, _In_ PUNICODE_STRING StringTwo)
Definition: Lib.c:79
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
WCHAR * PWCH
Definition: ntbasedef.h:411
VOID FltpFreeUnicodeString(_In_ PUNICODE_STRING String)
Definition: Lib.c:24
#define _In_
Definition: no_sal2.h:204
UnicodeString MaximumLength
Definition: rtlfuncs.h:2982
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
return STATUS_SUCCESS
Definition: btrfs.c:3014