OEMIocontrol 中编写case IOCTL_GET_CACHE_INFO不知如何解决错误?

jansionchang   2007-7-16 11:33 楼主
不太会编代码,参考别的代码硬着头皮写了个case.问题较多
Line 250 case IOCTL_GET_CACHE_INFO:
                  if(!lpOutBuf||(nOutBufSize < sizeof(CacheInfo))){
                           SetLastError(ERROR_INVALID_PARAMETER);
                        return FALSE;
                }else{
                 CACHE_INFO  pCacheInfo = (CACHE_INFO)lpOutBuf;
#define REQ_SIZE  dwL1ICacheSize+dwL1DCacheSize+dwL2ICacheSize+dwL2DCacheSize
                  if(sizeof(CacheInfo)>=REQ_SIZE){
                       nOutBufSize=REQ_SIZE;
                        sizeof(CacheInfo)=REQ_SIZE;
                        pCacheInfo.dwL1Flags=CF_UNIFIED;
                        pCacheInfo.dwL1ICacheSize=32;
                        pCacheInfo.dwL1ICacheLineSize=8;
                        pCacheInfo.dwL1ICacheNumWays=1;
                        pCacheInfo.dwL1DCacheSize=32;
                        pCacheInfo.dwL1DCacheLineSize=8;
                        pCacheInfo.dwL1DCacheNumWays=1;
                        pCacheInfo.dwL2Flags=CF_UNIFIED;
                        pCacheInfo.dwL2ICacheSize=32;
                        pCacheInfo.dwL2ICacheLineSize=8;
                        pCacheInfo.dwL2ICacheNumWays=1;
                        pCacheInfo.dwL2DCacheSize=32;
                        pCacheInfo.dwL2DCacheLineSize=8;
                        pCacheInfo.dwL2DCacheNumWays=1;
                           if(lpBytesReturned){
                                   *lpBytesReturned=REQ_SIZE;
                                   }
                           SetLastError(0);
                           return FALSE;
                    }else{
                     nOutBufSize=REQ_SIZE;
                        sizeof(CacheInfo)=REQ_SIZE;
                if(lpBytesReturned){
                                   *lpBytesReturned=REQ_SIZE;
                    }
                 SetLastError (ERROR_INSUFFICIENT_BUFFER);
                return FALSE;
                }
                        }
              break;

error C2065: 'IOCTL_GET_CACHE_INFO' : undeclared identifier
error C2051: case expression not constant
error C2065: 'CACHE_INFO' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'pCacheInfo'
error C2144: syntax error : '' should be preceded by ''
error C2144: syntax error : '' should be preceded by ''
error C2143: syntax error : missing ';' before 'identifier'
error C2065: 'pCacheInfo' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'lpOutBuf'
error C2144: syntax error : '' should be preceded by ''
error C2144: syntax error : '' should be preceded by ''
error C2143: syntax error : missing ';' before 'identifier'
error C2065: 'dwL1ICacheSize' : undeclared identifier
error C2065: 'dwL1DCacheSize' : undeclared identifier
error C2065: 'dwL2ICacheSize' : undeclared identifier
error C2065: 'dwL2DCacheSize' : undeclared identifier
error C2106: '=' : left operand must be l-value
error C2224: left of '.dwL1Flags' must have struct/union type
error C2224: left of '.dwL1ICacheSize' must have struct/union type
error C2224: left of '.dwL1ICacheLineSize' must have struct/union type
error C2224: left of '.dwL1ICacheNumWays' must have struct/union type
error C2224: left of '.dwL1DCacheSize' must have struct/union type
error C2224: left of '.dwL1DCacheLineSize' must have struct/union type
error C2224: left of '.dwL1DCacheNumWays' must have struct/union type
error C2224: left of '.dwL2Flags' must have struct/union type
error C2224: left of '.dwL2ICacheSize' must have struct/union type
error C2224: left of '.dwL2ICacheLineSize' must have struct/union type
error C2224: left of '.dwL2ICacheNumWays' must have struct/union type
error C2224: left of '.dwL2DCacheSize' must have struct/union type
error C2224: left of '.dwL2DCacheLineSize' must have struct/union type
error C2224: left of '.dwL2DCacheNumWays' must have struct/union type
error C2106: '=' : left operand must be l-value

回复评论 (2)

缺少对应的头函数,要不就是你拼写错误。
点赞  2007-7-16 17:19
IOCTL_GET_CACHE_INFO 是自定义的吧,看看文件之间的关系
点赞  2007-7-16 17:39
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复