TextSearch (Content plugin for fulltext search in DOC)
Moderators: Hacker, petermad, Stefan2, white
Sorry, it's a bug. 259 is STILL_ACTIVE, defined in WinBase.h and as you can guess it indicates that the program didn't quit yet.
Fixed:
http://www.ii.uj.edu.pl/~adamczym/crash.7z
crash.exe always crashes by writing at the 0 address. (And tries to return 0 if succeeded, just to make it clear that anything else than 0 is not what main() returned).
tst.exe reads that crash returned 0xC0000005, which is STATUS_ACCESS_VIOLATION. (ntstatus.h).
But you don't need to know what does the exact number mean. Just check for 0 / STILL_ACTIVE and if it's other value then either the application got a problem and returned some error code or it crashed.
Or (better) wait for the program quit and just check for 0 - some programmers might return 259 w/out knowing that it's wrong.
Fixed:
http://www.ii.uj.edu.pl/~adamczym/crash.7z
crash.exe always crashes by writing at the 0 address. (And tries to return 0 if succeeded, just to make it clear that anything else than 0 is not what main() returned).
tst.exe reads that crash returned 0xC0000005, which is STATUS_ACCESS_VIOLATION. (ntstatus.h).
But you don't need to know what does the exact number mean. Just check for 0 / STILL_ACTIVE and if it's other value then either the application got a problem and returned some error code or it crashed.
Or (better) wait for the program quit and just check for 0 - some programmers might return 259 w/out knowing that it's wrong.
Hmm...you're right, 0 is not the only valid exit code.
Can't find anything about converters, but:
WinMain reference
It gives no indication about valid return codes. Going deeper into WM_QUIT and PostQuitMessage doesn't help.
STATUS_ACCESS_VIOLATION is surely not the only possible value, it's easy to produce STATUS_INTEGER_DIVIDE_BY_ZERO.
I think that it's pretty safe to assume that Standard Error values defined in ntstatus.h are only results of crashes.
That's 0xC00000000 to 0xC000010EL for Windows 2003 API.
ADDED: http://msdn.microsoft.com/en-us/library/k9dcesdd.aspx
says that there's convention that 0 indicates success and everything else - failure. That's what I heard before, but it seems official.
What a mess, MS doesn't know what they want.
Can't find anything about converters, but:
WinMain reference
It gives no indication about valid return codes. Going deeper into WM_QUIT and PostQuitMessage doesn't help.
STATUS_ACCESS_VIOLATION is surely not the only possible value, it's easy to produce STATUS_INTEGER_DIVIDE_BY_ZERO.
I think that it's pretty safe to assume that Standard Error values defined in ntstatus.h are only results of crashes.
That's 0xC00000000 to 0xC000010EL for Windows 2003 API.
ADDED: http://msdn.microsoft.com/en-us/library/k9dcesdd.aspx
says that there's convention that 0 indicates success and everything else - failure. That's what I heard before, but it seems official.
What a mess, MS doesn't know what they want.

I use
Code: Select all
if not CreateProcess(nil, PChar(CmdLine), nil, nil, false, 0,
nil, PChar(CurrentDir), si, pi) then
Result:= exCannotRun
else
begin
if DoWait then WaitForSingleObject(pi.hProcess, INFINITE);
if GetExitCodeProcess(pi.hProcess, code) and
(code >= $C0000000) and (code <= $C000010E) then
Result:= exExcept
else
Result:= exOk;
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
end;
Seems fine, thank you.
BTW why CMD /c?
Direct CreateProcess should make the plugin faster.

Code: Select all
---------------------------
TextSearch plugin
---------------------------
Converter exception for "PDF".
Command: "C:\WINDOWS\system32\cmd.exe /C CONV\XDOC\XDOC2TXT.EXE "E:\Downloads\FF\BLO03024USEN.PDF">"C:\DOCUME~1\***\LOCALS~1\Temp\TextSrch.txt"".
---------------------------
OK
---------------------------
Direct CreateProcess should make the plugin faster.