Skip to content

Instantly share code, notes, and snippets.

@ndraiman
Forked from Ouroboros/cursor.md
Created March 7, 2025 22:04
Show Gist options
  • Save ndraiman/65cb3de5b51caa2aebed453362d37f6f to your computer and use it in GitHub Desktop.
Save ndraiman/65cb3de5b51caa2aebed453362d37f6f 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

@ndraiman
Copy link
Author

ndraiman commented Mar 7, 2025

Instructions to patch file:

  1. Install Microsoft "Hex Editor" extension - https://marketplace.cursorapi.com/items?itemName=ms-vscode.hexeditor
  2. Open debugAdapters\vsdbg\bin\vsdbg.dll
    1. Create a backup before modifying the file.
  3. Find 488D159E4B0600 in binary format
    1. Ctrl + F
    2. Toggle "Search in Binary Mode"
    3. Example:
      image
  4. find 74 15 a bit below it:
    image
  5. Enable Hex Editor Edit Mode
    1. Ctrl + Shift + P
    2. Search Hex Edit
    3. Choose "Hex Editor: Switch Edit Mode"
      image
  6. Mark the 15 box and change to it 00:
    image
  7. Save changes.

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