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 strongm 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 Disk Serial Number in fwp2.6

Status
Not open for further replies.

jorgematheus

Programmer
Nov 23, 2001
5
Hi

I'm trying to get the Disk Serial number from FPW 2.6a

using WInd West Tch approach using declare32, but not
succeed.

Can someone help out here.
Here is the code
***rutina para averiguar serie de disco duro
SET CONFIRM OFF
SET BELL ON
SET ECHO OFF
SET DELE ON
SET TALK OFF
SET SAFETY OFF
SET HEADING OFF
SET DELIMITER OFF
SET DEVICE TO SCREEN
SET ESCAPE Off
SET CENTURY ON
SET DATE TO BRITISH
SET INTENSITY ON
SET BLINK ON
SET SYSMENU to
SET STATUS BAR OFF


lproot="c:\"
lpvolname=space(256)
nvolsize=256
lpvolnumber=0
lpmaxcomp=256
lpflags=0
lpfsname=space(256)
nfssize=256
set library to "c:\WINDOWS\foxtools" additive
uno = regfn("Declare32","CCC","L","CALL32.DLL")
? UNO
dos=callfn(uno,"GetVolumeInformation","win32api.dll","ppiiiipi")
? DOS
tres=regfn("Call32","@C@CI@I@I@I@CIL","L","CALL32.DLL")
? TRES
CUAT = callfn(tres,@lproot,@lpvolname,nvolsize,@lpvolnumber,@lpmaxcomp,@lpflags,@lpfsname,nfssize,dos)

*declare integer GetVolumeInformation in win32api as getvolinfo;
*string @lproot,;
*string @lpvolname,;
*integer nvolsize,;
*integer @lpvolnumber,;
*integer @lpmaxcomp,;
*integer @lpflags,;
*string @lpfsname,;
*integer nfssize

*inret=getvolinfo(@lproot,@lpvolname,nvolsize,@lpvolnumber,@lpmaxcomp,@lpflags,@lpfsname,nfssize)

if CUAT>0
lcstring="drive name:"+alltrim(lproot)+chr(13)+;
"vol name:"+left(alltrim(lpvolname),len(alltrim(lpvolname))-1)+chr(13)+;
"max#/chars in vol name:"+alltrim(str(nvolsize))+chr(13)+;
"vol serial#:"+alltrim(str(lpvolnumber))+chr(13)+;
"max #/chars in dir/file names:"+alltrim(str(lpmaxcomp))+chr(13)+;
"file sys flags:"+alltrim(str(lpflags))+chr(13)+;
"file sys type:"+ left(alltrim(lpfsname),len(alltrim(lpfsname))-1)+chr(13)+;
"file size name:"+alltrim(str(nfssize))
else
lcstring="no sepudo ver informacion"
endif
*=messagebox(lcstring,"Informacion del volumen")
? "drive name:"+alltrim(lproot)
? "vol name:"+left(alltrim(lpvolname),len(alltrim(lpvolname))-1)
? "max#/chars in vol name:"+alltrim(str(nvolsize))
? "vol serial#:"+alltrim(str(lpvolnumber))
? "max #/chars in dir/file names:"+alltrim(str(lpmaxcomp))
? "file sys flags:"+alltrim(str(lpflags))
? "file sys type:"+ left(alltrim(lpfsname),len(alltrim(lpfsname))-1)
? "file size name:"+alltrim(str(nfssize))
wait window "pausa"

return

Thank in advace
 
Jorge:

En alguna oportunidad hice algo así con la interrupción 25H de MS-DOS (lectura absoluta de disco). No es simple (hay que crear un programa en Assembler, y compilarlo para crear un ".bin"). Luego se carga pasando un parámetro (LOAD mirutina.bin WITH cadena, y el FP retorna el valor en "cadena" (verdadera magia negra!). Tampoco sé si funcionaría en los sistemas actuales...

Si verdaderamente te interesa, me pongo a buscar algún fuente, quizás tenga algo por ahí.

David.
 
dear gentlemen

my spanish is very poor. Could you please translate what has been discussed? Thank you very much.
 
codetyko,

I'll try to translate:

&quot;Once I made something like this through MS-DOS 25h interruption (absolute disk reading). It's not easy (you should create an Assembler program and compile it to create '.bin' file. This one is load it passing a parameter (LOAD myroutine.bin WITH <string>), and FP returns in <string> the value read. I'm not sure if it would work in present systems...&quot;


David.

 
run dir > hdsn.txt
lnHandle = fopen(&quot;hdsn.txt&quot;)
do while not feof(lnHandle)
lcText = upper(alltrim(fgets(lnHandle)))
if lcText = &quot;Volume Serial Number is &quot;
lcDiskSn = substr(lcText , 25)
exit
endif
enddo

or something like that, These is also a Win-API command to do it but I was to busy to look it up.
David W. Grewe
Dave@internationalbid.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top