wirelessboy
驱动牛犊
驱动牛犊
  • 注册日期2002-04-21
  • 最后登录2003-12-17
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1270回复:2

Huyg版主请进!

楼主#
更多 发布于:2002-10-20 11:06
刚刚按照以前的贴子做截获MTU查询的程序,以便修改MTU,结果发现系统从来就没有调用这个参数。根据Windows 2000 TCP/IP Implementation Details,我查找了注册表中相应的位置,结果发现并没有这个MTU参数,我想知道是否只有Server中才有这个参数。

请胡斑竹指教,谢谢!
HuYuguang
论坛版主
论坛版主
  • 注册日期2001-04-25
  • 最后登录2013-04-29
  • 粉丝3
  • 关注1
  • 积分92分
  • 威望11点
  • 贡献值0点
  • 好评度9点
  • 原创分1分
  • 专家分0分
沙发#
发布于:2002-10-20 14:41
刚刚按照以前的贴子做截获MTU查询的程序,以便修改MTU,结果发现系统从来就没有调用这个参数。根据Windows 2000 TCP/IP Implementation Details,我查找了注册表中相应的位置,结果发现并没有这个MTU参数,我想知道是否只有Server中才有这个参数。

请胡斑竹指教,谢谢!
 


不,只要是eth网卡,tcp/ip协议都会查询mtu,
注意关于mtu的参数有两个,你一定搞错了。

这个和server无关。
不再回忆从前,我已经生活在幸福当中。
wirelessboy
驱动牛犊
驱动牛犊
  • 注册日期2002-04-21
  • 最后登录2003-12-17
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2002-10-20 22:46
[quote]刚刚按照以前的贴子做截获MTU查询的程序,以便修改MTU,结果发现系统从来就没有调用这个参数。根据Windows 2000 TCP/IP Implementation Details,我查找了注册表中相应的位置,结果发现并没有这个MTU参数,我想知道是否只有Server中才有这个参数。

请胡斑竹指教,谢谢!
 


不,只要是eth网卡,tcp/ip协议都会查询mtu,
注意关于mtu的参数有两个,你一定搞错了。

这个和server无关。 [/quote]

我的代码如下,你看看对不对,我看了些帖子就这么写了 :)

NDIS_STATUS
MPQueryInformation(
IN NDIS_HANDLE MiniportAdapterContext,
IN NDIS_OID Oid,
IN PVOID InformationBuffer,
IN ULONG InformationBufferLength,
OUT PULONG BytesWritten,
OUT PULONG BytesNeeded
)
/*++

Routine Description:

Miniport QueryInfo handler.
In the Power Management scenario, OID_PNP_QUERY_POWER is not sent to the underlying miniport.
OID_PNP_CAPABILITES is passed as a request to the miniport below.
If the result is a success then the InformationBuffer is filled in the MPQueryPNPCapabilites.

LBFO - For present all queries are passed on to the miniports that they were requested on.

Arguments:

MiniportAdapterContext Pointer to the adapter structure
Oid Oid for this query
InformationBuffer Buffer for information
InformationBufferLength Size of this buffer
BytesWritten Specifies how much info is written
BytesNeeded In case the buffer is smaller than what we need, tell them how much is needed


Return Value:

Return code from the NdisRequest below.

--*/
{
PADAPT pAdapt = (PADAPT)MiniportAdapterContext;
NDIS_STATUS Status = NDIS_STATUS_FAILURE;

do
{
//
// Return, if the device is OFF
//
if (IsIMDeviceStateOn(pAdapt) == FALSE)
{
break;
}

//
// Return Success for this OID
//
if (Oid == OID_PNP_QUERY_POWER)
{
Status=NDIS_STATUS_SUCCESS;
break;
}

//
// We are doing all sends on the secondary, so send all requests with Send OIDs to the Secondary
//
if (MPIsSendOID(Oid))
{
pAdapt = pAdapt->pSecondaryAdapt;
//
// Will point to itself, if there is no secondary (see initialization)
//
}

pAdapt->Request.RequestType = NdisRequestQueryInformation;
pAdapt->Request.DATA.QUERY_INFORMATION.Oid = Oid;
pAdapt->Request.DATA.QUERY_INFORMATION.InformationBuffer = InformationBuffer;
pAdapt->Request.DATA.QUERY_INFORMATION.InformationBufferLength = InformationBufferLength;
pAdapt->BytesNeeded = BytesNeeded;
pAdapt->BytesReadOrWritten = BytesWritten;
pAdapt->OutstandingRequests = TRUE;

ASSERT (Oid != OID_PNP_QUERY_POWER);

//
// default case, most requests will be passed to the miniport below
//
NdisRequest(&Status,
pAdapt->BindingHandle,
&pAdapt->Request);


//
// If the Query was a success, pass the results back to the entity that made the request
//
if (Status == NDIS_STATUS_SUCCESS)
{
*BytesWritten = pAdapt->Request.DATA.QUERY_INFORMATION.BytesWritten;
*BytesNeeded = pAdapt->Request.DATA.QUERY_INFORMATION.BytesNeeded;
}

//
// 自己添加的关于修改MTU的代码
//
if (Oid == OID_GEN_MAXIMUM_FRAME_SIZE)
{
DbgPrint(\"@_@ Query OID_GEN_MAXIMUM_FRAME_SIZE\\n\");
//DbgBreakPoint();
*(PULONG)InformationBuffer = MAX_MTU_SIZE - ETH_HEADER_LENGTH;
*BytesWritten = 4;
*BytesNeeded = 4;
return NDIS_STATUS_SUCCESS;
}

if (Oid == OID_GEN_MAXIMUM_TOTAL_SIZE)
{
DbgPrint(\"@_@ Query OID_GEN_MAXIMUM_TOTAL_SIZE\\n\");
//DbgBreakPoint();
*(PULONG)InformationBuffer = MAX_MTU_SIZE;
*BytesWritten = 4;
*BytesNeeded = 4;
return NDIS_STATUS_SUCCESS;
}


//
// Fill the buffer with the required values if Oid == OID_PNP_CAPABILITIES
// and the query was successful
//
if (Oid  == OID_PNP_CAPABILITIES  && Status == NDIS_STATUS_SUCCESS)
{
MPQueryPNPCapbilities(pAdapt,&Status);
}

if (Status != NDIS_STATUS_PENDING)
{
pAdapt->OutstandingRequests = FALSE;
}

} while (FALSE);

return(Status);

}
游客

返回顶部