Update TerraFX.Interop.Windows

This commit is contained in:
Haselnussbomber 2025-12-05 00:37:25 +01:00
parent 5bb212bfaa
commit ddc3113244
No known key found for this signature in database
GPG key ID: BB905BB49E7295D1
17 changed files with 73 additions and 73 deletions

View file

@ -64,9 +64,9 @@ public interface IObjectWithLocalizableName
var result = new Dictionary<string, string>((int)count); var result = new Dictionary<string, string>((int)count);
for (var i = 0u; i < count; i++) for (var i = 0u; i < count; i++)
{ {
fn->GetLocaleName(i, (ushort*)buf, maxStrLen).ThrowOnError(); fn->GetLocaleName(i, buf, maxStrLen).ThrowOnError();
var key = new string(buf); var key = new string(buf);
fn->GetString(i, (ushort*)buf, maxStrLen).ThrowOnError(); fn->GetString(i, buf, maxStrLen).ThrowOnError();
var value = new string(buf); var value = new string(buf);
result[key.ToLowerInvariant()] = value; result[key.ToLowerInvariant()] = value;
} }

View file

@ -133,8 +133,8 @@ public sealed class SystemFontFamilyId : IFontFamilyId
var familyIndex = 0u; var familyIndex = 0u;
BOOL exists = false; BOOL exists = false;
fixed (void* pName = this.EnglishName) fixed (char* pName = this.EnglishName)
sfc.Get()->FindFamilyName((ushort*)pName, &familyIndex, &exists).ThrowOnError(); sfc.Get()->FindFamilyName(pName, &familyIndex, &exists).ThrowOnError();
if (!exists) if (!exists)
throw new FileNotFoundException($"Font \"{this.EnglishName}\" not found."); throw new FileNotFoundException($"Font \"{this.EnglishName}\" not found.");

View file

@ -113,8 +113,8 @@ public sealed class SystemFontId : IFontId
var familyIndex = 0u; var familyIndex = 0u;
BOOL exists = false; BOOL exists = false;
fixed (void* name = this.Family.EnglishName) fixed (char* name = this.Family.EnglishName)
sfc.Get()->FindFamilyName((ushort*)name, &familyIndex, &exists).ThrowOnError(); sfc.Get()->FindFamilyName(name, &familyIndex, &exists).ThrowOnError();
if (!exists) if (!exists)
throw new FileNotFoundException($"Font \"{this.Family.EnglishName}\" not found."); throw new FileNotFoundException($"Font \"{this.Family.EnglishName}\" not found.");
@ -151,7 +151,7 @@ public sealed class SystemFontId : IFontId
flocal.Get()->GetFilePathLengthFromKey(refKey, refKeySize, &pathSize).ThrowOnError(); flocal.Get()->GetFilePathLengthFromKey(refKey, refKeySize, &pathSize).ThrowOnError();
var path = stackalloc char[(int)pathSize + 1]; var path = stackalloc char[(int)pathSize + 1];
flocal.Get()->GetFilePathFromKey(refKey, refKeySize, (ushort*)path, pathSize + 1).ThrowOnError(); flocal.Get()->GetFilePathFromKey(refKey, refKeySize, path, pathSize + 1).ThrowOnError();
return (new(path, 0, (int)pathSize), (int)fface.Get()->GetIndex()); return (new(path, 0, (int)pathSize), (int)fface.Get()->GetIndex());
} }

View file

