Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
g3rzi opened this issue Jan 2, 2023 · 0 comments

Comments

@g3rzi
Copy link

g3rzi commented Jan 2, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant