0516008.htm

来自「VC知识库5_chm_decompile_20040520_210715」· HTM 代码 · 共 272 行 · 第 1/2 页

HTM
272
字号
<p> 
<font size="3">  {</font>
<p>
<font size="3">  public:</font>
<p>
<font size="3">       virtual BOOL OnSysDynamicDeviceInit();</font> 
<p> 
<font size="3">       virtual BOOL OnSysDynamicDeviceExit();</font> 
<p> 
<font size="3">       virtual DWORD OnW32DeviceIoControl(PIOCTLPARAMS pDIOCParams);</font> 
<p> 
<font size="3">       MyHwInt* pMyIRQ;</font> 
<p> 
<font size="3">  };</font>
<p>
<font size="3">  class AudcardVM : public VVirtualMachine</font> 
<p> 
<font size="3">  {</font>
<p>
<font size="3">  public:</font>
<p>
<font size="3">     AudcardVM(VMHANDLE hVM);</font> 
<p> 
<font size="3">  };</font>
<p>
<font size="3">  class AudcardThread : public VThread</font> 
<p> 
<font size="3">  {</font>
<p>
<font size="3">    public:</font> 
<p> 
<font size="3">      AudcardThread(THREADHANDLE hThread);</font> 
<p> 
<font size="3">  };</font>
<p>
<font size="3">  </font>
<p>
<font size="3">  ②Audcard.cpp</font>
<p>
<font size="3">  //AUDCARD.cpp - main module for VxD AUDCARD</font> 
<p> 
<font size="3">  #define DEVICE_MAIN</font> 
<p> 
<font size="3">  #include "audcard.h"</font> 
<p> 
<font size="3">  Declare_Virtual_Device(AUDCARD)</font>
<p>
<font size="3">  #define WM_USER_POSTVXD     0x1000  //自定义消息</font>
<p>
<font size="3">  #undef DEVICE_MAIN</font> 
<p> 
<font size="3">  AudcardVM::AudcardVM(VMHANDLE hVM) : VVirtualMachine(hVM) {}</font> 
<p> 
<font size="3">  AudcardThread::AudcardThread(THREADHANDLE hThread) : VThread(hThread) {}</font> 
<p> 
<font size="3">  BOOL AudcardDevice::OnSysDynamicDeviceInit() //动态加载时初始化</font> 
<p> 
<font size="3">  {</font>
<p>
<font size="3">       ......//硬件初始化</font> 
<p> 
<font size="3">       pMyIRQ=new MyHwInt();</font> 
<p> 
<font size="3">  if(pMyIRQ&&pMyIRQ->hook())  //挂接中断</font> 
<p> 
<font size="3">  {</font>
<p>
<font size="3">   pMyIRQ->physicalUnmask();  //允许中断</font> 
<p> 
<font size="3">        return TRUE;</font> 
<p> 
<font size="3">       }</font> 
<p> 
<font size="3">       else return FALSE;</font> 
<p> 
<font size="3">  }</font>
<p>
<font size="3">  BOOL AudcardDevice::OnSysDynamicDeviceExit()</font> 
<p> 
<font size="3">  //动态卸载过程</font>
<p>
<font size="3">  {</font>
<p>
<font size="3">       delete pMyIRQ;</font> 
<p> 
<font size="3">       return TRUE;</font> 
<p> 
<font size="3">  }</font>
<p>
<font size="3">  DWORD AudcardDevice::OnW32DeviceIoControl(PIOCTLPARAMS pDIOCParams)</font> 
<p> 
<font size="3">  //与Win32应用程序的接口函数</font>  
<p>
<font size="3">  {</font>
<p>
<font size="3">  ......</font>
<p>
<font size="3">  }</font>
<p>
<font size="3">  VOID MyHwInt::OnHardwareInt(VMHANDLE hVM)</font> 
<p> 
<font size="3">  {</font>
<p>
<font size="3">    ...... // 中断处理</font> 
<p> 
<font size="3">    SHELL_PostMessage(AppWnd,WM_USER_POSTVXD ,0,0,0,NULL);</font> 
<p> 
<font size="3">    //向应用程序窗口发送消息</font> 
<p> 
<font size="3">    sendPhysicalEOI(); //通知VPICD中断结束</font> 
<p> 
<font size="3">  }</font> 
      </td>    
    </tr>   
    <tr>
      <td width="100%" height="12" class="font" colspan="2"> 
      </td>    
    </tr>
    <tr>
      <td width="100%" height="6" class="font" colspan="2"> 
      </td>    
    </tr>
    <tr>
      <td width="100%" height="8" class="font" colspan="2"> 
      </td>    
    </tr>
    <tr>   
      <td width="100%" height="17" class="font" colspan="2"></td>    
    </tr>   
  </table>    
</div>    
    
</body>    
    
</html>    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?