Delphi TPath.GetTempPath result is cropped

大城市里の小女人 提交于 2019-11-30 19:03:00

There is a note about this Windows API function on the Homeland Security pages:

"The return buffer for GetLongPathName() and similar functions might return a truncated path and lead to hard-to-find errors."

https://buildsecurityin.us-cert.gov/bsi-rules/home/g1/753-BSI.html

If you have the source code, you could check if the problem described in this article exists in the Delphi 2010 implementation.

What happens if you try:

var
  longpath : string;

SetLength(longpath,MAX_PATH);
SetLength(longpath, GetLongPathName(PChar(TmpDir),PChar(LongPath),MAX_PATH));

This worked for me, your version truncated the path.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!