Python 3 and Everything_SetSearchW - when to W? - here's a list of them

Plug-in and third party software discussion.
Post Reply
SparkyZ
Posts: 6
Joined: Thu Sep 19, 2019 7:18 pm

Python 3 and Everything_SetSearchW - when to W? - here's a list of them

Post by SparkyZ »

This is a little embarrassing, but how do I know when I should use a call that ends in 'W' as Everything_SetSearchW does and when I should use a call without the capital 'W' like Everything_SetRequestFlags?

That's it, that's my whole question. The https://www.voidtools.com/support/everything/sdk/ page doesn't show any calls with a 'W' tacked on.

Here's why I'm asking this question:
I'm going to tie Everything search into a anti-ransomware pre-screening helper. I want people to be able to use a list of known ransomware filenames which include lots of '*' and '?' wildcards in them. Windows FSRM screening only catches the files when they are created or used, but it doesn't prescreen the file name filter list first.

Thanks in advance for any words of wisdom.
Last edited by SparkyZ on Fri Sep 20, 2019 4:40 pm, edited 2 times in total.
void
Developer
Posts: 16833
Joined: Fri Oct 16, 2009 11:31 pm

Re: Python 3 and Everything_SetSearchW - when to W

Post by void »

W for functions that use Unicode strings (or Wide char strings)
A for functions that use ANSI strings

Usually you don't need to specify the trailing W or A as there is a macro in the Everything.h which defines which version to use:

Code: Select all

#ifdef UNICODE
#define Everything_SetSearch Everything_SetSearchW
#else
#define Everything_SetSearch Everything_SetSearchA
#endif
However, if you are using dynamic linking from Python or other language then you will need to specify which version to call.
In most cases you will call the Unicode version, eg: Everything_SetSearchW

For functions that do not use strings, there is no trailing W or A.

https://stackoverflow.com/questions/7424383/what-is-the-difference-between-the-a-and-w-functions-in-the-win32-api
https://docs.microsoft.com/en-us/windows/win32/learnwin32/working-with-strings?redirectedfrom=MSDN
SparkyZ
Posts: 6
Joined: Thu Sep 19, 2019 7:18 pm

Re: Python 3 and Everything_SetSearchW - when to W

Post by SparkyZ »

Thanks! I'm all Unicode all the time because Python 3 is good about it and a lot of the my file names contain it. I'll let Everything.h be my guide.

SparkyZ
SparkyZ
Posts: 6
Joined: Thu Sep 19, 2019 7:18 pm

Re: Python 3 and Everything_SetSearchW - when to W - here's a list of them

Post by SparkyZ »

For anyone else who may be interested, here are all the 'W' defines from Everything.h dated 17Dec2016:

Everything_SetSearchW
Everything_GetSearchW
Everything_QueryW
Everything_Query2W
Everything_GetResultFileNameW
Everything_GetResultPathW
Everything_GetResultFullPathNameW
Everything_GetResultExtensionW
Everything_GetResultFileListFileNameW
Everything_GetResultHighlightedFileNameW
Everything_GetResultHighlightedPathW
Everything_GetResultHighlightedFullPathAndFileNameW
Everything_GetRunCountFromFileNameW
Everything_SetRunCountFromFileNameW
Everything_IncRunCountFromFileNameW

I used this regex to find them:
Everything_\S+W$
Post Reply