2021年3月18日星期四

Debugger issue with Delphi 2007 on Windows 10

It is probably me being stupid, but I am having problems detecting if a network drive is up, but only when running the program in the IDE – when running the program normally (not in the IDE) the network drive is correctly detected. The IDE works fine on Windows 7.

While the program in question is different, I can reproduce the issue by creating a new project and adding the following into FormActivate:

var    bRet: Boolean;    LTemp2: string;    LFreeSpace: Int64;    LTotalSpace: Int64;  begin    LTemp2 := 'T:\';    bRet := GetDiskFreeSpaceEx(PAnsiChar(LTemp2), &LFreeSpace, &LTotalSpace, nil);    ShowMessage('GetDiskFreeSpaceEx: Drive T: is up? '+BoolToStr(bRet, True));  end;  

Assuming you have a networked drive T:, if you run the program in the IDE then the above always returns False, but if you run the built program from a desktop shortcut then it returns True. I get the same behaviour if you run it via a button click after the program starts. DiskSize() and doing a FindFirst on the root directory give the same results.

It is a clean Windows 10 install, not an upgrade, with a clean install of Codegear 2007 with all the patches applied. I have tried "Run as administrator" and all the Compatibility Modes back to Windows 7.

Am I doing something stupid?

https://stackoverflow.com/questions/66701610/debugger-issue-with-delphi-2007-on-windows-10 March 19, 2021 at 10:06AM

没有评论:

发表评论