{"action":"created","issue":{"url":"https://api.github.com/repos/dokan-dev/dokan-dotnet/issues/99","repository_url":"https://api.github.com/repos/dokan-dev/dokan-dotnet","labels_url":"https://api.github.com/repos/dokan-dev/dokan-dotnet/issues/99/labels{/name}","comments_url":"https://api.github.com/repos/dokan-dev/dokan-dotnet/issues/99/comments","events_url":"https://api.github.com/repos/dokan-dev/dokan-dotnet/issues/99/events","html_url":"https://github.com/dokan-dev/dokan-dotnet/issues/99","id":171138495,"number":99,"title":"Add alreadyExists param to CreateFile","user":{"login":"Liryna","id":4311419,"avatar_url":"https://avatars.githubusercontent.com/u/4311419?v=3","gravatar_id":"","url":"https://api.github.com/users/Liryna","html_url":"https://github.com/Liryna","followers_url":"https://api.github.com/users/Liryna/followers","following_url":"https://api.github.com/users/Liryna/following{/other_user}","gists_url":"https://api.github.com/users/Liryna/gists{/gist_id}","starred_url":"https://api.github.com/users/Liryna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Liryna/subscriptions","organizations_url":"https://api.github.com/users/Liryna/orgs","repos_url":"https://api.github.com/users/Liryna/repos","events_url":"https://api.github.com/users/Liryna/events{/privacy}","received_events_url":"https://api.github.com/users/Liryna/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dokan-dev/dokan-dotnet/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-08-15T09:36:49Z","updated_at":"2016-08-15T14:00:12Z","closed_at":null,"body":"Maybe we can add a new parameter to `CreateFile`, and then let `ZwCreateFile `use `SetLastError`:\r\n```C#\r\nNtStatus CreateFile(string fileName, FileAccess access, FileShare share, FileMode mode,\r\n            FileOptions options, FileAttributes attributes, out bool alreadyExists, DokanFileInfo info);\r\n```\r\n\r\nThis would avoid C# devs to call\r\n```\r\npublic const int ERROR_ALREADY_EXISTS = 183;\r\n[DllImport(\"kernel32.dll\", SetLastError = true)]\r\nstatic extern void SetLastError(uint dwErrorCode);\r\n...\r\nSetLastError(ERROR_ALREADY_EXISTS);\r\n```\r\nwhen parameter `mode==FileMode.OpenOrCreate | FileMode.Create` and the file specified in `fileName `already exist before `return NtStatus.Success`."},"comment":{"url":"https://api.github.com/repos/dokan-dev/dokan-dotnet/issues/comments/239808870","html_url":"https://github.com/dokan-dev/dokan-dotnet/issues/99#issuecomment-239808870","issue_url":"https://api.github.com/repos/dokan-dev/dokan-dotnet/issues/99","id":239808870,"user":{"login":"marinkobabic","id":3265080,"avatar_url":"https://avatars.githubusercontent.com/u/3265080?v=3","gravatar_id":"","url":"https://api.github.com/users/marinkobabic","html_url":"https://github.com/marinkobabic","followers_url":"https://api.github.com/users/marinkobabic/followers","following_url":"https://api.github.com/users/marinkobabic/following{/other_user}","gists_url":"https://api.github.com/users/marinkobabic/gists{/gist_id}","starred_url":"https://api.github.com/users/marinkobabic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marinkobabic/subscriptions","organizations_url":"https://api.github.com/users/marinkobabic/orgs","repos_url":"https://api.github.com/users/marinkobabic/repos","events_url":"https://api.github.com/users/marinkobabic/events{/privacy}","received_events_url":"https://api.github.com/users/marinkobabic/received_events","type":"User","site_admin":false},"created_at":"2016-08-15T14:00:12Z","updated_at":"2016-08-15T14:00:12Z","body":"@magol\r\nFrom .Net point of view it's just a state which tells that the file already exists. Based on context the state may be an error or success. \r\n\r\nJust add it to the documentation to make it clear when to return which state. "}}
{"actor":{"display_login":"marinkobabic"}}