Detecting empty pipes

Hi Everyone,

I am trying to detect if a pipe is empty and I am using the following code:

status = ZwQueryInformationFile(hFile,
&iostatus,
&pipeData,
sizeof(pipeData),
FilePipeLocalInformation);

if(status == STATUS_SUCCESS) {
if((pipeData.WriteQuotaAvailable == pipeData.OutboundQuota) &&
(pipeData.ReadDataAvailable == 0)) {
DbgPrint(“I am empty\n”);
}
}

Is this correct?

Thanks.

–Sam