在进行驱动开发时,调用ZwCreateFile报错0xC0000043,STATUS_SHARING_VIOLATION,经过搜索得知参数ShareAccess,指定“共享所有”的正确方法是FILE_SHARE_VALID_FLAGS,而不是0 。下面是帮助网页
https://community.osr.com/discussion/288138
关键回答
//
// MessageId: STATUS_SHARING_VIOLATION
//
// MessageText:
//
// A file cannot be opened because the share access flags are incompatible.
//
#define STATUS_SHARING_VIOLATION ((NTSTATUS)0xC0000043L)
If the file is local, you can call IoCreateFileEx and specify
IO_IGNORE_SHARE_ACCESS_CHECK. Note that this doesn't do anything for a file
on a network share.
Also, the proper way to specify "share all" is FILE_SHARE_VALID_FLAGS, not 0
(which means "share none").
-scott
OSR
@OSRDrivers