Changeset 50561 in vbox for trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnDDropTarget.cpp
- Timestamp:
- Feb 24, 2014 9:07:22 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnDDropTarget.cpp
r50508 r50561 120 120 else 121 121 { 122 LogFlowFunc(("CF_HDROP not supported, hr=%Rhrc\n", hr));122 LogFlowFunc(("CF_HDROP not wanted, hr=%Rhrc\n", hr)); 123 123 124 124 /* So we couldn't retrieve the data in CF_HDROP format; try with 125 * CF_ TEXT formatnow. Rest stays the same. */126 fmtEtc.cfFormat = CF_ TEXT;125 * CF_UNICODETEXT + CF_TEXT formats now. Rest stays the same. */ 126 fmtEtc.cfFormat = CF_UNICODETEXT; 127 127 hr = pDataObject->QueryGetData(&fmtEtc); 128 if (hr != S_OK)128 if (hr == S_OK) 129 129 { 130 LogFlowFunc(("CF_TEXT not supported, hr=%Rhrc\n", hr)); 131 fmtEtc.cfFormat = 0; /* Mark it to not supported. */ 130 mFormats = "text/plain;charset=utf-8"; 132 131 } 133 132 else 134 133 { 135 mFormats = "text/plain;charset=utf-8"; 134 LogFlowFunc(("CF_UNICODETEXT not wanted, hr=%Rhrc\n", hr)); 135 136 fmtEtc.cfFormat = CF_TEXT; 137 hr = pDataObject->QueryGetData(&fmtEtc); 138 if (hr == S_OK) 139 { 140 mFormats = "text/plain;charset=utf-8"; 141 } 142 else 143 { 144 LogFlowFunc(("CF_TEXT not wanted, hr=%Rhrc\n", hr)); 145 fmtEtc.cfFormat = 0; /* Mark it to not supported. */ 146 } 136 147 } 137 148 } … … 306 317 switch (mFormatEtc.cfFormat) 307 318 { 308 /* Handling CF_TEXT means that the system already did some marshalling 309 * to convert RTF or unicode text to plain ANSI text. */ 319 case CF_UNICODETEXT: 320 { 321 AssertPtr(pvData); 322 size_t cbSize = GlobalSize(pvData); 323 LogFlowFunc(("CF_UNICODETEXT 0x%p got %zu bytes\n", pvData, cbSize)); 324 if (cbSize) 325 { 326 char *pszText = NULL; 327 rc = RTUtf16ToUtf8((PCRTUTF16)pvData, &pszText); 328 if (RT_SUCCESS(rc)) 329 { 330 mpvData = (void *)pszText; 331 mcbData = strlen(pszText) + 1; /* Include termination. */ 332 333 /* Note: Don't free data of pszText, mpvData now owns it. */ 334 } 335 } 336 337 break; 338 } 339 310 340 case CF_TEXT: 311 341 { … … 320 350 { 321 351 mpvData = (void *)pszText; 322 mcbData = strlen(pszText) + 1; 352 mcbData = strlen(pszText) + 1; /* Include termination. */ 353 354 /* Note: Don't free data of pszText, mpvData now owns it. */ 323 355 } 324 356 } … … 412 444 /* Add separation between filenames. 413 445 * Note: Also do this for the last element of the list. */ 414 if (i > 0) 415 { 416 rc = RTStrAAppendExN(&pszFiles, 1 /* cPairs */, 417 "\r\n", 2 /* Bytes */); 418 if (RT_SUCCESS(rc)) 419 cchFiles += 2; /* Include \r\n */ 420 } 446 rc = RTStrAAppendExN(&pszFiles, 1 /* cPairs */, 447 "\r\n", 2 /* Bytes */); 448 if (RT_SUCCESS(rc)) 449 cchFiles += 2; /* Include \r\n */ 421 450 } 422 451
Note:
See TracChangeset
for help on using the changeset viewer.