mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 05:21:08 +00:00
shell32: Merge ANSI part of DROPFILES handler into DragQueryFileW.
This commit is contained in:
parent
2176e83060
commit
3389ba479b
|
@ -621,50 +621,58 @@ UINT WINAPI DragQueryFileW(
|
|||
LPWSTR lpszwFile,
|
||||
UINT lLength)
|
||||
{
|
||||
LPWSTR lpwDrop;
|
||||
LPWSTR buffer = NULL;
|
||||
LPCWSTR filename;
|
||||
UINT i = 0;
|
||||
DROPFILES *lpDropFileStruct = GlobalLock(hDrop);
|
||||
const DROPFILES *lpDropFileStruct = GlobalLock(hDrop);
|
||||
|
||||
TRACE("(%p, %x, %p, %u)\n", hDrop,lFile,lpszwFile,lLength);
|
||||
|
||||
if(!lpDropFileStruct) goto end;
|
||||
|
||||
lpwDrop = (LPWSTR) ((LPSTR)lpDropFileStruct + lpDropFileStruct->pFiles);
|
||||
|
||||
if(lpDropFileStruct->fWide == FALSE) {
|
||||
LPSTR lpszFileA = NULL;
|
||||
|
||||
if(lpszwFile && lFile != 0xFFFFFFFF) {
|
||||
lpszFileA = malloc(lLength);
|
||||
if(lpszFileA == NULL) {
|
||||
if(lpDropFileStruct->fWide)
|
||||
{
|
||||
LPCWSTR p = (LPCWSTR) ((LPCSTR)lpDropFileStruct + lpDropFileStruct->pFiles);
|
||||
while (i++ < lFile)
|
||||
{
|
||||
while (*p++); /* skip filename */
|
||||
if (!*p)
|
||||
{
|
||||
i = (lFile == 0xFFFFFFFF) ? i : 0;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
i = DragQueryFileA(hDrop, lFile, lpszFileA, lLength);
|
||||
|
||||
if(lpszFileA) {
|
||||
MultiByteToWideChar(CP_ACP, 0, lpszFileA, -1, lpszwFile, lLength);
|
||||
free(lpszFileA);
|
||||
filename = p;
|
||||
}
|
||||
else
|
||||
{
|
||||
LPCSTR p = (LPCSTR)lpDropFileStruct + lpDropFileStruct->pFiles;
|
||||
while (i++ < lFile)
|
||||
{
|
||||
while (*p++); /* skip filename */
|
||||
if (!*p)
|
||||
{
|
||||
i = (lFile == 0xFFFFFFFF) ? i : 0;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
goto end;
|
||||
i = MultiByteToWideChar(CP_ACP, 0, p, -1, NULL, 0);
|
||||
buffer = malloc(i * sizeof(WCHAR));
|
||||
if (!buffer)
|
||||
{
|
||||
i = 0;
|
||||
goto end;
|
||||
}
|
||||
MultiByteToWideChar(CP_ACP, 0, p, -1, buffer, i);
|
||||
filename = buffer;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i++ < lFile)
|
||||
{
|
||||
while (*lpwDrop++); /* skip filename */
|
||||
if (!*lpwDrop)
|
||||
{
|
||||
i = (lFile == 0xFFFFFFFF) ? i : 0;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
i = lstrlenW(lpwDrop);
|
||||
i = lstrlenW(filename);
|
||||
if ( !lpszwFile) goto end; /* needed buffer size */
|
||||
lstrcpynW (lpszwFile, lpwDrop, lLength);
|
||||
lstrcpynW(lpszwFile, filename, lLength);
|
||||
end:
|
||||
GlobalUnlock(hDrop);
|
||||
free(buffer);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
|
@ -809,16 +809,13 @@ static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
|
|||
|
||||
len = wcslen(expected_filenameW);
|
||||
num = DragQueryFileW(hDrop, 0, NULL, 0);
|
||||
todo_wine_if(expected_filename[0] == 'd' && !(flags & DROP_WIDE_FILENAME))
|
||||
ok(num == len, "expected %u, got %u\n", len, num);
|
||||
|
||||
num = DragQueryFileW(hDrop, 0, filenameW, 0);
|
||||
todo_wine_if(expected_filename[0] == 'd' && !(flags & DROP_WIDE_FILENAME))
|
||||
ok(num == len, "expected %u, got %u\n", len, num);
|
||||
ok(!wcscmp(filenameW, L"dummy"), "got %s\n", wine_dbgstr_w(filenameW));
|
||||
|
||||
num = DragQueryFileW(hDrop, 0, filenameW, ARRAY_SIZE(filename));
|
||||
todo_wine_if(expected_filename[0] == 'd' && !(flags & DROP_WIDE_FILENAME))
|
||||
ok(num == len, "expected %u, got %u\n", len, num);
|
||||
ok(!wcscmp(filenameW, expected_filenameW), "expected %s, got %s\n",
|
||||
wine_dbgstr_w(expected_filenameW), wine_dbgstr_w(filenameW));
|
||||
|
|
Loading…
Reference in a new issue