Skip to content
Shahm Najeeb edited this page Aug 10, 2025 · 7 revisions

Welcome to the PyCTools Wiki

PyCTools is a lightweight set of native DLLs and Python bindings for process inspection, memory analysis, and system metric collection on Windows.

This wiki serves as the official documentation hub. Whether you're a C developer building your own DLLs, a Python user leveraging the wrappers, or just curious how the system works under the hood — you're in the right place.

What You'll Find Here:

  • DLL Internals & Discovery How the processInspect and hRng DLLs are structured, built, and dynamically located.

  • Python Usage & Examples Step-by-step guides for using the wrapper classes, session handling, and metric querying.

  • C Code Explanations Detailed look into the native code powering the DLLs, from memory APIs to performance counters.

⚙ Whether you're downloading prebuilt binaries or compiling from source — this wiki will help you understand how it all fits together.


DLL Discovery and dist/ Directory

Important

Starting from v0.2.0-beta the script now purely checks dist/ inside the pyCTools directory!

In short ignore everything on the bottom

DLL Output Structure

Compiled DLLs are placed in the dist/ directory, organized by architecture:

dist/
  x64/
    hRng_x64.dll
    processInspect_x64.dll
    ...
  x86/
    hRng_x86.dll
    processInspect_x86.dll
    ...
  • x64/: DLLs for 64-bit Python and applications
  • x86/: DLLs for 32-bit Python and applications

How Python Finds the DLLs

Both hwrng and processInspect automatically search for the correct DLL based on your Python interpreter's architecture. The search order is:

  1. ./dist/{arch}/<dll_{arch}> (relative to the Python file)
  2. ../dist/{arch}/<dll_{arch}>
  3. ../../dist/{arch}/<dll_{arch}>

Where {arch} is x64 or x86.

If the DLL is not found, a FileNotFoundError is raised with a list of attempted locations.

Starting from v0.2.0-beta the function can handle custom directory search paths, or a direct DLL path

When Do You Need to Rebuild?

  • If you change any C source file, rerun the PowerShell build script to update the DLLs.
  • If you move the project, ensure the dist/ folder remains in a location discoverable by the Python wrappers.

Troubleshooting

  • If you get DLL not found errors, check that the correct DLLs exist in the expected dist/{arch} folders.
  • Ensure you are using the correct Python architecture (x64 or x86) for the DLLs present.

Clone this wiki locally