设置文件的简称 [英] Setting the Short Name of file
本文介绍了设置文件的简称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用GENERIC_ALL访问模式和FILE_SHARE_READ设置由CreateFile Function打开的文件的短名称| FILE_SHARE_WRITE | FILE_SHARE_DELETE.
要设置短名称,我使用了功能SetFileShortName,但它给出了运行时错误1314(客户端未拥有所需的特权.)
如何设置此特权?或setTheshort名另外吗?
在此先感谢,
Ajay
I am Trying to set Short Name of A file opened by CreateFile Function with GENERIC_ALL access mode and FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE.
To Set Short Name I used Function SetFileShortName but it gives Run time error 1314 (A required privilege is not held by the client.)
How can I set This privalege? Or setTheshort name Alternatively ?
Thanks in Advance,
Ajay
推荐答案
我不知该如何设置短名称,这不是长名称的截短版本吗?话虽如此,您需要将应用程序设置为以管理员身份运行. 此处 [ ^ ]是关于如何使用的技巧.
I am at a loss how you''d set the short name, isn''t it a truncated version of the long one ? Having said that, you need to set up your application to run as admin. Here[^] is an artile on how.
SetFileShortName
的文档说,必须使用GENERIC_ALL
打开文件和FILE_FLAG_BACKUP_SEMANTICS
标志(GENERIC_ALL | FILE_FLAG_BACKUP_SEMANTICS
).那是你打开文件的方式吗?
另外,必须启用SE_RESTORE_NAME
特权.
启用特权的方法如下-启用和禁用特权C ++ [ ^ ]
The documentation forSetFileShortName
says that the file must be opened withGENERIC_ALL
andFILE_FLAG_BACKUP_SEMANTICS
flags (GENERIC_ALL | FILE_FLAG_BACKUP_SEMANTICS
). Is that how you''ve opened the file?
Also theSE_RESTORE_NAME
privilege must be enabled.
Here is how privileges can be enabled - Enabling and Disabling Privileges in C++[^]
这篇关于设置文件的简称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文