以编程方式更改隐藏系统文件的属性 [英] Changing the attributes for a hidden system file programmatically

查看:59
本文介绍了以编程方式更改隐藏系统文件的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个隐藏的系统文件,我需要阅读。


我以管理员身份登录。


我无法使用Windows资源管理器更改文件属性。


我可以查看文件的内容。


以编程方式打开文件失败,访问被拒绝。


(如果我复制文件我可以访问它,虽然它也是隐藏的。)


因此我试图以编程方式将该文件的属性更改为正常。


获取属性成功并显示该文件是隐藏的并且

系统。


但是当我尝试将文件属性设置为正常时它会失败并获得

最后一个错误产生以下字符串:


错误183:当该文件已存在时无法创建文件。


MSDN声明对于WinXP,可以更改隐藏和系统的属性

m文件。


我需要一些特殊权限吗?哪些?


我已经注销并再次登录,行为没有改变。


任何线索,任何人?


谢谢!


Hi,

I have a hidden system file that I need to read.

I am logged in as an administrator.

I can not change the file attributes using the windows explorer.

I can view the file''s content.

Opening the file programmatically fails with access is denied.

(If I copy the file I can access it, although it is also hidden.)

Therefore I am trying to change the attributes of that file,
programmatically, to normal.

Getting the attributes succeeds and shows that the file is hidden and
system.

However when I try to set the file attribute to normal it fails and get
last error produces the following string :

Error 183 : Cannot create file when that file already exists.

The MSDN states that for WinXP it is possible to change the attributes
for hidden and system files.

Do I need some special permissions ? Which ones ?

I have logged off and logged in again, the behavior did not change.

Any leads, anyone ?

Thank you!


推荐答案

您可能需要删除系统文件属性之前能够删除

常规属性,如隐藏和只读。


-

问候,

Nish [VC ++ MVP]

" Alexandra" <人*********** @ gmail.com>在消息中写道

新闻:uw ************** @ TK2MSFTNGP15.phx.gbl ...
You may have to remove the system-file attribute before being able to remove
the regular attributes like hidden and readonly.

--
Regards,
Nish [VC++ MVP]
"Alexandra" <al***********@gmail.com> wrote in message
news:uw**************@TK2MSFTNGP15.phx.gbl...

我有一个隐藏的系统文件,我需要阅读。

我以管理员身份登录。

我无法使用更改文件属性Windows资源管理器。

我可以查看文件的内容。

以编程方式打开文件失败,访问被拒绝。

(如果我复制我可以访问它的文件,虽然它也是隐藏的。)

因此我试图以编程方式将该文件的属性更改为正常。

然而,当我尝试将文件属性设置为正常时,它失败并获得
上次错误产生以下字符串:

错误183:当该文件已存在时无法创建文件。

MSDN声明,对于WinXP,可以更改
我需要一些特殊权限吗?哪些?

我已经注销并再次登录,行为没有改变。

任何线索,任何人?

谢谢!
Hi,

I have a hidden system file that I need to read.

I am logged in as an administrator.

I can not change the file attributes using the windows explorer.

I can view the file''s content.

Opening the file programmatically fails with access is denied.

(If I copy the file I can access it, although it is also hidden.)

Therefore I am trying to change the attributes of that file,
programmatically, to normal.

Getting the attributes succeeds and shows that the file is hidden and
system.

However when I try to set the file attribute to normal it fails and get
last error produces the following string :

Error 183 : Cannot create file when that file already exists.

The MSDN states that for WinXP it is possible to change the attributes for
hidden and system files.

Do I need some special permissions ? Which ones ?

I have logged off and logged in again, the behavior did not change.

Any leads, anyone ?

Thank you!



" Alexandra" <人*********** @ gmail.com>在消息中写道

新闻:uw ************** @ TK2MSFTNGP15.phx.gbl ...
"Alexandra" <al***********@gmail.com> wrote in message
news:uw**************@TK2MSFTNGP15.phx.gbl...
我有一个隐藏的系统我需要阅读的文件。

我是以管理员身份登录的。


OK。

我无法使用Windows资源管理器更改文件属性。

我可以查看文件''内容。


OK。

