Skip to content

Commit

Permalink
use new module macros in docs (VirusTotal#2100)
Browse files Browse the repository at this point in the history
Co-authored-by: Tad Keller <logisch@pm.me>
  • Loading branch information
2 people authored and DavidTurland committed Sep 9, 2024
1 parent 5512c84 commit 7db693f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/writingmodules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -974,26 +974,26 @@ to the module's variables, or additional data stored in the ``data`` field of
``YR_OBJECT`` structures as discussed earlier in
:ref:`storing-data-for-later-use`. But for that we need a way to get access to
the corresponding ``YR_OBJECT`` first. There are two functions to do that:
``module()`` and ``parent()``. The ``module()`` function returns a pointer to
``yr_module()`` and ``yr_parent()``. The ``yr_module()`` function returns a pointer to
the top-level ``YR_OBJECT`` corresponding to the module, the same one passed
to the ``module_load`` function. The ``parent()`` function returns a pointer to
to the ``module_load`` function. The ``yr_parent()`` function returns a pointer to
the ``YR_OBJECT`` corresponding to the structure where the function is
contained. For example, consider the following code snippet:

.. code-block:: c
define_function(f1)
{
YR_OBJECT* module = module();
YR_OBJECT* parent = parent();
YR_OBJECT* module = yr_module();
YR_OBJECT* parent = yr_parent();
// parent == module;
}
define_function(f2)
{
YR_OBJECT* module = module();
YR_OBJECT* parent = parent();
YR_OBJECT* module = yr_module();
YR_OBJECT* parent = yr_parent();
// parent != module;
}
Expand Down Expand Up @@ -1026,4 +1026,4 @@ you get a pointer to the ``YR_SCAN_CONTEXT`` structure:

.. code-block:: c
YR_SCAN_CONTEXT* context = scan_context();
YR_SCAN_CONTEXT* context = yr_scan_context();

0 comments on commit 7db693f

Please sign in to comment.