找回密码
 加入计匠网
搜索
热搜: BIOS ACPI CPU Windows
查看: 55225|回复: 16

怎么用WINIO去读FFFFFFFF这个地址?

[复制链接]
发表于 2008-3-29 08:37:22 | 显示全部楼层 |阅读模式
怎么用WINIO去读FFFFFFFF这个地址?
发表于 2008-4-7 23:12:35 | 显示全部楼层
贴一个WINIO自带的例子:* A- |) i, y! ~0 _% T$ u
#include <windows.h>
% K' U* M8 c8 f. t6 U#include <stdio.h>% W1 ?$ @/ j3 P( A4 f6 m
#include "winio.h"
; ~$ ]5 F, W/ l& ^& `/ R& h$ p6 j7 g9 u9 `6 |
void main()
# p6 s& [2 c  q{5 U7 \0 H$ H0 u! i( V
  DWORD dwPortVal;0 U# [) ?1 e! o+ Q  d
  DWORD dwMemVal;
+ x5 }: k5 Y5 J1 r  bool bResult;. ~& |' M: b3 P5 `& o: [9 q- h# l( Q
  HANDLE hPhysicalMemory;  E7 t, h9 W& F+ u; r; N; @! M
  PBYTE pbLinAddr;
5 P4 k; A1 ~. ?4 j2 ?; \% Y7 }" Y1 Z: e' p8 x9 M: s6 y
  // Call InitializeWinIo to initialize the WinIo library.
4 v$ \0 y7 z0 N& i# j1 n$ e3 Q/ J" C
  bResult = InitializeWinIo();
! P  f, b( O' ~5 {2 @. b) Z& A; T9 y+ ]+ I5 j5 z7 m
  if (bResult)
; N+ P. g" j; R  {
: s7 }0 t: m- _8 \  z8 U    // Under Windows NT/2000/XP, after calling InitializeWinIo,3 ?$ {, [" C6 ^) ^0 T0 a& J
    // you can call _inp/_outp instead of using GetPortVal/SetPortVal% t7 F% m) }, _

