Process.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #include "il2cpp-config.h"
  2. #include "icalls/System/System.Diagnostics/Process.h"
  3. #include "os/Process.h"
  4. #include "vm/Exception.h"
  5. #include "vm/String.h"
  6. namespace il2cpp
  7. {
  8. namespace icalls
  9. {
  10. namespace System
  11. {
  12. namespace System
  13. {
  14. namespace Diagnostics
  15. {
  16. bool Process::CreateProcess_internal(Il2CppObject* startInfo, intptr_t _stdin, intptr_t _stdout, intptr_t _stderr, ProcInfo* procInfo)
  17. {
  18. IL2CPP_NOT_IMPLEMENTED_ICALL(Process::CreateProcess_internal);
  19. return false;
  20. }
  21. bool Process::ShellExecuteEx_internal(Il2CppObject* startInfo, ProcInfo* procInfo)
  22. {
  23. IL2CPP_NOT_IMPLEMENTED_ICALL(Process::ShellExecuteEx_internal);
  24. return false;
  25. }
  26. Il2CppArray* Process::GetModules_icall(Il2CppObject* thisPtr, intptr_t handle)
  27. {
  28. IL2CPP_NOT_IMPLEMENTED_ICALL(Process::GetModules_icall);
  29. return 0;
  30. }
  31. Il2CppArray* Process::GetProcesses_internal()
  32. {
  33. IL2CPP_NOT_IMPLEMENTED_ICALL(Process::GetProcesses_internal);
  34. return 0;
  35. }
  36. int64_t Process::GetProcessData(int32_t pid, int32_t data_type, int32_t* error)
  37. {
  38. NOT_SUPPORTED_IL2CPP(NativeMethods::GetProcessData, "IL2CPP does not support access to process data");
  39. return 0;
  40. }
  41. intptr_t Process::GetProcess_internal(int32_t pid)
  42. {
  43. auto process = os::Process::GetProcess(pid);
  44. vm::Exception::RaiseIfError(process.GetError());
  45. return reinterpret_cast<intptr_t>(process.Get());
  46. }
  47. Il2CppString* Process::ProcessName_icall(intptr_t handle)
  48. {
  49. os::ProcessHandle *pHandle = (os::ProcessHandle*)handle;
  50. auto name = os::Process::GetProcessName(pHandle);
  51. vm::Exception::RaiseIfError(name.GetError());
  52. return il2cpp::vm::String::New(name.Get().c_str());
  53. }
  54. intptr_t Process::MainWindowHandle_icall(int32_t pid)
  55. {
  56. return os::Process::GetMainWindowHandle(pid);
  57. }
  58. } /* namespace Diagnostics */
  59. } /* namespace System */
  60. } /* namespace System */
  61. } /* namespace icalls */
  62. } /* namespace il2cpp */