读取MAC地址,winXP可以用,但是到了win7运行不了,求教
源程序如下:
[Fortran] 纯文本查看 复制代码 c subroutine machostnm
USE MSFLIB
LOGICAL(4) result
character sult(17)
c write(*,*) ' '
write(*,'(1x,a16\)') ' 正在验证用户... '
result = SYSTEMQQ('ipconfig /all >ipconfig.txt')
result = SYSTEMQQ('find "Physical Address" ipconfig.txt >
&massage.txt')
result = SYSTEMQQ('for /f "skip=1 tokens=2 delims=:" %a in
& (massage.txt) do @echo %a>a.txt')
result = SYSTEMQQ('for /f "tokens=* delims=- " %a in (a.txt)
& do @echo %a>mac地址.txt')
result = SYSTEMQQ('find "Host Name" ipconfig.txt >
&massage.txt')
result = SYSTEMQQ('for /f "skip=1 tokens=2 delims=:" %a in
& (massage.txt) do @echo %a>a.txt')
result = SYSTEMQQ('for /f "tokens=* delims=- " %a in (a.txt)
& do @echo %a>host用户名.txt')
result = SYSTEMQQ('del ipconfig.txt')
result = SYSTEMQQ('del massage.txt')
result = SYSTEMQQ('del a.txt')
! 物理网卡地址在 mac地址.txt 文件中
open(12,file='mac地址.txt')
read(12,'(17a1)') (sult(i),i=1,17)
close(12,status='delete')
write(111,*) sult
c write(*,'(A28,17a1\)') 'mac地址:',(sult(i),i=1,17)
open(12,file='host用户名.txt')
read(12,'(17a1)',err=123) (sult(i),i=1,17)
close(12,status='delete')
123 write(*,'(1x,A12,17a1\)') ' 用户名:',(sult(i),i=1,17)
return
end
win xp下面用得好好的,到了win7就用不了。
这是一个程序加密的子程序,把授权的电脑MAC地址写入源程序,电脑MAC地址跟程序一致才能运行。
现在系统都逐步升级到win7 win8,导致原有程序无法运行或无法加密。
求教论坛高手。
|