This repository has been archived on 2024-06-01. You can view files and clone it, but cannot push or open issues or pull requests.
cathook/include/vfunc.hpp
2017-12-02 17:44:05 +03:00

19 lines
355 B
C++

/*
* vfunc.h
*
* Created on: Jan 8, 2017
* Author: nullifiedcat
*/
#ifndef VFUNC_HPP_
#define VFUNC_HPP_
template <typename F>
inline F vfunc(void *thisptr, uintptr_t idx, uintptr_t offset = 0)
{
void **vmt = *reinterpret_cast<void ***>(uintptr_t(thisptr) + offset);
return reinterpret_cast<F>((vmt)[idx]);
}
#endif /* VFUNC_HPP_ */