tyranid / oleviewdotnet

A .net OLE/COM viewer and inspector to merge functionality of OleView and Test Container
GNU General Public License v3.0
1.1k stars 182 forks source link

Can't unbox to ElevationPolicy when it is a QWORD #1

Closed kuza55 closed 10 years ago

kuza55 commented 10 years ago

This line cause an exception on my machine:

COMIELowRightsElevationPolicy.cs:40 Policy = (ElevationPolicy)key.GetValue("Policy", 0);

It seems the result of key.GetValue is a long when the registry value is a REG_QWORD, and the above code causes an unboxing operation to an int, which fails.

I'm not sure what the "right" way to fix this issue is, but this worked:

        object val = key.GetValue("Policy", 0);
        if (val is long) {
            Policy = (ElevationPolicy)(long)val;
        } else {
            Policy = (ElevationPolicy)val;
        }
tyranid commented 10 years ago

Thanks for the report. It should be fixed now :)