阅读:890回复:0
用VTOOLSD编写的VXD的系统分配的资源的问题,HELP!
我不能得到正确的系统分配的资源(I/O、内存及中断),我用DEBUG
得到的和实际的不符,切设备的接点是0,下面是我的代码,望能指点!将非常感谢! CONFIGRET OnPnpNewDevnode(DEVNODE Node, DWORD LoadType) { dprintf(\"OnPnpNewDevnode called, devnode=%x\\n\", Node); switch(LoadType) { case DLVXD_LOAD_DEVLOADER: // dn = LocatePCIDevice(VendorId, DeviceId); // pUnit=(HOTINFO*)HeapAllocate(sizeof(HOTINFO), // HEAPZEROINIT); pUnit=(HOTINFO*)malloc(sizeof(HOTINFO)); if(pUnit) { memset(pUnit,0,sizeof(HOTINFO)); pUnit->devicenode=Node; // Node=(DEVNODE)0xcedb1aa0; return CONFIGMG_Register_Device_Driver( Node, OnConfigure, (DWORD)pUnit, CM_REGISTER_DEVICE_DRIVER_REMOVABLE | CM_REGISTER_DEVICE_DRIVER_DISABLEABLE); } else return CR_FAILURE; default: return CR_DEFAULT; } } CONFIGRET OnConfigure(CONFIGFUNC cf, SUBCONFIGFUNC scf, DEVNODE devnode, DWORD refdata, ULONG flags) { CONFIGRET rc; CMCONFIG config; // HOTINFO* pDevice=(HOTINFO*)refdata; pUnit=(HOTINFO*)refdata; switch(cf) { case CONFIG_START: dprintf(\"CONFIG_START, unit=%x\\n\", pUnit); // get information about the Win95 P&P configuration assigned // to the board devnode=(DEVNODE)0xcedb1aa0; rc=CONFIGMG_Get_Alloc_Log_Conf(&config, devnode, CM_GET_ALLOC_LOG_CONF_ALLOC); if(rc!=CR_SUCCESS) { dprintf(\"CM_Get_Alloc_Log_Conf failed rc=%x\\n\",rc); return CR_FAILURE; } pUnit->birq = config.bIRQRegisters[0]; pUnit->wiobase = config.wIOPortBase[0]; pUnit->wiolength = config.wIOPortLength[0]; pUnit->dmembase = config.dMemBase[0]; pUnit->dmemlength = config.dMemLength[0]; if(MapMemory(pUnit)==NULL) return CR_FAILURE; // Hook the interrupt if (HookInterrupt(pUnit, &config) != CR_SUCCESS ) { UnMapMemory(pUnit); return CR_FAILURE; } return CR_SUCCESS; case CONFIG_STOP: dprintf(\"CONFIG_STOP, unit=%x\\n\", pUnit); UnhookInterrupt(pUnit); UnMapMemory(pUnit); // CloseEventHandle(pUnit); break; case CONFIG_REMOVE: dprintf(\"CONFIG_REMOVE, unit=%x\\n\", pUnit); UnhookInterrupt(pUnit); UnMapMemory(pUnit); // CloseEventHandle(pUnit); return CR_SUCCESS; case CONFIG_TEST: return CR_SUCCESS; 下面省了。 |
|