-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add wil::create_file_create, create_file_open, etc. tame use of CreateFileW #382
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm of multiple minds on this. I like that it's clearing up the "floor wax and dessert topping" form of the API, I don't know that this is the way that's most intuitive in naming for me yet.
…t/wil into user/chrisg/create_file
@@ -650,7 +649,6 @@ TEST_CASE("FileSystemTests::GetFileInfo<FileStreamInfo>", "[filesystem]") | |||
wistd::unique_ptr<FILE_STREAM_INFO> streamInfo; | |||
auto hr = wil::GetFileInfoNoThrow<FileStreamInfo>(handle.get(), streamInfo); | |||
REQUIRE(hr == S_OK); | |||
#endif | |||
} | |||
|
|||
TEST_CASE("FileSystemTests::QueryFullProcessImageNameW", "[filesystem]") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Not critical, but this could be pulled out of the ifdef
for exception support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still of the opinion that flags & attributes should come before security attributes, but otherwise things look good to me
I distilled the documented behavior of CreateFileW into these helpers with the goal enabling simple use of the functionality without having to construct the long and complicated, and interdependent parameter list.
auto handle = wil::open_file(path.c_str());
The design uses "open", "create" and "trucate" to distinguish the cases that open existing files and use that creates and modifies existing files. Here is more complicated use that demonstrates the handle and error code being returned (used in success cases, so providing access to it is essential.).
Here, are the method names that intend to describe the semantics.
PR includes tests now.