Close previous handle on sharing conflict

Is there a way to have an existing file handle closed if another attempt is made to open the file with a different sharing mode?

The reason for this is that I would like certain files opened by my application, which aren’t owned by my application, to never cause another application to fail when it attempts to open the same file.

Thanks,
Jeremy Boschen

I am not sure if this is a good idea at all.
The sharing concept in Windows exists for a reason, maybe
you manage to override it, but you mess the OS functionalty
by another way.

L.

You could go the other way around…write a filter that blocks other
application’s IRP_MJ_CREATE, while your application has files open.

schrieb im Newsbeitrag news:xxxxx@ntfsd…
> Is there a way to have an existing file handle closed if another attempt
> is made to open the file with a different sharing mode?
>
> The reason for this is that I would like certain files opened by my
> application, which aren’t owned by my application, to never cause another
> application to fail when it attempts to open the same file.
>
> Thanks,
> Jeremy Boschen
>

I remembered seeing something related to closing a file handle on some kind
of conflict but couldn’t locate it in the current DDK/WDK releases so I
thought I’d ask. Turns out it was MARK_HANDLE_CLOSE_ON_CONFLICT from the Feb
CTP WDK, but it has to do with renames and not sharing.

  • Jeremy Boschen

“Ladislav Zezula” wrote in message news:xxxxx@ntfsd…
>I am not sure if this is a good idea at all.
> The sharing concept in Windows exists for a reason, maybe
> you manage to override it, but you mess the OS functionalty
> by another way.
>
> L.
>