Software Archive
Read-only legacy content
17061 Discussions

Problem with GetVolumeInformation

davidgraham
Beginner
513 Views
I am trying to get the serial number for security.
The following code works on some computers but not on others, then I ger error 'The specified path is invalid'.

 
lpszDriveName='c:' 
bRC=GetVolumeInformation(lpszDriveName,Volume,50,LOC(lpVolumeSerialNo),NULL,NULL,lpszSystemName,32) 


If I relpace lpszDiveName with NULL I get the error when compiling -
'The type of the actual argument differs from the type of the dummy argument'

Any ideas how I can get this call to work?

Thanks, David
0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
513 Views
Yes, zero-terminate lpszDriveName :-). The behaviour you get is "unexpected" -- it depends on what's in memory imediately behind lpszDriveName -- if it's zero, it works, otherwise doesn't.

Since lpszDriveName is declared as CHARACTER, you cannot send NULL, which is INTEGER. You can use NULL_CHARACTER constant declared in DFWINTY or %VAL(0) -- something like that, not sure about the right syntax -- maybe %REF(0).

Jugoslav
0 Kudos
Steven_L_Intel1
Employee
513 Views
NULL_CHARACTER or %VAL(0) will work.

Steve
0 Kudos
Reply