Giter Club home page Giter Club logo

Comments (6)

SpartanJ avatar SpartanJ commented on June 26, 2024 1

That's a totally reasonable request. I've got to think of a good API for that and make it as a non-breaking change. If you have some minutes can you open a ticket for this specific feature request? Thanks

from efsw.

huyi51462 avatar huyi51462 commented on June 26, 2024

When you first call ReadDirectoryChangesW, the system allocates a buffer to store change information. This buffer is associated with the directory handle until it is closed and its size does not change during its lifetime. Directory changes that occur between calls to this function are added to the buffer and then returned with the next call. If the buffer overflows, ReadDirectoryChangesW will still return true, but the entire contents of the buffer are discarded and the lpBytesReturned parameter will be zero, which indicates that your buffer was too small to hold all of the changes that occurred.

The buffer is too small for changes that need to monitor a large number of files.

from efsw.

SpartanJ avatar SpartanJ commented on June 26, 2024

The buffer size was limited because of an old Windows bug, at least that's what it says in the code:

BYTE Buffer[63 * 1024]; // do NOT make this bigger than 64K because it will fail if the folder being watched is on the network! (see http://msdn.microsoft.com/en-us/library/windows/desktop/aa365465(v=vs.85).aspx)

I can probably increase the buffer size.
I will take a look at this issue. Here are some remarks in the documentation:
https://docs.microsoft.com/en-gb/windows/win32/api/winbase/nf-winbase-readdirectorychangesw?redirectedfrom=MSDN#remarks

from efsw.

huyi51462 avatar huyi51462 commented on June 26, 2024

The buffer size was limited because of an old Windows bug, at least that's what it says in the code:
I can probably increase the buffer size.

Yes, what occupies this buffer is actually the string of the file path,so in the case of a large number of files or many long path files, 64k is too small.

from efsw.

solarispika avatar solarispika commented on June 26, 2024

In the current implementation, it seems impossible to determine whether the ReadDirectoryChangesW() call has failed or not. Is it possible to provide users with information about any failures, so they can react accordingly?
Another suggestion could be to allow users to specify the buffer size or provide the buffer themselves, enabling them to tailor it to their needs. In this way, the onus is on the users to customize the buffer as necessary.

from efsw.

SpartanJ avatar SpartanJ commented on June 26, 2024

This issues has been fixes thanks to the @r00tcxx contribution in this PR. :)

from efsw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.