本文介绍了Deletefile API在网络上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hi All,
I used DeleteFile API as follow :
DeleteFile("\\\\MachineName\\ShareName\\FileName.txt");
where
\\\\MachineName\\ShareName\\FileName.txt full qualified path of remote machine
When i create simple Win32 or MFC App and Runs, then file get delete successfully.
but similar code i added in Win32 Service then its fails.
can anyone tell me the reason behind that.
My service running in System account which has full priveledges, then why DeleteFile API fails in
system account for network file.
i got GetLastError() == 5 (Access Denied)
我尝试过:
服务中心
1>
DeleteFile(Del \\\\\MachineName \\ShareName \\FileName.txt);
2>
系统(Del \\\\\MachineName \\ShareName \\FileName.txt);
3>
WNetAddConnection2用于IPC $(成功)
在1和2之前
仍未成功
What I have tried:
Under Service
1>
DeleteFile("Del \\\\MachineName\\ShareName\\FileName.txt");
2>
System("Del \\\\MachineName\\ShareName\\FileName.txt");
3>
WNetAddConnection2 for IPC$ (Success)
before 1 and 2
still not success
推荐答案
这篇关于Deletefile API在网络上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!