- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
I'm trying to retrieve a long full path, following a file search with FindFirstFile and FindNextFile, and FullPathQQ fails understandably as the buffer is limited to 260 chars.
I have tried to use aWIN API GetFullPathW to do the work, but somehow I cannot get it to work. The Intel interface defined in kernel32.f90 is pointing to the GetFullPathA, which cannot resolve paths longer than 260.
The length of the path, which I'm trying to retrieve is about 320chars. I am getting nothing in the output variable cFullPathW.
I have attached a part of the code below. What am I doing wrong?
integer(HANDLE) :: hFile
integer(BOOL) :: iResult
integer(DWORD) :: dwLenPathOut
integer(LPSTR) :: lpFilePart
integer :: ilen
integer(4) :: iLenPath
logical(4) :: lResult
logical :: first_instance
character(len=1024) :: cFullPath
character(len=4096) :: cFullPathW
type(T_WIN32_FIND_DATA) :: FileInfo
! Declare interfaces.
interface
function GetFullPathName( &
lpFileName, &
nBufferLength, &
lpBuffer, &
lpFilePart)
use ifwinty
integer(DWORD) :: GetFullPathName ! DWORD
!dec$ attributes default, stdcall, decorate, alias:'GetFullPathNameW' :: GetFullPathName
!dec$ attributes reference, ignore_loc, allow_null :: lpFileName
character*(*) lpFileName ! LPCSTR lpFileName
integer(DWORD) nBufferLength ! DWORD nBufferLength
!dec$ attributes reference, ignore_loc, allow_null :: lpBuffer
character*(*) lpBuffer ! LPSTR lpBuffer
!dec$ attributes reference, ignore_loc :: lpFilePart
integer(LPSTR) lpFilePart ! LPSTR* lpFilePart
end function
end interface
! Use the cFileName from the structure in UNICODE
dwLenPathOut = GetFullPathName("\\?" // trim(FileInfo%cFileName), &
4096, &
cFullPathW, lpFilePart)
Thank you for your help.
Daniel.
I'm trying to retrieve a long full path, following a file search with FindFirstFile and FindNextFile, and FullPathQQ fails understandably as the buffer is limited to 260 chars.
I have tried to use aWIN API GetFullPathW to do the work, but somehow I cannot get it to work. The Intel interface defined in kernel32.f90 is pointing to the GetFullPathA, which cannot resolve paths longer than 260.
The length of the path, which I'm trying to retrieve is about 320chars. I am getting nothing in the output variable cFullPathW.
I have attached a part of the code below. What am I doing wrong?
integer(HANDLE) :: hFile
integer(BOOL) :: iResult
integer(DWORD) :: dwLenPathOut
integer(LPSTR) :: lpFilePart
integer :: ilen
integer(4) :: iLenPath
logical(4) :: lResult
logical :: first_instance
character(len=1024) :: cFullPath
character(len=4096) :: cFullPathW
type(T_WIN32_FIND_DATA) :: FileInfo
! Declare interfaces.
interface
function GetFullPathName( &
lpFileName, &
nBufferLength, &
lpBuffer, &
lpFilePart)
use ifwinty
integer(DWORD) :: GetFullPathName ! DWORD
!dec$ attributes default, stdcall, decorate, alias:'GetFullPathNameW' :: GetFullPathName
!dec$ attributes reference, ignore_loc, allow_null :: lpFileName
character*(*) lpFileName ! LPCSTR lpFileName
integer(DWORD) nBufferLength ! DWORD nBufferLength
!dec$ attributes reference, ignore_loc, allow_null :: lpBuffer
character*(*) lpBuffer ! LPSTR lpBuffer
!dec$ attributes reference, ignore_loc :: lpFilePart
integer(LPSTR) lpFilePart ! LPSTR* lpFilePart
end function
end interface
! Use the cFileName from the structure in UNICODE
dwLenPathOut = GetFullPathName("\\?" // trim(FileInfo%cFileName), &
4096, &
cFullPathW, lpFilePart)
Thank you for your help.
Daniel.
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, one thing that jumps out at me is that I don't see a NUL termination of the input string argument.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
See : http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
for a full explanation about maximum path length from Microsoft
Best regards
See : http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
for a full explanation about maximum path length from Microsoft
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
Well, one thing that jumps out at me is that I don't see a NUL termination of the input string argument.
Steve,
Thank you. I modified my code to include the NUL termination butit fails when it calls GetFullPathNameW routine. Maybe I have the interface wrong. Everything seems to be working fine, until I call this function. I cannot find any interface for this function.
I have attached my project should you wish to take a look.
Thank you for your time.
Daniel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - gvautier
Hello
See : http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
for a full explanation about maximum path length from Microsoft
Best regards
See : http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
for a full explanation about maximum path length from Microsoft
Best regards
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We don't provide interfaces to the "W" functions at this time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
We don't provide interfaces to the "W" functions at this time.
Steve,
Are there any plans to extend the functionality of routines that handle paths, such as FullPathQQ, to support more than MAXPATH characters?
If yes, in what version of the Compiler would you think they will be?
Thank you.
Daniel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That isn't on our list at this time. I don't think it's appropriate to try to extend GETFULLPATHQQ in this way because local paths are still subject to MAX_PATH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Daniel,
Many years ago when I encountered this problem (on Win95) we used the current directory/change current directory as a work around. Instead of getting the full path just get the file name. The current path you maintain in your own data space. Your API calls are relative to the current directory on the drive in question (and you hold onto the full path name). You will then have no limit on the path name.
C:Program Filesblabla bla...more of the same...do dado dafoo.dat
You can save the current directory on C: first then use
dir = 'C:Program Files'
CHANGEDIRQQ(dir)
dir ='C:.bla'
CHANGEDIRQQ(dir)
dir ='C:.bla bla'
CHANGEDIRQQ(dir)
etc...
When you are traversing folders it will be your responsibility to maintain the full path of where the current directory is on the drive of interest.
dir ='C:..' ! pop-up a level
CHANGEDIRQQ(dir)
BTW, we had to do this in order to backup the temporay internet folders.
Jim Dempsey
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page