获取文件或文件夹的权限
我正在尝试获取当前用户对文件/文件夹的权限。我在这里找到了一篇关于它的好文章。我尝试运行这个程序,但我遇到了一些错误,而且我不知道在哪里可以找到解决方案。我尝试制作自己的版本。不幸的是,当我尝试时:
LPWSTR lpszPrimaryDC = NULL;
NetGetDCName(NULL, L"A", (LPBYTE *)&lpszPrimaryDC);
我收到错误:NERR_DCNotFound
。我该如何解决这个问题?
Iam trying to get permissions on file/folder for current user. I found nice article about it here. I have tried to run this program but I got few erros and I dont know where I can find solutions to them. I tried to make my own version. Unfortunately when i try:
LPWSTR lpszPrimaryDC = NULL;
NetGetDCName(NULL, L"A", (LPBYTE *)&lpszPrimaryDC);
I got error: NERR_DCNotFound
. How I can solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
文档称,当“找不到域名参数中指定的域的域控制器”时,会返回错误。您有一个名为“A”的域名吗?如果不是,该函数就会失败(并且您需要重新思考为什么/如何调用它)。
The documentation says that error is returned when it "Could not find the domain controller for the domain specified in the domainname parameter." Do you have a domain called "A"? If not, the function is right to fail (and you need to rethink why/how you are calling it).
代码不崩溃并给我正确答案的问题的唯一方法:文件或文件夹可读吗?
希望这有帮助。您可以使用相同的方法用“w”编写测试。
The only way the code didn't crash and gave me correct answer to question: is file or folder readable?
Hope this helps. You can use the same for writing test with "w".