Willy,
Thanks, the following worked out to be the most ideal:
[DllImport("Kernel32.dll", SetLastError = true, CharSet =
CharSet.Auto)]
static extern SafeFileHandle CreateFile(
string fileName,
[MarshalAs(UnmanagedType.U4)] FileAccess fileAccess,
[MarshalAs(UnmanagedType.U4)] FileShare fileShare,
int securityAttributes,
[MarshalAs(UnmanagedType.U4)] FileMode creationDisposition,
int flags,
IntPtr template);
- Scott
> Note that there is no need to Pinvoke Win32's ReadFile, the handle (use a
> SafeHandle in V2) returned by CreateFile can be used to create a FileStream,
> this class has a number of contructor overloads that take an IntPtr
> (representing the handle) or a SafeHandle.
>
> Willy.