CeCreateFile (rapi)
Last changed: -217.109.85.156

.
Summary
This function creates, opens, or truncates a file, pipe, communications resource, disk device, or console. It returns a handle that can be used to access the object. It can also open and return a handle to a directory.

C# Signature:

[DllImport("rapi.dll", CharSet=CharSet.Unicode)]
public static extern int CeCreateFile(
    string lpFileName,
    uint dwDesiredAccess,
    int dwShareMode,
    int lpSecurityAttributes,
    int dwCreationDisposition,
    int dwFlagsAndAttributes,
    int hTemplateFile);

User-Defined Types:

short FILE_ATTRIBUTE_NORMAL = 0x80;
short FILE_ATTRIBUTE_DIRECTORY = 0x10;
short FILE_ATTRIBUTE_TEMPORARY = 0x100;
uint GENERIC_READ = 0x80000000;
uint GENERIC_WRITE = 0x40000000;
short CREATE_NEW = 1;
short CREATE_ALWAYS = 2;
short OPEN_EXISTING = 3;

Notes:

function info on msdn at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceactsy/html/cerefCeCreateFileRAPI.asp

Tips & Tricks:

Please add some!

Sample Code:

CeCreateFile("\\test.txt", GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);

Alternative Managed API:

Documentation

OpenNETCF allow to use all the possibilities of the Remote API, http://www.opennetcf.org/library/OpenNETCF.Desktop.Communication.html