mirror of
https://github.com/reactos/reactos.git
synced 2026-06-04 18:30:41 +08:00
[WDF] Add Windows Driver Framework files
Takern from Microsoft GitHub repo:
d9c6040fe9
Licensed under MIT
This commit is contained in:
67
sdk/lib/drivers/wdf/shared/support/fxstring.cpp
Normal file
67
sdk/lib/drivers/wdf/shared/support/fxstring.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
FxString.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
This module implements a simple string class to operate on
|
||||
unicode strings.
|
||||
|
||||
Author:
|
||||
|
||||
|
||||
|
||||
Environment:
|
||||
|
||||
Both kernel and user mode
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
|
||||
#include "FxSupportPch.hpp"
|
||||
|
||||
FxString::FxString(
|
||||
__in PFX_DRIVER_GLOBALS FxDriverGlobals
|
||||
) :
|
||||
FxObject(FX_TYPE_STRING, sizeof(FxString), FxDriverGlobals)
|
||||
{
|
||||
RtlInitUnicodeString(&m_UnicodeString, NULL);
|
||||
MarkPassiveDispose(ObjectDoNotLock);
|
||||
}
|
||||
|
||||
FxString::~FxString()
|
||||
{
|
||||
if (m_UnicodeString.Buffer) {
|
||||
FxPoolFree(m_UnicodeString.Buffer);
|
||||
}
|
||||
}
|
||||
|
||||
_Must_inspect_result_
|
||||
NTSTATUS
|
||||
FxString::Assign(
|
||||
__in const UNICODE_STRING* UnicodeString
|
||||
)
|
||||
{
|
||||
return FxDuplicateUnicodeString(GetDriverGlobals(),
|
||||
UnicodeString,
|
||||
&m_UnicodeString);
|
||||
}
|
||||
|
||||
_Must_inspect_result_
|
||||
NTSTATUS
|
||||
FxString::Assign(
|
||||
__in PCWSTR SourceString
|
||||
)
|
||||
|
||||
{
|
||||
UNICODE_STRING string;
|
||||
|
||||
RtlInitUnicodeString(&string, SourceString);
|
||||
|
||||
return Assign(&string);
|
||||
}
|
||||
Reference in New Issue
Block a user