diff --git a/krabs/krabs/size_provider.hpp b/krabs/krabs/size_provider.hpp index 4d10724..0a6962e 100644 --- a/krabs/krabs/size_provider.hpp +++ b/krabs/krabs/size_provider.hpp @@ -69,9 +69,19 @@ namespace krabs { } ULONG propertyLength = 0; - propertyLength = get_heuristic_size(propertyStart, propertyInfo); - // didn't have a heuristic for size, ask Tdh + // If no flags are set on the property, attempt to use the length + // field. If that field is 0, try using our heuristic. + if (propertyInfo.Flags == 0) + { + if (propertyInfo.length > 0) + propertyLength = propertyInfo.length; + else + propertyLength = get_heuristic_size(propertyStart, propertyInfo); + } + + // Couldn't get the length from the 'length' field or + // the heuristic for size failed -> ask Tdh. if (propertyLength == 0) propertyLength = get_tdh_size(propertyName, record); @@ -89,10 +99,6 @@ namespace krabs { // The following _very_ common property types can be short-circuited // to prevent the expensive call. - // We don't handle array types for heuristic sizing. - if (propertyInfo.Flags & PropertyParamCount) - return propertyLength; - // Be careful! Check IN and OUT types before making an assumption. if (propertyInfo.nonStructType.OutType == TDH_OUTTYPE_STRING)