CF_HDROP Explained: How Windows File Drop Lists Work
CF_HDROP is the standard format Windows uses to pass files through the clipboard and drag-and-drop. It holds a DROPFILES header followed by a double-null-terminated list of fully qualified paths, and no file data. File Explorer puts every selected item in one CF_HDROP; you read them with DragQueryFile, passing 0xFFFFFFFF first to get the count. When a tool shows only one of several copied files, it is usually reading the single-path CFSTR_FILENAME format instead of walking the whole list.
The layout
Microsoft describes CF_HDROP as the format "used when transferring the locations of a group of existing files". Unlike the other Shell formats, it is predefined, so you don't call RegisterClipboardFormat for it (its value is 15).
The data is a global memory object containing a DROPFILES structure:
| Member | Meaning |
|---|---|
pFiles | Offset in bytes from the start of the structure to the file list |
pt | The drop point, when the data came from a drag |
fNC | Whether pt is in non-client (screen) or client coordinates |
fWide | Zero for ANSI paths, non-zero for Unicode paths |
After the header comes the list: each full path ends with a null character, and one extra null ends the list. For two files, Microsoft's example is:
c:\temp1.txt'\0'c:\temp2.txt'\0''\0'
Here '\0' stands for a single null character. The paths point at files on disk; if a file is deleted before the paste or drop, the entry still exists but the transfer fails.
Reading every path
Microsoft's documented procedure for a pasted or dropped file list:
- Get the CF_HDROP data as an
HGLOBALand treat it as anHDROP. - Call
DragQueryFilewithiFileset to0xFFFFFFFF. It returns the number of paths. - Call
DragQueryFileonce per index from 0 to count − 1. Passing aNULLbuffer returns the length needed, not counting the terminating null.
A complete console program in C that lists whatever files are on the clipboard:
#include <windows.h>
#include <shellapi.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
if (!IsClipboardFormatAvailable(CF_HDROP)) {
wprintf(L"No file list on the clipboard.\n");
return 0;
}
if (!OpenClipboard(NULL)) {
wprintf(L"Could not open the clipboard.\n");
return 1;
}
HDROP hDrop = (HDROP)GetClipboardData(CF_HDROP);
if (hDrop != NULL) {
UINT count = DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0);
wprintf(L"%u item(s)\n", count);
for (UINT i = 0; i < count; i++) {
UINT len = DragQueryFileW(hDrop, i, NULL, 0);
WCHAR *path = malloc((len + 1) * sizeof(WCHAR));
if (path != NULL && DragQueryFileW(hDrop, i, path, len + 1) > 0) {
wprintf(L"%ls\n", path);
}
free(path);
}
}
CloseClipboard();
return 0;
}
Build it with the Visual Studio developer prompt: cl listdrop.c user32.lib shell32.lib. Select several files in File Explorer, press Ctrl+C, and run it; every path should be listed.
Without a compiler, Windows PowerShell 5.1 does the same job:
Get-Clipboard -Format FileDropList
The -Format parameter exists only in Windows PowerShell 5.1; PowerShell 7's Get-Clipboard reads text only. In .NET, System.Windows.Forms.Clipboard.GetFileDropList() returns the list as a string collection. More clipboard commands are in the PowerShell clipboard cheat sheet.
The related Shell formats
An Explorer copy usually carries several formats besides CF_HDROP. The ones that matter most for bugs:
| Format | What it carries |
|---|---|
| CF_HDROP | Full paths of one or more existing files. The format to read and write for files on disk. |
| CFSTR_FILENAME | A single full path. Microsoft says it "has been superseded by CF_HDROP" and is kept for Windows 3.1 applications. |
| CFSTR_SHELLIDLIST | Item ID lists (PIDLs) instead of paths, so it can describe virtual objects as well as files. |
| CFSTR_FILEDESCRIPTOR + CFSTR_FILECONTENTS | File-like data that isn't stored as a file on disk, such as items from virtual folders; each file's contents are fetched by index. |
| CFSTR_PREFERREDDROPEFFECT | The source's preference: move, copy or link. Explorer's Cut sets move. |
| CFSTR_PERFORMEDDROPEFFECT / CFSTR_LOGICALPERFORMEDDROPEFFECT | What the target actually did, reported back to the source. |
Why a tool sees only one of several files
Explorer itself puts the whole selection in one CF_HDROP; pasting into another Explorer folder proves it. When a clipboard manager or app shows only one file, look for these mistakes:
- Reading CFSTR_FILENAME. It holds one path by design. Its registered names are
FileName(ANSI) andFileNameW(Unicode). Code that reads only that gets the first file and nothing else. - Reading only the first index. Code that calls
DragQueryFilewith index 0 and never asks for the count. - Parsing the list by hand with the wrong width.
fWidesays whether the paths are Unicode. Treating a wide list as ANSI, or the reverse, can stop the walk after the first entry.DragQueryFilehandles this for you. - Expecting CF_HDROP from virtual locations. Microsoft notes that data from virtual folders, which are usually not ordinary files, generally comes as CFSTR_FILEDESCRIPTOR/CFSTR_FILECONTENTS instead. Apps that accept files should handle both.
A three-file test catches all of these: create a.txt, b.txt and c.txt, copy all three in Explorer, paste them into a second folder as a control, then check what the tool recorded. If it can drag items back out, drag them into a third folder and count again.
Building a file list as a source
When your app puts files on the clipboard or starts a drag:
- Offer CF_HDROP for every file that exists on disk. Microsoft's guidance is that existing files should be offered in this format.
- Build the path list with a terminating null after each path and one more at the end, and set
fWidefor Unicode paths. - Add CFSTR_PREFERREDDROPEFFECT set to copy, unless the user chose Cut.
- For an image that exists only in memory, write it to a file first and offer that file's path. A bitmap alone gives File Explorer nothing to drop.
- For data that isn't a file, offer CFSTR_FILEDESCRIPTOR and CFSTR_FILECONTENTS rather than a path to a file that doesn't exist.
Be careful with moves. The Shell normally uses an optimized move, where the target moves the files itself and reports DROPEFFECT_NONE through CFSTR_PERFORMEDDROPEFFECT, meaning the source has nothing left to delete. A source that deletes on its own after every move can destroy data. Read CFSTR_LOGICALPERFORMEDDROPEFFECT if you need to know what the user saw happen.
Edge Drop, the clipboard shelf made by the team behind this site, follows the same model: it reads the full file list from an Explorer copy, stores the paths rather than the file data, and drags the original files back out through Electron's native drag. Images are written to a temporary PNG before the drag starts.
What this means for Win+V
Windows clipboard history stores text, HTML and bitmap images, so CF_HDROP never appears in it. A file copy lives only on the live clipboard until the next copy replaces it. How to copy multiple files and paste them somewhere else covers the everyday side, and what happens when you copy a folder shows how a folder fits in the same list. For why a drag can fail when paste works, see why paste works but drag-and-drop fails.
Related reading
- Why Paste Works but Drag-and-Drop Fails on Windows
- What Happens When You Copy a Folder to the Clipboard?
- How to Copy and Paste Multiple Files at Once in Windows
- PowerShell Clipboard Cheat Sheet: Get-Clipboard and Set-Clipboard
Sources
- Shell Clipboard Formats (Microsoft Learn) — CF_HDROP layout, CFSTR_FILENAME, SHELLIDLIST, FILEDESCRIPTOR/FILECONTENTS, drop-effect formats.
- Handling Shell Data Transfer Scenarios (Microsoft Learn) — reading paths with DragQueryFile, virtual folders, optimized moves.
- DROPFILES structure (Microsoft Learn) — pFiles, pt, fNC, fWide.
- DragQueryFileW function (Microsoft Learn) — 0xFFFFFFFF count and buffer sizing.
- Standard Clipboard Formats (Microsoft Learn) — CF_HDROP value 15.
- Get-Clipboard, Windows PowerShell 5.1 (Microsoft Learn) —
-Format FileDropList. - Clipboard.GetFileDropList (Microsoft Learn) — .NET file drop list.
Deepender Yadav created Edge Drop and builds and tests it, from the edge-hover shelf to each release. A B.Tech Computer Science Engineering student, Deepender writes the Edge Drop guides, comparisons and developer posts, and checks product details against the app's source code.
GitHub · LinkedInCopy. Stack. Drop.
Transform your clipboard into an interactive edge shelf. Stack, pin, and drag assets into any app with zero friction.
Download for Windows Get from Microsoft Store
How to Install Guide · First 10 Minutes Guide · Drag & Drop Guide · Edge Drop vs Win+V · Support
Free · Lightweight · Privacy First