@ -104,19 +104,19 @@ internal static unsafe class ReShadePeeler
fixed (byte* pfn5 = "glBegin"u8) fixed (byte* pfn5 = "glBegin"u8)
fixed (byte* pfn6 = "vkCreateDevice"u8) fixed (byte* pfn6 = "vkCreateDevice"u8)
{ {
if (GetProcAddress((HMODULE)dosh, (sbyte*)pfn0) == 0) if (GetProcAddress((HMODULE)dosh, (sbyte*)pfn0) == null)
continue; continue;
if (GetProcAddress((HMODULE)dosh, (sbyte*)pfn1) == 0) if (GetProcAddress((HMODULE)dosh, (sbyte*)pfn1) == null)
continue; continue;
if (GetProcAddress((HMODULE)dosh, (sbyte*)pfn2) == 0) if (GetProcAddress((HMODULE)dosh, (sbyte*)pfn2) == null)
continue; continue;
if (GetProcAddress((HMODULE)dosh, (sbyte*)pfn3) == 0) if (GetProcAddress((HMODULE)dosh, (sbyte*)pfn3) == null)
continue; continue;
if (GetProcAddress((HMODULE)dosh, (sbyte*)pfn4) == 0) if (GetProcAddress((HMODULE)dosh, (sbyte*)pfn4) == null)
continue; continue;
if (GetProcAddress((HMODULE)dosh, (sbyte*)pfn5) == 0) if (GetProcAddress((HMODULE)dosh, (sbyte*)pfn5) == null)
continue; continue;
if (GetProcAddress((HMODULE)dosh, (sbyte*)pfn6) == 0) if (GetProcAddress((HMODULE)dosh, (sbyte*)pfn6) == null)
continue; continue;
} }

View file

@ -622,7 +622,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
hbrBackground = (HBRUSH)(1 + COLOR.COLOR_BACKGROUND), hbrBackground = (HBRUSH)(1 + COLOR.COLOR_BACKGROUND),
lpfnWndProc = (delegate* unmanaged<HWND, uint, WPARAM, LPARAM, LRESULT>)Marshal lpfnWndProc = (delegate* unmanaged<HWND, uint, WPARAM, LPARAM, LRESULT>)Marshal
.GetFunctionPointerForDelegate(this.input.wndProcDelegate), .GetFunctionPointerForDelegate(this.input.wndProcDelegate),
lpszClassName = (ushort*)windowClassNamePtr, lpszClassName = windowClassNamePtr,
}; };
if (RegisterClassExW(&wcex) == 0) if (RegisterClassExW(&wcex) == 0)
@ -658,7 +658,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
fixed (char* windowClassNamePtr = WindowClassName) fixed (char* windowClassNamePtr = WindowClassName)
{ {
UnregisterClassW( UnregisterClassW(
(ushort*)windowClassNamePtr, windowClassNamePtr,
(HINSTANCE)Marshal.GetHINSTANCE(typeof(ViewportHandler).Module)); (HINSTANCE)Marshal.GetHINSTANCE(typeof(ViewportHandler).Module));
} }
@ -781,8 +781,8 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
{ {
data->Hwnd = CreateWindowExW( data->Hwnd = CreateWindowExW(
(uint)data->DwExStyle, (uint)data->DwExStyle,
(ushort*)windowClassNamePtr, windowClassNamePtr,
(ushort*)windowClassNamePtr, windowClassNamePtr,
(uint)data->DwStyle, (uint)data->DwStyle,
rect.left, rect.left,
rect.top, rect.top,
@ -993,7 +993,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler
{ {
var data = (ImGuiViewportDataWin32*)viewport.PlatformUserData; var data = (ImGuiViewportDataWin32*)viewport.PlatformUserData;
fixed (char* pwszTitle = MemoryHelper.ReadStringNullTerminated((nint)title)) fixed (char* pwszTitle = MemoryHelper.ReadStringNullTerminated((nint)title))
SetWindowTextW(data->Hwnd, (ushort*)pwszTitle); SetWindowTextW(data->Hwnd, pwszTitle);
} }
[UnmanagedCallersOnly(CallConvs = [typeof(CallConvCdecl)])] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvCdecl)])]

View file

