public static IntPtr GetFILETIMEs(DateTime[] datetimes)
{
int count = (datetimes != null)?datetimes.Length:0;
if (count <= 0)
{
return IntPtr.Zero;
}
IntPtr pFiletimes = Marshal.AllocCoTaskMem(count*Marshal.SizeOf(typeof(System.Runtime.InteropServices.ComTypes.FILETIME)));
IntPtr pos = pFiletimes;
for (int ii = 0; ii < count; ii++)
{
Marshal.StructureToPtr(GetFILETIME(datetimes[ii]), pos, false);
pos = (IntPtr)(pos.ToInt64() + Marshal.SizeOf(typeof(System.Runtime.InteropServices.ComTypes.FILETIME)));
}
return pFiletimes;
}