diff --git a/src/api/dirmonitor/win32.c b/src/api/dirmonitor/win32.c index 318fda3..c320b86 100644 --- a/src/api/dirmonitor/win32.c +++ b/src/api/dirmonitor/win32.c @@ -41,7 +41,7 @@ void deinit_dirmonitor(struct dirmonitor_internal* monitor) { int translate_changes_dirmonitor(struct dirmonitor_internal* monitor, char* buffer, int buffer_size, int (*change_callback)(int, const char*, void*), void* data) { for (FILE_NOTIFY_INFORMATION* info = (FILE_NOTIFY_INFORMATION*)buffer; (char*)info < buffer + buffer_size; info = (FILE_NOTIFY_INFORMATION*)(((char*)info) + info->NextEntryOffset)) { char transform_buffer[MAX_PATH*4]; - int count = WideCharToMultiByte(CP_UTF8, 0, (WCHAR*)info->FileName, info->FileNameLength, transform_buffer, MAX_PATH*4 - 1, NULL, NULL); + int count = WideCharToMultiByte(CP_UTF8, 0, (WCHAR*)info->FileName, info->FileNameLength / 2, transform_buffer, MAX_PATH*4 - 1, NULL, NULL); change_callback(count, transform_buffer, data); if (!info->NextEntryOffset) break;