Skip to content

Unhandled failure case for GetFileInformationByHandleEx when STD handles are pipes #43

@lacasseio

Description

@lacasseio

This Gradle issue expose an interesting system configuration which cause GetFileInformationByHandleEx to fail with ERROR_INVALID_FUNCTION under a scenario where the STD handles are pipes on, what appears to be, very specific driver usage. Unfortunately, the reproduction case is still unknown but I will document what have been found.

I could only successfully creating STD handles as pipe when running on mintty with Cygwin 3. However, even with this setup the GetFileInformationByHandleEx function succeeded properly. The most plausible answer for the API call to return invalid function error is the underlying driver doesn't handle the IRP sent to it or it simply fail for some other reason which cause the invalid function error to be returned. Assuming this is correct, the possible scenarios could be where custom drivers would be used which involves containers, some sort of virtualization, network drives or specialized hardware. It seems the Gradle errors is flaky which makes it harder to narrow the issue further.

A better alternative could be to use NtQueryObject API instead. I can't confirmed yet if the API goes through the driver. The feeling is it's a Kernel call that return information from the object store.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions