Files
Work/socket/HOOKER.HPP
2024-08-07 09:16:27 -04:00

44 lines
998 B
C++

#ifndef _SOCKET_BLOCKHOOKER_HPP_
#define _SOCKET_BLOCKHOOKER_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_CODEGEN_HPP_
#include <common/codegen.hpp>
#endif
#ifndef _COMMON_CALLBACK_HPP_
#include <common/callback.hpp>
#endif
#ifndef _SOCKET_PROCADDRESS_HPP_
#include <socket/procaddr.hpp>
#endif
class BlockHooker
{
public:
BlockHooker(void);
virtual ~BlockHooker();
BOOL hookBlock(void);
BOOL unhookBlock(void);
BOOL cancelBlocking(void);
void setHandler(PureCallback *lpCallback);
private:
BlockHooker(const BlockHooker &someBlockHooker);
BlockHooker &operator=(const BlockHooker &someBlockHooker);
BOOL operator==(const BlockHooker &someBlockHooker)const;
BOOL cancelBlockingCall(void);
BOOL isBlocking(void);
BOOL hookProc(void);
BOOL yield(void);
CodeGen mCodeGenerator;
BOOL mIsHooked;
CallbackPointer mCallback;
};
inline
void BlockHooker::setHandler(PureCallback *lpCallback)
{
mCallback=CallbackPointer(lpCallback);
}
#endif