Home > Back-end >  FORTRAN, access to the hard disk serial number/CPU/MAC/IP/graphics/motherboard hardware information
FORTRAN, access to the hard disk serial number/CPU/MAC/IP/graphics/motherboard hardware information

Time:09-18

Wrote before access to hard disk serial number of the DLL, delphi7 development, met a friend want to use in FORTRAN, a few days ago, was studied, the development kit can be downloaded to http://www.dxmylove.com/download/jyharddisk.zip, here is the code of FORTRAN,
The program FortranDemo

Use Kernel32

Implicit None

Interface

SUBROUTINE GetDiskSerialNumber1 (drive, pout, poutsize)
! DEC $ATTRIBUTES STDCALL: : GetDiskSerialNumber1
! DEC $ATTRIBUTES Alias: 'GetDiskSerialNumber1' : : GetDiskSerialNumber1
! DEC $ATTRIBUTES REFERENCE: : pout, poutsize
INTEGER: : poutsize
CHARACTER: (len=1) : drive
CHARACTER: : pout (*)
End SUBROUTINE
SUBROUTINE DoReg (user, userlen, regid regidlen)
! DEC $ATTRIBUTES STDCALL: : DoReg
! DEC $ATTRIBUTES Alias: 'DoReg' : : DoReg
! DEC $ATTRIBUTES REFERENCE: : pout, poutsize
INTEGER: : userlen, regidlen
CHARACTER: the user (*), regid (*)
End SUBROUTINE

End Interface

CHARACTER (len=20) dllname
Logical RetLog
The INTEGER poutsize
CHARACTER drive
CHARACTER: : pout (100)
CHARACTER (len=100) : : user
CHARACTER (len=300) : : regid
The INTEGER userlen, regidlen
The Pointer (fGetDiskSerialNumber1 GetDiskSerialNumber1)
The Pointer (fDoReg DoReg)
! Under a 32-bit INTEGER (4), under a 64 - bit INTEGER (8)
! INTEGER (4) hLib
! DEC $IF DEFINED (_X86_)
INTEGER (4) hLib
Dllname="jydisk. DLL" C
Print *, 'the win32'
! DEC $ELSE
INTEGER (8) hLib
Dllname="jydisk64. DLL" C
Print *, 'win64'
! DEC $ENDIF

HLib=LoadLibrary (dllname)

FDoReg=GetProcAddress call (hLib, 'DoReg C)
Print *, 'DoReg=' fDoReg

FGetDiskSerialNumber1=GetProcAddress call (hLib, 'GetDiskSerialNumber1 C)
Print *, 'GetDiskSerialNumber1=' fGetDiskSerialNumber1

User="171833017 @qq.com"
Regid="telme"
Userlen=len (trim (user))
Regidlen=len (trim (regid))
Call DoReg (user, userlen, regid regidlen)

Drive="c"
PRINT *, '=' in, drive
Call GetDiskSerialNumber1 (drive, pout, poutsize)
! Print *, 'RetLog=' RetLog

PRINT *, 'OUTPUT (1)=', poutsize
PRINT *, 'OUTPUT (2)=', pout

RetLog=FreeLibrary (hLib)


End the program FortranDemo

CodePudding user response:

This also charge! ?