public static void RopWriteStreamMethod(OpenModeFlags openFlag, bool isExceedMax, out CPRPTErrorCode error)
{
Condition.IsTrue(isInitialized && isStreamOpenedSuccess);
Condition.IsTrue(openFlag == streamOpenFlag);
Condition.IsTrue(globalObj != ServerObjectType.Logon);
Condition.IfThen(isExceedMax, openFlag == OpenModeFlags.ReadWrite);
error = CPRPTErrorCode.None;
isStreamWriteSuccess = true;
if (streamOpenFlag == OpenModeFlags.ReadWrite)
{
ModelHelper.CaptureRequirement(
269,
@"[In RopOpenStream ROP Request Buffer] OpenModeFlags: ReadWrite: Open the stream for read/write access.");
}
if (streamOpenFlag == OpenModeFlags.ReadOnly)
{
error = CPRPTErrorCode.STG_E_ACCESSDENIED;
isStreamWriteSuccess = false;
ModelHelper.CaptureRequirement(
267,
@"[In RopOpenStream ROP Request Buffer] OpenModeFlags: ReadOnly: Open the stream for read-only access.");
}
if (isExceedMax)
{
// For ExchangeServer 2007, StreamSizeError error code returned.
if (requirementContainer[86706])
{
error = CPRPTErrorCode.StreamSizeError;
ModelHelper.CaptureRequirement(
86706,
@"[In Appendix A: Product Behavior] Implementation does return the StreamSizeError error code. (<12> Section 3.2.5.13: Exchange 2003 and Exchange 2007 return the StreamSizeError error code if they write less than the amount requested.)");
}
// For Exchange 2010, toobig error code returned.
if (requirementContainer[55707])
{
error = CPRPTErrorCode.ecTooBig;
ModelHelper.CaptureRequirement(
55707,
@"[In Processing RopWriteStream] Implementation does return the TooBig error code if it writes less than the amount requested.(Microsoft Exchange Server 2010 and above follow this behavior)");
}
if (requirementContainer[90102])
{
error = CPRPTErrorCode.ecTooBig;
ModelHelper.CaptureRequirement(
90102,
@"[In Processing RopWriteStream] Implementation does return error code ""0x80040305"" with name ""TooBig"", when the write will exceed the maximum stream size.(Microsoft Exchange Server 2007 and above follow this behavior)");
}
isStreamWriteSuccess = false;
}
}