[Omake] Lm_notify windows port,
unable to perform certain operations on monitored directory
Aleksey Nogin
nogin at metaprl.org
Sat Feb 2 14:00:36 PST 2008
On 21.01.2008 01:54, RABIH.ELCHAAR at sgam.com wrote:
> The problem that arises is the following:
>
> When monitoring directory A, under Windows, some operations are rendered
> infeasible, like renaming a file, or injecting some code (during
> compilation process).
>
> After some investigations, I cornered the problem to the fam_win32.c
> file, at line 367 in the CreateFile function
>
> /* Get a handle to the directory for synchronous operation */
>
> dir_handle = CreateFile(name,
> GENERIC_READ,
> FILE_SHARE_READ | FILE_SHARE_DELETE,
> NULL,
> OPEN_EXISTING,
> FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED,
> NULL);
>
> According to the MSDN documentation, the third argument, the
> dwShareMode, in order to respond to my needs should include also the
> FILE_SHARE_WRITE.
>
> When changing the code to
>
> dir_handle = CreateFile(name,
> GENERIC_READ,
> FILE_SHARE_READ | FILE_SHARE_DELETE | FILE_SHARE_WRITE,
> NULL,
> OPEN_EXISTING,
> FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED,
> NULL);
>
> Other processes are able to perform renaming and code injection (mainly
> in my case, embedding manifests).
>
> Is there a reason to justify that the FILE_SHARE_WRITE flag is not passed?
>
Thanks a lot for reporting this.
I talked to Jason (who is the author of this code) and he does not
remember why the FILE_SHARE_WRITE was omitted. I am planning to try
adding it back and checking if that creates any problems.
Aleksey
More information about the Omake
mailing list