Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 11th, 2012  |  syntax: None  |  size: 0.78 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Why does DeviceIoControl prepend 12 bytes of information to the user-provided input buffer?
  2. const ULONG         ulBufferSize = sizeof( CONTROL_READ_DATA );
  3. unsigned char       pBuffer[sizeof(CONTROL_READ_DATA)];
  4. DWORD               dwBytesReturned;
  5. CONTROL_READ_DATA*  readData = (CONTROL_READ_DATA*)pBuffer;
  6.  
  7. readData->field1 = data;
  8. readData->field2 = moreData;
  9. // ... all fields filled in...
  10.  
  11. // Send IOCTLs into camera
  12. if( !::DeviceIoControl( hDevice,
  13.                         IOCTL_CUSTOM_000,
  14.                         &readData,
  15.                         ulBufferSize,
  16.                         &readData,
  17.                         ulBufferSize,
  18.                         &dwBytesReturned,
  19.                         NULL ) )
  20. {
  21.     dwError = ::GetLastError();
  22.     // Clean up here
  23.     return dwError;
  24. }