How do we resolve warning C4055?

This is warning C4055.

'conversion': from data pointer 'type1' to function pointer 'type2'
    The data pointer is mapped (possibly incorrectly) to the function pointer.
    This is a level 1 warning under / Za and a level 4 warning in the / Ze section.

How do we resolve this warning? (In the right way, not a trick)

Edit:

There is a warning in this code snippet.

typedef NTSTATUS (*t_ObRegisterCallbacks)
(
  IN POB_CALLBACK_REGISTRATION CallBackRegistration,
  OUT PVOID *RegistrationHandle
);

t_ObRegisterCallbacks   g_ObRegisterCallbacks = NULL;

void foo()
{
  g_ObRegisterCallbacks = (t_ObRegisterCallbacks)MmGetSystemRoutineAddress(&regName); //C4055
}
//warning C4055: 'type cast' : from data pointer 'PVOID' to function pointer 't_ObRegisterCallbacks'
+3
source share
2 answers

WDK . MmGetSystemRoutineAddress() FARPROC PVOID. , , WDK, void * , 32- 64- , , - .

#pragma (: 4055)

+10

. union hack : union, , . , , .

, (dlsym - ), , , .

+7

Source: https://habr.com/ru/post/1735714/


All Articles