Hello, I am just an amateur python programmer. I have been modifying the example python code found here https://www.voidtools.com/support/every ... dk/python/ to just display the Filename of the results but have been running into errors.
I only want to see the filename so I changed this code block like so:
#show results
for i in range(num_results):
filename = everything_dll.Everything_GetResultFileNameW(i)
print(ctypes.wstring_at(filename))
From what I understand from the sdk documentation, GetResultFileNameW returns a c_wchar_p? However from other error messages, I think what it actually returns is an int. I think this is the problem but I'm not sure how to fix it.
Last edited by void on Tue Jun 15, 2021 12:44 pm, edited 2 times in total.
Reason:added everything_dll.Everything_GetResultFileNameW.restype = ctypes.c_wchar_p
PS C:\Users\Vincent Lau\Documents\Valve Search> python voids-code.py
Result Count: 33
Traceback (most recent call last):
File "C:\Users\Vincent Lau\Documents\Valve Search\voids-code.py", line 69, in <module>
print("Filename: {}\nDate Modified: {}\nSize: {} bytes\n".format(ctypes.wstring_at(basename),get_time(date_modified_filetime),file_size.value))
File "C:\Users\Vincent Lau\AppData\Local\Programs\Python\Python39\lib\ctypes\__init__.py", line 529, in wstring_at
return _wstring_at(ptr, size)
OSError: exception: access violation reading 0xFFFFFFFF9463BD40
PS C:\Users\Vincent Lau\Documents\Valve Search>
I'm running python 3.9.5, but I tried uninstalling and running it on python 3.7.9. I also thought that maybe Everything64.dll being in the root of my C drive might be the problem so tried moving it to my user folder instead. Both of those still resulted in the same OSError. Any other thoughts as to what it could be?
thanks for your response. What does this line do? Is it like staticly typing the output of GetResultFileNameW?
everything_dll.Everything_GetResultFileNameW.argtypes = [ctypes.c_int]
This line declares the parameters to Everything_GetResultFileNameW, which takes a DWORD to specify the result index.