2021-11-11 11:18:46 -06:00
|
|
|
using System;
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using Microsoft.Iris;
|
|
|
|
|
using Microsoft.Zune.Util;
|
|
|
|
|
using ZuneUI;
|
|
|
|
|
|
|
|
|
|
namespace MicrosoftZuneLibrary
|
|
|
|
|
{
|
|
|
|
|
public abstract class FirmwareOperationBase : IDisposable
|
|
|
|
|
{
|
2021-11-23 01:09:52 -06:00
|
|
|
internal readonly CComPtrMgd<IEndpointHost> m_spEndpointHost;
|
2021-11-11 11:18:46 -06:00
|
|
|
|
|
|
|
|
internal object m_FirmwareLock;
|
|
|
|
|
|
|
|
|
|
internal bool m_fFirmwareProcessSupported;
|
|
|
|
|
|
|
|
|
|
internal bool m_Canceled;
|
|
|
|
|
|
|
|
|
|
internal bool m_DeviceRebooting;
|
|
|
|
|
|
2021-11-24 00:38:28 -06:00
|
|
|
internal readonly CComPtrMgd<FirmwareUpdateMediator> m_spFirmwareMediator;
|
2021-11-11 11:18:46 -06:00
|
|
|
|
|
|
|
|
internal FirmwareCompleteHandler m_OnCompleteHandler;
|
|
|
|
|
|
|
|
|
|
internal DeferredInvokeHandler m_HandlerComplete;
|
|
|
|
|
|
|
|
|
|
[return: MarshalAs(UnmanagedType.U1)]
|
|
|
|
|
public bool EnterContinuousPowerMode()
|
|
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
return (Module.SetThreadExecutionState(2147483649u) != 0) ? true : false;
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[return: MarshalAs(UnmanagedType.U1)]
|
|
|
|
|
public bool LeaveContinuousPowerMode()
|
|
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
return (Module.SetThreadExecutionState(2147483648u) != 0) ? true : false;
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[return: MarshalAs(UnmanagedType.U1)]
|
|
|
|
|
public virtual bool IsValid()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public HRESULT CheckPowerRequirements(out bool fOnBatteryPower)
|
|
|
|
|
{
|
2021-11-24 00:38:28 -06:00
|
|
|
return PowerRequirements.CheckOnBatteryPower(out fOnBatteryPower);
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal FirmwareOperationBase()
|
|
|
|
|
{
|
2021-11-23 01:09:52 -06:00
|
|
|
CComPtrMgd<IEndpointHost> spEndpointHost = new CComPtrMgd<IEndpointHost>();
|
2021-11-11 11:18:46 -06:00
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
m_spEndpointHost = spEndpointHost;
|
2021-11-24 00:38:28 -06:00
|
|
|
CComPtrMgd<FirmwareUpdateMediator> spFirmwareMediator = new();
|
2021-11-11 11:18:46 -06:00
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
m_spFirmwareMediator = spFirmwareMediator;
|
|
|
|
|
m_Canceled = false;
|
|
|
|
|
m_FirmwareLock = new object();
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
|
|
|
|
((IDisposable)m_spFirmwareMediator).Dispose();
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
|
|
|
|
((IDisposable)m_spEndpointHost).Dispose();
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void _007EFirmwareOperationBase()
|
|
|
|
|
{
|
|
|
|
|
m_spEndpointHost.Release();
|
|
|
|
|
m_spFirmwareMediator.Release();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[return: MarshalAs(UnmanagedType.U1)]
|
|
|
|
|
internal unsafe bool IsDeviceRebooting()
|
|
|
|
|
{
|
2021-11-22 00:09:47 -06:00
|
|
|
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u)
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.WPP_SF_(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 18, (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids));
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
return m_DeviceRebooting;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal unsafe int Reset([MarshalAs(UnmanagedType.U1)] bool deviceRebooting)
|
|
|
|
|
{
|
2021-11-22 00:09:47 -06:00
|
|
|
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u)
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.WPP_SF_(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 19, (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids));
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
int result = InternalReset();
|
|
|
|
|
m_DeviceRebooting = deviceRebooting;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal unsafe void SendCompleteNotification(int hr, [MarshalAs(UnmanagedType.U1)] bool disconnectDeviceOnComplete)
|
|
|
|
|
{
|
|
|
|
|
//IL_001e: Expected I, but got I8
|
|
|
|
|
//IL_0038: Expected I, but got I8
|
2021-11-24 00:38:28 -06:00
|
|
|
CComPtrNtv<IFirmwareUpdateErrorInfo> cComPtrNtv_003CIFirmwareUpdateErrorInfo_003E = new();
|
2021-11-11 11:18:46 -06:00
|
|
|
try
|
|
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
InternalErrorInfo* ptr = (InternalErrorInfo*)Module.@new(56uL);
|
2021-11-11 11:18:46 -06:00
|
|
|
InternalErrorInfo* lp;
|
|
|
|
|
try
|
|
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
lp = ((ptr == null) ? null : Module.MicrosoftZuneLibrary_002EInternalErrorInfo_002E_007Bctor_007D(ptr, hr));
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.delete(ptr);
|
2021-11-11 11:18:46 -06:00
|
|
|
throw;
|
|
|
|
|
}
|
2021-11-24 00:38:28 -06:00
|
|
|
cComPtrNtv_003CIFirmwareUpdateErrorInfo_003E.set_p((IFirmwareUpdateErrorInfo*)lp);
|
|
|
|
|
FirmwareProcessCompleteArgs args = new FirmwareProcessCompleteArgs(new FirmwareUpdateErrorInfo((IFirmwareUpdateErrorInfo*)(*(ulong*)(cComPtrNtv_003CIFirmwareUpdateErrorInfo_003E.p))), null, CompletionAction.Complete, disconnectDeviceOnComplete);
|
2021-11-11 11:18:46 -06:00
|
|
|
Application.DeferredInvokeOnWorkerThread(ProcessCompleteWorker, ProcessCompleteWorkerComplete, args);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
2021-11-30 01:00:46 -06:00
|
|
|
cComPtrNtv_003CIFirmwareUpdateErrorInfo_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
throw;
|
|
|
|
|
}
|
2021-11-24 00:38:28 -06:00
|
|
|
cComPtrNtv_003CIFirmwareUpdateErrorInfo_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal unsafe void OnFirmwareProcessCompleteWorker(object data)
|
|
|
|
|
{
|
|
|
|
|
FirmwareProcessCompleteArgs firmwareProcessCompleteArgs = (FirmwareProcessCompleteArgs)data;
|
|
|
|
|
switch (firmwareProcessCompleteArgs.Action)
|
|
|
|
|
{
|
|
|
|
|
case CompletionAction.Complete:
|
2021-11-22 00:09:47 -06:00
|
|
|
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 6u)
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.WPP_SF_d(_a1: firmwareProcessCompleteArgs.ErrorInfo.HrStatus.hr, Logger: *(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), id: 23, TraceGuid: (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids));
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
ProcessCompleteWorker(firmwareProcessCompleteArgs);
|
|
|
|
|
break;
|
|
|
|
|
case CompletionAction.Rollback:
|
|
|
|
|
{
|
2021-11-22 00:09:47 -06:00
|
|
|
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 2u)
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.WPP_SF_d(_a1: firmwareProcessCompleteArgs.ErrorInfo.HrStatus.hr, Logger: *(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), id: 22, TraceGuid: (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids));
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
DeferredInvokeHandler handlerComplete2 = m_HandlerComplete;
|
|
|
|
|
if (handlerComplete2 != null)
|
|
|
|
|
{
|
|
|
|
|
handlerComplete2(firmwareProcessCompleteArgs);
|
|
|
|
|
}
|
|
|
|
|
ContinueFirmwareProcess(null);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case CompletionAction.Reboot:
|
|
|
|
|
{
|
2021-11-22 00:09:47 -06:00
|
|
|
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 6u)
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.WPP_SF_d(_a1: firmwareProcessCompleteArgs.ErrorInfo.HrStatus.hr, Logger: *(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), id: 21, TraceGuid: (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids));
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
Reset(deviceRebooting: true);
|
|
|
|
|
DeferredInvokeHandler handlerComplete = m_HandlerComplete;
|
|
|
|
|
if (handlerComplete != null)
|
|
|
|
|
{
|
|
|
|
|
handlerComplete(firmwareProcessCompleteArgs);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case CompletionAction.Continue:
|
2021-11-22 00:09:47 -06:00
|
|
|
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 6u)
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.WPP_SF_d(_a1: firmwareProcessCompleteArgs.ErrorInfo.HrStatus.hr, Logger: *(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), id: 20, TraceGuid: (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids));
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
ContinueFirmwareProcess(null);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal unsafe void ProcessCompleteWorker(object data)
|
|
|
|
|
{
|
|
|
|
|
//IL_006c: Expected I, but got I8
|
|
|
|
|
FirmwareProcessCompleteArgs firmwareProcessCompleteArgs = (FirmwareProcessCompleteArgs)data;
|
2021-11-22 00:09:47 -06:00
|
|
|
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u)
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.WPP_SF_d(_a1: firmwareProcessCompleteArgs.ErrorInfo.HrStatus.hr, Logger: *(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), id: 24, TraceGuid: (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids));
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
Reset(deviceRebooting: false);
|
|
|
|
|
m_spFirmwareMediator.op_Assign(null);
|
|
|
|
|
if (m_OnCompleteHandler != null)
|
|
|
|
|
{
|
|
|
|
|
HRESULT hrStatus = firmwareProcessCompleteArgs.ErrorInfo.HrStatus;
|
|
|
|
|
m_OnCompleteHandler(hrStatus.hr);
|
|
|
|
|
m_OnCompleteHandler = null;
|
|
|
|
|
}
|
|
|
|
|
if (m_HandlerComplete != null)
|
|
|
|
|
{
|
|
|
|
|
m_HandlerComplete(firmwareProcessCompleteArgs);
|
|
|
|
|
m_HandlerComplete = null;
|
|
|
|
|
}
|
|
|
|
|
if (firmwareProcessCompleteArgs.DisconnectDeviceOnComplete)
|
|
|
|
|
{
|
|
|
|
|
IEndpointHost* p = m_spEndpointHost.p;
|
|
|
|
|
DeviceList.Instance.DeviceDisconnected(p);
|
|
|
|
|
}
|
2021-11-22 00:09:47 -06:00
|
|
|
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u)
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.WPP_SF_(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 25, (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids));
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal void ProcessCompleteWorkerComplete(object P_0)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal unsafe void DeferredCancel()
|
|
|
|
|
{
|
|
|
|
|
//IL_0086: Expected I, but got I8
|
|
|
|
|
//IL_00cd: Expected I, but got I8
|
|
|
|
|
//IL_00e1: Expected I, but got I8
|
|
|
|
|
//IL_00e1: Expected I, but got I8
|
|
|
|
|
//IL_00e1: Expected I, but got I8
|
2021-11-24 00:38:28 -06:00
|
|
|
CComPtrNtv<IFirmwareUpdateNotification> cComPtrNtv_003CIFirmwareUpdateNotification_003E = new();
|
2021-11-11 11:18:46 -06:00
|
|
|
try
|
|
|
|
|
{
|
2021-11-22 00:09:47 -06:00
|
|
|
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u)
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.WPP_SF_(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 26, (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids));
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
m_DeviceRebooting = false;
|
2021-11-24 00:38:28 -06:00
|
|
|
int firmwareUpdateNotification = GetFirmwareUpdateNotification((IFirmwareUpdateNotification**)(cComPtrNtv_003CIFirmwareUpdateNotification_003E.p));
|
|
|
|
|
if (*(long*)(cComPtrNtv_003CIFirmwareUpdateNotification_003E.p) != 0L && firmwareUpdateNotification >= 0)
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
2021-11-30 01:00:46 -06:00
|
|
|
string WBSTRString = "";
|
2021-11-11 11:18:46 -06:00
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
IEndpointHost* p = m_spEndpointHost.p;
|
|
|
|
|
firmwareUpdateNotification = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, EEndpointHostProperty, ushort**, int>)(*(ulong*)(*(long*)p + 120)))((nint)p, EEndpointHostProperty.eEndpointHostPropertyEndpointId, (ushort**)(&wBSTRString));
|
|
|
|
|
if (firmwareUpdateNotification >= 0)
|
|
|
|
|
{
|
2021-11-22 00:09:47 -06:00
|
|
|
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u)
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.WPP_SF_S(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 27, (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids), (ushort*)(*(ulong*)(&wBSTRString)));
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
2021-11-24 00:38:28 -06:00
|
|
|
long num = *(long*)(cComPtrNtv_003CIFirmwareUpdateNotification_003E.p);
|
2021-11-11 11:18:46 -06:00
|
|
|
long num2 = *(long*)(&wBSTRString);
|
2021-11-24 00:38:28 -06:00
|
|
|
((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, ushort*, int>)(*(ulong*)(*(long*)(*(ulong*)(cComPtrNtv_003CIFirmwareUpdateNotification_003E.p)) + 48)))((nint)num, (ushort*)num2);
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.___CxxCallUnwindDtor((delegate*<void*, void>)(delegate*<WBSTRString*, void>)(&Module.WBSTRString_002E_007Bdtor_007D), &wBSTRString);
|
2021-11-11 11:18:46 -06:00
|
|
|
throw;
|
|
|
|
|
}
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.WBSTRString_002E_007Bdtor_007D(&wBSTRString);
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
SendCompleteNotification(-2147467260, disconnectDeviceOnComplete: true);
|
2021-11-22 00:09:47 -06:00
|
|
|
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u)
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.WPP_SF_(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 28, (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids));
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
2021-11-30 01:00:46 -06:00
|
|
|
cComPtrNtv_003CIFirmwareUpdateNotification_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
throw;
|
|
|
|
|
}
|
2021-11-24 00:38:28 -06:00
|
|
|
cComPtrNtv_003CIFirmwareUpdateNotification_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal unsafe int GetFirmwareUpdateNotification(IFirmwareUpdateNotification** ppNotification)
|
|
|
|
|
{
|
|
|
|
|
//IL_0152: Expected I, but got I8
|
|
|
|
|
//IL_0152: Expected I, but got I8
|
|
|
|
|
//IL_016b: Expected I, but got I8
|
|
|
|
|
//IL_016b: Expected I, but got I8
|
|
|
|
|
//IL_0174: Expected I, but got I8
|
|
|
|
|
//IL_017c: Expected I8, but got I
|
2021-11-24 00:38:28 -06:00
|
|
|
CComPtrNtv<IEndpointHostManager> cComPtrNtv_003CIEndpointHostManager_003E = new();
|
|
|
|
|
CComPtrNtv<IEndpointManager> cComPtrNtv_003CIEndpointManager_003E = new();
|
|
|
|
|
CComPtrNtv<IFirmwareUpdateNotification> cComPtrNtv_003CIFirmwareUpdateNotification_003E = new();
|
2021-11-11 11:18:46 -06:00
|
|
|
EEndpointClass eEndpointClass;
|
|
|
|
|
try
|
|
|
|
|
{
|
2021-11-24 00:38:28 -06:00
|
|
|
*(long*)(cComPtrNtv_003CIEndpointManager_003E.p) = 0L;
|
2021-11-11 11:18:46 -06:00
|
|
|
try
|
|
|
|
|
{
|
2021-11-24 00:38:28 -06:00
|
|
|
*(long*)(cComPtrNtv_003CIFirmwareUpdateNotification_003E.p) = 0L;
|
2021-11-11 11:18:46 -06:00
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
eEndpointClass = EEndpointClass.eEndpointClassInvalid;
|
2021-11-22 00:09:47 -06:00
|
|
|
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u)
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.WPP_SF_(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 29, (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids));
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
if (ppNotification == null)
|
|
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module._ZuneShipAssert(1001u, 1289u);
|
2021-11-11 11:18:46 -06:00
|
|
|
goto IL_0072;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
2021-11-30 01:00:46 -06:00
|
|
|
cComPtrNtv_003CIFirmwareUpdateNotification_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
goto end_IL_000a;
|
|
|
|
|
IL_0072:
|
2021-11-24 00:38:28 -06:00
|
|
|
cComPtrNtv_003CIFirmwareUpdateNotification_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
goto IL_0089;
|
|
|
|
|
end_IL_000a:;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
2021-11-30 01:00:46 -06:00
|
|
|
cComPtrNtv_003CIEndpointManager_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
goto end_IL_0005;
|
|
|
|
|
IL_0089:
|
2021-11-24 00:38:28 -06:00
|
|
|
cComPtrNtv_003CIEndpointManager_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
goto IL_00a0;
|
|
|
|
|
end_IL_0005:;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
2021-11-30 01:00:46 -06:00
|
|
|
cComPtrNtv_003CIEndpointHostManager_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
throw;
|
|
|
|
|
}
|
2021-11-23 01:09:52 -06:00
|
|
|
CComPtrMgd<IEndpointHost> spEndpointHost;
|
2021-11-11 11:18:46 -06:00
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
spEndpointHost = m_spEndpointHost;
|
|
|
|
|
if (spEndpointHost.p == null)
|
|
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module._ZuneShipAssert(1002u, 1290u);
|
2021-11-11 11:18:46 -06:00
|
|
|
goto IL_00de;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
2021-11-30 01:00:46 -06:00
|
|
|
cComPtrNtv_003CIFirmwareUpdateNotification_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
goto end_IL_00ae;
|
|
|
|
|
IL_00de:
|
2021-11-24 00:38:28 -06:00
|
|
|
cComPtrNtv_003CIFirmwareUpdateNotification_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
goto IL_00f5;
|
|
|
|
|
end_IL_00ae:;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
2021-11-30 01:00:46 -06:00
|
|
|
cComPtrNtv_003CIEndpointManager_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
goto end_IL_00ae_2;
|
|
|
|
|
IL_00f5:
|
2021-11-24 00:38:28 -06:00
|
|
|
cComPtrNtv_003CIEndpointManager_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
goto IL_010c;
|
|
|
|
|
end_IL_00ae_2:;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
2021-11-30 01:00:46 -06:00
|
|
|
cComPtrNtv_003CIEndpointHostManager_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
int num;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
num = Module.GetEnumProperty_003Cstruct_0020IEndpointHost_002Cenum_0020EEndpointHostProperty_002Cenum_0020EEndpointClass_003E(spEndpointHost.p, EEndpointHostProperty.eEndpointHostPropertyClassId, &eEndpointClass);
|
2021-11-11 11:18:46 -06:00
|
|
|
if (num >= 0)
|
|
|
|
|
{
|
2021-11-24 00:38:28 -06:00
|
|
|
num = Module.GetSingleton(Module.GUID_IEndpointHostManager, (void**)(cComPtrNtv_003CIEndpointHostManager_003E.p));
|
2021-11-11 11:18:46 -06:00
|
|
|
if (num >= 0)
|
|
|
|
|
{
|
2021-11-24 00:38:28 -06:00
|
|
|
long num2 = *(long*)(cComPtrNtv_003CIEndpointHostManager_003E.p);
|
|
|
|
|
num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, IEndpointManager**, int>)(*(ulong*)(*(long*)(*(ulong*)(cComPtrNtv_003CIEndpointHostManager_003E.p)) + 88)))((nint)num2, (IEndpointManager**)(cComPtrNtv_003CIEndpointManager_003E.p));
|
2021-11-11 11:18:46 -06:00
|
|
|
if (num >= 0)
|
|
|
|
|
{
|
2021-11-24 00:38:28 -06:00
|
|
|
long num3 = *(long*)(cComPtrNtv_003CIEndpointManager_003E.p);
|
2021-11-11 11:18:46 -06:00
|
|
|
EEndpointClass num4 = eEndpointClass;
|
2021-11-24 00:38:28 -06:00
|
|
|
num = ((delegate* unmanaged[Cdecl, Cdecl]<IntPtr, EEndpointClass, IFirmwareUpdateNotification**, int>)(*(ulong*)(*(long*)(*(ulong*)(cComPtrNtv_003CIEndpointManager_003E.p)) + 88)))((nint)num3, num4, (IFirmwareUpdateNotification**)(cComPtrNtv_003CIFirmwareUpdateNotification_003E.p));
|
2021-11-11 11:18:46 -06:00
|
|
|
if (num >= 0)
|
|
|
|
|
{
|
2021-11-24 00:38:28 -06:00
|
|
|
IFirmwareUpdateNotification* ptr = (IFirmwareUpdateNotification*)(*(ulong*)(cComPtrNtv_003CIFirmwareUpdateNotification_003E.p));
|
|
|
|
|
*(long*)(cComPtrNtv_003CIFirmwareUpdateNotification_003E.p) = 0L;
|
2021-11-11 11:18:46 -06:00
|
|
|
*(long*)ppNotification = (nint)ptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-11-22 00:09:47 -06:00
|
|
|
if (Module.WPP_GLOBAL_Control != Unsafe.AsPointer(ref Module.WPP_GLOBAL_Control) && ((uint)(*(int*)((ulong)(nint)Module.WPP_GLOBAL_Control + 60uL)) & 4u) != 0 && *(byte*)((ulong)(nint)Module.WPP_GLOBAL_Control + 57uL) >= 5u)
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
2021-11-18 12:01:22 -06:00
|
|
|
Module.WPP_SF_d(*(ulong*)((ulong)(nint)Module.WPP_GLOBAL_Control + 48uL), 30, (_GUID*)Unsafe.AsPointer(ref Module._003FA0x15529884_002EWPP_FirmwareUpdateAPI_cpp_Traceguids), num);
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
2021-11-30 01:00:46 -06:00
|
|
|
cComPtrNtv_003CIFirmwareUpdateNotification_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
throw;
|
|
|
|
|
}
|
2021-11-24 00:38:28 -06:00
|
|
|
cComPtrNtv_003CIFirmwareUpdateNotification_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
2021-11-30 01:00:46 -06:00
|
|
|
cComPtrNtv_003CIEndpointManager_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
throw;
|
|
|
|
|
}
|
2021-11-24 00:38:28 -06:00
|
|
|
cComPtrNtv_003CIEndpointManager_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//try-fault
|
2021-11-30 01:00:46 -06:00
|
|
|
cComPtrNtv_003CIEndpointHostManager_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
throw;
|
|
|
|
|
}
|
2021-11-24 00:38:28 -06:00
|
|
|
cComPtrNtv_003CIEndpointHostManager_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
return num;
|
|
|
|
|
IL_00a0:
|
2021-11-24 00:38:28 -06:00
|
|
|
cComPtrNtv_003CIEndpointHostManager_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
return -2147467261;
|
|
|
|
|
IL_010c:
|
2021-11-24 00:38:28 -06:00
|
|
|
cComPtrNtv_003CIEndpointHostManager_003E.Dispose();
|
2021-11-11 11:18:46 -06:00
|
|
|
return -2147418113;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal abstract int ContinueFirmwareProcess(FirmwareCompleteHandler onCompleteHandler);
|
|
|
|
|
|
|
|
|
|
internal abstract void ReleaseNativeObject();
|
|
|
|
|
|
|
|
|
|
internal abstract int InternalReset();
|
|
|
|
|
|
|
|
|
|
protected virtual void Dispose([MarshalAs(UnmanagedType.U1)] bool P_0)
|
|
|
|
|
{
|
|
|
|
|
if (P_0)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_007EFirmwareOperationBase();
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
((IDisposable)m_spFirmwareMediator).Dispose();
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
((IDisposable)m_spEndpointHost).Dispose();
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-22 01:51:40 -06:00
|
|
|
public void Dispose()
|
2021-11-11 11:18:46 -06:00
|
|
|
{
|
|
|
|
|
Dispose(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|