发点好玩的东西!
### MSVC编译器下的玩意!```cpp
#define OFFSET(n, t, o) \
__forceinline t& propGet##n() \
{\
return *(t*)((uintptr_t)this + o);\
}\
__forceinline t& propSet##n(const t& value) \
{\
return *(t*)((uintptr_t)this + o) = value;\
}\
\
__declspec(property(get = propGet##n, put = propSet##n)) t& n;\
class EPROCESS
{
public:
OFFSET(Length, uint32_t, 0x10);
};
int main()
{
EPROCESS* Process = (EPROCESS*)malloc(100);
Process->Length = 10;
printf("%X\n", Process->Length);
free(Process);
}
```
很不错,谢谢分享。。。
页:
[1]