@ -256,7 +256,7 @@ internal partial class InterfaceManager : IInternalDisposableService
var gwh = default(HWND); var gwh = default(HWND);
fixed (char* pClass = "FFXIVGAME") fixed (char* pClass = "FFXIVGAME")
{ {
while ((gwh = FindWindowExW(default, gwh, (ushort*)pClass, default)) != default) while ((gwh = FindWindowExW(default, gwh, pClass, default)) != default)
{ {
uint pid; uint pid;
_ = GetWindowThreadProcessId(gwh, &pid); _ = GetWindowThreadProcessId(gwh, &pid);

View file

@ -63,11 +63,11 @@ internal sealed unsafe partial class ReShadeAddonInterface
return; return;
bool GetProcAddressInto(ProcessModule m, ReadOnlySpan<char> name, void* res) static bool GetProcAddressInto(ProcessModule m, ReadOnlySpan<char> name, void* res)
{ {
Span<byte> name8 = stackalloc byte[Encoding.UTF8.GetByteCount(name) + 1]; Span<byte> name8 = stackalloc byte[Encoding.UTF8.GetByteCount(name) + 1];
name8[Encoding.UTF8.GetBytes(name, name8)] = 0; name8[Encoding.UTF8.GetBytes(name, name8)] = 0;
*(nint*)res = GetProcAddress((HMODULE)m.BaseAddress, (sbyte*)Unsafe.AsPointer(ref name8[0])); *(nint*)res = (nint)GetProcAddress((HMODULE)m.BaseAddress, (sbyte*)Unsafe.AsPointer(ref name8[0]));
return *(nint*)res != 0; return *(nint*)res != 0;
} }
} }
@ -174,7 +174,7 @@ internal sealed unsafe partial class ReShadeAddonInterface
CERT.CERT_NAME_SIMPLE_DISPLAY_TYPE, CERT.CERT_NAME_SIMPLE_DISPLAY_TYPE,
CERT.CERT_NAME_ISSUER_FLAG, CERT.CERT_NAME_ISSUER_FLAG,
null, null,
(ushort*)Unsafe.AsPointer(ref issuerName[0]), (char*)Unsafe.AsPointer(ref issuerName[0]),
pcb); pcb);
if (pcb == 0) if (pcb == 0)
throw new Win32Exception("CertGetNameStringW(2)"); throw new Win32Exception("CertGetNameStringW(2)");

View file

@ -94,7 +94,7 @@ internal static unsafe class ReShadeUnwrapper
static bool HasProcExported(ProcessModule m, ReadOnlySpan<byte> name) static bool HasProcExported(ProcessModule m, ReadOnlySpan<byte> name)
{ {
fixed (byte* p = name) fixed (byte* p = name)
return GetProcAddress((HMODULE)m.BaseAddress, (sbyte*)p) != 0; return GetProcAddress((HMODULE)m.BaseAddress, (sbyte*)p) != null;
} }
} }

View file

@ -216,7 +216,7 @@ internal partial class StaThreadService : IInternalDisposableService
lpfnWndProc = &MessageReceiverWndProcStatic, lpfnWndProc = &MessageReceiverWndProcStatic,
hInstance = hInstance, hInstance = hInstance,
hbrBackground = (HBRUSH)(COLOR.COLOR_BACKGROUND + 1), hbrBackground = (HBRUSH)(COLOR.COLOR_BACKGROUND + 1),
lpszClassName = (ushort*)name, lpszClassName = name,
}; };
wndClassAtom = RegisterClassExW(&wndClass); wndClassAtom = RegisterClassExW(&wndClass);
@ -226,8 +226,8 @@ internal partial class StaThreadService : IInternalDisposableService
this.messageReceiverHwndTask.SetResult( this.messageReceiverHwndTask.SetResult(
CreateWindowExW( CreateWindowExW(
0, 0,
(ushort*)wndClassAtom, (char*)wndClassAtom,
(ushort*)name, name,
0, 0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
@ -275,7 +275,7 @@ internal partial class StaThreadService : IInternalDisposableService
_ = OleFlushClipboard(); _ = OleFlushClipboard();
OleUninitialize(); OleUninitialize();
if (wndClassAtom != 0) if (wndClassAtom != 0)
UnregisterClassW((ushort*)wndClassAtom, hInstance); UnregisterClassW((char*)wndClassAtom, hInstance);
this.messageReceiverHwndTask.TrySetException(e); this.messageReceiverHwndTask.TrySetException(e);
} }
} }

View file

@ -44,12 +44,12 @@ internal sealed class BitmapCodecInfo : IBitmapCodecInfo
private static unsafe string ReadStringUsing( private static unsafe string ReadStringUsing(
IWICBitmapCodecInfo* codecInfo, IWICBitmapCodecInfo* codecInfo,
delegate* unmanaged<IWICBitmapCodecInfo*, uint, ushort*, uint*, int> readFuncPtr) delegate* unmanaged[MemberFunction]<IWICBitmapCodecInfo*, uint, char*, uint*, int> readFuncPtr)
{ {
var cch = 0u; var cch = 0u;
_ = readFuncPtr(codecInfo, 0, null, &cch); _ = readFuncPtr(codecInfo, 0, null, &cch);
var buf = stackalloc char[(int)cch + 1]; var buf = stackalloc char[(int)cch + 1];
Marshal.ThrowExceptionForHR(readFuncPtr(codecInfo, cch + 1, (ushort*)buf, &cch)); Marshal.ThrowExceptionForHR(readFuncPtr(codecInfo, cch + 1, buf, &cch));
return new(buf, 0, (int)cch); return new(buf, 0, (int)cch);
} }
} }

View file

@ -219,14 +219,14 @@ internal sealed partial class TextureManager
return; return;
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static int QueryInterfaceStatic(IUnknown* pThis, Guid* riid, void** ppvObject) => static int QueryInterfaceStatic(IUnknown* pThis, Guid* riid, void** ppvObject) =>
ToManagedObject(pThis)?.QueryInterface(riid, ppvObject) ?? E.E_UNEXPECTED; ToManagedObject(pThis)?.QueryInterface(riid, ppvObject) ?? E.E_UNEXPECTED;
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static uint AddRefStatic(IUnknown* pThis) => (uint)(ToManagedObject(pThis)?.AddRef() ?? 0); static uint AddRefStatic(IUnknown* pThis) => (uint)(ToManagedObject(pThis)?.AddRef() ?? 0);
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static uint ReleaseStatic(IUnknown* pThis) => (uint)(ToManagedObject(pThis)?.Release() ?? 0); static uint ReleaseStatic(IUnknown* pThis) => (uint)(ToManagedObject(pThis)?.Release() ?? 0);
} }

View file

