郁金香灬老师 游戏安全  驱动 逆向调试 C/C++编程  脚本 UE4/UE5

找回密码
立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
发新帖
课程大纲和价格
官方联系方式2024在线课大纲QQ咨询

34万

积分

131

好友

145

主题
发表于 2024-8-14 21:20:21 | 查看: 590| 回复: 0
其中,UObjectBase 提供了四个核心属性:
typedef struct _UObjectBase
{
PVOID vftable;
EObjectFlags        ObjectFlags; //UINT32 用于跟踪和报告各种对象状态的标志。这需要在32位上对齐8字节减少内存浪费的平台
UINT32 InternalIndex;//对象在全局表中的唯一索引
_UObjectBase* ClassPrivate;//对象的 UClass 类型
FName NamePrivate ;//对象名,也是全局唯一
_UObjectBase* OuterPrivate;//对象所属的 Outer 对象,即对象所在的 UPackage
UObjectBaseUtility 没有额外属性,提供了一系列引擎内部使用的方法,我们不必太关心。
...
}UObjectBase

数量=00000001,对象[0006][6724F]=0000018BC4E61A80 ID64=25AA318, 名字=CharacterSelectButton  line=214
数量=00000002,对象[0006][672A5]=0000018BC4E6B380 ID64=25AA318, 名字=CharacterSelectButton  line=214
0000018BC4E61A80                                                                         
$ ==>             00007FF6BC7C68A8   
$+8               0006724F 00000008   
$+10              0000018B50765100   
$+18              00000000025AA318   
$+20              0000018BE7AC4A20   
$+28              0000018BBDD45080   
                                                                         
0000018BC4E6B380                    
$ ==>             00007FF6BC7C68A8  
$+8               000672A5 00280008  
$+10              0000018B50765100  
$+18              00000000025AA318  
$+20              0000018B42A99AF0  
$+28              0000018A50A28680  


enum EObjectFlags
{
        // Do not add new flags unless they truly belong here. There are alternatives.
        // if you change any the bit of any of the RF_Load flags, then you will need legacy serialization
        RF_NoFlags                                                = 0x00000000,        ///< No flags, used to avoid a cast

        // This first group of flags mostly has to do with what kind of object it is. Other than transient, these are the persistent object flags.
        // The garbage collector also tends to look at these.
        RF_Public                                        =0x00000001,        ///< Object is visible outside its package.
        RF_Standalone                                =0x00000002,        ///< Keep object around for editing even if unreferenced.
        RF_MarkAsNative                                =0x00000004,        ///< Object (UField) will be marked as native on construction (DO NOT USE THIS FLAG in HasAnyFlags() etc)
        RF_Transactional                        =0x00000008,        ///< Object is transactional. 对象是事务性的。
        RF_ClassDefaultObject                =0x00000010,        ///< This object is its class's default object
        RF_ArchetypeObject                        =0x00000020,        ///< This object is a template for another object - treat like a class default object
        RF_Transient                                =0x00000040,        ///< Don't save object. //对象不能被保存

        // This group of flags is primarily concerned with garbage collection.
        RF_MarkAsRootSet                                        =0x00000080,        ///< Object will be marked as root set on construction and not be garbage collected, even if unreferenced (DO NOT USE THIS FLAG in HasAnyFlags() etc)
        RF_TagGarbageTemp                        =0x00000100,        ///< This is a temp user flag for various utilities that need to use the garbage collector. The garbage collector itself does not interpret it.

        // 这组标志追踪一个对象生命周期的各个阶段   //The group of flags tracks the stages of the lifetime of a uobject
        // 此对象尚未完成初始化过程。~FObjectInitializer完成时清除
        RF_NeedInitialization                =0x00000200,        ///< This object has not completed its initialization process. Cleared when ~FObjectInitializer completes
        //正在加载过程中,表示对象需要加载。
        RF_NeedLoad                                        =0x00000400,        ///< During load, indicates object needs loading.
        //在垃圾回收过程中保留此对象,因为它仍在被炊具使用
        RF_KeepForCooker                        =0x00000800,        ///< Keep this object during garbage collection because it's still being used by the cooker
        //对象需要预加载再使用?
        RF_NeedPostLoad                                =0x00001000,        ///< Object needs to be postloaded.
        //在加载过程中,表示对象仍需要实例化子对象并修复序列化的组件引用
        RF_NeedPostLoadSubobjects        =0x00002000,        ///< During load, indicates that the object still needs to instance subobjects and fixup serialized component references
        //由于其所有者包被重新加载,对象已被遗忘,目前存在较新版本
        RF_NewerVersionExists                =0x00004000,        ///< Object has been consigned to oblivion due to its owner package being reloaded, and a newer version currently exists
        //开始销毁对象
        RF_BeginDestroyed                        =0x00008000,        ///< BeginDestroy has been called on the object.
        //完成销毁对象
        RF_FinishDestroyed                        =0x00010000,        ///< FinishDestroy has been called on the object.

        // Misc. Flags
        //标记在用于创建UClass的UObjects上(例如蓝图),同时它们在加载时重新生成其UClass(请参阅FLinkerLoad::CreateExport()),以及在创建过程中的UClass对象
        RF_BeingRegenerated                        =0x00020000,        ///< Flagged on UObjects that are used to create UClasses (e.g. Blueprints) while they are regenerating their UClass on load (See FLinkerLoad::CreateExport()), as well as UClass objects in the midst of being created
        RF_DefaultSubObject                        =0x00040000,        ///< Flagged on subobjects that are defaults
        //////<标记 该UObjects 为已加载
        RF_WasLoaded                                =0x00080000,        ///< Flagged on UObjects that were loaded
        //不要将对象导出为文本形式(例如复制/粘贴)。通常用于可以从其父对象中的数据重新生成的子对象。
        RF_TextExportTransient                =0x00100000,        ///< Do not export object to text form (e.g. copy/paste). Generally used for sub-objects that can be regenerated from data in their parent object.
        //<对象已被linkerload完全序列化至少一次。请勿使用此标志,应将其替换为 RF_WasLoaded。
        RF_LoadCompleted                        =0x00200000,        ///< Object has been completely serialized by linkerload at least once. DO NOT USE THIS FLAG, It should be replaced with RF_WasLoaded.
        RF_InheritableComponentTemplate = 0x00400000, ///< Archetype of the object can be in its super class
        ///<对象不应包含在任何类型的复制中(复制/粘贴、二进制复制等)
        RF_DuplicateTransient                =0x00800000,        ///< Object should not be included in any type of duplication (copy/paste, binary duplication, etc.)
        RF_StrongRefOnFrame                        =0x01000000,        ///< References to this object from persistent function frame are handled as strong ones.
        //对象不应包含在复制中,除非它是为PIE会话复制的
        RF_NonPIEDuplicateTransient        =0x02000000,        ///< Object should not be included for duplication unless it's being duplicated for a PIE session
        RF_Dynamic                                        =0x04000000,        ///< Field Only. Dynamic field - doesn't get constructed during static initialization, can be constructed multiple times
        RF_WillBeLoaded                                =0x08000000,        ///< This object was constructed during load and will be loaded shortly
        RF_HasExternalPackage                =0x10000000,        ///< This object has an external package assigned and should look it up when getting the outermost package
};




UObject 扩展出了一些生命周期方法,以及最重要的序列化方法 Serialize(),
调用 UObject#Serialize() 即可完成对象的序列化或反序列化。
另外全局对象表代码在 /Source/Runtime/CoreUObject/Private/UObject/UObjectHash.cpp,进入文件我们可以找到两个关键类:
FUObjectArray
FUObjectHashTables


        /** Flags used to track and report various object states. This needs to be 8 byte aligned on 32-bit
            platforms to reduce memory waste */
        EObjectFlags                                        ObjectFlags;

        /** Index into GObjectArray...very private. */
        int32                                                        InternalIndex;

        /** Class the object belongs to. */
        UClass*                                                        ClassPrivate;

        /** Name of this object */
        FName                                                        NamePrivate;

        /** Object this object resides in. */
        UObject*                                                OuterPrivate;

游戏安全课程 学员办理咨询联系QQ150330575 手机 139 9636 2600  免费课程 在 www.bilibili.com 搜 郁金香灬老师
您需要登录后才可以回帖 登录 | 立即注册

QQ咨询

QQ|Archiver|手机版|小黑屋|郁金香游戏技术

GMT+8, 2024-11-23 01:42 , Processed in 0.090716 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表