Skip to content

[QUESTION] Windows library functions names  #281

Open
@volga629-1

Description

@volga629-1

Hello Everyone,
I need help with library functions names.
I am trying basic script

import ctypes
import os

# Path to your .dll file (ensure this is the correct path)
dll_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'libzt.dll')
libzt = ctypes.cdll.LoadLibrary(dll_file)
nwid = "bla"
storage_path = os.getcwd()
# Authorization required via my.zerotier.com if this is a private network).
print('Joining virtual network...')
node = libzt.ZeroTierNode()
node.init_from_storage(storage_path)

node.node_start()

while not node.node_is_online():
  time.sleep(1)

print("Node ID:", node.node_id())

node.net_join(nwid)

while not node.net_transport_is_ready(nwid):
  time.sleep(1)

print("IP address: ", node.addr_get_ipv4(nwid))

Script output error

PS C:\Users\rdpmaster\Desktop\app> python3.12 .\test2.py
Joining virtual network...
Traceback (most recent call last):
  File "C:\Users\rdpmaster\Desktop\app\test2.py", line 16, in <module>
    node = libzt.ZeroTierNode()
           ^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1776.0_x64__qbz5n2kfra8p0\Lib\ctypes\__init__.py", line 392, in __getattr__
    func = self.__getitem__(name)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1776.0_x64__qbz5n2kfra8p0\Lib\ctypes\__init__.py", line 397, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: function 'ZeroTierNode' not found

Folders

PS C:\Users\rdpmaster\Desktop\app> dir

    Directory: C:\Users\rdpmaster\Desktop\app

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           9/23/2024  5:13 PM        1094656 libzt.dll
-a---           9/23/2024  5:13 PM        7774436 libzt.lib
-a---           9/23/2024  1:23 PM            383 test.py
-a---           9/23/2024  6:33 PM            795 test2.py

PS C:\Users\rdpmaster\Desktop\app>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions