dllbridge

Untitled

Oct 9th, 2020
850
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. #include <windows.h>
  4. #include   <stdio.h>
  5. //#include  <stdlib.h>
  6.  
  7.  
  8. #include <malloc.h>
  9.  
  10.  
  11.  
  12. VOID Messages(VOID);
  13. VOID MultiThread(VOID);
  14.  
  15. DWORD WINAPI WorkThread0(LPVOID param);
  16. DWORD WINAPI WorkThread1(LPVOID param);
  17. DWORD WINAPI WorkThread2(LPVOID param);
  18.  
  19. /////////////////////////////////////////////////////   4
  20. int main()                                         //  
  21. {
  22.  
  23.     //Messages();
  24.     MultiThread();
  25.     return 0;
  26. }
  27.  
  28.  
  29.  
  30.  
  31. /////////////////////////////////////////////////////
  32. VOID MultiThread(VOID)                                 //
  33. {
  34.  
  35.     HANDLE hArr[3];
  36.  
  37.     hArr[0] = CreateThread(NULL, 0, WorkThread0, NULL, 0, 0);
  38.     hArr[1] = CreateThread(NULL, 0, WorkThread1, NULL, 0, 0);
  39.     hArr[2] = CreateThread(NULL, 0, WorkThread2, NULL, 0, 0);
  40.  
  41.     WaitForMultipleObjects(3, hArr, TRUE, INFINITE);
  42.     //WARNING! Íóæåí ìàêðîñ INFINITE à íå INFINITY
  43.  
  44.     //Æäàòü 1 ïîòîê
  45.     //WaitForSingleObject(hArr[0], INFINITE);
  46.  
  47.     for(int i = 0; i < 3; ++i)  CloseHandle(hArr[i]);      
  48. }
  49.  
  50.  
  51.  
  52.  
  53. /////////////////////////////////////////////////////
  54. DWORD WINAPI WorkThread0(LPVOID param)             //
  55. {
  56.     for (int i = 0; i < 50; ++i)
  57.         printf("Message 0: %d\n", i);
  58.  
  59. ExitThread(0);
  60. }
  61.  
  62. DWORD WINAPI WorkThread1(LPVOID param)
  63. {
  64.     for (int i = 0; i < 50; ++i)
  65.         printf("Message 1: %d\n", i);
  66.  
  67. ExitThread(0);
  68. }
  69.  
  70. DWORD WINAPI WorkThread2(LPVOID param)
  71. {
  72.     for (int i = 0; i < 50; ++i)
  73.         printf("Message 2: %d\n", i);
  74.  
  75. ExitThread(0);
  76. }
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
RAW Paste Data