Skip to content

Is there a way to check if a certain fields threw an exception when using NtFile.Open? #68

@g3rzi

Description

@g3rzi

I am using NtFileOpen on named pipes, sometimes some fields are throwing an exception while others are not:
image

Is there a way to check if a field threw an exception without using try..catch for every field?

For example, in the following code, we can get an object with fields that threw an exception:

namedPipeFileObject = (NtNamedPipeFileBase)NtFile.Open(obj_attributes, i_Access, i_ShareMode, i_Options);  
row.Cells[0].Value = namedPipeObject.NumberOfLinks;
row.Cells[1].Value = namedPipeObject.DirectoryGrantedAccess;
row.Cells[2].Value = namedPipeObject.GrantedAccess;
row.Cells[3].Value = namedPipeObject.GrantedAccessGeneric;    

But using try..catch for every field can be overkill, especially if we will go over all the fields.
Any suggestion how to handle it?

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