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 <[email protected]>
  • Loading branch information
GLMONTER and Tad Keller authored Aug 16, 2024
1 parent 6936a2a commit 79954d3
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 79954d3

Please sign in to comment.