, `5 e/ b( Z/ E, a    GetPortVal(0x378, &dwPortVal, 4);+ _! t! S/ c7 t& _2 f

3 x/ p  y2 B; _    SetPortVal(0x378, 10, 4);0 d! Y6 \1 W7 G! Y  R' c
7 {! a6 }9 V/ i. c
    // Map physical addresses 0xA0000 - 0xAFFFF into the linear address space8 C2 n2 [- B$ G+ Y9 n; ]# z( B
    // of the application. The value returned from the call to MapPhysToLin is% t7 [: ?6 \% l
    // a linear address corresponding to physical address 0xA0000. In case of
8 `/ c1 I4 p  M" z; i: c) N: k    // an error, the return value is NULL.
( Y* o6 ~# T1 M6 L0 B! k# Q  \& O, n& k
( [" h  H/ I4 o: q- f    pbLinAddr = MapPhysToLin((PBYTE)0xA0000, 65536, &hPhysicalMemory);
4 q- Q) ^( i$ p# V. T2 s% `' F. _
    if (pbLinAddr)
2 q! k" _" q/ H( N7 d% L+ `    {
* i7 ?  Y8 ?1 i4 |& J- ^      // Now we can use pbLinAddr to access physical address 0xA0000
' `6 Z( g. z6 x/ l5 N3 P7 ~. G/ r
      *pbLinAddr = 10;: j. o6 p# {2 `
/ j7 L# u5 L* J: Z9 ~
      // When you're done with pbLinAddr, call UnmapPhysicalMemory
* h; G! u" M0 Z# M
. P) H9 w& t' a" i      UnmapPhysicalMemory(hPhysicalMemory, pbLinAddr);* u( m9 N+ ^( I2 n! S. S, V
    }3 `- u& \8 A% N. W

8 u# d2 j, |, W9 n8 c+ ]* {, s    // Instead of using MapPhysToLin, we can use GetPhysLong/SetPhysLong0 g- k: x# {; y( o5 v
4 I/ D* Z+ D; k# m2 e6 q
    GetPhysLong((PBYTE)0xA0000, &dwMemVal);
( v' ]; h& B' B( {* y# l# Y1 o
" {# a3 ^0 `. m. U9 m7 @6 h# r2 m    SetPhysLong((PBYTE)0xA0000, 10);
) T. m- M- I0 v  X" D' r- V, g- `2 H0 W4 Z8 c) _, o7 T
    // When you're done using WinIo, call ShutdownWinIo
4 _! {# i4 s: r6 k. k. b3 n! y& r: I2 ]7 e/ ?7 Y9 Y3 Z
    ShutdownWinIo();
" e& t- F& `! |; p8 c  M  }7 {( c! \0 R0 k  n1 {- _
  else2 ?. x$ w7 W( ]) O" b( }
  {/ f6 |" p8 f" b, k( D# [
    printf("Error during initialization of WinIo.\n");
! K$ ^7 i8 v7 b    exit(1);. q0 `. L+ N" a& p9 V
  }
+ O6 P) _) B$ l' s2 @" I}
回复

使用道具 举报

发表于 2008-9-23 14:49:10 | 显示全部楼层
楼上的有试过吗?楼主所说的 地址超过2G了哦
回复

使用道具 举报

发表于 2008-9-24 20:00:29 | 显示全部楼层
我目前也是2G之后就不行了
回复

使用道具 举报

发表于 2008-12-12 21:45:50 | 显示全部楼层
WinIO是有2G的限制,因为2G~4G之间属于系统部分,Microsoft是不会让用户自己乱搞的。
回复

使用道具 举报

发表于 2008-12-13 17:07:47 | 显示全部楼层
此问题已解决,请用附件改过的WinIo库,就可以访问到>2G的memory了
# d( O0 R9 w# j0 I+ ?" N8 f. X) e4 h7 t5 S7 y1 ^! f% H
[ 本帖最后由 happybasic 于 2008-12-24 11:00 编辑 ]
回复

使用道具 举报

发表于 2008-12-18 15:36:12 | 显示全部楼层
向happybasic 表达一下自己的无线敬意!!
回复

使用道具 举报

发表于 2008-12-23 22:24:04 | 显示全部楼层
谢谢2#和6#
回复

使用道具 举报

发表于 2008-12-24 11:19:55 | 显示全部楼层
谁来翻译/解释一下~
1 N9 R. U4 Y6 S7 a  X+ ~END USER LICENSE AGREEMENT
' z: G5 [2 Y# k$ h2 }* T" Y1 g4 r4 Y
Software License Agreement for WinIo
! ^) I8 Y1 X4 J, @2 LThe following terms apply to all files associated with the software unless explicitly disclaimed in individual files. % z" t3 d/ k5 h+ v  N. E& k

$ p0 H+ H( w* E0 e5 ]) K/ h8 h1 b- @IMPORTANT- PLEASE READ CAREFULLY: BY INSTALLING THE SOFTWARE (AS DEFINED BELOW), OR COPYING THE SOFTWARE, YOU (EITHER ON BEHALF OF YOURSELF AS AN INDIVIDUAL OR ON BEHALF OF AN ENTITY AS ITS AUTHORIZED REPRESENTATIVE) AGREE TO ALL OF THE TERMS OF THIS END USER LICENSE AGREEMENT ("AGREEMENT") REGARDING YOUR USE OF THE SOFTWARE. IF YOU DO NOT AGREE WITH ALL OF THE TERMS OF THIS AGREEMENT, DO NOT INSTALL, COPY OR OTHERWISE USE THE SOFTWARE. ( J) c% Y4 P0 H/ u
: T( P, \1 `, X+ N
1. GRANT OF LICENSE: Subject to the terms below, Yariv Kaplan ("AUTHOR") hereby grants you a non-exclusive, non-transferable, non-assignable license to install and to use the downloadable version of WinIo ("SOFTWARE"). , O5 I/ P9 S/ x! y* D; `- C

, i* p7 T; Y  d/ |  K5 H4 da. Redistributable Code. You may reproduce and distribute the object code form of the SOFTWARE solely in conjunction with, and as part of, your application ("Permitted Application"); provided that you comply with the following: ( x$ u" f$ {3 w  q- [. T& i
8 W0 \; v/ J) g9 H  `
If you redistribute any portion of the Redistributable Code, you agree that: (i) you will only distribute the Redistributable Code in conjunction with, and as part of, your Permitted Application which adds significant functionality to the Redistributable Code and that distribution of the Permitted Application does not compete with the AUTHOR's distribution of the SOFTWARE; (ii) you will include a valid copyright notice on your Permitted Application; (iii) you will not permit further redistribution of the Redistributable Code; and (iv) you will indemnify, hold harmless, and defend the AUTHOR from and against any claims or lawsuits, including attorneys' fees, that arise or result from the use or distribution of your Permitted Application. ) l5 |8 s( i. F# X, g6 h4 G

5 q$ o) `  g/ R+ l$ Rb. License to use Source Code. You may not sell, lease, rent, transfer or sublicense the source code of this SOFTWARE.
9 f9 P2 u1 \. o/ Q8 L8 ]3 H9 m6 s
7 h9 @1 K6 P/ V. Y2. MODIFICATION: SOFTWARE Source Code may be modified without the prior written permission of the AUTHOR. Any modifications made to the SOFTWARE will continue to be subject to the terms and conditions of this AGREEMENT. 2 M9 `# ~7 K  {+ D# n

0 T+ m' D1 p* e8 x8 o3. COPYRIGHT: All rights, title, and copyrights in and to the SOFTWARE and any copies of the SOFTWARE are owned by the AUTHOR. The SOFTWARE is protected by copyright laws and international treaty provisions. Therefore, you must treat the SOFTWARE like any other copyrighted material. 9 A8 c" }) M( Q/ K. \$ `& f) }

# _) \8 F8 ~9 u/ e4 }* `4. TITLE: You acknowledge that no title to the intellectual property in the SOFTWARE is transferred to you. Title, ownership, rights, and intellectual property rights in and to the SOFTWARE shall remain the exclusive property of the AUTHOR. The SOFTWARE is protected by copyright laws of the United States and international treaties. " w. }- m( W; a7 x) J8 Z

0 a  @7 l# E& b7 w1 [3 S! Q+ v5. LIMITATION OF LIABILITY: You must assume the entire risk of using the SOFTWARE. " {& p" n* _+ z; f

) a9 g6 B" [) Z& o% `/ ]# HIN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . l! E3 G8 a. u" F. r- v& l2 @
, ~* O: E" B/ c
THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHOR HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
回复

使用道具 举报

发表于 2008-12-24 11:21:14 | 显示全部楼层
刚收到一位在用我改过的WinIo的网友提醒说我可能在违反license ... 很晕的说,他先下了,再提醒我....
回复

使用道具 举报

发表于 2009-1-16 00:42:09 | 显示全部楼层
对,向happybasic 表达一下自己的无线敬意!!他人很好~
回复

使用道具 举报

发表于 2009-2-14 22:41:35 | 显示全部楼层
原帖由 happybasic 于 2008-12-24 11:21 发表
' }/ y4 K+ E5 ?5 q/ d/ _刚收到一位在用我改过的WinIo的网友提醒说我可能在违反license ... 很晕的说,他先下了,再提醒我....

. @" `2 p, h, m( u5 ]5 t' N% C- D7 ~( P& ~# x3 l& B4 Q
winio早已经不维护了,他自己有bug还不许别人修改吗。
9 M. ?4 Q% D! ^$ N
+ T" g7 p9 Z2 D( _8 @. k原来的作者误以为_LARGE_INTEGER的QuartPart是个无符号数了。
回复

使用道具 举报

发表于 2009-6-14 14:57:16 | 显示全部楼层
我路过,,我是菜鸟,
回复

使用道具 举报

发表于 2010-3-23 16:09:06 | 显示全部楼层
原帖由 happybasic 于 2008-12-13 17:07 发表 9 c5 d2 J  r. _2 G8 ?
此问题已解决,请用附件修改过的WinIo库,就可以访问到>2G的memory了
: D0 r) e$ ]" i2 n

) ?8 P! x: O. V9 m3 v5 Z请问现在这个修改过的winIo库还有吗?好像删除了
回复

使用道具 举报

发表于 2010-3-23 16:29:29 | 显示全部楼层
已经找到了,感谢各位~
回复

使用道具 举报

发表于 2010-3-31 11:40:16 | 显示全部楼层
pStartPhysAddress.QuadPart = (ULONGLONG)pPhysAddress &.......
回复

使用道具 举报

发表于 2011-5-26 20:29:37 | 显示全部楼层
也在为读取2G以上的地址所困扰,谢谢
9 `% p7 L' f; J! n; k) I/ p) l+ x+ n3 J- I0 O# ?* h
所说的附件呢?
: M* x1 z! n7 p) A8 g: A9 o1 {8 ^& `. R
[ 本帖最后由 iwillbeback008 于 2011-5-26 20:31 编辑 ]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 加入计匠网

本版积分规则

Archiver|手机版|小黑屋|计匠网

GMT+8, 2024-5-9 15:31 , Processed in 0.036830 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表