Skip to content

Commit

Permalink
Fix VARIANT implementation and align with CLR (#3197)
Browse files Browse the repository at this point in the history
  • Loading branch information
hughbe authored Jul 7, 2020
1 parent 6fd4ae6 commit fd49490
Show file tree
Hide file tree
Showing 66 changed files with 7,928 additions and 685 deletions.
6 changes: 0 additions & 6 deletions src/System.Windows.Forms.Design/src/Resources/SR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,6 @@
<data name="InheritanceServiceReadOnlyCollection" xml:space="preserve">
<value>Read-Only</value>
</data>
<data name="CannotConvertDoubleToDate" xml:space="preserve">
<value>Double cannot be converted to a date.</value>
</data>
<data name="CannotConvertIntToFloat" xml:space="preserve">
<value>Integer cannot be converted to a float.</value>
</data>
<data name="COM2UnhandledVT" xml:space="preserve">
<value>Unhandled VT: {0}.</value>
</data>
Expand Down
10 changes: 0 additions & 10 deletions src/System.Windows.Forms.Design/src/Resources/xlf/SR.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/System.Windows.Forms.Design/src/Resources/xlf/SR.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/System.Windows.Forms.Design/src/Resources/xlf/SR.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/System.Windows.Forms.Design/src/Resources/xlf/SR.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/System.Windows.Forms.Design/src/Resources/xlf/SR.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/System.Windows.Forms.Design/src/Resources/xlf/SR.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/System.Windows.Forms.Design/src/Resources/xlf/SR.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/System.Windows.Forms.Design/src/Resources/xlf/SR.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/System.Windows.Forms.Design/src/Resources/xlf/SR.pt-BR.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/System.Windows.Forms.Design/src/Resources/xlf/SR.ru.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/System.Windows.Forms.Design/src/Resources/xlf/SR.tr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hans.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/System.Windows.Forms.Design/src/Resources/xlf/SR.zh-Hant.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ internal enum HRESULT : int
DISP_E_UNKNOWNNAME = unchecked((int)0x80020006),
DISP_E_EXCEPTION = unchecked((int)0x80020009),
DISP_E_UNKNOWNLCID = unchecked((int)0x8002000C),
DISP_E_DIVBYZERO = unchecked((int)0x80020012),
TYPE_E_BADMODULEKIND = unchecked((int)0x800288BD),
E_NOTIMPL = unchecked((int)0x80004001),
E_NOINTERFACE = unchecked((int)0x80004002),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public static class Libraries
public const string Oleacc = "oleacc.dll";
public const string Oleaut32 = "oleaut32.dll";
public const string Powrprof = "Powrprof.dll";
public const string Propsys = "Propsys.dll";
public const string RichEdit41 = "MsftEdit.DLL";
public const string SHCore = "SHCore.dll";
public const string Shell32 = "shell32.dll";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;

internal static partial class Interop
{
internal static partial class Kernel32
{
public struct FILETIME
{
public FILETIME(DateTime date)
{
long ft = date.ToFileTime();
dwLowDateTime = (uint)(ft & 0xFFFFFFFF);
dwHighDateTime = (uint)(ft >> 32);
}

public uint dwLowDateTime;
public uint dwHighDateTime;

public DateTime ToDateTime()
{
return DateTime.FromFileTime(((long)dwHighDateTime << 32) + dwLowDateTime);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Runtime.InteropServices;
using static Interop.Oleaut32;

internal partial class Interop
{
internal static partial class Ole32
{
[DllImport(Libraries.Ole32, ExactSpelling = true)]
public unsafe static extern HRESULT PropVariantClear(VARIANT* pvarg);

public unsafe static HRESULT PropVariantClear(ref VARIANT varg)
{
fixed (VARIANT* pvarg = &varg)
{
return PropVariantClear(pvarg);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

internal static partial class Interop
{
internal static partial class Oleaut32
{
public struct DECIMAL
{
public ushort wReserved;
public byte scale;
public byte sign;
public uint Hi32;
public uint Lo32;
public uint Mid32;

public decimal ToDecimal()
{
return new decimal((int)Lo32, (int)Mid32, (int)Hi32, sign == 0x80, scale);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;

internal partial class Interop
{
internal static partial class Oleaut32
{
[Flags]
public enum FADF : ushort
{
AUTO = 0x0001,
STATIC = 0x0002,
EMBEDDED = 0x0004,
FIXEDSIZE = 0x0010,
RECORD = 0x0020,
HAVEIID = 0x0040,
HAVEVARTYPE = 0x0080,
BSTR = 0x0100,
UNKNOWN = 0x0200,
DISPATCH = 0x0400,
VARIANT = 0x0800
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ HRESULT MapPropertyToPage(
[PreserveSig]
HRESULT GetPredefinedStrings(
DispatchID dispID,
CA* pCaStringsOut,
CA* pCaCookiesOut);
Ole32.CA* pCaStringsOut,
Ole32.CA* pCaCookiesOut);

[PreserveSig]
HRESULT GetPredefinedValue(
Expand Down
Loading

0 comments on commit fd49490

Please sign in to comment.