Maciej Katafiasz ml@mathrick.org wrote:
if(!strncasecmp(p, "://localhost/", 13))
{
i = 12;
} else if (!strncasecmp(p, ":///", 4))
{
i = 3;
} else
{
TRACE("Not a valid file: URI: %s\n", (char*)data);
return count;
}
Please use the same indentation style as the existing does, i.e. 4 spaces, not 2.
- pathlen = MultiByteToWideChar(CP_UNIXCP, 0, filename, len, NULL, 0);
- wfn = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pathlen);
You allocate not enough space for a wide char string.
- TRACE("Convert to WCHAR: filename: %s, len: %d\n", debugstr_a(filename), pathlen);
- pathlen = MultiByteToWideChar(CP_UNIXCP, 0, filename, len, wfn, pathlen);
- if(GetLastError())
- {
TRACE("Can't convert to WCHAR: %d\n", GetLastError());
goto clean_wfn;
- }
This is not an appropriate way of testing for an API failure.
- TRACE("WCHAR filename: %s\n", debugstr_w(wfn));
- wpath = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pathlen * sizeof(WCHAR));
Memory space calculations and allocations don't look right all over the place.
strcpy(((char*)lpDrop)+lpDrop->pFiles, path);
memcpy(((char*)lpDrop)+lpDrop->pFiles, (char*)wpath, fullpathlen * sizeof(WCHAR));
Use lstrcpyW here instead of memcpy.