osutil.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * category: [misc]
  3. * apply status:
  4. * edit status:
  5. * build status:
  6. * description:
  7. */
  8. #ifndef __OSUTIL_H__
  9. #define __OSUTIL_H__
  10. #pragma once
  11. #include "config.h"
  12. typedef void* ostuile_void_ptr;
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #define MAX_ALIVE_PROCESS_COUNT 100
  17. #define ALIVE_PROCESS_PATH_LEN 512
  18. typedef struct t_process_info
  19. {
  20. int pid;
  21. char name[64];
  22. char path[ALIVE_PROCESS_PATH_LEN]; //or cmd
  23. } alive_process_info;
  24. typedef struct toolkit_utsname_s
  25. {
  26. char sysname[256];
  27. char release[256];
  28. char version[256];
  29. char machine[256];
  30. /* This struct does not contain the nodename and domainname fields present in
  31. the utsname type. domainname is a GNU extension. Both fields are referred
  32. to as meaningless in the docs. */
  33. }tk_utsname_t;
  34. typedef struct toolkit_systime_s {
  35. unsigned short year;
  36. unsigned short month;
  37. unsigned short dayofweek;
  38. unsigned short day;
  39. unsigned short hour;
  40. unsigned short minute;
  41. unsigned short second;
  42. unsigned short milli_seconds;
  43. } tk_systime_t;
  44. // non-zero: unique
  45. // zero: has clone
  46. TOOLKIT_API int osutil_detect_unique_app(char **pNames, int nNum, int* alive, alive_process_info* alive_process_arr);
  47. TOOLKIT_API int osutil_restart_system();
  48. TOOLKIT_API int osutil_shutdown_system();
  49. //force: which is only available at UOS, non-zero meaning kill -9 otherwise -15
  50. TOOLKIT_API void osutil_terminate_related_process(char** process_array, const int array_size, int force);
  51. TOOLKIT_API int osutil_uname(tk_utsname_t* buffer);
  52. TOOLKIT_API int osutil_system_boot_time(tk_systime_t* ptr_boot_time);
  53. /*
  54. * -1:failed
  55. * 0:no
  56. * 1:yes
  57. */
  58. TOOLKIT_API int osutil_is32r64_platform();
  59. TOOLKIT_API ostuile_void_ptr osutil_sure_redirect_32sys_in_wow64();
  60. TOOLKIT_API void osutil_reset_redirect_32sys_in_wow64(ostuile_void_ptr* value);
  61. #ifdef __cplusplus
  62. } // extern "C" {
  63. #endif
  64. #endif //__OSUTIL_H__