转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 软件开发 >> VB.NET程序 >> 正文
直接从RING3获取硬盘序列号         ★★★★

直接从RING3获取硬盘序列号

作者:闵涛 文章来源:闵涛的学习笔记 点击数:1542 更新时间:2009/4/23 18:59:29
g() As Byte, uscStrSize As Long)
    Dim i As Long
    Dim temp As String
     For i = 0 To uscStrSize - 1 Step 2
        temp = szString(i)
        szString(i) = szString(i + 1)
        szString(i + 1) = temp
     Next i
End Sub

Private Function hdid9x() As String

''''We start in 95/98/Me
h = CreateFile("\\.\Smartvsd", 0, 0, 0, CREATE_NEW, 0, 0)
If h = 0 Then
    hdid9x = "open smartvsd.vxd failed"
    Exit Function
End If

Dim olp As OVERLAPPED
Dim lRet As Long
lRet = DeviceIoControl(h, DFP_GET_VERSION, ByVal 0&, 0, vers, Len(vers), ByVal i, olp)
If lRet = 0 Then
        hdid9x = "DeviceIoControl failed:DFP_GET_VERSION"
        CloseHandle (h)
        Exit Function
End If

''''If IDE identify command not supported, fails
If (vers.fCapabilities And 1) <> 1 Then
    hdid9x = "Error: IDE identify command not supported."
    CloseHandle (h)
    Exit Function
End If

''''Display IDE drive number detected
Dim sPreOutStr As String
sPreOutStr = DetectIDE(vers.bIDEDeviceMap)
hdid9x = sPreOutStr

''''Identify the IDE drives
For j = 0 To 3
    Dim phdinfo As TIDSECTOR
    Dim s(40) As Byte
   
    If (j And 1) = 1 Then
        in_data.irDriveRegs.bDriveHeadReg = &HB0
    Else
        in_data.irDriveRegs.bDriveHeadReg = &HA0
    End If
    If (vers.fCapabilities And (16 \ (2 ^ j))) = (16 \ (2 ^ j)) Then
        ''''We don''''t detect a ATAPI device.
        hdid9x = "Drive " & CStr(j + 1) & " is a ATAPI device, we don''''t detect it"
    Else
          in_data.irDriveRegs.bCommandReg = &HEC
          in_data.bDriveNumber = j
          in_data.irDriveRegs.bSectorCountReg = 1
          in_data.irDriveRegs.bSectorNumberReg = 1
          in_data.cBufferSize = 512
         
          lRet = DeviceIoControl(h, DFP_RECEIVE_DRIVE_DATA, in_data, Len(in_data), out_data, Len(out_data), ByVal i, olp)
         
          If lRet = 0 Then
              hdid9x = "DeviceIoControl failed:DFP_RECEIVE_DRIVE_DATA"
              CloseHandle (h)
              Exit Function
          End If
         
          Dim StrOut As String
         
          CopyMemory phdinfo, out_data.bBuffer(0), Len(phdinfo)
         
          CopyMemory s(0), phdinfo.sModelNumber(0), 40
          s(40) = 0
          ChangeByteOrder s, 40
         
          StrOut = ByteArrToString(s, 40)
         
          hdid9x = hdid9x & vbCrLf & "Module Number:" & StrOut
          CopyMemory s(0), phdinfo.sFirmwareRev(0), 8
          s(8) = 0
          ChangeByteOrder s, 8
         
          StrOut = ByteArrToString(s, 8)
         
          hdid9x = hdid9x & vbCrLf & "Firmware rev:" & StrOut
          CopyMemory s(0), phdinfo.sSerialNumber(0), 20
          s(20) = 0
          ChangeByteOrder s, 20
         
          StrOut = ByteArrToString(s, 20)
         
          hdid9x = hdid9x & vbCrLf & "Serial Number:" & StrOut
         
          CopyMemory s(0), phdinfo.ulTotalAddressableSectors(0), 4
         
          s(5) = 0
          Dim dblStrOut As Double
          dblStrOut = ByteArrToLong(s)
          hdid9x = hdid9x & vbCrLf & "Capacity:" & dblStrOut / 2 / 1024 & "M"
      End If
Next j

''''Close handle before quit
CloseHandle (h)
CopyRight

End Function

Private Function hdidnt() As String
Dim hd As String * 80
Dim phdinfo As TIDSECTOR
Dim s(40) As Byte
Dim StrOut As String

hdidnt = ""
''''We start in NT/Win2000

上一页  [1] [2] 


[Sql Server]直接从SQL语句问题贴子数据建表并生成建表语句的存…  
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · C语言系列  · VB.NET程序
    · JAVA开发  · Delphi程序
    · 脚本语言
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台