Greetinx!
Here your code:
PIOCTLPARAMS p;
char buf[128];
_snprintf (buf, 128, "IOCTL is: %i", p->dioc_IOCtlCode);
and where are you allocate memory for IOCTLPARAMS structure?
So if not you must allocate memory and define parameters of the structure.
Happy programming!))