#define how do I do this in c#?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

#define FILE_DEVICE_FTE 0x8001
#define FTE_IOCTL_INDEX 0x800

#define FTE_CTL_CF_XMIT CTL_CODE(FILE_DEVICE_FTE, FTE_IOCTL_INDEX +31,
METHOD_BUFFERED, FILE_ANY_ACCESS)

Any help are appreciated
 
In C# you cannot define a variable or macro the way you
did in your example.

#defines are pretty much only used for defining symbols
for use in conditional compilation.

For the actual values, you could simply define them as
regular constant variables within the class they will be
used.

As for the function call, you would need to locate what
function that is and pinvoke against it or otherwise
define it on your own.

If I am not mistaken, CTL_CODE ends up being:

static uint CTL_CODE(uint DeviceType, uint Function, uint
Method, uint Access)
{
return ((DeviceType) << 16) | ((Access) << 14) |
((Function) << 2) | (Method);
}

Hope that helps,
Brendan
 
Back
Top