ReactOS  0.4.14-dev-317-g96040ec
suspend.c File Reference
#include <windows.h>
#include <stdio.h>
#include <ndk/ntndk.h>
#include <debug.h>
Include dependency graph for suspend.c:

Go to the source code of this file.

Macros

#define UNICODE
 
#define WIN32_NO_STATUS
 
#define NTOS_MODE_USER
 
#define NDEBUG
 

Functions

static NTSTATUS WINAPI thread_1 (PVOID Param)
 
int main (int argc, char *argv[])
 

Variables

static volatile DWORD z
 
static volatile DWORD x =0
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 8 of file suspend.c.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 5 of file suspend.c.

◆ UNICODE

Definition at line 1 of file suspend.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 2 of file suspend.c.

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

hosttype.c Copyright (C) 2002 by Brian Palmer brian.nosp@m.p@sg.nosp@m.inet..nosp@m.com

Definition at line 33 of file suspend.c.

34 {
35  HANDLE thread;
38 
39  context.ContextFlags=CONTEXT_CONTROL;
40 
41  z=0;
43  0x1000,
45  NULL,
46  0,
47  &thread_id);
48 
49  if(!thread)
50  {
51  printf("Error: could not create thread ...\n");
52  ExitProcess(0);
53  }
54 
55  Sleep(1000);
56 
58 
59  for(;;)
60  {
61  printf("%lx ", z);
62  Sleep(100);x++;
63  if(x>100 && GetThreadContext(thread, &context))
64  {
65 #if defined(_M_IX86)
66  printf("EIP: %lx\n", context.Eip);
67 #elif defined(_M_AMD64)
68  printf("RIP: %p\n", context.Rip);
69 #endif
70  printf("Calling resumethread ... \n");
72  }
73  }
74 
75  ExitProcess(0);
76  return(0);
77 }
DWORD(WINAPI * LPTHREAD_START_ROUTINE)(LPVOID)
Definition: winbase.h:707
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
Definition: http.c:6587
static NTSTATUS WINAPI thread_1(PVOID Param)
Definition: suspend.c:15
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1487
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
BOOL WINAPI GetThreadContext(IN HANDLE hThread, OUT LPCONTEXT lpContext)
Definition: thread.c:500
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:136
smooth NULL
Definition: ftsmooth.c:416
#define CONTEXT_CONTROL
Definition: compat.h:265
unsigned long DWORD
Definition: ntddk_ex.h:95
static HANDLE thread
Definition: service.c:33
DWORD WINAPI SuspendThread(IN HANDLE hThread)
Definition: thread.c:641
static DWORD thread_id
Definition: protocol.c:158
DWORD WINAPI ResumeThread(IN HANDLE hThread)
Definition: thread.c:566
#define printf
Definition: config.h:203

◆ thread_1()

static NTSTATUS WINAPI thread_1 ( PVOID  Param)
static

Definition at line 15 of file suspend.c.

16 {
17  DWORD y=0;
18 
19  for(;;)
20  {
21  z++;
22  if(x>50)
23  {
24  printf("I should have been suspended for years :-)\n");
25  Sleep(100);
26  x=0;y++;
27  if(y==3) ExitProcess(0);
28  }
29  }
30 }
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1487
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble GLdouble z
Definition: glext.h:5874
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define printf
Definition: config.h:203

Referenced by main().

Variable Documentation

◆ x

volatile DWORD x =0
static

Definition at line 12 of file suspend.c.

◆ z

volatile DWORD z
static

Definition at line 11 of file suspend.c.