Instead of updating a global variable counter for the next index of strings and data blobs, pass along a reference to actual string vector and let the TreeNode insertion methods add their strings to the vector when a new entry is needed.
Additionally, if the resource tree had duplicates, that were ignored with -force:multipleres in lld, we no longer store all versions of the duplicated resource data, now we only keep the one that actually ends up referenced.
Maybe comment what StringIndex and DataIndex are?