Skip to content

examples/shellcode_run.py: skip the Windows stages when system DLLs are absent - #1630

Open
retrocpugeek wants to merge 1 commit into
qilingframework:devfrom
retrocpugeek:fix/examples
Open

examples/shellcode_run.py: skip the Windows stages when system DLLs are absent#1630
retrocpugeek wants to merge 1 commit into
qilingframework:devfrom
retrocpugeek:fix/examples

Conversation

@retrocpugeek

@retrocpugeek retrocpugeek commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Split as requested — this PR is now only the examples/shellcode_run.py change. The framework-side illegal-instruction handling moved to #1661.

shellcode_run.py runs a Windows x86 and x86-64 stage that need genuine Windows system DLLs. Those cannot be redistributed, so they are not shipped with Qiling and must be collected from a licensed Windows host with examples/scripts/dllscollector.bat.

Without them the example does not fail gracefully — it crashes on an unmapped read partway through. This probes for Windows/System32/ntdll.dll under each Windows rootfs and, when it is missing, prints a message pointing at the collector script instead of running that stage.

@xwings

xwings commented Jul 2, 2026

Copy link
Copy Markdown
Member

Hey,

Welcome to QIling Framework and thanks for the PR.

PR looks good to me. Lets wait for second approval

@retrocpugeek

retrocpugeek commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Hey,

Welcome to QIling Framework and thanks for the PR.

PR looks good to me. Lets wait for second approval

Hi, thanks for the welcome. Love the project.
I've been working towards getting mips64be support for a project I'm working on.
It's almost there - although it's dependent on a couple of issues/PRs in unicorn - I've created #1645 to track them.

@xwings

xwings commented Sep 5, 2026

Copy link
Copy Markdown
Member

Hi,

Welcome to QIling Framework.

Except the ql.stop(), it would be better if we split into two differnt PR for two differnt code.

The Windows shellcode stages need genuine Windows system DLLs, which are not
redistributable and so are not shipped with Qiling; they must be collected
from a licensed Windows host via examples/scripts/dllscollector.bat. Without
them the loader failed to map ntdll.dll and the example crashed with an
unhandled UC_ERR_READ_UNMAPPED traceback.

Probe for ntdll.dll under each Windows rootfs and skip those stages with a
message pointing at the collector script, so the example runs to completion
on a stock checkout.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@retrocpugeek retrocpugeek changed the title Fix examples/shellcode_run.py: handle illegal-instruction exceptions and missing Windows DLLs examples/shellcode_run.py: skip the Windows stages when system DLLs are absent Sep 6, 2026
@retrocpugeek

Copy link
Copy Markdown
Contributor Author

Ok, using this PR for the 'skip if windows DLLs absent' part

@xwings

xwings commented Sep 7, 2026

Copy link
Copy Markdown
Member

Hi,

This PR seems like makes no different. if the rootfs does not exits. it will not run anyway.

@retrocpugeek

Copy link
Copy Markdown
Contributor Author

I think we're talking about two different cases here

There's

A/ rootfs directory absent

user will get
QlErrorFileNotFound: Target rootfs not found: "..."
which is a clear error. No fix needed as I see it.

B/ rootfs directory present, but no Windows/System32/*.dll

user will get
UcError: Invalid memory read (UC_ERR_READ_UNMAPPED)
with no hint that DLLs are the problem. This is what the PR fixes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants