似乎,我想用 FileExists() 检查的一些文件即使在那里也永远找不到,而其他文件每次都能找到。
如果我将文件“driver.sys”放入“C:\Windows\System32\drivers\”目录中,将永远找不到(每次调用该函数时 FileExists 都是错误的)。如果我将文件移动到 Windows 根目录“C:\Windows\”中,就会找到它。
这不起作用(虽然文件肯定在文件夹'C:\Windows\System32\drivers\'中):
function isNotDriverInstalled(): Boolean;
begin
if (FileExists('C:\Windows\System32\drivers\driver.sys')) then begin
Log('File exists');
Result := False;
end else begin
Log('File doesn''t exist');
Result := True;
end;
end;
这有效(当文件位于文件夹 'C:\Windows\' 中时):
function isNotDriverInstalled(): Boolean;
begin
if (FileExists('C:\Windows\driver.sys')) then begin
Log('File exists');
Result := False;
end else begin
Log('File doesn''t exist');
Result := True;
end;
end;
顺便说一句:我使用的是 Windows 7、64 位。
有没有人经历过这样的案例?有什么建议么?
提前谢谢!