scroll mode for very long start menus
[reactos.git] / reactos / apps / tests / suspend / suspend.c
1 #define UNICODE
2
3 #define NTOS_MODE_USER
4 #include <ntos.h>
5 #include <windows.h>
6 #include <stdio.h>
7
8 #define DBG
9 #define NDEBUG
10 #include <debug.h>
11
12 static volatile DWORD z;
13 static volatile DWORD x=0;
14
15 static NTSTATUS STDCALL
16 thread_1(PVOID Param)
17 {
18 DWORD y=0;
19
20 for(;;)
21 {
22 z++;
23 if(x>50)
24 {
25 printf("I should have been suspended for years :-)\n");
26 Sleep(100);
27 x=0;y++;
28 if(y==3) ExitProcess(0);
29 }
30 }
31 }
32
33 int
34 main(int argc, char *argv[])
35 {
36 HANDLE thread;
37 DWORD thread_id;
38 CONTEXT context;
39
40 context.ContextFlags=CONTEXT_CONTROL;
41
42 z=0;
43 thread=CreateThread(NULL,
44 0x1000,
45 (LPTHREAD_START_ROUTINE)thread_1,
46 NULL,
47 0,
48 &thread_id);
49
50 if(!thread)
51 {
52 printf("Error: could not create thread ...\n");
53 ExitProcess(0);
54 }
55
56 Sleep(1000);
57
58 SuspendThread(thread);
59
60 for(;;)
61 {
62 printf("%lx ", z);
63 Sleep(100);x++;
64 if(x>100 && GetThreadContext(thread, &context))
65 {
66 printf("EIP: %lx\n", context.Eip);
67 printf("Calling resumethread ... \n");
68 ResumeThread(thread);
69 }
70 }
71
72 ExitProcess(0);
73 return(0);
74 }