32 if (value1 ==
null || value1.Length == 0)
36 if (value2 ==
null || value2.Length == 0)
40 if (v1Empty && !v2Empty || !v1Empty && v2Empty)
44 if (v1Empty && v2Empty)
48 IntPtr unmanagedString1 = IntPtr.Zero;
49 IntPtr unmanagedString2 = IntPtr.Zero;
52 unmanagedString1 = Marshal.SecureStringToBSTR(value1);
53 unmanagedString2 = Marshal.SecureStringToBSTR(value2);
54 int length1 = Marshal.ReadInt32(unmanagedString1, -4);
55 int length2 = Marshal.ReadInt32(unmanagedString2, -4);
56 if (length1 == length2)
58 for (
int i = 0; i < length1; ++i)
60 byte byte1 = Marshal.ReadByte(unmanagedString1, i);
61 byte byte2 = Marshal.ReadByte(unmanagedString2, i);
62 if (byte1 != byte2)
return false;
74 if (unmanagedString2 != IntPtr.Zero) Marshal.ZeroFreeBSTR(unmanagedString2);
75 if (unmanagedString1 != IntPtr.Zero) Marshal.ZeroFreeBSTR(unmanagedString1);