/
/
At engine_struct.h
static constexpr uint32_t FNameMaxBlockBits
=
13
;
static constexpr uint32_t FNameBlockOffsetBits
=
16
;
static constexpr uint32_t FNameMaxBlocks
=
1
<< FNameMaxBlockBits;
static constexpr uint32_t FNameBlockOffsets
=
1
<< FNameBlockOffsetBits;
struct FNameEntryId;
struct FNameEntryHandle;
struct FNameEntryHeader;
struct FNameEntry;
class
FNameEntryAllocator;
class
FNamePool;
class
FName;
struct FNameEntryId
{
public:
uint32_t ToUnstableInt() const {
return
Value; }
static FNameEntryId FromUnstableInt(uint32_t Value)
{
FNameEntryId
Id
;
Id
.Value
=
Value;
return
Id
;
}
private:
uint32_t Value;
};
struct FNameEntryHandle
{
uint32_t Block
=
0
;
uint32_t Offset
=
0
;
FNameEntryHandle(uint32_t InBlock, uint32_t InOffset)
: Block(InBlock)
, Offset(InOffset)
{}
FNameEntryHandle(FNameEntryId
Id
)
: Block(
Id
.ToUnstableInt() >> FNameBlockOffsetBits)
, Offset(
Id
.ToUnstableInt()& (FNameBlockOffsets
-
1
))
{}
operator FNameEntryId() const
{
return
FNameEntryId::FromUnstableInt(Block << FNameBlockOffsetBits | Offset);
}
explicit operator
bool
() const {
return
Block | Offset; }
};
struct FNameEntryHeader
{
uint16_t bIsWide :
1
;
static constexpr uint32_t ProbeHashBits
=
5
;
uint16_t LowercaseProbeHash : ProbeHashBits;
uint16_t
Len
:
10
;
};
struct FNameEntry
{
private:
FNameEntryHeader Header;
union
{
char AnsiName[
1024
];
wchar_t WideName[
1024
];
};
public:
bool
isEmpty();
bool
isWide();
DWORD getHashValue();
DWORD getLength();
std::string getAnsiName();
std::wstring getWideName();
};
class
FNameEntryAllocator
{
private:
void
*
Lock;
/
/
底层就是void
*
Ptr
uint32_t CurrentBlock
=
0
;
uint32_t CurrentByteCursor
=
0
;
uint8_t
*
Blocks[FNameMaxBlocks]
=
{};
public:
enum { Stride
=
alignof(FNameEntry) };
enum { BlockSizeBytes
=
Stride
*
FNameBlockOffsets };
FNameEntry& Resolve(FNameEntryHandle Handle) const
{
return
*
reinterpret_cast<FNameEntry
*
>(Blocks[Handle.Block]
+
Stride
*
Handle.Offset);
}
};
class
FNamePool {
private:
enum { MaxENames
=
512
};
FNameEntryAllocator Entries;
public:
FNameEntry& Resolve(FNameEntryHandle Handle) const {
return
Entries.Resolve(Handle);
}
};
class
FName {
private:
FNamePool
*
GetNamePool()
{
return
reinterpret_cast<FNamePool
*
>((DWORD64)GetModuleHandleA(
"AAAA.exe"
)
+
0xA73DE80
);
}
FNameEntryId ComparisonIndex;
uint32_t Number;
public:
const FNameEntry
*
GetDisplayNameEntry()
{
return
&
reinterpret_cast<FNamePool
*
>(GetNamePool())
-
>Resolve(this
-
>ComparisonIndex);
}
};
/
/
At engine_struct.h
static constexpr uint32_t FNameMaxBlockBits
=
13
;
static constexpr uint32_t FNameBlockOffsetBits
=
16
;
static constexpr uint32_t FNameMaxBlocks
=
1
<< FNameMaxBlockBits;
static constexpr uint32_t FNameBlockOffsets
=
1
<< FNameBlockOffsetBits;
struct FNameEntryId;
struct FNameEntryHandle;
struct FNameEntryHeader;
struct FNameEntry;
class
FNameEntryAllocator;
class
FNamePool;
class
FName;
struct FNameEntryId
{
public:
uint32_t ToUnstableInt() const {
return
Value; }
static FNameEntryId FromUnstableInt(uint32_t Value)
{
FNameEntryId
Id
;
Id
.Value
=
Value;
return
Id
;
}
private:
uint32_t Value;
};
struct FNameEntryHandle
{
uint32_t Block
=
0
;
uint32_t Offset
=
0
;
FNameEntryHandle(uint32_t InBlock, uint32_t InOffset)
: Block(InBlock)
, Offset(InOffset)
{}
FNameEntryHandle(FNameEntryId
Id
)
: Block(
Id
.ToUnstableInt() >> FNameBlockOffsetBits)
, Offset(
Id
.ToUnstableInt()& (FNameBlockOffsets
-
1
))
{}
operator FNameEntryId() const
{
return
FNameEntryId::FromUnstableInt(Block << FNameBlockOffsetBits | Offset);
}
explicit operator
bool
() const {
return
Block | Offset; }
};
struct FNameEntryHeader
{
uint16_t bIsWide :
1
;
static constexpr uint32_t ProbeHashBits
=
5
;
uint16_t LowercaseProbeHash : ProbeHashBits;
uint16_t
Len
:
10
;
};
struct FNameEntry
{
private:
FNameEntryHeader Header;
union
{
char AnsiName[
1024
];
wchar_t WideName[
1024
];
};
public:
bool
isEmpty();
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)
最后于 2023-8-13 20:56
被Uioa编辑
,原因: 补充代码附件