zoukankan      html  css  js  c++  java
  • 获取硬盘序列号的Fortran程序

    以前写了个获取硬盘序列号的fortran程序,但未经实证
    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 :: user(*),regid(*)
               End SUBROUTINE
            
              End Interface
               
              CHARACTER(len=20)  dllname
              Logical RetLog
              INTEGER poutsize
              CHARACTER  drive
              CHARACTER :: pout(100)
              CHARACTER(len=100) :: user
              CHARACTER(len=300) :: regid
              INTEGER userlen,regidlen
              Pointer (fGetDiskSerialNumber1, GetDiskSerialNumber1)
              Pointer (fDoReg, DoReg)
               !32位下INTEGER(4),64位下INTEGER(8)
              !INTEGER(4) hLib
              !DEC$ IF DEFINED (_X86_)          
               INTEGER(4) hLib
               dllname="jydisk.DLL"C
               print *,'win32'
              !DEC$ ELSE          
               INTEGER(8) hLib
               dllname="jydisk64.DLL"C
               print *,'win64 '
              !DEC$ ENDIF         
              
              hLib = LoadLibrary(dllname)
    
              fDoReg = GetProcAddress(hLib, 'DoReg'C)
          print *,'DoReg= ',fDoReg
              
              fGetDiskSerialNumber1 = GetProcAddress(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 program FortranDemo
    
  • 相关阅读:
    随笔-CompletableFuture的使用
    什么是spring,它能够做什么?
    springboot使用mail提示没有该类型的bean
    js中对对象经行判空
    记录一下第一次webSocket通信成功
    RuoYi-Cloud从配置到运行
    Git配置环境变量
    idea反编译失败 /* compiled code */的解决方法
    MacOS终端ssh登陆红旗系统后中文乱码问题解决
    佛教中的“荤腥”(辛腥)指的是什么?
  • 原文地址:https://www.cnblogs.com/China3S/p/9630401.html
Copyright © 2011-2022 走看看