This is C4055 Warning message.
‘conversion’ : from data pointer ‘type1’ to function pointer ‘type2’
A data pointer is cast (possibly incorrectly) to a function pointer.
This is a level 1 warning under /Za and a level 4 warning under /Ze.
How do we resolve this warning?(By correct way, not a trick)
Edit:
This is a code snippet has warning.
typedef NTSTATUS (*t_ObRegisterCallbacks)
(
IN POB_CALLBACK_REGISTRATION CallBackRegistration,
OUT PVOID *RegistrationHandle
);
t_ObRegisterCallbacks g_ObRegisterCallbacks = NULL;
void foo()
{
g_ObRegisterCallbacks = (t_ObRegisterCallbacks)MmGetSystemRoutineAddress(®Name); //C4055
}
//warning C4055: 'type cast' : from data pointer 'PVOID' to function pointer 't_ObRegisterCallbacks'
The WDK header files are not that clean. The return type for MmGetSystemRoutineAddress() should have been declare FARPROC instead of PVOID. Still, that doesn’t matter on any machine for which you’d write device drivers with the WDK, a void* is convertible to a function address without problems, data and code pointers have the same size on 32- and 64-bit platforms. It is going to be a cold day in hell when we ever get that segmented memory model misery back.
I recommend you simply turn off the warning with #pragma warning(disable:4055)