Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the volume label ...

Status
Not open for further replies.

ShyFox

Programmer
Mar 22, 2003
210
ES
Hy,
As I was looking for a better way to protect my application's cd from beeing copied without authorisation, I realised that as a another thing that I have to do is to read the volume label of the disk. Does anyoune knows how can I achieve that?
Regards

As I go deeper the road seems to go further. We're just simply pasangers on the road of knowledge.
 
Found it!

Declare Integer GetVolumeInformation in WIN32API ;
String @lpRootPathName, ;
String @lpVolumeNameBuffer, ;
Integer nVolumeNameSize, ;
Integer @lpVolumeSerialNumber, ;
Integer @lpMaximumComponentLength, ;
Integer @lpFileSystemFlags, ;
String @lpFileSystemNameBuffer, ;
Integer nFileSystemNameSize

Regards

As I go deeper the road seems to go further. We're just simply pasangers on the road of knowledge.
 
Hi Shy,

Try ...

DECLARE GetVolumeInformation IN win32api STRING, STRING @, INTEGER, INTEGER @, INTEGER @, INTEGER @, STRING @, INTEGER

LOCAL ;
lcFileSystemName, ;
lcRootPath, ;
lcVolname, ;
lnFileSystemFlags, ;
lnFsnameLen, ;
lnMaxFileNameLen, ;
lnVolNameLen, ;
lnVolumeSerialNumber

lcRootPath = 'H:\'
lcVolname = SPACE(255)
lnVolnameLen = LEN (lcVolName)
lnVolumeSerialNumber = 0
lnMaxFileNameLen = 0
lnFileSystemFlags = 0
lcFileSystemName = SPACE(255)
lnFsnameLen = LEN (lcFileSystemName)

=GetVolumeInformation ;
( ;
lcRootPath, ;
@lcVolname, ;
lnVolNameLen, ;
@lnVolumeSerialNumber, ;
@lnMaxFileNameLen, ;
@lnFileSystemFlags, ;
@lcFileSystemName, ;
lnFsnameLen ;
)

? LEFT (lcVolName, AT(CHR(0), lcVolName) - 1)
 
sarklow (Programmer)
I've already solved my problem but thank you for your example.
Regards

As I go deeper the road seems to go further. We're just simply pasangers on the road of knowledge.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top