1. Larry Peters
  2. PowerBuilder
  3. Friday, 6 April 2018 03:43 AM UTC

My PowerBuilder app is using Appeon 2017 R2 Build 1756 with PFC.

The pfc_n_cst_filesrvwin32 object has a function of_dirlist() which lists all the files in a directory. It uses the Win API calls FindFirstFileA() and FindNextFileA().

The first argument to FindFirstFileA is a directory or path and a filename eg "O:\TestPath\*.FXC". This works fine EXCEPT when the "O:" drive is a mapped drive on a PC running a 64bit operating system like Win Server 2012.

I have googled this and I've been directed to using the Wow64RevertWow64FsRedirection function to get around this. I haven't had much luck. Has anybody hit this problem?

TIA

Larry Peters

Larry Peters Accepted Answer Pending Moderation
  1. Friday, 6 April 2018 04:46 AM UTC
  2. PowerBuilder
  3. # 1

I have done a bit more research and I find that I was wrong in my assumptions.

The file and path in my example was NOT "O:\TestPath\*.FXC". It was actually "O:\TestPath\????????.FXC".

The strange thing is that on a 64bit file system this will not find any files which have names not exactly 8 bytes long (excluding the suffix which MUST be "FXC"). By contrast on a 32bit file system all files are found which only have the "FXC" suffix.

This can be demonstrated outside the system.

Create three text files 12900508.FXC, LONGFILE12900510.FXC and LONG FILE 12900509.FXC.

Place the files in "O:\TestPath\" where "O:" is on a 64bit file system. Place the same files in "C:\TestPath\" where "C:" is on a 32bit file system.

Open a CMD session and DIR "O:\TestPath\????????.FXC". One file will get listed (12900508.FXC).

Now DIR "C:\TestPath\????????.FXC". ALL the files will get listed.

Sorry, for posting the query. There is no real problem in my code. I need to re-examine the logic of using the "?" wildcard.

However, any comments on the issue are welcome.

 

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Friday, 6 April 2018 05:19 AM UTC
  2. PowerBuilder
  3. # 2

pfc_n_cst_filsrvwin32 ist not the right class for unicode systems! You have to use pfc_n_cst_filesrvunicode. This uses the unicode functions FindFirstFileW and FindNextFileW.

Use should use the global function f_setfilesrv for instantiation. It selects the right class.

example:

n_cst_filesrv lnv_filesrv

f_SetFileSrv (lnv_filesrv, TRUE)  // create

// call functions of lnv_filesrv

f_SetFileSrv (lnv_filesrv, FALSE)  // destroy

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Friday, 6 April 2018 12:35 PM UTC
  2. PowerBuilder
  3. # 3

Try using * for the wildcard, it will pick up file names with any length.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.