From: sds on
Is there a way to "inspect" a handle?
E.g., how do I figure out if the handle is open for output or input?
POSIX offers fcntl(fd,F_GETFL,0) which returns a flag which contains
the access mode.
Note that I do not want to write to the handle or read from it
(because I do not want to pollute the terminal with test i/o).
thanks.

PS. Thanks to Remy Lebeau for answering my previous question about
FormatMessage
From: Hugo gleaves on
Not sure of that info can be ascertained easily.

Why not look at this:

http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx

Let me know if this isn't sufficient, there may be some undocumented calls
NtXXX that can be used.

H



"sds" wrote:

> Is there a way to "inspect" a handle?
> E.g., how do I figure out if the handle is open for output or input?
> POSIX offers fcntl(fd,F_GETFL,0) which returns a flag which contains
> the access mode.
> Note that I do not want to write to the handle or read from it
> (because I do not want to pollute the terminal with test i/o).
> thanks.
>
> PS. Thanks to Remy Lebeau for answering my previous question about
> FormatMessage
>
From: sds on
On Oct 9, 2:47 pm, Hugo glea...(a)hotmail.com> <hugh<underbar> wrote:
> Not sure of that info can be ascertained easily.
>
> Why not look at this:
> http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx

this is a binary, I need to get this info inside my source code

> Let me know if this isn't sufficient, there may be some undocumented calls
> NtXXX that can be used.

yes, please!

> "sds" wrote:
> > Is there a way to "inspect" a handle?
> > E.g., how do I figure out if the handle is open for output or input?
> > POSIX offers fcntl(fd,F_GETFL,0) which returns a flag which contains
> > the access mode.
> > Note that I do not want to write to the handle or read from it
> >  (because I do not want to pollute the terminal with test i/o).

From: Remy Lebeau on

"sds" <sam.steingold(a)gmail.com> wrote in message
news:2d585cbb-6b29-4cd4-a6d2-4befb3d1e403(a)w19g2000yqk.googlegroups.com...

> this is a binary, I need to get this info inside my source code

Read the article again more carefully. It points you to information about
how the Handle app gets its information from the OS.

--
Remy Lebeau (TeamB)


From: Hugo gleaves on
OK, I've done this in C code myself, if I recall correctly it can be a
problem doing it from a 32-bit process running under 64-bit OS, but is
otherwise OK.

You need to enumerate all processes in the machine
(NtQuerySystemInformation), and pass in SystemHandleInformation as the
argiument (this is a constant with value 16 decimal).

See here for more:

http://forum.sysinternals.com/forum_posts.asp?TID=18892


"sds" wrote:

> On Oct 9, 2:47 pm, Hugo glea...(a)hotmail.com> <hugh<underbar> wrote:
> > Not sure of that info can be ascertained easily.
> >
> > Why not look at this:
> > http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx
>
> this is a binary, I need to get this info inside my source code
>
> > Let me know if this isn't sufficient, there may be some undocumented calls
> > NtXXX that can be used.
>
> yes, please!
>
> > "sds" wrote:
> > > Is there a way to "inspect" a handle?
> > > E.g., how do I figure out if the handle is open for output or input?
> > > POSIX offers fcntl(fd,F_GETFL,0) which returns a flag which contains
> > > the access mode.
> > > Note that I do not want to write to the handle or read from it
> > > (because I do not want to pollute the terminal with test i/o).
>
>
 |  Next  |  Last
Pages: 1 2
Prev: Custom Keyboard driver
Next: 86 Opinion Dsiconsolas.com