28 if (value1 ==
null || value1.Length == 0)
32 if (value2 ==
null || value2.Length == 0)
36 if (v1Empty && !v2Empty || !v1Empty && v2Empty)
40 if (v1Empty && v2Empty)
44 IntPtr unmanagedString1 = IntPtr.Zero;
45 IntPtr unmanagedString2 = IntPtr.Zero;
48 unmanagedString1 = Marshal.SecureStringToBSTR(value1);
49 unmanagedString2 = Marshal.SecureStringToBSTR(value2);
50 int length1 = Marshal.ReadInt32(unmanagedString1, -4);
51 int length2 = Marshal.ReadInt32(unmanagedString2, -4);
52 if (length1 == length2)
54 for (
int i = 0; i < length1; ++i)
56 byte byte1 = Marshal.ReadByte(unmanagedString1, i);
57 byte byte2 = Marshal.ReadByte(unmanagedString2, i);
58 if (byte1 != byte2)
return false;
70 if (unmanagedString2 != IntPtr.Zero) Marshal.ZeroFreeBSTR(unmanagedString2);
71 if (unmanagedString1 != IntPtr.Zero) Marshal.ZeroFreeBSTR(unmanagedString1);