I have a function with a certain number of parameters. But I need to avoid calling any parameter in the function body:
void MyClass::MyMethod(int32 parm1, FString parm2, UObject* parm3) { void* firstParmPtr = ?; // как мне получить указатель? Где находится адрес первого параметра? } The value of the firstParmPtr pointer must be equal to &parm1 .
Found an interesting moment. Arguments are on the stack, as are new variables. Thus, I can define one variable in the function body and subtract the size of all function arguments (there is a way to do it).
void MyClass::MyMethod(int32 parm1, FString parm2, UObject* parm3) { uint64 _framePtr; UFunction* func = FindFunction("MyMethod"); void* firstParmPtr = &_framePtr - func->ParamsSize; // Вроде оно... } However, this option does not work. _framePtr too far in the stack from the parameter list. Much more than the sizeof each parameter. Then how should I act? Maybe you need to subtract some more constant?
Need any information about this. And the address of the return value is also interesting. And it is also desirable without the use of assembly inserts. Although it is possible and their, but this is not the main object of interest, since I can not compile this.
thisparameter. And now, if you can - the main question - why? This is a serious question, because maybe you are just asking how to hold the microscope correctly in order to hammer in nails, and it would be right to ask - how to hammer nails in? Maybe your main task is solved in a completely different way? - Harry