以编程方式打开文件失败,访问被拒绝。


您不提供的重要信息是

CreateFile()的参数。您是否指定了GENERIC_READ的访问模式和FILE_SHARE_READ的共享

模式?

(如果我复制文件我可以访问它,尽管它也是隐藏的。)

因此我试图以编程方式将该文件的属性更改为正常。

获取属性成功并显示文件被隐藏并且
然而,当我尝试将文件属性设置为正常时,它失败并获得
最后一个错误产生以下字符串:

错误183:不能当该文件已经存在时创建文件。
I have a hidden system file that I need to read.

I am logged in as an administrator.
OK.
I can not change the file attributes using the windows explorer.

I can view the file''s content.
OK.
Opening the file programmatically fails with access is denied.
Important bits of information that you don''t offer are the parameters to
CreateFile(). Are you specifying an access mode of GENERIC_READ and a share
mode of FILE_SHARE_READ?
(If I copy the file I can access it, although it is also hidden.)

Therefore I am trying to change the attributes of that file,
programmatically, to normal.

Getting the attributes succeeds and shows that the file is hidden and
system.

However when I try to set the file attribute to normal it fails and get
last error produces the following string :

Error 183 : Cannot create file when that file already exists.




嗯。我想你需要在这里发一个_short_代码片段,如果之前的建议对你不起作用,会导致

错误。


问候,




Hmm. I think you''ll need to post a _short_ snippet of code here that causes
the error if the previous suggestion does not work for you.

Regards,
Will


BTW我说的是通过资源管理器进行操作(只允许你设置

readonly并隐藏)。你将不得不使用attrib.exe设置系统

属性。


-

问候,

Nish [VC ++ MVP]

" Nishant Sivakumar" < NI ** @ nospam.asianetindia.com>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP12.phx.gbl ...
BTW I am talking about doing it via Explorer (which only allows you to set
readonly and hidden). You''ll have to use attrib.exe to set the system
attribute.

--
Regards,
Nish [VC++ MVP]
"Nishant Sivakumar" <ni**@nospam.asianetindia.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
你可以必须删除系统文件属性才能删除隐藏和只读等常规属性。

-
问候,
Nish [VC ++ MVP]

" Alexandra" <人*********** @ gmail.com>在消息中写道
新闻:uw ************** @ TK2MSFTNGP15.phx.gbl ...
You may have to remove the system-file attribute before being able to
remove the regular attributes like hidden and readonly.

--
Regards,
Nish [VC++ MVP]
"Alexandra" <al***********@gmail.com> wrote in message
news:uw**************@TK2MSFTNGP15.phx.gbl...

我有一个隐藏的系统文件,我需要阅读。

我以管理员身份登录。

我无法使用Windows资源管理器更改文件属性。

我可以查看文件的内容。

以编程方式打开文件失败,访问被拒绝。

(如果我复制文件我可以访问它,虽然它也是隐藏的。)

因此我试图以编程方式将该文件的属性更改为正常。

获取属性成功并显示文件被隐藏和系统。

然而,当我尝试将文件属性设置为正常时,它失败并获得
最后一个错误产生以下字符串:

错误183:当该文件已经存在时无法创建文件。

MSDN声明,对于WinXP,可以更改属性
idden和系统文件。

我需要一些特殊权限吗?哪些?

我已经注销并再次登录,行为没有改变。

任何线索,任何人?

谢谢!
Hi,

I have a hidden system file that I need to read.

I am logged in as an administrator.

I can not change the file attributes using the windows explorer.

I can view the file''s content.

Opening the file programmatically fails with access is denied.

(If I copy the file I can access it, although it is also hidden.)

Therefore I am trying to change the attributes of that file,
programmatically, to normal.

Getting the attributes succeeds and shows that the file is hidden and
system.

However when I try to set the file attribute to normal it fails and get
last error produces the following string :

Error 183 : Cannot create file when that file already exists.

The MSDN states that for WinXP it is possible to change the attributes
for hidden and system files.

Do I need some special permissions ? Which ones ?

I have logged off and logged in again, the behavior did not change.

Any leads, anyone ?

Thank you!




这篇关于以编程方式更改隐藏系统文件的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