mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 00:32:57 +00:00
[WDF] Add Windows Driver Framework files
Takern from Microsoft GitHub repo:
d9c6040fe9
Licensed under MIT
This commit is contained in:
parent
545df81502
commit
8a978a179f
475 changed files with 285099 additions and 0 deletions
152
sdk/lib/drivers/wdf/shared/inc/private/common/fxstring.hpp
Normal file
152
sdk/lib/drivers/wdf/shared/inc/private/common/fxstring.hpp
Normal file
|
@ -0,0 +1,152 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
FxString.hpp
|
||||
|
||||
Abstract:
|
||||
|
||||
This module implements a simple string class to operate on
|
||||
unicode strings.
|
||||
|
||||
Author:
|
||||
|
||||
|
||||
|
||||
|
||||
Environment:
|
||||
|
||||
Both kernel and user mode
|
||||
|
||||
Revision History:
|
||||
|
||||
|
||||
--*/
|
||||
#ifndef _FXSTRING_H_
|
||||
#define _FXSTRING_H_
|
||||
|
||||
class FxString : public FxObject {
|
||||
public:
|
||||
//
|
||||
// Length describes the length of the string in bytes (not WCHARs)
|
||||
// MaximumLength describes the size of the buffer in bytes
|
||||
//
|
||||
UNICODE_STRING m_UnicodeString;
|
||||
|
||||
public:
|
||||
FxString(
|
||||
__in PFX_DRIVER_GLOBALS FxDriverGlobals
|
||||
);
|
||||
|
||||
~FxString();
|
||||
|
||||
VOID
|
||||
__inline
|
||||
ReleaseString(
|
||||
__out PUNICODE_STRING ReleaseTo
|
||||
)
|
||||
{
|
||||
RtlCopyMemory(ReleaseTo, &m_UnicodeString, sizeof(UNICODE_STRING));
|
||||
RtlZeroMemory(&m_UnicodeString, sizeof(m_UnicodeString));
|
||||
}
|
||||
|
||||
__inline
|
||||
operator PUNICODE_STRING(
|
||||
)
|
||||
{
|
||||
return &m_UnicodeString;
|
||||
}
|
||||
|
||||
PUNICODE_STRING
|
||||
__inline
|
||||
GetUnicodeString(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return &m_UnicodeString;
|
||||
}
|
||||
|
||||
_Must_inspect_result_
|
||||
NTSTATUS
|
||||
Assign(
|
||||
__in PCWSTR SourceString
|
||||
);
|
||||
|
||||
_Must_inspect_result_
|
||||
NTSTATUS
|
||||
Assign(
|
||||
__in const UNICODE_STRING* UnicodeString
|
||||
);
|
||||
|
||||
__inline
|
||||
USHORT
|
||||
Length(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return m_UnicodeString.Length;
|
||||
}
|
||||
|
||||
__inline
|
||||
USHORT
|
||||
ByteLength(
|
||||
__in BOOLEAN IncludeNull
|
||||
)
|
||||
{
|
||||
if (IncludeNull) {
|
||||
return m_UnicodeString.Length + sizeof(UNICODE_NULL);
|
||||
}
|
||||
else {
|
||||
return m_UnicodeString.Length;
|
||||
}
|
||||
}
|
||||
|
||||
__inline
|
||||
USHORT
|
||||
CharacterLength(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return m_UnicodeString.Length / sizeof(WCHAR);
|
||||
}
|
||||
|
||||
__inline
|
||||
USHORT
|
||||
MaximumLength(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return m_UnicodeString.MaximumLength;
|
||||
}
|
||||
|
||||
__inline
|
||||
USHORT
|
||||
MaximumByteLength(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return m_UnicodeString.MaximumLength;
|
||||
}
|
||||
|
||||
__inline
|
||||
USHORT
|
||||
MaximumCharacterLength(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return m_UnicodeString.MaximumLength / sizeof(WCHAR);
|
||||
}
|
||||
|
||||
__inline
|
||||
PWCHAR
|
||||
Buffer(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return m_UnicodeString.Buffer;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _FXSTRING_H_
|
Loading…
Add table
Add a link
Reference in a new issue