2

I am passing a structure from application to the driver through deviceiocontrol function.

The structure has only two members.

struct Buff
{
   BYTE * bPtr;
   UINT   uiSize; 
}BuffVar;

I assign a pointer and size and pass the address of the structure to the driver.

On the driver I create pointers to the structure (I have the structure shared between app and driver) and access the values from the user passed buffer. When I access the pointer I get the correct value, but the size value is always a junk data. It is a 64bit platform I am working with. When I compile the application with WDK, it works perfectly, when I use visual studio I face this problem. I m new to this environment. Has any one faced such kind of issue? Any help is highly appreciated.

Regards, Abhiram

seva titov
  • 11,720
  • 2
  • 35
  • 54
  • I can't help with drivers and/or WDK, but perhaps comparing sizeof() and offsetof() on the client side and driver side will shed some light. Try: `sizeof(struct Buff)` and `offsetof(Buff, uiSize)` – cbranch Sep 10 '12 at 05:20

0 Answers0