I am trying to start notepad.exe from within a FireBreath-Plugin, but when I call the appropriate API-Function (this time "echo" for testing only) it crashes with "Error calling method on NPObject!" in FireFox.
Here is my code:
FB::variant redtestAPI::echo(const FB::variant& msg)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line)
L"notepad.exe", // Filename
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi ) // Pointer to PROCESS_INFORMATION structure
) {
return "error";
}
return "foo";
}
What am I doing wrong? I found some security solutions for Flash concerning this error message (--> System.security.allowDomain), but none for FireBreath. What am I doing wrong?
Thanks in advance
heinob
FireBreath itself does nothing to help or prevent CreateProcess from running; does it actually crash or does it just throw a javascript exception? If the plugin actually crashes then your call is crashing, otherwise it's likely an uncaught exception.
There is nothing FireBreath specific going on here that you need to know about; just attach a debugger, set a breakpoint, and step through to see what is happening.