- if (lstrlenW(filename) + lstrlenW(path) + ARRAY_SIZE(str_dll) + 4
= filename_size) /* Include blackslash and null-terminator */
This looks like it goes over the needed length. ARRAY_SIZE will include the null terminator from str_dll, and the backslash is only one character.
You're right, I missed that ARRAY_SIZE counts the null terminator already. I sent an updated patch.
Regards, Fabian Maurer