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

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

[复制链接]
发表于 2008-3-29 08:37:22 | 显示全部楼层 |阅读模式
怎么用WINIO去读FFFFFFFF这个地址?
发表于 2008-4-7 23:12:35 | 显示全部楼层
贴一个WINIO自带的例子:
- Z2 s6 Y3 Q4 `# W#include <windows.h>% M: ^. b! U2 Q3 q7 E4 O
#include <stdio.h>
) ^3 U% j# A1 P! J! Z6 b#include "winio.h"
; [) T! X: Q% Z; M4 m- }( i
. ^+ p/ a) |( b0 y$ t7 y0 Rvoid main()
5 V. f  n# z5 V- c# O3 j{( P  t& S  M7 I+ M( L
  DWORD dwPortVal;
! L. `* v/ v. x- |& N  DWORD dwMemVal;
5 C+ U/ o: a0 X  bool bResult;8 C% V& u* u# V  k' d
  HANDLE hPhysicalMemory;
# N" u+ o$ g2 G. \2 q3 A) y  PBYTE pbLinAddr;
( x7 N8 e# U* y# R/ G; u# e- e; ~) t' t/ F' N) j
  // Call InitializeWinIo to initialize the WinIo library.
6 Y+ C/ t/ Z. c, x" n
) A' x. Q7 C, w& Z. b% u# @  bResult = InitializeWinIo();
+ i  n+ x- y0 m1 ^- a& N8 B, m+ T$ q- J- a0 D, U- n
  if (bResult)" q( B* h" R( F0 V5 Q0 Q, I
  {0 B  P8 W& h# }: \
    // Under Windows NT/2000/XP, after calling InitializeWinIo,
' n3 s: _+ ^+ t5 H6 _+ g    // you can call _inp/_outp instead of using GetPortVal/SetPortVal
! E+ P; @; f& C  [% j
- w9 n  n8 i/ M2 Z4 N% a! B- N    GetPortVal(0x378, &dwPortVal, 4);+ w& x2 X: a  `* z% \

1 |! f( c! [1 p$ N3 t. G" d    SetPortVal(0x378, 10, 4);
$ v/ x  j- M- W& D5 t# X% c; b6 E: Z4 ?% G
    // Map physical addresses 0xA0000 - 0xAFFFF into the linear address space
; s4 K, C' X  t9 i9 R) ]2 w    // of the application. The value returned from the call to MapPhysToLin is  ~5 x2 d( v1 x. x  Y+ M
    // a linear address corresponding to physical address 0xA0000. In case of
4 \* D+ H3 _+ ?1 Y    // an error, the return value is NULL.
+ c; B) Q  @- a8 P- Y- c" I" p
$ f& [- y/ _( K    pbLinAddr = MapPhysToLin((PBYTE)0xA0000, 65536, &hPhysicalMemory);
  J7 p( G$ U1 G0 _+ n' l' ^4 h2 V
    if (pbLinAddr)4 K( ?1 d# }8 q( u7 O; J# g
    {
! B! T; f0 A6 M6 \+ P, ]: f      // Now we can use pbLinAddr to access physical address 0xA00005 Q/ p5 d( h: j9 T

  X# O" V8 u0 \      *pbLinAddr = 10;- x& K, O4 m# V# L' J6 W2 {
$ m) k; ^; u2 ^; K9 E- w) e* v- r
      // When you're done with pbLinAddr, call UnmapPhysicalMemory2 U& s3 {" _  Z5 ~1 o% d- p5 T7 e2 o
- Q7 s. @) e+ ?* ?
      UnmapPhysicalMemory(hPhysicalMemory, pbLinAddr);
. i& b% p: m% P3 L5 R0 S6 U" n& Q    }
# U* l6 N/ p& x$ \* T0 t. X
( J# j# l7 l! r/ ?' f" X    // Instead of using MapPhysToLin, we can use GetPhysLong/SetPhysLong
. A* j: i$ d) P! H/ M0 n! g5 F/ N4 S$ c) a# e
    GetPhysLong((PBYTE)0xA0000, &dwMemVal);
  ^5 N: n2 i; a; G/ C; o1 q0 s
7 X, |$ T; b+ i  k, x4 r5 w* v    SetPhysLong((PBYTE)0xA0000, 10);
/ g% G  P+ v6 e8 u6 X- S% t7 c+ q% h2 O" b
    // When you're done using WinIo, call ShutdownWinIo
2 Z; f) W; J0 p' f: e) x  X
0 _# y( C7 u% Q2 ?5 }4 T) r    ShutdownWinIo();
" Z! p1 `, c4 N2 A  }
2 ~2 Y: w# o1 b5 [, t  else
1 i% U6 _6 D" T! T6 w: S0 T0 N% h6 }  {: I/ ?/ O1 y; ?. c
    printf("Error during initialization of WinIo.\n");5 n9 O; b4 |# Z* P( O' R
    exit(1);
* j( k, Z- h2 S( `5 N; r  }
7 @  k7 U+ h$ N4 a3 ~4 J. `7 [% k}
回复

使用道具 举报

发表于 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了
/ o0 ?& ?5 A, V' i' W) B
0 @" A4 h) g+ e' U' I7 V' ?- o[ 本帖最后由 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 | 显示全部楼层
谁来翻译/解释一下~
7 |8 Z7 `3 z0 mEND USER LICENSE AGREEMENT
$ v0 r+ t) C' T: m% ^3 Y
! C/ @, n3 ~/ }+ ~0 eSoftware License Agreement for WinIo % e9 ~& l4 ^, }) b
The following terms apply to all files associated with the software unless explicitly disclaimed in individual files. 4 U4 M( t# [, j) i2 B- A
0 Q* N+ M, t+ _( ^
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.
" z8 a* G3 F" r  Y) z0 ^% ?6 Z8 w" M! U
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").
0 T1 T( d# f% A5 f: Y# e5 M0 f/ P& t8 a' }1 c/ X7 B1 }! J
a. 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:
6 T% j; k# o* `4 W4 i. g& O' Z
  O# t1 j6 H+ C5 ?2 BIf 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.
$ U+ D/ E; m) V  V- e/ O- c
0 Q% Q* @2 D" m6 d3 n, Q7 Q  Kb. License to use Source Code. You may not sell, lease, rent, transfer or sublicense the source code of this SOFTWARE. : `/ b& U: s, P' L

2 d# R7 r9 k8 F* E/ Q2. 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. : \& d8 v. _% n/ N

7 e7 k' V3 L; T. ?- X. k( [' M3. 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 V% }0 l/ o5 `4 P; G: ?2 m; D! f: U- x
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. ' N; b. T0 D+ |/ J  q0 m
. m# e8 c9 _3 Y- |0 j0 V7 a
5. LIMITATION OF LIABILITY: You must assume the entire risk of using the SOFTWARE. 0 J1 a) }" k8 [. J% N
0 e7 o4 Q# Y- r4 I+ X# n- a" J
IN 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. 3 W' b4 P! y9 z* _( a/ F: W/ d+ M
! ~- U: O% h2 N) Q" ]
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 发表
. @) q# E+ p4 s; s& p& M刚收到一位在用我改过的WinIo的网友提醒说我可能在违反license ... 很晕的说,他先下了,再提醒我....
" w6 c' q6 Z8 s4 v: p8 H4 d
9 p, X3 s' T% N) j
winio早已经不维护了,他自己有bug还不许别人修改吗。
1 Z8 V6 X% f* |+ I$ |% u! g- c
' A. M5 J* E+ y0 v% B原来的作者误以为_LARGE_INTEGER的QuartPart是个无符号数了。
回复

使用道具 举报

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

使用道具 举报

发表于 2010-3-23 16:09:06 | 显示全部楼层
原帖由 happybasic 于 2008-12-13 17:07 发表
6 e. I1 [  x8 @. D此问题已解决,请用附件修改过的WinIo库,就可以访问到>2G的memory了

' ~8 h: Q& h- O  l8 K6 V7 q8 i4 X+ h6 r" W* z3 L8 y, ~5 r
请问现在这个修改过的winIo库还有吗?好像删除了
回复

使用道具 举报

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

使用道具 举报

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

使用道具 举报

发表于 2011-5-26 20:29:37 | 显示全部楼层
也在为读取2G以上的地址所困扰,谢谢, I% a0 L! e+ L' w1 I  f( s5 \

1 O" d% A9 u7 C+ T所说的附件呢?
8 W$ Y$ x/ E, q, T  \
) D+ }0 H! i! q, S$ g% j+ J8 p[ 本帖最后由 iwillbeback008 于 2011-5-26 20:31 编辑 ]
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-21 17:41 , Processed in 0.038086 second(s), 17 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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