Lparameters tcVolume OldSet="'"+ALLTRIM(FULLPATH(CURDIR()))+"'" SET DEFAULT TO (tcVolume) Dimension taArray[10] *============================================================================== * Function: GetVolumeInformation * Purpose: Returns information about the specified volume * Author: Doug Hennig, from code taken off MSDN * Copyright: (c) 2001 Stonefield Systems Group Inc. * Last revision: 02/20/2001 * Parameters: tcVolume - the volume to get information for * taArray - an array to hold information about the volume: * * Column Information * ------ ----------- * 1 Volume name * 2 Volume serial number * 3 File system name (FAT, NTFS, etc.) * 4 .T. if the file system supports case-sensitive * filenames * 5 .T. if the file system preserves case of filenames * 6 .T. if the file system supports Unicode filenames * 7 .T. if the file system preserves and enforces ACLs * (NTFS only) * 8 .T. if the file system supports file-based * compression * 9 .T. if the volume is compressed * 10 maximum filename length * * Returns: .T. * Environment in: none * Environment out: none *============================================================================== #Define ccNULL Chr(0) #Define cnMAX_PATH 260 #Define cnFS_CASE_SENSITIVE 0 #Define cnFS_CASE_IS_PRESERVED 1 #Define cnFS_UNICODE_STORED_ON_DISK 2 #Define cnFS_PERSISTENT_ACLS 3 #Define cnFS_FILE_COMPRESSION 4 #Define cnFS_VOL_IS_COMPRESSED 15 Local lcVolume, ; lcVolumeName, ; lnVolumeNameLen, ; lnVolumeSerialNumber, ; lnMaxFileNameLen, ; lnFileSystemFlags, ; lcFileSystemName, ; lnFileSystemNameLen, ; lcFileInfo, ; lcFileName, ; laFiles[1], ; lnFiles, ; lnI, ; lcFile, ; lnHandle * Declare the API function and constants. Declare GetVolumeInformation In Win32API ; string lpRootPathName, String @lpVolumeNameBuffer, ; integer nVolumeNameSize, Integer @lpVolumeSerialNumber, ; integer @lpMaximumComponentLength, Integer @lpFileSystemFlags, ; string @lpFileSystemNameBuffer, Integer nFileSystemNameSize * If the path wasn't specified, use the current drive. Otherwise, get the drive * for the specified path, handling UNC paths specially. Do Case Case Vartype(tcVolume) ='C' *&& #108;t;> 'C' or empty(tcVolume) lcVolume = Addbs(Sys(5)) Case Left(tcVolume, 2) = '\\' lcVolume = Addbs(tcVolume) lcVolume = Left(lcVolume, At('\', lcVolume, 4)) Case Len(tcVolume) = 1 lcVolume = tcVolume + ':\' Otherwise lcVolume = Addbs(Justdrive(tcVolume)) Endcase * Create the parameters for the API function, then call it. lcVolumeName = Space(255) lnVolumeNameLen = Len(lcVolumeName) lnVolumeSerialNumber = 0 lnMaxFileNameLen = 0 lnFileSystemFlags = 0 lcFileSystemName = Space(255) lnFileSystemNameLen = Len(lcFileSystemName) GetVolumeInformation(lcVolume, @lcVolumeName, lnVolumeNameLen, ; @lnVolumeSerialNumber, @lnMaxFileNameLen, @lnFileSystemFlags, ; @lcFileSystemName, lnFileSystemNameLen) * Put the information into the array. Dimension taArray[10] taArray[ 1] = Left(lcVolumeName, At(ccNULL, lcVolumeName) - 1) taArray[ 2] = lnVolumeSerialNumber taArray[ 3] = Left(lcFileSystemName, At(ccNULL, lcFileSystemName) - 1) taArray[ 4] = Bittest(lnFileSystemFlags, cnFS_CASE_SENSITIVE) taArray[ 5] = Bittest(lnFileSystemFlags, cnFS_CASE_IS_PRESERVED) taArray[ 6] = Bittest(lnFileSystemFlags, cnFS_UNICODE_STORED_ON_DISK) taArray[ 7] = Bittest(lnFileSystemFlags, cnFS_PERSISTENT_ACLS) taArray[ 8] = Bittest(lnFileSystemFlags, cnFS_FILE_COMPRESSION) taArray[ 9] = Bittest(lnFileSystemFlags, cnFS_VOL_IS_COMPRESSED) taArray[10] = lnMaxFileNameLen * If the serial number is 0 (which happens with Win95/98 systems on remote * drives), open a file on the drive and get the file information for it. If lnVolumeSerialNumber = 0 Declare GetFileInformationByHandle In Win32API ; integer lnHandle, String @lcFileInfo Declare Integer CreateFile In Win32API ; string @lcFileName, Integer dwDesiredAccess, ; integer dwShareMode, Integer lpSecurityAttributes, ; integer dwCreationDisposition, Integer dwFlagsAndAttributes, ; integer hTemplateFile Declare CloseHandle In Win32API ; integer lnHandle lcFileInfo = Space(255) * If a file was specified for the volume name, use it. Otherwise, find some * file we can open. If File(tcVolume) lcFileName = tcVolume Else lnFiles = Adir(laFiles, lcVolume + '*.*') lcFileName = '' For lnI = 1 To lnFiles lcFile = lcVolume + laFiles[lnI, 1] lnHandle = Fopen(lcFile) Fclose(lnHandle) If lnHandle >= 0 && >= 0 lcFileName = lcFile Exit Endif &&lnHandle >= 0 Next lnI Endif File(tcVolume) If Not Empty(lcFileName) lnHandle = CreateFile(@lcFileName, 0, 0, 0, 3, 0, 0) If lnHandle >= 0 && >= 0 GetFileInformationByHandle(lnHandle, @lcFileInfo) CloseHandle(lnHandle) lnVolumeSerialNumber = Hex2Decimal(Substr(lcFileInfo, 29, 4)) taArray[2] = lnVolumeSerialNumber Endif &&lnHandle >= 0 Endif Not Empty(lcFileName) Endif lnVolumeSerialNumber = 0 RetValue=taArray[ 2] Release taArray, lcVolume, lcVolumeName,lnVolumeNameLen,lnVolumeSerialNumber,lnMaxFileNameLen RELEASE lnFileSystemFlags,lcFileSystemName,lnFileSystemNameLen,lcFileInfo,lcFileName,laFiles,lnFiles,lnI,lcFile,lnHandle IF !EMPTY(OldSet) SET DEFAULT TO &OldSet ENDIF Return RetValue *============================================================================== * Function: Hex2Decimal * Purpose: Converts a value in Intel format to a decimal value * Author: Doug Hennig * Copyright: (c) 1996 Stonefield Systems Group Inc. * Last Revision: 09/07/99 * Parameters: tcValue - the value to convert * tlSigned - .T. if the value is signed * Returns: the numeric value * Environment in: none * Environment out: none *============================================================================== FUNCTION Hex2Decimal Lparameters tcValue, ; tlSigned Local lnDecimal, ; lnLen, ; lnI, ; lnMSB, ; lnMax lnDecimal = 0 lnLen = Len(tcValue) For lnI = 1 To lnLen lnDecimal = lnDecimal + Asc(Substr(tcValue, lnI, 1)) * 256 ^ (lnI - 1) Next lnI If tlSigned lnMSB = (lnLen * 8) - 1 If Bittest(lnDecimal, lnMSB) lnMax = 2 ^ (lnMSB + 1) lnDecimal = lnResult - lnMax Endif Bittest(lnDecimal, lnMSB) Endif tlSigned Return lnDecimal>We would like to change our present piracy control method. I can't disclose how it's done but it's simple & we developer know it. Hint : We update the s/w regularly at Customer site. It's getting unmanagable. Some people know & have started pirating our s/w. Our s/w is a Accounting software & sell copies.