ReactOS  0.4.13-dev-99-g7e18b6d
terminate.c
Go to the documentation of this file.
1 #define UNICODE
2 #define WIN32_NO_STATUS
3 #include <windows.h>
4 #include <stdio.h>
5 #define NTOS_MODE_USER
6 #include <ndk/ntndk.h>
7 
8 #define NDEBUG
9 #include <debug.h>
10 
11 static volatile DWORD z;
12 static volatile DWORD x=0;
13 
14 static NTSTATUS WINAPI
16 {
17  DWORD y=0;
18 
19  for(;;)
20  {
21  z++;
22  if(x>50)
23  {
24  Sleep(100);
25  x=0;y++;
26  if(y==3) return(0);
27  }
28  }
29 }
30 
31 int
32 main(int argc, char *argv[])
33 {
34  HANDLE thread;
37  DWORD z = 0;
38 
39  context.ContextFlags=CONTEXT_CONTROL;
40 
41  while (z < 50)
42  {
43  z++;
45  0x1000,
47  NULL,
48  0,
49  &thread_id);
50 
51  if(!thread)
52  {
53  printf("Error: could not create thread ...\n");
54  ExitProcess(0);
55  }
56 
57  Sleep(1000);
58 
59  printf("T");
60  if ((z % 5) == 0)
61  {
63  }
64  printf("C");
66  printf("S");
68  printf("R");
71  }
72 
73  ExitProcess(0);
74  return(0);
75 }
static int argc
Definition: ServiceArgs.c:12
DWORD(WINAPI * LPTHREAD_START_ROUTINE)(LPVOID)
Definition: winbase.h:707
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
BOOL WINAPI TerminateThread(IN HANDLE hThread, IN DWORD dwExitCode)
Definition: thread.c:549
Definition: http.c:6587
LONG NTSTATUS
Definition: precomp.h:26
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1517
int main(int argc, char *argv[])
Definition: terminate.c:32
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define argv
Definition: mplay32.c:18
static volatile DWORD z
Definition: terminate.c:11
BOOL WINAPI GetThreadContext(IN HANDLE hThread, OUT LPCONTEXT lpContext)
Definition: thread.c:463
GLdouble GLdouble z
Definition: glext.h:5874
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:112
smooth NULL
Definition: ftsmooth.c:416
#define CONTEXT_CONTROL
Definition: compat.h:265
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
static HANDLE thread
Definition: service.c:33
DWORD WINAPI SuspendThread(IN HANDLE hThread)
Definition: thread.c:604
static NTSTATUS WINAPI thread_1(PVOID Param)
Definition: terminate.c:15
static DWORD thread_id
Definition: protocol.c:158
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
DWORD WINAPI ResumeThread(IN HANDLE hThread)
Definition: thread.c:529
#define printf
Definition: config.h:203