Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3029

Defined as a length of 1 to avoid compiler warning

$
0
0
Hi all,
the subject is a cryptic (for me) comment found in a MS struct declaration that can be found in winbio_ioctl.h:

Code:

// The WINBIO_DATA structure associates a length, in
// bytes, with an arbitrary block of contiguous memory.
//
typedef struct _WINBIO_DATA{
    DWORD Size;
    BYTE Data[1]; // Defined as a length of 1 to avoid compiler warning.
} WINBIO_DATA, *PWINBIO_DATA;

...

//
// A container for biometric captured data.
// OUT payload for IOCTL_BIOMETRIC_CAPTURE_DATA
//
typedef struct _WINBIO_CAPTURE_DATA {
    DWORD PayloadSize;
    HRESULT WinBioHresult;
    WINBIO_SENSOR_STATUS SensorStatus;
    WINBIO_REJECT_DETAIL RejectDetail;
    WINBIO_DATA CaptureData;
} WINBIO_CAPTURE_DATA, *PWINBIO_CAPTURE_DATA;

When it's time to assign some memory to "Data" how can I proceed?

For example I've the following:

PWINBIO_CAPTURE_DATA captureData = NULL;
BYTE CaptureBuffer[1000];
...
GetIoRequestParams(FxRequest,
&controlCode,
(PUCHAR *)&captureParams,
&inputBufferSize,
(PUCHAR *)&captureData,
&outputBufferSize);
...
captureData->CaptureData.Size = 1000;
captureData->CaptureData.Data = CaptureBuffer;

The last line generate an error (expression must be a modifiable lvalue) and I cannot understand how can I assign memory to that BYTE Data[1] array...

Thank a lot!
Dadeur

Viewing all articles
Browse latest Browse all 3029

Latest Images

Trending Articles



Latest Images