-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ComStream indicate that inner IStream is not readable/writeable incorrectly #504
Comments
Given: STGM_READ = 0x00000000,
STGM_WRITE = 0x00000001,
STGM_READWRITE = 0x00000002, I think the following is correct given different values of public override bool CanRead => (GetStats().grfMode & 0x00000003) is 0 or 2;
public override bool CanSeek => netStream?.CanSeek ?? true;
public override bool CanTimeout => netStream?.CanTimeout ?? false;
public override bool CanWrite => (GetStats().grfMode & 0x00000003) is 1 or 2; Do you agree? |
I would prefer use Vanara/Core/Extensions/EnumExtensions.cs Line 99 in 4a8854b
Anyway, it looks good. Thanks~ |
By the way, would you release the next version in the near future? |
Yes, I plan to push 4.0.5 by the end of the month. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Construct the ComStream with this constructor
Vanara/Core/InteropServices/ComStream.cs
Lines 20 to 22 in 4904128
However, CanSeek/CanRead/CanWrite are all false (Only consider netStream)
Vanara/Core/InteropServices/ComStream.cs
Lines 35 to 49 in 4904128
Should use
IStream.Stat(out STATSTG pstatstg, int grfStatFlag)
to get STATSTG.grfMode and check whether the stream is readable/writeable instead of simply return false.For IStream, I think CanSeek should always true & CanTimeout should always false
The text was updated successfully, but these errors were encountered: