MiUnloadHotPatch
INT64 __fastcall MiUnloadHotPatch(INT64 a1, INT64 a2){
unsigned int v2;
unsigned int v3;
__int64 *v4;
_ETHREAD *Lock;
int v6;
__int64 *v7;
int v8;
int v9;
int v10;
INT64 v12[3];
unsigned int v13;
unsigned int v14;
v2 = a2;
v3 = a1;
memset((INT64)v12, 0i64);
v4 = 0i64;
Lock = MmAcquireLoadLock();
v6 = 0;
MiDeleteHotPatchRecord(&MiGlobalHotPatchList, 0i64, v3, v2);
if( (MiFlags & 0x8000) != 0 )
{
v7 = (__int64 *)MiSecureImageActivePatches;
v13 = v3;
v14 = v2;
if( MiSecureImageActivePatches )
{
do
{
v8 = MiCompareHotPatchNodes((INT64)v12, (INT64)v7);
if( v8 >= 0 )
{
if( v8 <= 0 )
break;
v7 = (__int64 *)v7[1];
}
else
{
v7 = (__int64 *)*v7;
}
}
while( v7 );
if( v7 )
{
v9 = VslRevertHotPatch(0i64, v3, v2);
MiLogHotPatchOperationStatus(v3, v2, 0i64, v9, 2);
if( v9 < 0 )
{
v6 = v9;
}
else
{
RtlAvlRemoveNode((unsigned __int64 *)&MiSecureImageActivePatches, v7);
v4 = v7;
}
}
}
v10 = MiApplyHotPatchToDriver(v3, v2, 0i64, 0i64);
if( (int)(v10 + 0x80000000) >= 0 && v10 != -1073741515 && v6 >= 0 )
v6 = v10;
}
MmReleaseLoadLock(Lock);
MiHotPatchAllProcesses(v3, v2);
if( v4 )
ExFreePoolWithTag(v4, 0);
return(unsigned int)v6;
}Referenced by:
NtManageHotPatch