Help calling WIN API function from PVF Fortran

I’m trying to call function GetVolumeInformation located in kernel32.dll from PVF to read a disk serial number. The function is correctly returning the file system name (NTFS) through a string argument, but the disk serial number, which is an integer (LPDWORD) argument, is coming back as 0.

My simple program is shown below. I tried the equivalent program in VB.NET and I get my correct disk serial number value of 2026099636.

Can anyone tell me what I’m doing wrong in Fortran?
Thanks, Mark

program main

USE dfwin
  Integer(BOOL)    iret
  Character*60     RootPathName
  Character*60     VolumeNameBuffer
  Integer(DWORD)   VolumeNameSize
  Integer(HANDLE)  VolumeSerialNumber
  Integer(HANDLE)  MaximumComponentLength
  Integer(HANDLE)  FileSystemFlags
  Character*60     FileSystemNameBuffer
  Integer(DWORD)   FileSystemNameSize

	RootPathName = "c:\"	
	VolumeNameSize = 60
	FileSystemNameSize = 60

	iret = GetVolumeInformation( &
           TRIM(RootPathName), &
           VolumeNameBuffer, &
           VolumeNameSize, &
           VolumeSerialNumber, &
           MaximumComponentLength, &
           FileSystemFlags, &
           FileSystemNameBuffer, &

  print *,"File system name:      ", FileSystemNameBuffer
  print *,"Volume serial number:  ", VolumeSerialNumber
end program main


Thanks for reporting to us. We are looking into a problem to see if this is a compiler bug or it is coding issue with our implemention of GetVolumeInformation. We have filed a TPR #4333. We will report if a TPR is fixed.



We have fixed this bug and it will be out in 7.1-6 release.

Thanks for your help.