1 /*++ 2 3 Copyright (c) Microsoft Corporation 4 5 Module Name: 6 7 FxString.cpp 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 Environment: 19 20 Both kernel and user mode 21 22 Revision History: 23 24 --*/ 25 26 #include "fxsupportpch.hpp" 27 28 FxString::FxString( 29 __in PFX_DRIVER_GLOBALS FxDriverGlobals 30 ) : 31 FxObject(FX_TYPE_STRING, sizeof(FxString), FxDriverGlobals) 32 { 33 RtlInitUnicodeString(&m_UnicodeString, NULL); 34 MarkPassiveDispose(ObjectDoNotLock); 35 } 36 37 FxString::~FxString() 38 { 39 if (m_UnicodeString.Buffer) { 40 FxPoolFree(m_UnicodeString.Buffer); 41 } 42 } 43 44 _Must_inspect_result_ 45 NTSTATUS 46 FxString::Assign( 47 __in const UNICODE_STRING* UnicodeString 48 ) 49 { 50 return FxDuplicateUnicodeString(GetDriverGlobals(), 51 UnicodeString, 52 &m_UnicodeString); 53 } 54 55 _Must_inspect_result_ 56 NTSTATUS 57 FxString::Assign( 58 __in PCWSTR SourceString 59 ) 60 61 { 62 UNICODE_STRING string; 63 64 RtlInitUnicodeString(&string, SourceString); 65 66 return Assign(&string); 67 } 68