ReactOS  0.4.14-dev-55-g2da92ac
apc.c File Reference
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <ndk/ntndk.h>
Include dependency graph for apc.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define NTOS_MODE_USER
 

Functions

VOID WINAPI ApcRoutine (PVOID Context, PIO_STATUS_BLOCK IoStatus, ULONG Reserved)
 
int main (int argc, char *argv[])
 

Variables

HANDLE OutputHandle
 
HANDLE InputHandle
 

Macro Definition Documentation

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 5 of file apc.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 3 of file apc.c.

Function Documentation

◆ ApcRoutine()

VOID WINAPI ApcRoutine ( PVOID  Context,
PIO_STATUS_BLOCK  IoStatus,
ULONG  Reserved 
)

Definition at line 12 of file apc.c.

15 {
16  printf("(apc.exe) ApcRoutine(Context %p)\n", Context);
17 }
#define printf
Definition: config.h:203

Referenced by main(), and WahQueueUserApc().

◆ 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 20 of file apc.c.

21 {
27  CHAR Buffer[256];
30 
31  AllocConsole();
34 
35  printf("APC test program\n");
36 
38  FALSE,
39  FALSE,
40  NULL);
42  {
43  printf("Failed to create event\n");
44  return 0;
45  }
46 
47  printf("Opening file\n");
49  &FileName,
50  0,
51  NULL,
52  NULL);
53 
54  printf("Creating file\n");
55  FileHandle = CreateFileW(L"C:\\a.txt",
57  0,
58  NULL,
61  NULL);
62 
64  {
65 
66  printf("Open failed last err 0x%lx\n",GetLastError());
67  return 0;
68  }
69 
70  off.QuadPart = 0;
71 
72  printf("Reading file\n");
73  Status = ZwReadFile(FileHandle,
74  NULL,
76  (PVOID) 0xdeadbeef,
77  &IoStatus,
78  Buffer,
79  256,//len
80  &off ,//offset must exist if file was opened for asynch. i/o aka. OVERLAPPED
81  NULL);
82 
83  if (!NT_SUCCESS(Status))
84  {
85  printf("Read failed status 0x%lx\n",Status);
86  }
87  printf("Waiting\n");
89  printf("Returned from wait\n");
91  printf("Program finished\n");
92  return 0;
93 }
#define FILE_GENERIC_READ
Definition: nt_native.h:653
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
DWORD WINAPI WaitForSingleObjectEx(IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:94
#define TRUE
Definition: types.h:120
BOOL WINAPI AllocConsole(VOID)
Definition: console.c:48
VOID(* PIO_APC_ROUTINE)(IN PVOID ApcContext, IN PIO_STATUS_BLOCK IoStatusBlock, IN ULONG Reserved)
Definition: nt_native.h:877
HANDLE OutputHandle
Definition: apc.c:8
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
char CHAR
Definition: xmlstorage.h:175
VOID WINAPI ApcRoutine(PVOID Context, PIO_STATUS_BLOCK IoStatus, ULONG Reserved)
Definition: apc.c:12
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:152
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
HANDLE FileHandle
Definition: stats.c:38
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define STD_INPUT_HANDLE
Definition: winbase.h:264
#define OPEN_EXISTING
Definition: compat.h:426
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR L[]
Definition: oid.c:1250
#define STD_OUTPUT_HANDLE
Definition: winbase.h:265
Status
Definition: gdiplustypes.h:24
#define FILE_GENERIC_WRITE
Definition: nt_native.h:660
HANDLE InputHandle
Definition: apc.c:9
#define CreateFileW
Definition: compat.h:400
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
#define INFINITE
Definition: serial.h:102
#define printf
Definition: config.h:203
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
off
Definition: i386-dis.c:3909
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

Variable Documentation

◆ InputHandle

◆ OutputHandle

HANDLE OutputHandle

Definition at line 8 of file apc.c.

Referenced by ConSrvInitHandlesTable(), main(), ODBC32_SQLAllocHandle(), and ODBC32_SQLAllocHandleStd().