Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating bindings for um/objbase and adding implicit conversion operators to LARGE_INTEGER #295

Merged
merged 2 commits into from
Dec 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions TerraFX.Interop.Windows.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2770,6 +2770,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lzexpand", "lzexpand", "{CC
generation\Windows\um\lzexpand\um-lzexpand.h = generation\Windows\um\lzexpand\um-lzexpand.h
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "objbase", "objbase", "{B31F49C6-C263-4674-86D9-3E890348AF4B}"
ProjectSection(SolutionItems) = preProject
generation\Windows\um\objbase\generate.rsp = generation\Windows\um\objbase\generate.rsp
generation\Windows\um\objbase\header.txt = generation\Windows\um\objbase\header.txt
generation\Windows\um\objbase\um-objbase.h = generation\Windows\um\objbase\um-objbase.h
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -3197,6 +3204,7 @@ Global
{CBC62B75-03A4-470D-A52A-D84161773CB7} = {67311E5E-FA9C-43A6-B431-9EF10047A0CE}
{5FC51DA5-FF47-4100-BE74-2F3DE11EF163} = {67311E5E-FA9C-43A6-B431-9EF10047A0CE}
{CC539B27-F7D6-44F9-9CB4-6CA9486D824D} = {67311E5E-FA9C-43A6-B431-9EF10047A0CE}
{B31F49C6-C263-4674-86D9-3E890348AF4B} = {67311E5E-FA9C-43A6-B431-9EF10047A0CE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2FE36DF8-2D9C-4F20-8787-45DC74B57461}
Expand Down
63 changes: 63 additions & 0 deletions generation/Windows/um/objbase/generate.rsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@../../../settings.rsp
@../../../remap.rsp
--exclude
CLSIDFromProgIDEx
CoBuildVersion
CoCreateStandardMalloc
CoFileTimeNow
CreateStdProgressIndicator
DcomChannelSetHResult
StgOpenLayoutDocfile
--file
um-objbase.h
--methodClassName
Windows
--namespace
TerraFX.Interop.Windows
--output
../../../../sources/Interop/Windows/Windows/um/objbase
--test-output
../../../../tests/Interop/Windows/Windows/um/objbase
--traverse
C:/Program Files (x86)/Windows Kits/10/Include/10.0.20348.0/um/objbase.h
--with-librarypath
BindMoniker=ole32
CoAllowSetForegroundWindow=ole32
CoDosDateTimeToFileTime=ole32
CoFileTimeToDosDateTime=ole32
CoFreeAllLibraries=ole32
CoFreeLibrary=ole32
CoGetInstanceFromFile=combase
CoGetInstanceFromIStorage=combase
CoGetObject=ole32
CoGetSystemSecurityPermissions=combase
CoInitialize=ole32
CoInstall=ole32
CoIsOle1Class=ole32
CoLoadLibrary=ole32
CoRegisterChannelHook=ole32
CoRegisterInitializeSpy=combase
CoRegisterMallocSpy=combase
CoRegisterMessageFilter=combase
CoRevokeInitializeSpy=combase
CoRevokeMallocSpy=combase
CoTreatAsClass=ole32
CreateAntiMoniker=ole32
CreateBindCtx=ole32
CreateClassMoniker=ole32
CreateDataAdviseHolder=ole32
CreateDataCache=ole32
CreateFileMoniker=ole32
CreateGenericComposite=ole32
CreateItemMoniker=ole32
CreateObjrefMoniker=ole32
CreatePointerMoniker=ole32
GetClassFile=ole32
GetRunningObjectTable=ole32
IsEqualGUID=ole32
MkParseDisplayName=ole32
MonikerCommonPrefixWith=ole32
MonikerRelativePathTo=ole32
StgGetIFillLockBytesOnFile=ole32
StgGetIFillLockBytesOnILockBytes=ole32
StgOpenAsyncDocfileOnIFillLockBytes=ole32
4 changes: 4 additions & 0 deletions generation/Windows/um/objbase/header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um/objbase.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
2 changes: 2 additions & 0 deletions generation/Windows/um/objbase/um-objbase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include "..\..\..\TerraFX.h"
#include <objbase.h>
24 changes: 24 additions & 0 deletions sources/Interop/Windows/Windows/um/objbase/COINIT.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um/objbase.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.

using static TerraFX.Interop.Windows.COINITBASE;

namespace TerraFX.Interop.Windows;

/// <include file='COINIT.xml' path='doc/member[@name="COINIT"]/*' />
public enum COINIT
{
/// <include file='COINIT.xml' path='doc/member[@name="COINIT.COINIT_APARTMENTTHREADED"]/*' />
COINIT_APARTMENTTHREADED = 0x2,

/// <include file='COINIT.xml' path='doc/member[@name="COINIT.COINIT_MULTITHREADED"]/*' />
COINIT_MULTITHREADED = COINITBASE_MULTITHREADED,

/// <include file='COINIT.xml' path='doc/member[@name="COINIT.COINIT_DISABLE_OLE1DDE"]/*' />
COINIT_DISABLE_OLE1DDE = 0x4,

/// <include file='COINIT.xml' path='doc/member[@name="COINIT.COINIT_SPEED_OVER_MEMORY"]/*' />
COINIT_SPEED_OVER_MEMORY = 0x8,
}
22 changes: 22 additions & 0 deletions sources/Interop/Windows/Windows/um/objbase/COMSD.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um/objbase.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.

namespace TerraFX.Interop.Windows;

/// <include file='COMSD.xml' path='doc/member[@name="COMSD"]/*' />
public enum COMSD
{
/// <include file='COMSD.xml' path='doc/member[@name="COMSD.SD_LAUNCHPERMISSIONS"]/*' />
SD_LAUNCHPERMISSIONS = 0,

/// <include file='COMSD.xml' path='doc/member[@name="COMSD.SD_ACCESSPERMISSIONS"]/*' />
SD_ACCESSPERMISSIONS = 1,

/// <include file='COMSD.xml' path='doc/member[@name="COMSD.SD_LAUNCHRESTRICTIONS"]/*' />
SD_LAUNCHRESTRICTIONS = 2,

/// <include file='COMSD.xml' path='doc/member[@name="COMSD.SD_ACCESSRESTRICTIONS"]/*' />
SD_ACCESSRESTRICTIONS = 3,
}
18 changes: 18 additions & 0 deletions sources/Interop/Windows/Windows/um/objbase/STG.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um/objbase.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.

namespace TerraFX.Interop.Windows;

public static partial class STG
{
[NativeTypeName("#define STG_TOEND 0xFFFFFFFFL")]
public const uint STG_TOEND = 0xFFFFFFFF;

[NativeTypeName("#define STG_LAYOUT_SEQUENTIAL 0x00000000L")]
public const int STG_LAYOUT_SEQUENTIAL = 0x00000000;

[NativeTypeName("#define STG_LAYOUT_INTERLEAVED 0x00000001L")]
public const int STG_LAYOUT_INTERLEAVED = 0x00000001;
}
180 changes: 180 additions & 0 deletions sources/Interop/Windows/Windows/um/objbase/Windows.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um/objbase.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.

using System;
using System.Runtime.InteropServices;

namespace TerraFX.Interop.Windows;

public static unsafe partial class Windows
{
/// <include file='Windows.xml' path='doc/member[@name="Windows.CoInitialize"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CoInitialize([NativeTypeName("LPVOID")] void* pvReserved);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoRegisterMallocSpy"]/*' />
[DllImport("combase", ExactSpelling = true)]
public static extern HRESULT CoRegisterMallocSpy([NativeTypeName("LPMALLOCSPY")] IMallocSpy* pMallocSpy);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoRevokeMallocSpy"]/*' />
[DllImport("combase", ExactSpelling = true)]
public static extern HRESULT CoRevokeMallocSpy();

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoRegisterInitializeSpy"]/*' />
[DllImport("combase", ExactSpelling = true)]
public static extern HRESULT CoRegisterInitializeSpy(IInitializeSpy* pSpy, ULARGE_INTEGER* puliCookie);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoRevokeInitializeSpy"]/*' />
[DllImport("combase", ExactSpelling = true)]
public static extern HRESULT CoRevokeInitializeSpy(ULARGE_INTEGER uliCookie);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoGetSystemSecurityPermissions"]/*' />
[DllImport("combase", ExactSpelling = true)]
public static extern HRESULT CoGetSystemSecurityPermissions(COMSD comSDType, [NativeTypeName("PSECURITY_DESCRIPTOR *")] void** ppSD);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoLoadLibrary"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HINSTANCE CoLoadLibrary([NativeTypeName("LPOLESTR")] ushort* lpszLibName, BOOL bAutoFree);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoFreeLibrary"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern void CoFreeLibrary(HINSTANCE hInst);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoFreeAllLibraries"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern void CoFreeAllLibraries();

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoGetInstanceFromFile"]/*' />
[DllImport("combase", ExactSpelling = true)]
public static extern HRESULT CoGetInstanceFromFile(COSERVERINFO* pServerInfo, [NativeTypeName("CLSID *")] Guid* pClsid, IUnknown* punkOuter, [NativeTypeName("DWORD")] uint dwClsCtx, [NativeTypeName("DWORD")] uint grfMode, [NativeTypeName("OLECHAR *")] ushort* pwszName, [NativeTypeName("DWORD")] uint dwCount, MULTI_QI* pResults);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoGetInstanceFromIStorage"]/*' />
[DllImport("combase", ExactSpelling = true)]
public static extern HRESULT CoGetInstanceFromIStorage(COSERVERINFO* pServerInfo, [NativeTypeName("CLSID *")] Guid* pClsid, IUnknown* punkOuter, [NativeTypeName("DWORD")] uint dwClsCtx, [NativeTypeName("struct IStorage *")] IStorage* pstg, [NativeTypeName("DWORD")] uint dwCount, MULTI_QI* pResults);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoAllowSetForegroundWindow"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CoAllowSetForegroundWindow(IUnknown* pUnk, [NativeTypeName("LPVOID")] void* lpvReserved);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoIsOle1Class"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern BOOL CoIsOle1Class([NativeTypeName("const IID &")] Guid* rclsid);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoFileTimeToDosDateTime"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern BOOL CoFileTimeToDosDateTime(FILETIME* lpFileTime, [NativeTypeName("LPWORD")] ushort* lpDosDate, [NativeTypeName("LPWORD")] ushort* lpDosTime);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoDosDateTimeToFileTime"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern BOOL CoDosDateTimeToFileTime([NativeTypeName("WORD")] ushort nDosDate, [NativeTypeName("WORD")] ushort nDosTime, FILETIME* lpFileTime);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoRegisterMessageFilter"]/*' />
[DllImport("combase", ExactSpelling = true)]
public static extern HRESULT CoRegisterMessageFilter([NativeTypeName("LPMESSAGEFILTER")] IMessageFilter* lpMessageFilter, [NativeTypeName("LPMESSAGEFILTER *")] IMessageFilter** lplpMessageFilter);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoRegisterChannelHook"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CoRegisterChannelHook([NativeTypeName("const GUID &")] Guid* ExtensionUuid, IChannelHook* pChannelHook);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoTreatAsClass"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CoTreatAsClass([NativeTypeName("const IID &")] Guid* clsidOld, [NativeTypeName("const IID &")] Guid* clsidNew);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CreateDataAdviseHolder"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CreateDataAdviseHolder([NativeTypeName("LPDATAADVISEHOLDER *")] IDataAdviseHolder** ppDAHolder);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CreateDataCache"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CreateDataCache([NativeTypeName("LPUNKNOWN")] IUnknown* pUnkOuter, [NativeTypeName("const IID &")] Guid* rclsid, [NativeTypeName("const IID &")] Guid* iid, [NativeTypeName("LPVOID *")] void** ppv);

/// <include file='Windows.xml' path='doc/member[@name="Windows.StgOpenAsyncDocfileOnIFillLockBytes"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT StgOpenAsyncDocfileOnIFillLockBytes(IFillLockBytes* pflb, [NativeTypeName("DWORD")] uint grfMode, [NativeTypeName("DWORD")] uint asyncFlags, IStorage** ppstgOpen);

/// <include file='Windows.xml' path='doc/member[@name="Windows.StgGetIFillLockBytesOnILockBytes"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT StgGetIFillLockBytesOnILockBytes(ILockBytes* pilb, IFillLockBytes** ppflb);

/// <include file='Windows.xml' path='doc/member[@name="Windows.StgGetIFillLockBytesOnFile"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT StgGetIFillLockBytesOnFile([NativeTypeName("const OLECHAR *")] ushort* pwcsName, IFillLockBytes** ppflb);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoInstall"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CoInstall(IBindCtx* pbc, [NativeTypeName("DWORD")] uint dwFlags, uCLSSPEC* pClassSpec, QUERYCONTEXT* pQuery, [NativeTypeName("LPWSTR")] ushort* pszCodeBase);

/// <include file='Windows.xml' path='doc/member[@name="Windows.BindMoniker"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT BindMoniker([NativeTypeName("LPMONIKER")] IMoniker* pmk, [NativeTypeName("DWORD")] uint grfOpt, [NativeTypeName("const IID &")] Guid* iidResult, [NativeTypeName("LPVOID *")] void** ppvResult);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CoGetObject"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CoGetObject([NativeTypeName("LPCWSTR")] ushort* pszName, BIND_OPTS* pBindOptions, [NativeTypeName("const IID &")] Guid* riid, void** ppv);

/// <include file='Windows.xml' path='doc/member[@name="Windows.MkParseDisplayName"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT MkParseDisplayName([NativeTypeName("LPBC")] IBindCtx* pbc, [NativeTypeName("LPCOLESTR")] ushort* szUserName, [NativeTypeName("ULONG *")] uint* pchEaten, [NativeTypeName("LPMONIKER *")] IMoniker** ppmk);

/// <include file='Windows.xml' path='doc/member[@name="Windows.MonikerRelativePathTo"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT MonikerRelativePathTo([NativeTypeName("LPMONIKER")] IMoniker* pmkSrc, [NativeTypeName("LPMONIKER")] IMoniker* pmkDest, [NativeTypeName("LPMONIKER *")] IMoniker** ppmkRelPath, BOOL dwReserved);

/// <include file='Windows.xml' path='doc/member[@name="Windows.MonikerCommonPrefixWith"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT MonikerCommonPrefixWith([NativeTypeName("LPMONIKER")] IMoniker* pmkThis, [NativeTypeName("LPMONIKER")] IMoniker* pmkOther, [NativeTypeName("LPMONIKER *")] IMoniker** ppmkCommon);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CreateBindCtx"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CreateBindCtx([NativeTypeName("DWORD")] uint reserved, [NativeTypeName("LPBC *")] IBindCtx** ppbc);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CreateGenericComposite"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CreateGenericComposite([NativeTypeName("LPMONIKER")] IMoniker* pmkFirst, [NativeTypeName("LPMONIKER")] IMoniker* pmkRest, [NativeTypeName("LPMONIKER *")] IMoniker** ppmkComposite);

/// <include file='Windows.xml' path='doc/member[@name="Windows.GetClassFile"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT GetClassFile([NativeTypeName("LPCOLESTR")] ushort* szFilename, [NativeTypeName("CLSID *")] Guid* pclsid);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CreateClassMoniker"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CreateClassMoniker([NativeTypeName("const IID &")] Guid* rclsid, [NativeTypeName("LPMONIKER *")] IMoniker** ppmk);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CreateFileMoniker"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CreateFileMoniker([NativeTypeName("LPCOLESTR")] ushort* lpszPathName, [NativeTypeName("LPMONIKER *")] IMoniker** ppmk);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CreateItemMoniker"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CreateItemMoniker([NativeTypeName("LPCOLESTR")] ushort* lpszDelim, [NativeTypeName("LPCOLESTR")] ushort* lpszItem, [NativeTypeName("LPMONIKER *")] IMoniker** ppmk);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CreateAntiMoniker"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CreateAntiMoniker([NativeTypeName("LPMONIKER *")] IMoniker** ppmk);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CreatePointerMoniker"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CreatePointerMoniker([NativeTypeName("LPUNKNOWN")] IUnknown* punk, [NativeTypeName("LPMONIKER *")] IMoniker** ppmk);

/// <include file='Windows.xml' path='doc/member[@name="Windows.CreateObjrefMoniker"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT CreateObjrefMoniker([NativeTypeName("LPUNKNOWN")] IUnknown* punk, [NativeTypeName("LPMONIKER *")] IMoniker** ppmk);

/// <include file='Windows.xml' path='doc/member[@name="Windows.GetRunningObjectTable"]/*' />
[DllImport("ole32", ExactSpelling = true)]
public static extern HRESULT GetRunningObjectTable([NativeTypeName("DWORD")] uint reserved, [NativeTypeName("LPRUNNINGOBJECTTABLE *")] IRunningObjectTable** pprot);

[NativeTypeName("#define MARSHALINTERFACE_MIN 500")]
public const int MARSHALINTERFACE_MIN = 500;

[NativeTypeName("#define ASYNC_MODE_COMPATIBILITY 0x00000001L")]
public const int ASYNC_MODE_COMPATIBILITY = 0x00000001;

[NativeTypeName("#define ASYNC_MODE_DEFAULT 0x00000000L")]
public const int ASYNC_MODE_DEFAULT = 0x00000000;

[NativeTypeName("#define STGTY_REPEAT 0x00000100L")]
public const int STGTY_REPEAT = 0x00000100;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um/winnt.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.

using System.Runtime.CompilerServices;

namespace TerraFX.Interop.Windows;

public partial struct LARGE_INTEGER
{
public static implicit operator long(LARGE_INTEGER value) => value.QuadPart;

public static implicit operator LARGE_INTEGER(long value)
{
Unsafe.SkipInit(out LARGE_INTEGER result);
result.QuadPart = value;
return result;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um/winnt.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.

using System.Runtime.CompilerServices;

namespace TerraFX.Interop.Windows;

public partial struct ULARGE_INTEGER
{
public static implicit operator ulong(ULARGE_INTEGER value) => value.QuadPart;

public static implicit operator ULARGE_INTEGER(ulong value)
{
Unsafe.SkipInit(out ULARGE_INTEGER result);
result.QuadPart = value;
return result;
}
}