ReactOS  0.4.15-dev-2701-g34593d9
fxstring.hpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  FxString.hpp
8 
9 Abstract:
10 
11  This module implements a simple string class to operate on
12  unicode strings.
13 
14 Author:
15 
16 
17 
18 
19 Environment:
20 
21  Both kernel and user mode
22 
23 Revision History:
24 
25 
26 --*/
27 #ifndef _FXSTRING_H_
28 #define _FXSTRING_H_
29 
30 class FxString : public FxObject {
31 public:
32  //
33  // Length describes the length of the string in bytes (not WCHARs)
34  // MaximumLength describes the size of the buffer in bytes
35  //
37 
38 public:
39  FxString(
40  __in PFX_DRIVER_GLOBALS FxDriverGlobals
41  );
42 
43  ~FxString();
44 
45  VOID
46  __inline
48  __out PUNICODE_STRING ReleaseTo
49  )
50  {
51  RtlCopyMemory(ReleaseTo, &m_UnicodeString, sizeof(UNICODE_STRING));
53  }
54 
55  __inline
56  operator PUNICODE_STRING(
57  )
58  {
59  return &m_UnicodeString;
60  }
61 
63  __inline
65  VOID
66  )
67  {
68  return &m_UnicodeString;
69  }
70 
72  NTSTATUS
73  Assign(
75  );
76 
78  NTSTATUS
79  Assign(
81  );
82 
83  __inline
84  USHORT
86  VOID
87  )
88  {
89  return m_UnicodeString.Length;
90  }
91 
92  __inline
93  USHORT
95  __in BOOLEAN IncludeNull
96  )
97  {
98  if (IncludeNull) {
99  return m_UnicodeString.Length + sizeof(UNICODE_NULL);
100  }
101  else {
102  return m_UnicodeString.Length;
103  }
104  }
105 
106  __inline
107  USHORT
109  VOID
110  )
111  {
112  return m_UnicodeString.Length / sizeof(WCHAR);
113  }
114 
115  __inline
116  USHORT
118  VOID
119  )
120  {
122  }
123 
124  __inline
125  USHORT
127  VOID
128  )
129  {
131  }
132 
133  __inline
134  USHORT
136  VOID
137  )
138  {
139  return m_UnicodeString.MaximumLength / sizeof(WCHAR);
140  }
141 
142  __inline
143  PWCHAR
145  VOID
146  )
147  {
148  return m_UnicodeString.Buffer;
149  }
150 };
151 
152 #endif // _FXSTRING_H_
UNICODE_STRING m_UnicodeString
Definition: fxstring.hpp:36
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define _Must_inspect_result_
Definition: no_sal2.h:62
USHORT MaximumLength
Definition: env_spec_w32.h:370
VOID __inline ReleaseString(__out PUNICODE_STRING ReleaseTo)
Definition: fxstring.hpp:47
__inline USHORT Length(VOID)
Definition: fxstring.hpp:85
LONG NTSTATUS
Definition: precomp.h:26
uint16_t * PWCHAR
Definition: typedefs.h:56
__inline USHORT MaximumCharacterLength(VOID)
Definition: fxstring.hpp:135
#define UNICODE_NULL
#define __out
Definition: dbghelp.h:62
~FxString()
Definition: fxstring.cpp:37
unsigned char BOOLEAN
__wchar_t WCHAR
Definition: xmlstorage.h:180
__inline USHORT MaximumByteLength(VOID)
Definition: fxstring.hpp:126
_Must_inspect_result_ NTSTATUS Assign(__in PCWSTR SourceString)
Definition: fxstring.cpp:57
__inline USHORT MaximumLength(VOID)
Definition: fxstring.hpp:117
__inline PWCHAR Buffer(VOID)
Definition: fxstring.hpp:144
_Out_ _Inout_ POEM_STRING _In_ PCUNICODE_STRING SourceString
Definition: rtlfuncs.h:1868
FxString(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
Definition: fxstring.cpp:28
__inline USHORT ByteLength(__in BOOLEAN IncludeNull)
Definition: fxstring.hpp:94
unsigned short USHORT
Definition: pedump.c:61
UNICODE_STRING * PUNICODE_STRING
Definition: env_spec_w32.h:373
__inline USHORT CharacterLength(VOID)
Definition: fxstring.hpp:108
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
PUNICODE_STRING __inline GetUnicodeString(VOID)
Definition: fxstring.hpp:64
#define __in
Definition: dbghelp.h:35