Skip to content

Instantly share code, notes, and snippets.

@Ouroboros
Last active May 22, 2025 17:31
Show Gist options
  • Save Ouroboros/1a1e0b9c8bcbac2a519516aa5a12a52b to your computer and use it in GitHub Desktop.
Save Ouroboros/1a1e0b9c8bcbac2a519516aa5a12a52b to your computer and use it in GitHub Desktop.
Make Cursor Work with cppvsdbg

1. Modify cpptools/package.json

Remove this condition "when": "workspacePlatform == windows"

%USERPROFILE%\.cursor\extensions\ms-vscode.cpptools-1.23.5-win32-x64\package.json

    "type": "cppvsdbg",
    "label": "C++ (Windows)",
    "when1": "workspacePlatform == windows",

2. Bypass the signature verification of vsdbg.dll

Keyword signature

%USERPROFILE%\.cursor\extensions\ms-vscode.cpptools-1.23.5-win32-x64\debugAdapters\vsdbg\bin\vsdbg.dll

  body = sub_18008D374(Delimiter, "body");
  *(_OWORD *)signature = 0i64;
  si128 = _mm_load_si128((const __m128i *)&xmmword_1800D7CF0);
  LOBYTE(signature[0]) = 0;
  sub_18003A624(body, "signature", signature);
  v7 = signature;
  if ( si128.m128i_i64[1] > 0xFui64 )
    v7 = (void **)signature[0];
  if ( sub_1800B08EC(v6, v7) )      // <----- check signature, force String + 0x154 = 4
  {
    if ( *((_DWORD *)String + 0x154) != 4 )
      *((_DWORD *)String + 0x154) = 4;
  }
  else
  {
    *((_DWORD *)String + 0x154) = 5;
  }
.text:000000018006C09F 48 8D 15 9E 4B 06 00                    lea     rdx, aBody      ; "body"
.text:000000018006C0A6 48 8B CF                                mov     rcx, rdi
.text:000000018006C0A9 E8 C6 12 02 00                          call    sub_18008D374
.text:000000018006C0AE 0F 57 C0                                xorps   xmm0, xmm0
.text:000000018006C0B1 0F 11 44 24 20                          movups  xmmword ptr [rsp+58h+signature], xmm0
.text:000000018006C0B6 66 0F 6F 0D 32 BC 06 00                 movdqa  xmm1, cs:xmmword_1800D7CF0
.text:000000018006C0BE F3 0F 7F 4C 24 30                       movdqu  [rsp+58h+var_28], xmm1
.text:000000018006C0C4 C6 44 24 20 00                          mov     byte ptr [rsp+58h+signature], 0
.text:000000018006C0C9 4C 8D 44 24 20                          lea     r8, [rsp+58h+signature]
.text:000000018006C0CE 48 8D 15 43 57 06 00                    lea     rdx, aSignature_0 ; "signature"
.text:000000018006C0D5 48 8B C8                                mov     rcx, rax
.text:000000018006C0D8 E8 47 E5 FC FF                          call    sub_18003A624
.text:000000018006C0DD 48 8D 54 24 20                          lea     rdx, [rsp+58h+signature]
.text:000000018006C0E2 48 83 7C 24 38 0F                       cmp     qword ptr [rsp+58h+var_28+8], 0Fh
.text:000000018006C0E8 48 0F 47 54 24 20                       cmova   rdx, [rsp+58h+signature] ; pMessage
.text:000000018006C0EE E8 F9 47 04 00                          call    VerifySignature
.text:000000018006C0F3 84 C0                                   test    al, al
.text:000000018006C0F5 74 15                                   jz      short loc_18006C10C ; <-------- patch here
.text:000000018006C0F7 83 BB 50 05 00 00 04                    cmp     dword ptr [rbx+550h], 4
.text:000000018006C0FE 74 16                                   jz      short loc_18006C116
.text:000000018006C100 C7 83 50 05 00 00 04 00+                mov     dword ptr [rbx+550h], 4

Now, simply use a hex editor to modify 74 15 to 74 00 at 18006C0F5

@smthan
Copy link

smthan commented Apr 26, 2025

Good! It works on Trae also.

@ionabio
Copy link

ionabio commented May 14, 2025

@Ouroboros I have reverse engineered upto here on arm64 : Could you guide me how should I modify the instructions (it looks different than x64 on asm side)? AI helped me with the patch, thanks to your guide. I updated below

  uVar4 = FUN_18003f0f0(puVar6,"signature",&local_60);
  pppppppcVar1 = (char *******)local_60;
  if (local_48 < 0x10) {
    pppppppcVar1 = &local_60;
  }
  bVar2 = FUN_1800bed80((ulonglong)uVar4,(char *)pppppppcVar1);
  if (bVar2) { 
    if (*(int *)(param_1 + 0x550) == 4) goto LAB_180076584;
    uVar7 = 4;
  }
  else {
    uVar7 = 5;
  }
                             LAB_180076544                                   XREF[1]:     180103908 (*)  
       180076544 eb 22 ff 97     bl         FUN_18003f0f0                                   
       180076548 c8 16 40 f9     ldr        x8,[x22, #local_48 ]
       18007654c c9 42 00 91     add        x9,x22,#0x10
       180076550 1f 3d 00 f1     cmp        x8,#0xf
       180076554 c8 0a 40 f9     ldr        x8,[x22, #local_60[0] ]
       180076558 01 81 89 9a     csel       param_2 ,x8,x9,hi
       18007655c 09 22 01 94     bl         FUN_1800bed80                                  
       180076560 08 1c 00 53     uxtb       w8,param_1
       180076564 c8 00 00 34     cbz        w8,LAB_18007657c      ;<----- Change c8 to 28, 
       180076568 88 52 45 b9     ldr        w8,[x20, #0x550 ]
       18007656c 1f 11 00 71     cmp        w8,#0x4
       180076570 a0 00 00 54     b.eq       LAB_180076584
       180076574 88 00 80 52     mov        w8,#0x4
       180076578 02 00 00 14     b          LAB_180076580
                             LAB_18007657c                                   XREF[1]:     180076564 (j)  
       18007657c a8 00 80 52     mov        w8,#0x5
                             LAB_180076580                                   XREF[1]:     180076578 (j)  
       180076580 88 52 05 b9     str        w8,[x20, #0x550 ]

in your hex editor of choice search for 53c8000034 and replace c8 with 28
don't forget the package.json change.

I hope Cursor comes up with an official solution ASAP. I don't feel ok having to do this. although it is for just playing around with my home projects. VSCode is nowhere as good and extensive as cursor and cursor is not good at all at their tooling and debuging support in windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment