| 
			 
					阅读:1480回复:5
				 
				求助地址问题
					已知物理地址,有没有什么函数可以把它转换成虚拟地址,然后可以在VC中对其进行操作?各位高手,帮帮忙吧,谢谢了!				 
							 | 
	|
					
						
						
						
						
  | 
	
| 
			 沙发# 
								发布于:2002-12-15 22:10				
			
					估计编写驱动程序;
 
							然后调用一个函数(自己查查),得到一个指针; 用deviceiocontrol()将指针传递到应用程序。 我以前用vxd做过。  | 
	|
| 
			 板凳# 
								发布于:2002-12-16 09:46				
			用户被禁言,该主题自动屏蔽! 				 | 
	|
| 
			 地板# 
								发布于:2002-12-16 10:09				
			估计编写驱动程序; 是的。这是一个类似问题的例程: NTSTATUS SX5933Device::IOCTL_MEM_Handler(KIrp I) { NTSTATUS status = STATUS_SUCCESS; t << \"Entering SX5933Device::IOCTL_MEM_Handler, \" << I << EOL; // TODO: Verify that the input parameters are correct // If not, return STATUS_INVALID_PARAMETER // TODO: Handle the the IOCTL_MEM request, or // defer the processing of the IRP (i.e. by queuing) and set // status to STATUS_PENDING. ULONG Address=Phy_Address.LowPart; MemRegion = new (NonPagedPool) KMemoryToProcessMap(Address, // peripheral memory address mem_length, // number of bytes (HANDLE)-1, // current process FALSE, // don\'t do kernel mapping NULL, // any address ViewShare); // view inherit if ( !MemRegion||!NT_SUCCESS( MemRegion->ConstructorStatus() ) ) { // insufficient memory I.Information() = 0; return FALSE; } ((Mem_Param*)I.IoctlBuffer())->mdr_PhysicalAddress=Address; ((Mem_Param*)I.IoctlBuffer())->mdr_LinearAddress=MemRegion->ProcessAddress(); // TODO: Assuming that the request was handled here. Set I.Information // to indicate how much data to copy back to the user. I.Information() = sizeof(ULONGLONG); return status; } NTSTATUS SX5933Device::IOCTL_UNMEM_Handler(KIrp I) { NTSTATUS status = STATUS_SUCCESS; t << \"Entering SX5933Device::IOCTL_UNMEM_Handler, \" << I << EOL; // TODO: Verify that the input parameters are correct // If not, return STATUS_INVALID_PARAMETER // TODO: Handle the the IOCTL_UNMEM request, or // defer the processing of the IRP (i.e. by queuing) and set // status to STATUS_PENDING. delete MemRegion; // TODO: Assuming that the request was handled here. Set I.Information // to indicate how much data to copy back to the user. I.Information() = 0; return status; }  | 
	|
					
						
  | 
	
| 
			 地下室# 
								发布于:2002-12-16 11:16				
			
					谢谢各位大虾!我就是要编驱动,但不能用VXD,只能用C、VC++或汇编。我想可能会有相应的函数吧,可是我找了很久还没找到,急!!!!高手们帮帮忙吧!				 
							 | 
	|
					
						
  | 
	
| 
			 5楼# 
								发布于:2002-12-16 12:47				
			
					如用DriverWorks,你可用这个函数:
 
							KMemoryToProcessMap() 具体用法可查帮助,我上面的贴子就是一个应用的例子。  | 
	|
					
						
  |