I use this code to copy files to Clipboard:
IDataObject data = new DataObject();
data.SetData(DataFormats.FileDrop, new string[] {@"X:\test.doc"});
MemoryStream memo = new MemoryStream(4);
byte[] bytes = new byte[] { (byte)(5), 0, 0, 0 };
memo.Write(bytes, 0, bytes.Length);
data.SetData("Preferred DropEffect", memo);
Clipboard.SetDataObject(data);
Unfortunately, this doesn't work if the disk is a TrueCrypt mounted volume. What is the way to do this on a TrueCrypt volume?
Unfortunately, I do not think you can get away without a proper Shell ID list, on my Windows 7 your code doesn't even work with regular file system. The proper code would first and foremost provide a CIDL:
Where
CreateShellIDList
creates a binary representation of CIDA (CFSTR_SHELLIDLIST) structure needed. The implementation is below:I can't take all the credit here, I found this CIDA code some time ago and just ported it to c#. Can't really remember the original source but it works well so far (I just tested it on TrueCrypt as well)