| 2574 | |
| 2575 | |
| 2576 | IObject* GuiType::CreateDropArray(HDROP hDrop) |
| 2577 | { |
| 2578 | auto arr = Array::Create(); |
| 2579 | // The added complexity/code size of handling out-of-memory here and in MsgSleep() |
| 2580 | // by aborting the new thread seems to outweigh the trivial benefits. So assume |
| 2581 | // arr is non-NULL and let the access violation occur if otherwise. |
| 2582 | TCHAR buf[T_MAX_PATH]; |
| 2583 | UINT file_count = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0); |
| 2584 | for (UINT u = 0; u < file_count; u ++) |
| 2585 | { |
| 2586 | arr->Append(buf, DragQueryFile(hDrop, u, buf, _countof(buf))); |
| 2587 | // Result not checked for reasons described above. The likely outcome at this |
| 2588 | // point would be for the event handler to either execute with fewer files than |
| 2589 | // expected, or for it to raise ERR_OUTOFMEM. |
| 2590 | } |
| 2591 | return arr; |
| 2592 | } |
| 2593 | |
| 2594 | |
| 2595 | |