Skip to content

Instantly share code, notes, and snippets.

@hardening
Created August 18, 2022 09:29
Show Gist options
  • Save hardening/9012b387ce5836f7deb5755af35952b3 to your computer and use it in GitHub Desktop.
Save hardening/9012b387ce5836f7deb5755af35952b3 to your computer and use it in GitHub Desktop.
/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */
/* protected: long __cdecl RdpGfxProtocolClientDecoder::DecodeSolidFill(void) __ptr64 */
long __thiscall RdpGfxProtocolClientDecoder::DecodeSolidFill(RdpGfxProtocolClientDecoder *this)
{
ushort **ppuVar1;
ushort uVar2;
ushort *puVar3;
uint uVar4;
OffscreenSurface *this_00;
long lVar5;
undefined4 uVar6;
undefined4 uVar7;
_XResult32 _Var8;
int iVar9;
char *pcVar10;
byte bVar11;
ulonglong uVar12;
undefined8 uVar13;
uint uVar14;
ulonglong uVar15;
uint uVar16;
uint uVar17;
uint local_res8 [2];
uint local_res10;
uint local_res18;
uint local_res20;
ulonglong in_stack_ffffffffffffff48;
longlong *local_98;
uint local_90;
uint local_8c;
uint local_88;
uint local_84;
OffscreenSurface *local_80;
ushort *local_78;
uint local_68;
uint uStack100;
uint uStack96;
uint uStack92;
tagRECT local_58;
local_80 = (OffscreenSurface *)0x0;
ppuVar1 = (ushort **)(this + 0x48);
puVar3 = *ppuVar1;
uVar16 = 0x14;
bVar11 = 8;
uVar15 = 8;
lVar5 = GetVariableSizeFieldStructSize(8,0,8,local_res8);
uVar6 = (undefined4)(in_stack_ffffffffffffff48 >> 0x20);
if (lVar5 < 0) {
if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&
((WPP_GLOBAL_Control[0x1c] & bVar11) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x19])) {
uVar6 = RdpX_GetActivityIdPrefix();
WPP_SF_DSD(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xcf,
&WPP_7b454cd88cc93e58f743d62f10fdc4f1_Traceguids,uVar6,"GetSolidFillSize failed",
lVar5);
}
goto LAB_16a980d89;
}
uVar16 = *(uint *)(this + 0x94);
if (uVar16 < local_res8[0]) {
if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&
((WPP_GLOBAL_Control[0x1c] & bVar11) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x19])) {
uVar7 = RdpX_GetActivityIdPrefix();
uVar13 = 0xd0;
LAB_16a9808e9:
WPP_SF_Dl(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),uVar13,
&WPP_7b454cd88cc93e58f743d62f10fdc4f1_Traceguids,uVar7,CONCAT44(uVar6,0x8007000d));
}
LAB_16a98090b:
lVar5 = -0x7ff8fff3;
}
else if (((ulonglong)local_res8[0] - 1) + (longlong)puVar3 < *(ulonglong *)(this + 0x50)) {
uVar2 = puVar3[3];
local_84 = (uint)uVar2;
uVar12 = uVar15 & 0xffffffff;
lVar5 = GetVariableSizeFieldStructSize((uint)uVar12,(uint)uVar2,(uint)uVar15,local_res8);
if (-1 < lVar5) {
if (uVar16 < local_res8[0]) {
if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&
((WPP_GLOBAL_Control[0x1c] & (byte)uVar12) != 0)) &&
(1 < (byte)WPP_GLOBAL_Control[0x19])) {
uVar7 = RdpX_GetActivityIdPrefix();
uVar13 = 0xd3;
goto LAB_16a9808e9;
}
goto LAB_16a98090b;
}
_Var8 = RdpX_ULongPtr_Add((__uint64)puVar3,(ulonglong)local_res8[0],(__uint64 *)ppuVar1);
lVar5 = MapXResultToHR(_Var8);
if (lVar5 < 0) {
if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&
((WPP_GLOBAL_Control[0x1c] & 8) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x19])) {
uVar6 = RdpX_GetActivityIdPrefix();
uVar13 = 0xd4;
pcVar10 = "Integer overflow";
goto LAB_16a9809dd;
}
goto LAB_16a980910;
}
if (*(ushort **)(this + 0x50) <= *ppuVar1 && *ppuVar1 != *(ushort **)(this + 0x50)) {
if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&
((WPP_GLOBAL_Control[0x1c] & 8) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x19])) {
uVar7 = RdpX_GetActivityIdPrefix();
WPP_SF_Dl(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xd5,
&WPP_7b454cd88cc93e58f743d62f10fdc4f1_Traceguids,uVar7,
CONCAT44(uVar6,0x8007006f));
}
goto LAB_16a980979;
}
if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&
((*(uint *)(WPP_GLOBAL_Control + 0x1c) & 0x100) != 0)) &&
(4 < (byte)WPP_GLOBAL_Control[0x19])) {
RdpX_GetActivityIdPrefix();
WPP_SF_DhDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x10));
}
local_98 = (longlong *)0x0;
local_res8[0] = 0x15;
iVar9 = GetOffscreenSurface(this,*puVar3,&local_80);
this_00 = local_80;
if (iVar9 == 0) {
if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&
((WPP_GLOBAL_Control[0x1c] & 8) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x19])) {
uVar7 = RdpX_GetActivityIdPrefix();
WPP_SF_Dl(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xd7,
&WPP_7b454cd88cc93e58f743d62f10fdc4f1_Traceguids,uVar7,
CONCAT44(uVar6,0x80070490));
}
lVar5 = -0x7ff8fb70;
LAB_16a980bc9:
RdpXSPtr<struct_RdpXInterfaceStreamEvents>::SafeRelease
((RdpXSPtr<struct_RdpXInterfaceStreamEvents> *)&local_98);
}
else {
if (*(int *)(local_80 + 0x70) != 0) {
PAL_System_CritSecEnter(*(undefined8 *)(local_80 + 0x68));
}
*(int *)(this_00 + 0x78) = *(int *)(this_00 + 0x78) + 1;
lVar5 = OffscreenSurface::GetTexture(this_00,(RdpXInterfaceTexture2D **)&local_98);
if (lVar5 < 0) {
if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&
((WPP_GLOBAL_Control[0x1c] & 8) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x19])) {
uVar6 = RdpX_GetActivityIdPrefix();
uVar13 = 0xd8;
pcVar10 = "GetTexture() failed";
LAB_16a980c27:
WPP_SF_DSD(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),uVar13,
&WPP_7b454cd88cc93e58f743d62f10fdc4f1_Traceguids,uVar6,pcVar10,lVar5);
}
goto LAB_16a980bc9;
}
iVar9 = (**(code **)(*local_98 + 0x50))();
local_res10 = *(uint *)(puVar3 + 1);
if (iVar9 == 2) {
local_res10 = local_res10 | 0xff000000;
}
local_res18 = 0;
if (uVar2 != 0) {
local_78 = puVar3 + 5;
do {
local_88 = (uint)local_78[2];
local_res20 = (uint)*local_78;
uVar17 = local_88 - local_res20;
local_8c = (uint)local_78[1];
local_90 = (uint)local_78[-1];
uVar14 = local_8c - local_90;
(**(code **)(**(longlong **)(this + 0x3a0) + 0x20))();
uVar4 = local_90;
uVar16 = local_res20;
*(double *)(this + 0x598) =
(double)(ulonglong)(uVar14 * uVar17) + *(double *)(this + 0x598);
lVar5 = OffscreenSurface::Fill(this_00,local_90,local_res20,uVar14,uVar17,local_res10);
if (lVar5 < 0) {
if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||
((WPP_GLOBAL_Control[0x1c] & 8) == 0)) || ((byte)WPP_GLOBAL_Control[0x19] < 2))
goto LAB_16a980bc9;
uVar6 = RdpX_GetActivityIdPrefix();
uVar13 = 0xd9;
pcVar10 = "Fill failed!";
goto LAB_16a980c27;
}
uStack96 = local_8c;
uStack92 = local_88;
local_68 = uVar4;
uStack100 = uVar16;
local_58.left = uVar4;
local_58.top = uVar16;
local_58.right = local_8c;
local_58.bottom = local_88;
OffscreenSurface::OnSolidFill(this_00,&local_58);
local_res18 = local_res18 + 1;
local_78 = local_78 + 4;
} while (local_res18 < local_84);
}
RdpXSPtr<struct_RdpXInterfaceStreamEvents>::SafeRelease
((RdpXSPtr<struct_RdpXInterfaceStreamEvents> *)&local_98);
lVar5 = 0;
*(int *)(this + 0xe0) = *(int *)(this + 0xe0) + (*(int *)(this + 0x48) - (int)puVar3);
}
uVar16 = local_res8[0];
if ((this_00 != (OffscreenSurface *)0x0) &&
(iVar9 = OffscreenSurface::IsLocked(this_00), uVar16 = local_res8[0], iVar9 != 0)) {
OffscreenSurface::Unlock(this_00 + 0x38);
uVar16 = local_res8[0];
}
goto LAB_16a980d89;
}
if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&
((WPP_GLOBAL_Control[0x1c] & (byte)uVar12) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x19])) {
uVar6 = RdpX_GetActivityIdPrefix();
uVar13 = 0xd2;
pcVar10 = "GetSolidFillStructSize failed";
LAB_16a9809dd:
WPP_SF_DSD(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),uVar13,
&WPP_7b454cd88cc93e58f743d62f10fdc4f1_Traceguids,uVar6,pcVar10,lVar5);
}
}
else {
if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&
((*(uint *)(WPP_GLOBAL_Control + 0x1c) & 0x100) != 0)) &&
(1 < (byte)WPP_GLOBAL_Control[0x19])) {
uVar16 = ((int)puVar3 - *(int *)(this + 0x50)) + local_res8[0];
uVar6 = RdpX_GetActivityIdPrefix();
WPP_SF_Dl(*(undefined8 *)(WPP_GLOBAL_Control + 0x10),0xd1,
&WPP_7b454cd88cc93e58f743d62f10fdc4f1_Traceguids,uVar6,
in_stack_ffffffffffffff48 & 0xffffffff00000000 | (ulonglong)uVar16);
}
LAB_16a980979:
lVar5 = -0x7ff8ff91;
}
LAB_16a980910:
uVar16 = 0x14;
LAB_16a980d89:
if (lVar5 < 0) {
LogError(this,uVar16,lVar5);
}
TCntPtr<class_CBBar>::SafeRelease((TCntPtr<class_CBBar> *)&local_80);
return lVar5;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment