Skip to content

GetStdHandle shouldn't return a CloseHandleSafeHandle #91

@sfiruch

Description

@sfiruch

Standard output handles should rarely be closed. Here's Raymond Chen's explanation. Thus, the proper way to use GetStdHandle is by combining it with DangerousAddRef:

var handle = PInvoke.GetStdHandle(STD_HANDLE_TYPE.STD_OUTPUT_HANDLE);
bool ignore=default;
handle.DangerousAddRef(ref ignore);

This could be simplified if GetStdHandle wouldn't return a CloseHandleSafeHandle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedThis issue cannot be fixed without first a change to a dependencyenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions