CPF/CPF.Windows/ComWrapper/IFileDialogWrapper.cs

745 lines
26 KiB
C#
Raw Normal View History

2023-11-21 23:05:03 +08:00
// <auto-generated>
// Code generated by COM Proxy Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
#nullable enable
using System;
using Marshal = System.Runtime.InteropServices.Marshal;
namespace CPF.Windows.ComWrapper
{
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
unsafe partial class IFileDialogWrapper : IFileDialog
{
internal readonly IntPtr instance;
public IFileDialogWrapper(IntPtr instance)
{
this.instance = instance;
Marshal.AddRef(instance);
}
~IFileDialogWrapper()
{
Marshal.Release(this.instance);
}
uint IFileDialog.Show(global::System.IntPtr hwndOwner)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
uint retVal;
retVal = ((delegate* unmanaged<System.IntPtr, global::System.IntPtr, uint>)vtbl[3])(thisPtr, hwndOwner);
return (uint)retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.SetFileTypes(uint cFileTypes, COMDLG_FILTERSPEC[] rgFilterSpec)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
uint retVal;
COMDLG_FILTERSPEC_native[] natives = new COMDLG_FILTERSPEC_native[rgFilterSpec.Length];
for (int i = 0; i < rgFilterSpec.Length; i++)
{
natives[i] = new COMDLG_FILTERSPEC_native { pszName = Marshal.StringToHGlobalUni(rgFilterSpec[i].pszName), pszSpec = Marshal.StringToHGlobalUni(rgFilterSpec[i].pszSpec) };
}
fixed (COMDLG_FILTERSPEC_native* local_1 = natives)
result = ((delegate* unmanaged<System.IntPtr, uint, COMDLG_FILTERSPEC_native*, uint*, int>)vtbl[4])(thisPtr, cFileTypes, local_1, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.SetFileTypeIndex(uint iFileType)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, uint, uint*, int>)vtbl[5])(thisPtr, iFileType, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.GetFileTypeIndex(out uint piFileType)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
uint retVal;
fixed (uint* local_0 = &piFileType)
result = ((delegate* unmanaged<System.IntPtr, uint*, uint*, int>)vtbl[6])(thisPtr, local_0, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.Advise(global::System.IntPtr pfde, out uint pdwCookie)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
uint retVal;
fixed (uint* local_1 = &pdwCookie)
result = ((delegate* unmanaged<System.IntPtr, global::System.IntPtr, uint*, uint*, int>)vtbl[7])(thisPtr, pfde, local_1, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.Unadvise(uint dwCookie)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, uint, uint*, int>)vtbl[8])(thisPtr, dwCookie, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.SetOptions(uint fos)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, uint, uint*, int>)vtbl[9])(thisPtr, fos, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.GetOptions(out uint fos)
{
var targetInterface = CpfComWrappers.IID_IFileDialog;
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
uint retVal;
fixed (uint* local_0 = &fos)
result = ((delegate* unmanaged<System.IntPtr, uint*, uint*, int>)vtbl[10])(thisPtr, local_0, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
void IFileDialog.SetDefaultFolder(IShellItem psi)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
System.IntPtr local_0;
if (psi == null)
{
local_0 = System.IntPtr.Zero;
}
else
{
var local_0_unk = Marshal.GetIUnknownForObject(psi);
var local_psi_IID = new System.Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE");
result = Marshal.QueryInterface(local_0_unk, ref local_psi_IID, out local_0);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
}
result = ((delegate* unmanaged<System.IntPtr, System.IntPtr, int>)vtbl[11])(thisPtr, local_0);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.SetFolder(IShellItem psi)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
System.IntPtr local_0;
if (psi == null)
{
local_0 = System.IntPtr.Zero;
}
else
{
var local_0_unk = Marshal.GetIUnknownForObject(psi);
var local_psi_IID = new System.Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE");
result = Marshal.QueryInterface(local_0_unk, ref local_psi_IID, out local_0);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
}
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, System.IntPtr, uint*, int>)vtbl[12])(thisPtr, local_0, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.GetFolder(out IShellItem ppsi)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
System.IntPtr local_0;
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, System.IntPtr*, uint*, int>)vtbl[13])(thisPtr, &local_0, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
ppsi = local_0 == System.IntPtr.Zero ? null : (IShellItem)Marshal.GetObjectForIUnknown(local_0);
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.GetCurrentSelection(out IShellItem ppsi)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
System.IntPtr local_0;
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, System.IntPtr*, uint*, int>)vtbl[14])(thisPtr, &local_0, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
ppsi = local_0 == System.IntPtr.Zero ? null : (IShellItem)Marshal.GetObjectForIUnknown(local_0);
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.SetFileName(string pszName)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
var local_0 = Marshal.StringToCoTaskMemUni(pszName);
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, System.IntPtr, uint*, int>)vtbl[15])(thisPtr, local_0, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
Marshal.FreeCoTaskMem(local_0);
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.GetFileName(out string pszName)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
System.IntPtr local_0;
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, System.IntPtr*, uint*, int>)vtbl[16])(thisPtr, &local_0, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
pszName = Marshal.PtrToStringUni(local_0);
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.SetTitle(string pszTitle)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
var local_0 = Marshal.StringToCoTaskMemUni(pszTitle);
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, System.IntPtr, uint*, int>)vtbl[17])(thisPtr, local_0, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
Marshal.FreeCoTaskMem(local_0);
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.SetOkButtonLabel(string pszText)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
var local_0 = Marshal.StringToCoTaskMemUni(pszText);
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, System.IntPtr, uint*, int>)vtbl[18])(thisPtr, local_0, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
Marshal.FreeCoTaskMem(local_0);
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.SetFileNameLabel(string pszLabel)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
var local_0 = Marshal.StringToCoTaskMemUni(pszLabel);
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, System.IntPtr, uint*, int>)vtbl[19])(thisPtr, local_0, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
Marshal.FreeCoTaskMem(local_0);
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.GetResult(out IShellItem ppsi)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
System.IntPtr local_0;
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, System.IntPtr*, uint*, int>)vtbl[20])(thisPtr, &local_0, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
ppsi = local_0 == System.IntPtr.Zero ? null : (IShellItem)Marshal.GetObjectForIUnknown(local_0);
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.AddPlace(IShellItem psi, uint fdap)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
System.IntPtr local_0;
if (psi == null)
{
local_0 = System.IntPtr.Zero;
}
else
{
var local_0_unk = Marshal.GetIUnknownForObject(psi);
var local_psi_IID = new System.Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE");
result = Marshal.QueryInterface(local_0_unk, ref local_psi_IID, out local_0);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
}
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, System.IntPtr, uint, uint*, int>)vtbl[21])(thisPtr, local_0, fdap, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.SetDefaultExtension(string pszDefaultExtension)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
var local_0 = Marshal.StringToCoTaskMemUni(pszDefaultExtension);
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, System.IntPtr, uint*, int>)vtbl[22])(thisPtr, local_0, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
Marshal.FreeCoTaskMem(local_0);
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.Close(uint hr)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, uint, uint*, int>)vtbl[23])(thisPtr, hr, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.SetClientGuid(ref global::System.Guid guid)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
uint retVal;
fixed (global::System.Guid* local_0 = &guid)
result = ((delegate* unmanaged<System.IntPtr, global::System.Guid*, uint*, int>)vtbl[24])(thisPtr, local_0, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.ClearClientData()
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, uint*, int>)vtbl[25])(thisPtr, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
uint IFileDialog.SetFilter(global::System.IntPtr pFilter)
{
var targetInterface = new System.Guid("42F85136-DB7E-439C-85F1-E4075D135FC8");
var result = Marshal.QueryInterface(this.instance, ref targetInterface, out var thisPtr);
if (result != 0)
{
throw new System.InvalidCastException();
}
try
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
uint retVal;
result = ((delegate* unmanaged<System.IntPtr, global::System.IntPtr, uint*, int>)vtbl[26])(thisPtr, pFilter, &retVal);
if (result != 0)
{
Marshal.ThrowExceptionForHR(result);
}
return retVal;
}
finally
{
Marshal.Release(thisPtr);
}
}
}
}