for the V3: 1) I dropped using PropVariantCompareEx as the underlying helper for VariantCompare, and implemented needed things directly. Rationale: - VariantCompare is (from the tests) antisymetric (VariantCompare(v1,v2)==-VariantCompare(v2,v1)), while PropVariantCompareEx isn't (it always coerces v2 into v1's type) - it saves us a couple of (PROP)VARIANT copies - there are a lot of things behaving differently (eg Prop comparison converts betwen numeric & strings, while VariantCompare doesn't; VariantCompare properly compares all cases of signed/unsigned args, while PropVariantCompare only succeeds when second arg can be converted to first's type...) 2) there are a bunch of new tests, some can look redundant; but given some of the outcome (eg unsigned int + float), it ended up covering a great deal of the possible cases 3) I moved changes to PropVariantCompareEx outside of this MR (things are no longer related). I'll send it after this one is merged. 4) code for VariantCompare passes all the tests (and should be ok for all numeric types and BSTR), but I couldn't figure out a nicer way to implement behavior for some some of the results. The quote of MSDN for this function reads
This function does not support the comparison of different VARIANT types. If the types named in var1 and var2 are different, the results are undefined and should be ignored. Calling applications should ensure that they are comparing two of the same type before they call this function. The PropVariantChangeType function can be used to convert the two structures to the same type.
(side note: PropVariantChangeType doesn't apply to VARIANT) on one hand tests show that VariantCompare does the conversions between the numeric types (integers & floats), but on the other hand that some results are "strange" (ie BSTR\<\>numeric return -1/1, indepentantly of values of the args vs eg ARRAY) this would require much more tests to get perhaps a better understanding. for now I'd rather keep it as is (and extend it if needed, there should be a FIXME for the not handled cases) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10196#note_130869