Skip to content

Commit

Permalink
Follow partial suggestions from mingkuang.
Browse files Browse the repository at this point in the history
  • Loading branch information
MouriNaruto committed Jun 22, 2024
1 parent 9a97c4b commit 2c005fc
Show file tree
Hide file tree
Showing 2 changed files with 361 additions and 353 deletions.
77 changes: 40 additions & 37 deletions src/Shared/hstring_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,49 @@
* @remark The following definitions are dumped from the debug symbol from the
* Windows 10 Build 14347's combase.dll.
*/
namespace YY::Thunks::internal
{
/*
* @brief The flags of the Windows Runtime String.
* @remark Originally it's a C/C++ enum in the debug symbols. But we changed
* the definition to macro for reducing the C++ implicit cast
* operations to make both compiler and maintainer happily.
*/
#ifndef WINDOWS_RUNTIME_HSTRING_FLAGS
#define WINDOWS_RUNTIME_HSTRING_FLAGS

/*
* @brief The flags of the Windows Runtime String.
* @remark Originally it's a C/C++ enum in the debug symbols. But we changed the
* definition to macro for reducing the C++ implicit cast operations to
* make both compiler and maintainer happily.
*/
#ifndef WINDOWS_RUNTIME_HSTRING_FLAGS
#define WINDOWS_RUNTIME_HSTRING_FLAGS

#define WRHF_NONE 0x00000000
#define WRHF_STRING_REFERENCE 0x00000001
#define WRHF_VALID_UNICODE_FORMAT_INFO 0x00000002
#define WRHF_WELL_FORMED_UNICODE 0x00000004
#define WRHF_HAS_EMBEDDED_NULLS 0x00000008
#define WRHF_EMBEDDED_NULLS_COMPUTED 0x00000010
#define WRHF_RESERVED_FOR_PREALLOCATED_STRING_BUFFER 0x80000000
#define WRHF_NONE 0x00000000
#define WRHF_STRING_REFERENCE 0x00000001
#define WRHF_VALID_UNICODE_FORMAT_INFO 0x00000002
#define WRHF_WELL_FORMED_UNICODE 0x00000004
#define WRHF_HAS_EMBEDDED_NULLS 0x00000008
#define WRHF_EMBEDDED_NULLS_COMPUTED 0x00000010
#define WRHF_RESERVED_FOR_PREALLOCATED_STRING_BUFFER 0x80000000

#endif // !WINDOWS_RUNTIME_HSTRING_FLAGS
#endif // !WINDOWS_RUNTIME_HSTRING_FLAGS

/*
* @brief The internal structure of Windows Runtime String header.
*/
typedef struct _HSTRING_HEADER_INTERNAL
{
UINT32 Flags;
UINT32 Length;
UINT32 Padding1;
UINT32 Padding2;
PCWSTR StringRef;
} HSTRING_HEADER_INTERNAL, *PHSTRING_HEADER_INTERNAL;
/*
* @brief The internal structure of Windows Runtime String header.
*/
typedef struct _HSTRING_HEADER_INTERNAL
{
UINT32 Flags;
UINT32 Length;
UINT32 Padding1;
UINT32 Padding2;
PCWSTR StringRef;
} HSTRING_HEADER_INTERNAL, *PHSTRING_HEADER_INTERNAL;
static_assert(sizeof(HSTRING_HEADER) == sizeof(HSTRING_HEADER_INTERNAL));

/*
* @brief The internal structure of heap allocated Windows Runtime String.
*/
typedef struct _STRING_OPAQUE
{
HSTRING_HEADER_INTERNAL Header;
volatile INT RefCount;
WCHAR String[ANYSIZE_ARRAY];
} STRING_OPAQUE, *PSTRING_OPAQUE;
/*
* @brief The internal structure of heap allocated Windows Runtime String.
*/
typedef struct _STRING_OPAQUE
{
HSTRING_HEADER_INTERNAL Header;
volatile INT RefCount;
WCHAR String[ANYSIZE_ARRAY];
} STRING_OPAQUE, *PSTRING_OPAQUE;
}

#endif // !YY_THUNKS_HSTRING_PRIVATE
Loading

0 comments on commit 2c005fc

Please sign in to comment.