Illegal memory access from GetAlias()

May 20, 2008
12,049
128
Syracuse, NY, USA
I have a SHELLEX plugin with these lines.

Code:
                    //tty_yield(0);
                    pAlias = GetAlias(argv[i]);
                    Printf(L"OK\r\n");
                    sei.lpFile = (pAlias == nullptr) ? argv[i] : pAlias;

I get this (never seeing the "OK").

Code:
v:\> shellex favs:
TCC: (Sys) Invalid access to memory location.
 "SHELLEX"

v:\>

If I uncomment the tty-yield() line, it works as desired; i.e., GetAlias() resolves "favs:" and (later) ShellExecuteEx() opens it. A Printf() will work as well as tty_yield().

What's happening?
 
May 20, 2008
12,049
128
Syracuse, NY, USA
Funny ... SwitchToThread() also cures it, but SwitchToThead() returns FALSE, meaning no other thread was waiting. Sleep(0) works also.