# CreateFileA

```csharp
[DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
public static extern unsafe HANDLE CreateFileA(
    PCSTR lpFileName,
    uint dwDesiredAccess,
    FILE_SHARE_MODE dwShareMode,
    [Optional] SECURITY_ATTRIBUTES* lpSecurityAttributes,
    FILE_CREATION_DISPOSITION dwCreationDisposition,
    FILE_FLAGS_AND_ATTRIBUTES dwFlagsAndAttributes,
    HANDLE hTemplateFile);
```

[file\_share\_mode](https://www.pinvoke.dev/filesystem/file_share_mode "mention")

[file\_creation\_disposition](https://www.pinvoke.dev/filesystem/file_creation_disposition "mention")

[file\_flags\_and\_attributes](https://www.pinvoke.dev/filesystem/file_flags_and_attributes "mention")
