ReactOS  0.4.14-dev-114-gc8cbd56
server.c
Go to the documentation of this file.
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <ctype.h>
4 #include "ctx.h"
5 
6 void CtxOpen( PCTXTYPE *pphContext,
7  long Value)
8 {
9  printf("CtxOpen(): Value=%d\n",Value);
10  *pphContext = (PCTXTYPE)midl_user_allocate( sizeof(CTXTYPE) );
11  **pphContext = Value;
12 }
13 
14 void CtxHello( PCTXTYPE phContext )
15 {
16  printf("CtxHello(): Hello, World! Context value: %d\n", *phContext);
17 }
18 
19 void CtxClose(PCTXTYPE *pphContext )
20 {
21  printf("CtxClose(): %d\n", **pphContext);
22  midl_user_free(*pphContext);
23  *pphContext = NULL;
24 }
25 
26 
27 void main()
28 {
30  unsigned int cMinCalls = 1;
31  unsigned int cMaxCalls = 20;
32  int i;
33 
34  status = RpcServerUseProtseqEp("ncacn_np", 20, "\\pipe\\hello", NULL);
35 
36  if (status)
37  {
38  printf("RpcServerUseProtseqEp %x\n", status);
39  exit(status);
40  }
41 
43 
44  if (status)
45  {
46  printf("RpcServerRegisterIf %x\n", status);
47  exit(status);
48  }
49 
50  status = RpcServerListen(1, 20, FALSE);
51 
52  if (status)
53  {
54  printf("RpcServerListen %x", status);
55  exit(status);
56  }
57 
58  scanf("%d", &i);
59 }
60 
61 
63  PCTXTYPE hContext)
64 {
65  PCTXTYPE pCtx = (PCTXTYPE)hContext;
66  printf("Context rundown: Value=%d \n", *pCtx);
67  midl_user_free(hContext);
68 }
69 
71 {
72  return(malloc(len));
73 }
74 
76 {
77  free(ptr);
78 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
void CtxClose(PCTXTYPE *pphContext)
Definition: server.c:19
#define free
Definition: debug_ros.c:5
CTXTYPE __RPC_FAR * PCTXTYPE
Definition: ctx.h:48
#define RpcServerUseProtseqEp
Definition: rpcdce.h:479
RPC_IF_HANDLE hello_v1_0_s_ifspec
Definition: ctx_s.c:61
_Check_return_ _CRTIMP int __cdecl scanf(_In_z_ _Scanf_format_string_ const char *_Format,...)
void __RPC_USER PCTXTYPE_rundown(PCTXTYPE hContext)
Definition: server.c:62
long RPC_STATUS
Definition: rpc.h:52
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
RPC_STATUS WINAPI RpcServerListen(UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait)
Definition: rpc_server.c:1527
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define __RPC_FAR
Definition: rpc.h:56
#define __RPC_USER
Definition: rpc.h:65
void CtxHello(PCTXTYPE phContext)
Definition: server.c:14
RPC_STATUS WINAPI RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
Definition: rpc_server.c:1123
void __RPC_FAR *__RPC_USER midl_user_allocate(size_t len)
Definition: server.c:70
GLenum GLsizei len
Definition: glext.h:6722
void CtxOpen(PCTXTYPE *pphContext, long Value)
Definition: server.c:6
#define malloc
Definition: debug_ros.c:4
void exit(int exitcode)
Definition: _exit.c:33
static SERVICE_STATUS status
Definition: service.c:31
void main()
Definition: server.c:27
long CTXTYPE
Definition: ctx.h:46
#define printf
Definition: config.h:203
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: server.c:75
Definition: ps.c:97