Converted from bytes to characters, as this is what windows is expecting.

This commit is contained in:
Adam Harrison 2022-12-18 14:49:59 -05:00
parent e152db2cce
commit 5ab8dc0275
1 changed files with 1 additions and 1 deletions

View File

@ -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) { 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)) { 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]; 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); change_callback(count, transform_buffer, data);
if (!info->NextEntryOffset) if (!info->NextEntryOffset)
break; break;