daily pastebin goal
77%
SHARE
TWEET

Untitled

a guest Mar 24th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <windows.h>
  3. #include <io.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <iostream>
  7. #include <string>
  8.  
  9.  
  10. LPWSTR konwertuj(char* tekst);
  11.  
  12.  
  13. /*
  14. PRIORYTETY PROCESOW:
  15. REALTIME_PRIORITY_CLASS
  16. HIGH_PRIORITY_CLASS
  17. NORMAL_PRIORITY_CLASS
  18. IDLE_PRIORITY_CLASS
  19.  
  20. PRIORYTETY WATKOW:
  21. THREAD_PRIORITY_ABOVE_NORMAL 1
  22. THREAD_PRIORITY_BELOW_NORMAL -1
  23. THREAD_PRIORITY_HIGHEST 2
  24. THREAD_PRIORITY_IDLE -15
  25. THREAD_PRIORITY_LOWEST -2
  26. THREAD_PRIORITY_NORMAL 0
  27. THREAD_PRIORITY_TIME_CRITICAL 15
  28. */
  29.  
  30. int main(int argc, char **argv)
  31. {
  32.     PROCESS_INFORMATION pi;
  33.     STARTUPINFO si;
  34.     ZeroMemory(&pi, sizeof(pi));
  35.     ZeroMemory(&si, sizeof(si));
  36.     si.cb = sizeof(si);
  37.  
  38.  
  39.     std::string dana = argv[0];
  40.     for (int i = 1; i < argc-1; i++)
  41.     {
  42.         dana.append(" ");
  43.         dana.append(argv[i + 1]);
  44.     }
  45.  
  46.     char* cstr = new char(100);
  47.     strcpy(cstr, dana.c_str());
  48.     LPWSTR sciezka = konwertuj(cstr);
  49.     int process_created = 0;
  50.  
  51.     if (argc >= 1)
  52.     {
  53.         while (process_created < atoi(argv[1]))
  54.         {
  55.             CreateProcess(NULL, cstr, NULL, NULL, FALSE, NULL, NULL, NULL, &si, &pi);
  56.             process_created++;
  57.             std::cout << dana;
  58.         }
  59.         WaitForSingleObject(pi.hProcess, INFINITE);
  60.     }
  61.     else
  62.         Sleep(10000);
  63.  
  64.     delete cstr;
  65.     CloseHandle(pi.hProcess);
  66.     CloseHandle(pi.hThread);
  67.     ExitProcess(0);
  68.     return 0;
  69. }
  70.  
  71.  
  72. LPWSTR konwertuj(char* tekst)
  73. {
  74.     wchar_t konw[100];
  75.     mbstowcs(konw, tekst, strlen(tekst) + 1); //konwersja na windowsowy string
  76.     LPWSTR sciezka = konw;
  77.     return sciezka;
  78. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top