printf("Device name length chosen: %d\n", (LONG *)arguments[0]);
/N are *pointer* to LONG value, not LONG itself, or else there would be no way to enter 0.
So, to make it work, reference the pointer (with '*'):
printf("Device name length chosen: %d\n", *(LONG *)arguments[0]);
Or to make it more readable:
LONG *longptr;
longptr = (LONG *) arguments[0];
printf("Device name length chosen: %d\n", *longptr);