Hello
I am trying to create a function inside a NPAPI plugin that will execute a command received as an argument using CreateProcess...
I managed somehow to convert from const char to LPCWSTR, the plugin loads in the browser but when I try to call the function in breaks and it displays Plugin cannot be loaded... ( javascript error )
Bellow is the code, the plugin is built using FireBreath
Code:
// Method run
FB::variant HarrisonRunCmdPluginAPI::runCommand(const char command)
{
STARTUPINFO startupInfo = {0};
startupInfo.cb = sizeof(startupInfo);
PROCESS_INFORMATION processInformation;
LPCWSTR cmd = (LPCWSTR)command;
// Try to start the process
BOOL result = ::CreateProcess(
cmd,
NULL,
NULL,
NULL,
FALSE,
NORMAL_PRIORITY_CLASS,
NULL,
NULL,
&startupInfo,
&processInformation
);
if(result == 0)
return("Could not create process");
else
return true;
}
if I hardcode an exe file like "c:\\windows\\notepad.exe" it works with no problem...
Can someone tell me what I am doing wrong...
Thank you