@@ -126,7 +126,7 @@ void Action::SetCommandPath(const std::wstring& szPath )
126
126
* \param isPrivileged if we need administrator privilege to run this.
127
127
* \return BOOL true.
128
128
*/
129
- ActiveAction* Action::CreateActiveAction (CWnd* pWnd, const std::wstring& szCommandLine, const bool isPrivileged) const
129
+ ActiveAction* Action::CreateActiveAction (IVirtualMachines& virtualMachines, CWnd* pWnd, const std::wstring& szCommandLine, const bool isPrivileged) const
130
130
{
131
131
// not sure how to do that...
132
132
if ( Len () == 0 )
@@ -144,12 +144,12 @@ ActiveAction* Action::CreateActiveAction(CWnd* pWnd, const std::wstring& szComma
144
144
ActiveAction* aa;
145
145
if ( szCommandLine.length () == 0 )
146
146
{
147
- aa = CreateActiveActionWithNoCommandLine ( pWnd, isPrivileged);
147
+ aa = CreateActiveActionWithNoCommandLine ( virtualMachines, pWnd, isPrivileged);
148
148
}
149
149
else
150
150
{
151
151
// so now, at last we can call the command line
152
- aa = CreateActiveActionDirect ( pWnd, szCommandLine.c_str (), isPrivileged);
152
+ aa = CreateActiveActionDirect ( virtualMachines, pWnd, szCommandLine.c_str (), isPrivileged);
153
153
}
154
154
155
155
// now that we are back from calling the plugin, restore the keyboard state.
@@ -164,7 +164,7 @@ ActiveAction* Action::CreateActiveAction(CWnd* pWnd, const std::wstring& szComma
164
164
* \param isPrivileged if this action is privileged or not.
165
165
* \return bool success or not.
166
166
*/
167
- ActiveAction* Action::CreateActiveActionWithNoCommandLine (CWnd* pWnd, const bool isPrivileged ) const
167
+ ActiveAction* Action::CreateActiveActionWithNoCommandLine (IVirtualMachines& virtualMachines, CWnd* pWnd, const bool isPrivileged ) const
168
168
{
169
169
// the command line we will try and make.
170
170
std::wstring szCommandLine = L" " ;
@@ -209,7 +209,7 @@ ActiveAction* Action::CreateActiveActionWithNoCommandLine(CWnd* pWnd, const bool
209
209
}
210
210
211
211
// we can now do it direct.
212
- return CreateActiveActionDirect ( pWnd, szCommandLine, isPrivileged);
212
+ return CreateActiveActionDirect ( virtualMachines, pWnd, szCommandLine, isPrivileged);
213
213
}
214
214
215
215
/* *
@@ -367,7 +367,7 @@ bool Action::Execute(const std::vector<std::wstring>& argv, const bool isPrivile
367
367
* \param isPrivileged if we need administrator privilege to run this.
368
368
* \return TRUE|FALSE success or not.
369
369
*/
370
- ActiveAction* Action::CreateActiveActionDirect (CWnd* pWnd, const std::wstring& szCommandLine, const bool isPrivileged) const
370
+ ActiveAction* Action::CreateActiveActionDirect (IVirtualMachines& virtualMachines, CWnd* pWnd, const std::wstring& szCommandLine, const bool isPrivileged) const
371
371
{
372
372
// sanity check
373
373
if (0 == _szFile.length ())
@@ -383,7 +383,7 @@ ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& s
383
383
//
384
384
if (LuaVirtualMachine::IsExt (_szFile ))
385
385
{
386
- auto ala = new ActiveLuaAction (*this , hTopHWnd, szCommandLine, isPrivileged);
386
+ auto ala = new ActiveLuaAction (*this , virtualMachines, hTopHWnd, szCommandLine, isPrivileged);
387
387
if (ala->Initialize ())
388
388
{
389
389
return ala;
@@ -399,7 +399,7 @@ ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& s
399
399
//
400
400
if (PythonVirtualMachine::IsExt (_szFile))
401
401
{
402
- auto apa = new ActivePythonAction (*this , hTopHWnd, szCommandLine, isPrivileged);
402
+ auto apa = new ActivePythonAction (*this , virtualMachines, hTopHWnd, szCommandLine, isPrivileged);
403
403
if (apa->Initialize () )
404
404
{
405
405
return apa;
@@ -415,13 +415,13 @@ ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& s
415
415
//
416
416
if (PowershellVirtualMachine::IsExt (_szFile))
417
417
{
418
- auto apa = new ActivePowershellAction (*this , hTopHWnd, szCommandLine, isPrivileged);
418
+ auto apa = new ActivePowershellAction (*this , virtualMachines, hTopHWnd, szCommandLine, isPrivileged);
419
419
if (apa->Initialize ())
420
420
{
421
421
return apa;
422
422
}
423
423
424
- // did not work, try the default way...
424
+ // did not work, try the default way...`
425
425
delete apa;
426
426
}
427
427
#endif // ACTIONMONITOR_PS_PLUGIN
@@ -431,7 +431,7 @@ ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& s
431
431
//
432
432
if (ShellVirtualMachine::IsExt (_szFile))
433
433
{
434
- auto asa = new ActiveShellAction (*this , hTopHWnd, szCommandLine, isPrivileged);
434
+ auto asa = new ActiveShellAction (*this , virtualMachines, hTopHWnd, szCommandLine, isPrivileged);
435
435
if (asa->Initialize ())
436
436
{
437
437
return asa;
@@ -447,7 +447,7 @@ ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& s
447
447
//
448
448
if (CsVirtualMachine::IsExt (_szFile))
449
449
{
450
- auto acsa = new ActiveCsAction (*this , hTopHWnd, szCommandLine, isPrivileged);
450
+ auto acsa = new ActiveCsAction (*this , virtualMachines, hTopHWnd, szCommandLine, isPrivileged);
451
451
if (acsa->Initialize ())
452
452
{
453
453
return acsa;
@@ -463,7 +463,7 @@ ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& s
463
463
//
464
464
if (PluginVirtualMachine::IsExt (_szFile))
465
465
{
466
- auto apa = new ActivePluginAction (*this , hTopHWnd, szCommandLine, isPrivileged);
466
+ auto apa = new ActivePluginAction (*this , virtualMachines, hTopHWnd, szCommandLine, isPrivileged);
467
467
if (apa->Initialize ())
468
468
{
469
469
return apa;
@@ -477,21 +477,21 @@ ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& s
477
477
// Batch files...
478
478
if ( myodd::files::IsExtension (_szFile, _T (" bat" )))
479
479
{
480
- return new ActiveBatchAction (*this , hTopHWnd, szCommandLine );
480
+ return new ActiveBatchAction (*this , virtualMachines, hTopHWnd, szCommandLine );
481
481
}
482
482
if (myodd::files::IsExtension (_szFile, _T (" cmd" )))
483
483
{
484
- return new ActiveCmdAction (*this , hTopHWnd, szCommandLine);
484
+ return new ActiveCmdAction (*this , virtualMachines, hTopHWnd, szCommandLine);
485
485
}
486
486
if (myodd::files::IsExtension (_szFile, _T (" com" )))
487
487
{
488
- return new ActiveComAction (*this , hTopHWnd, szCommandLine);
488
+ return new ActiveComAction (*this , virtualMachines, hTopHWnd, szCommandLine);
489
489
}
490
490
if (myodd::files::IsExtension (_szFile, _T (" exe" )))
491
491
{
492
- return new ActiveExeAction (*this , hTopHWnd, szCommandLine, isPrivileged);
492
+ return new ActiveExeAction (*this , virtualMachines, hTopHWnd, szCommandLine, isPrivileged);
493
493
}
494
494
495
495
// run the default action.
496
- return new ActiveDefaultAction ( *this , hTopHWnd, szCommandLine, isPrivileged );
496
+ return new ActiveDefaultAction ( *this , virtualMachines, hTopHWnd, szCommandLine, isPrivileged );
497
497
}
0 commit comments