@ -133,7 +133,7 @@ internal sealed partial class TextureManager
}, },
}, },
}; };
namea.AsSpan().CopyTo(new(fgda.fgd.e0.cFileName, 260)); namea.AsSpan().CopyTo(new(Unsafe.AsPointer(ref fgda.fgd.e0.cFileName[0]), 260));
AddToDataObject( AddToDataObject(
pdo, pdo,
@ -157,7 +157,7 @@ internal sealed partial class TextureManager
}, },
}, },
}; };
preferredFileNameWithoutExtension.AsSpan().CopyTo(new(fgdw.fgd.e0.cFileName, 260)); preferredFileNameWithoutExtension.AsSpan().CopyTo(new(Unsafe.AsPointer(ref fgdw.fgd.e0.cFileName[0]), 260));
AddToDataObject( AddToDataObject(
pdo, pdo,
@ -450,7 +450,7 @@ internal sealed partial class TextureManager
try try
{ {
IStream* pfs; IStream* pfs;
SHCreateStreamOnFileW((ushort*)pPath, sharedRead, &pfs).ThrowOnError(); SHCreateStreamOnFileW((char*)pPath, sharedRead, &pfs).ThrowOnError();
var stgm2 = new STGMEDIUM var stgm2 = new STGMEDIUM
{ {

View file

@ -1,4 +1,4 @@
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Drawing; using System.Drawing;
@ -294,18 +294,18 @@ internal sealed class LoadingDialog
? null ? null
: Icon.ExtractAssociatedIcon(Path.Combine(workingDirectory, "Dalamud.Injector.exe")); : Icon.ExtractAssociatedIcon(Path.Combine(workingDirectory, "Dalamud.Injector.exe"));
fixed (void* pszEmpty = "-") fixed (char* pszEmpty = "-")
fixed (void* pszWindowTitle = "Dalamud") fixed (char* pszWindowTitle = "Dalamud")
fixed (void* pszDalamudBoot = "Dalamud.Boot.dll") fixed (char* pszDalamudBoot = "Dalamud.Boot.dll")
fixed (void* pszThemesManifestResourceName = "RT_MANIFEST_THEMES") fixed (char* pszThemesManifestResourceName = "RT_MANIFEST_THEMES")
fixed (void* pszHide = Loc.Localize("LoadingDialogHide", "Hide")) fixed (char* pszHide = Loc.Localize("LoadingDialogHide", "Hide"))
fixed (void* pszShowLatestLogs = Loc.Localize("LoadingDialogShowLatestLogs", "Show Latest Logs")) fixed (char* pszShowLatestLogs = Loc.Localize("LoadingDialogShowLatestLogs", "Show Latest Logs"))
fixed (void* pszHideLatestLogs = Loc.Localize("LoadingDialogHideLatestLogs", "Hide Latest Logs")) fixed (char* pszHideLatestLogs = Loc.Localize("LoadingDialogHideLatestLogs", "Hide Latest Logs"))
{ {
var taskDialogButton = new TASKDIALOG_BUTTON var taskDialogButton = new TASKDIALOG_BUTTON
{ {
nButtonID = IDOK, nButtonID = IDOK,
pszButtonText = (ushort*)pszHide, pszButtonText = pszHide,
}; };
var taskDialogConfig = new TASKDIALOGCONFIG var taskDialogConfig = new TASKDIALOGCONFIG
{ {
@ -318,8 +318,8 @@ internal sealed class LoadingDialog
(int)TDF_CALLBACK_TIMER | (int)TDF_CALLBACK_TIMER |
(extractedIcon is null ? 0 : (int)TDF_USE_HICON_MAIN), (extractedIcon is null ? 0 : (int)TDF_USE_HICON_MAIN),
dwCommonButtons = 0, dwCommonButtons = 0,
pszWindowTitle = (ushort*)pszWindowTitle, pszWindowTitle = pszWindowTitle,
pszMainIcon = extractedIcon is null ? TD.TD_INFORMATION_ICON : (ushort*)extractedIcon.Handle, pszMainIcon = extractedIcon is null ? TD.TD_INFORMATION_ICON : (char*)extractedIcon.Handle,
pszMainInstruction = null, pszMainInstruction = null,
pszContent = null, pszContent = null,
cButtons = 1, cButtons = 1,
@ -329,9 +329,9 @@ internal sealed class LoadingDialog
pRadioButtons = null, pRadioButtons = null,
nDefaultRadioButton = 0, nDefaultRadioButton = 0,
pszVerificationText = null, pszVerificationText = null,
pszExpandedInformation = (ushort*)pszEmpty, pszExpandedInformation = pszEmpty,
pszExpandedControlText = (ushort*)pszShowLatestLogs, pszExpandedControlText = pszShowLatestLogs,
pszCollapsedControlText = (ushort*)pszHideLatestLogs, pszCollapsedControlText = pszHideLatestLogs,
pszFooterIcon = null, pszFooterIcon = null,
pszFooter = null, pszFooter = null,
pfCallback = &HResultFuncBinder, pfCallback = &HResultFuncBinder,
@ -348,8 +348,8 @@ internal sealed class LoadingDialog
{ {
cbSize = (uint)sizeof(ACTCTXW), cbSize = (uint)sizeof(ACTCTXW),
dwFlags = ACTCTX_FLAG_HMODULE_VALID | ACTCTX_FLAG_RESOURCE_NAME_VALID, dwFlags = ACTCTX_FLAG_HMODULE_VALID | ACTCTX_FLAG_RESOURCE_NAME_VALID,
lpResourceName = (ushort*)pszThemesManifestResourceName, lpResourceName = pszThemesManifestResourceName,
hModule = GetModuleHandleW((ushort*)pszDalamudBoot), hModule = GetModuleHandleW(pszDalamudBoot),
}; };
hActCtx = CreateActCtxW(&actctx); hActCtx = CreateActCtxW(&actctx);
if (hActCtx == default) if (hActCtx == default)

View file

@ -30,8 +30,8 @@ internal static class ClipboardFormats
private static unsafe uint ClipboardFormatFromName(ReadOnlySpan<char> name) private static unsafe uint ClipboardFormatFromName(ReadOnlySpan<char> name)
{ {
uint cf; uint cf;
fixed (void* p = name) fixed (char* p = name)
cf = RegisterClipboardFormatW((ushort*)p); cf = RegisterClipboardFormatW(p);
if (cf != 0) if (cf != 0)
return cf; return cf;
throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error()) ?? throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error()) ??

View file

@ -57,60 +57,60 @@ internal sealed unsafe class ManagedIStream : IStream.Interface, IRefCountable
static ManagedIStream? ToManagedObject(void* pThis) => static ManagedIStream? ToManagedObject(void* pThis) =>
GCHandle.FromIntPtr(((nint*)pThis)[1]).Target as ManagedIStream; GCHandle.FromIntPtr(((nint*)pThis)[1]).Target as ManagedIStream;
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static int QueryInterfaceStatic(IStream* pThis, Guid* riid, void** ppvObject) => static int QueryInterfaceStatic(IStream* pThis, Guid* riid, void** ppvObject) =>
ToManagedObject(pThis)?.QueryInterface(riid, ppvObject) ?? E.E_UNEXPECTED; ToManagedObject(pThis)?.QueryInterface(riid, ppvObject) ?? E.E_UNEXPECTED;
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static uint AddRefStatic(IStream* pThis) => (uint)(ToManagedObject(pThis)?.AddRef() ?? 0); static uint AddRefStatic(IStream* pThis) => (uint)(ToManagedObject(pThis)?.AddRef() ?? 0);
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static uint ReleaseStatic(IStream* pThis) => (uint)(ToManagedObject(pThis)?.Release() ?? 0); static uint ReleaseStatic(IStream* pThis) => (uint)(ToManagedObject(pThis)?.Release() ?? 0);
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static int ReadStatic(IStream* pThis, void* pv, uint cb, uint* pcbRead) => static int ReadStatic(IStream* pThis, void* pv, uint cb, uint* pcbRead) =>
ToManagedObject(pThis)?.Read(pv, cb, pcbRead) ?? E.E_UNEXPECTED; ToManagedObject(pThis)?.Read(pv, cb, pcbRead) ?? E.E_UNEXPECTED;
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static int WriteStatic(IStream* pThis, void* pv, uint cb, uint* pcbWritten) => static int WriteStatic(IStream* pThis, void* pv, uint cb, uint* pcbWritten) =>
ToManagedObject(pThis)?.Write(pv, cb, pcbWritten) ?? E.E_UNEXPECTED; ToManagedObject(pThis)?.Write(pv, cb, pcbWritten) ?? E.E_UNEXPECTED;
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static int SeekStatic( static int SeekStatic(
IStream* pThis, LARGE_INTEGER dlibMove, uint dwOrigin, ULARGE_INTEGER* plibNewPosition) => IStream* pThis, LARGE_INTEGER dlibMove, uint dwOrigin, ULARGE_INTEGER* plibNewPosition) =>
ToManagedObject(pThis)?.Seek(dlibMove, dwOrigin, plibNewPosition) ?? E.E_UNEXPECTED; ToManagedObject(pThis)?.Seek(dlibMove, dwOrigin, plibNewPosition) ?? E.E_UNEXPECTED;
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static int SetSizeStatic(IStream* pThis, ULARGE_INTEGER libNewSize) => static int SetSizeStatic(IStream* pThis, ULARGE_INTEGER libNewSize) =>
ToManagedObject(pThis)?.SetSize(libNewSize) ?? E.E_UNEXPECTED; ToManagedObject(pThis)?.SetSize(libNewSize) ?? E.E_UNEXPECTED;
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static int CopyToStatic( static int CopyToStatic(
IStream* pThis, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, IStream* pThis, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead,
ULARGE_INTEGER* pcbWritten) => ULARGE_INTEGER* pcbWritten) =>
ToManagedObject(pThis)?.CopyTo(pstm, cb, pcbRead, pcbWritten) ?? E.E_UNEXPECTED; ToManagedObject(pThis)?.CopyTo(pstm, cb, pcbRead, pcbWritten) ?? E.E_UNEXPECTED;
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static int CommitStatic(IStream* pThis, uint grfCommitFlags) => static int CommitStatic(IStream* pThis, uint grfCommitFlags) =>
ToManagedObject(pThis)?.Commit(grfCommitFlags) ?? E.E_UNEXPECTED; ToManagedObject(pThis)?.Commit(grfCommitFlags) ?? E.E_UNEXPECTED;
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static int RevertStatic(IStream* pThis) => ToManagedObject(pThis)?.Revert() ?? E.E_UNEXPECTED; static int RevertStatic(IStream* pThis) => ToManagedObject(pThis)?.Revert() ?? E.E_UNEXPECTED;
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static int LockRegionStatic(IStream* pThis, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType) => static int LockRegionStatic(IStream* pThis, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType) =>
ToManagedObject(pThis)?.LockRegion(libOffset, cb, dwLockType) ?? E.E_UNEXPECTED; ToManagedObject(pThis)?.LockRegion(libOffset, cb, dwLockType) ?? E.E_UNEXPECTED;
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static int UnlockRegionStatic( static int UnlockRegionStatic(
IStream* pThis, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType) => IStream* pThis, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType) =>
ToManagedObject(pThis)?.UnlockRegion(libOffset, cb, dwLockType) ?? E.E_UNEXPECTED; ToManagedObject(pThis)?.UnlockRegion(libOffset, cb, dwLockType) ?? E.E_UNEXPECTED;
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static int StatStatic(IStream* pThis, STATSTG* pstatstg, uint grfStatFlag) => static int StatStatic(IStream* pThis, STATSTG* pstatstg, uint grfStatFlag) =>
ToManagedObject(pThis)?.Stat(pstatstg, grfStatFlag) ?? E.E_UNEXPECTED; ToManagedObject(pThis)?.Stat(pstatstg, grfStatFlag) ?? E.E_UNEXPECTED;
[UnmanagedCallersOnly] [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
static int CloneStatic(IStream* pThis, IStream** ppstm) => ToManagedObject(pThis)?.Clone(ppstm) ?? E.E_UNEXPECTED; static int CloneStatic(IStream* pThis, IStream** ppstm) => ToManagedObject(pThis)?.Clone(ppstm) ?? E.E_UNEXPECTED;
} }

View file

@ -88,7 +88,7 @@ internal static unsafe partial class TerraFxComInterfaceExtensions
fixed (char* pPath = path) fixed (char* pPath = path)
{ {
SHCreateStreamOnFileEx( SHCreateStreamOnFileEx(
(ushort*)pPath, pPath,
grfMode, grfMode,
(uint)attributes, (uint)attributes,
fCreate, fCreate,
@ -115,7 +115,7 @@ internal static unsafe partial class TerraFxComInterfaceExtensions
{ {
fixed (char* pName = name) fixed (char* pName = name)
{ {
var option = new PROPBAG2 { pstrName = (ushort*)pName }; var option = new PROPBAG2 { pstrName = pName };
return obj.Write(1, &option, &varValue); return obj.Write(1, &option, &varValue);
} }
} }
@ -145,7 +145,7 @@ internal static unsafe partial class TerraFxComInterfaceExtensions
try try
{ {
fixed (char* pName = name) fixed (char* pName = name)
return obj.SetMetadataByName((ushort*)pName, &propVarValue); return obj.SetMetadataByName(pName, &propVarValue);
} }
finally finally
{ {
@ -165,7 +165,7 @@ internal static unsafe partial class TerraFxComInterfaceExtensions
public static HRESULT RemoveMetadataByName(ref this IWICMetadataQueryWriter obj, string name) public static HRESULT RemoveMetadataByName(ref this IWICMetadataQueryWriter obj, string name)
{ {
fixed (char* pName = name) fixed (char* pName = name)
return obj.RemoveMetadataByName((ushort*)pName); return obj.RemoveMetadataByName(pName);
} }
[LibraryImport("propsys.dll")] [LibraryImport("propsys.dll")]

View file

@ -26,7 +26,7 @@
<PackageVersion Include="sqlite-net-pcl" Version="1.8.116" /> <PackageVersion Include="sqlite-net-pcl" Version="1.8.116" />
<!-- DirectX / Win32 --> <!-- DirectX / Win32 -->
<PackageVersion Include="TerraFX.Interop.Windows" Version="10.0.22621.2" /> <PackageVersion Include="TerraFX.Interop.Windows" Version="10.0.26100.5" />
<PackageVersion Include="SharpDX.Direct3D11" Version="4.2.0" /> <PackageVersion Include="SharpDX.Direct3D11" Version="4.2.0" />
<PackageVersion Include="SharpDX.Mathematics" Version="4.2.0" /> <PackageVersion Include="SharpDX.Mathematics" Version="4.2.0" />
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.3.183" /> <PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.3.183" />