Skip to content

Commit

Permalink
Add options to allow PtypMultipleGuid objects to be treated as a sing…
Browse files Browse the repository at this point in the history
…le 32-bit integer, required for OST 2013 support
  • Loading branch information
Jmcleodfoss committed Jul 23, 2020
1 parent 2615fed commit d22d610
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
8 changes: 7 additions & 1 deletion pst/src/main/java/io/github/jmcleodfoss/pst/DataType.java
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,13 @@ static DataType definitionFactory(final short propertyType)
return multipleStringReader;

case MULTIPLE_GUID:
throw new RuntimeException("Property Type " + Integer.toHexString(propertyType) +" not implemented");
if (Options.multipleGUIDSAsInts) {
if (Options.logMultipleGUIDSAsIntsInstances)
System.out.println("PtypMultipleGUID treated as PtypInteger32");
return integer32Reader;
} else {
throw new RuntimeException("Property Type " + Integer.toHexString(propertyType) +" not implemented");
}

case MULTIPLE_BINARY:
return multipleBinaryReader;
Expand Down
25 changes: 24 additions & 1 deletion pst/src/main/java/io/github/jmcleodfoss/pst/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ public class Options
/** This dictates whether or not to log failures to expand zipped OST 2013 blocks. */
static boolean logUnzipFailures = false;

/** This dictates whether properties with type MULTIPLE_GUID should be treated as multiple GUIDS (which is not supported yet) or as 32-bit integers to handle the
* AggregatedItemLinkIds property found in OST files which reports itself as PtypMultipleGuid but is actually a 32-bit integer.
* If this is false, the library will throw an exception indicating the property type is unsupported if it encounters one.
* @see #logMultipleGUIDSAsIntsInstances
*/
static boolean multipleGUIDSAsInts = true;

/** This dicates whether we should log a message to System.out when we encounter an object of PtypMultipleGuid and treat it as a 32-bit integer.
* @see #multipleGUIDSAsInts
*/
static boolean logMultipleGUIDSAsIntsInstances = false;

/** This dictates whether to throw an exception if we find a non-heap-node block signature when reading a Heap on Node Header (HNHDR); {@link HeapOnNode.Header#Header} */
static boolean strictHeapNodes = false;

Expand All @@ -30,7 +42,18 @@ public static void setLogUnzipFailures(boolean newValue)
logUnzipFailures = newValue;
}

/** Control whether to throw an exception on finding non-heap-node block signatures in a Node Header.
/** Control how to handle objects of PtypMultipleGuid
* Note that calling this function as {@code setMultipleGUIDHandling(false, true)} is a pointless, but not forbidden.
* @param treatAsInt If true, objects of PtypMultipleGuid are treated as 32-bit integers.
* @param logTreatAsInt If true, a message is logged to System.out if an object of PtypMultipleGuid is encountered {@link multipleGUIDSAsInts} is true
* @see DataType#definitionFactory
*/
public static void setMultipleGUIDHandling(boolean treatAsInt, boolean logTreatAsInt)
{
multipleGUIDSAsInts = treatAsInt;
logMultipleGUIDSAsIntsInstances = logTreatAsInt;
}

/** Control whether to throw an exception on finding non-heap-node block signatures in a Node Header.
* @param newValue The new value to set {@link strictHeapNodes} to
* @see HeapOnNode.Header#Header
Expand Down

0 comments on commit d22d610

Please sign in to comment.