Initial
This commit is contained in:
34
socket/PROCADDR.TPP
Normal file
34
socket/PROCADDR.TPP
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
template <class T>
|
||||
ProcAddress<T>::ProcAddress(void)
|
||||
{
|
||||
}
|
||||
|
||||
template <class T>
|
||||
ProcAddress<T>::~ProcAddress()
|
||||
{
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
template <class T>
|
||||
int ProcAddress<T>::getProcAddress(LPFNMETHODVOID lpfnMethod)
|
||||
{
|
||||
typedef BOOL (*LPFNPROCVOID)(void);
|
||||
int methodAddress=*((int*)&lpfnMethod);
|
||||
return methodAddress;
|
||||
}
|
||||
#else
|
||||
template <class T>
|
||||
int ProcAddress<T>::getProcAddress(void (T::* /*lpfnMethod*/ )(void))
|
||||
{
|
||||
typedef BOOL (*LPFNPROCVOID)(void);
|
||||
int methodAddress;
|
||||
char assign[]={0x8B,0x5D,0x0C,0xC3};
|
||||
char address[]={0x00,0x00,0x00,0x00};
|
||||
*((DWORD*)address)=(DWORD)((DWORD*)assign);
|
||||
((LPFNPROCVOID)address)();
|
||||
return methodAddress;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user