Skip to content
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

Storage object creation doesn't follow the specification #68

Closed
Sonic-The-Hedgehog-LNK1123 opened this issue Aug 17, 2020 · 1 comment
Closed

Comments

@Sonic-The-Hedgehog-LNK1123
Copy link
Contributor

Sonic-The-Hedgehog-LNK1123 commented Aug 17, 2020

See the below quote from the specification:

If an implementation of the file format enables applications to create
storage objects without explicitly setting an object class GUID, it MUST write all zeroes by default.
If this value is not all zeroes, the object class GUID can be used as a parameter to start
applications.

To fix this, change:

To:

 = Guid.Empty;

This change makes the switch block:

even more redundant than it already was, you're setting member variables to zero that you're already initialized to zero at their declaration.
Also, this:

this.storageCLSID = new Guid("00000000000000000000000000000000");

is one of the most inefficient ways to set a GUID to Guid.Empty.

Replacing that switch block with this if statement:

if (stgType == StgType.StgStorage)
{
    this.creationDate = BitConverter.GetBytes((DateTime.Now.ToFileTime()));
}

will have the same effect as that switch block.

ironfede added a commit that referenced this issue Sep 17, 2020
@ironfede
Copy link
Owner

Thank you for your advices.
Best Regards,
Federico

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants