阅读:1187回复:4
LinPageLock()???????
我的代码是:
ReadNode->lpOverlapped = LinPageLock( PAGENUM(p->dioc_ovrlp), _NPAGES_(p->dioc_ovrlp,sizeof(OVERLAPPED)), PAGEMAPGLOBAL ); ReadNode->UnlpOverlapped = (OVERLAPPED*) (ReadNode->lpOverlapped + ((ULONG)p->dioc_ovrlp & 0xffff)); 是要维护一个队列,可是总是出错!! error C2146: syntax error : missing \')\' before identifier \'p\' .\\firewall.c(237) : error C2066: cast to function type is illegal .\\firewall.c(237) : error C2146: syntax error : missing \')\' before identifier \'p\' .\\firewall.c(237) : error C2296: \'>>\' : illegal, left operand has type \'unsigned long (__cdecl *)()\' .\\firewall.c(237) : error C2198: \'LOCK__LinPageLock\' : too few actual parameters .\\firewall.c(238) : error C2061: syntax error : identifier \'p\' NMAKE : fatal error U1077: \'D:\\PROGRA~1\\MICROS~1\\VC98\\bin\\CL.exe\' : return code \'0x2\' Stop. 工具:VtoolsD3.0+VC6.0 |
|
|
沙发#
发布于:2002-04-30 18:17
那位大侠一定要看看!!
|
|
|
板凳#
发布于:2002-04-30 18:29
唉!太马虎了!
把(((ULONG)p) >> 12)写成了(((ULONG)p) >> 12) 看来以后要少提问,多看代码呀!!! |
|
|
地板#
发布于:2002-04-30 18:30
唉!太马虎了!
把(((ULONG)p) >> 12)写成了(((ULONG)p) >> 12) 看来以后要少提问,多看代码呀!!! 分怎么办,可以收回吗?? |
|
|
地下室#
发布于:2002-04-30 18:30
你的p->dioc_ovrlp是从应用层传下来的缓冲区吧,
ring3的线性地址不能直接锁定的,需要先转换成ring0的线性地址的。 如: DWORD MyPageLock(DWORD lpMem, DWORD cbSize) { DWORD LinPageNum = 0, LinOffset = 0, nPages = 0; LinOffset = (DWORD)lpMem & 0xfff;// page offset of memory to map LinPageNum = (DWORD)lpMem >> 12; // generate page number // Calculate # of pages to map globally nPages = (((DWORD)lpMem + cbSize) >> 12) - LinPageNum + 1; // add by Arthur, M1/2/2001, check if the pages are valid if(PageCheckLinRange(LinPageNum,nPages,0) < nPages) { return 0; } // // Return global mapping of passed in pointer, as this new pointer // is how the memory must be accessed out of context. // return (LinPageLock(LinPageNum, nPages, PAGEMAPGLOBAL) + LinOffset); } 然后再用这个函数锁定你的p->dioc_ovrlp |
|
|