ReactOS  0.4.14-dev-599-g2d4d3f5
lpcclt.c File Reference
#include <ddk/ntddk.h>
#include <rosrtl/string.h>
#include <windows.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "lpctest.h"
Include dependency graph for lpcclt.c:

Go to the source code of this file.

Functions

void debug_printf (char *fmt,...)
 
int main (int argc, char *argv[])
 

Variables

const charMyName = "LPC-CLI"
 
HANDLE OutputHandle
 
HANDLE InputHandle
 

Function Documentation

◆ debug_printf()

void debug_printf ( char fmt,
  ... 
)

Definition at line 19 of file lpcclt.c.

20 {
21  va_list args;
22  char buffer[255];
23 
24  va_start(args,fmt);
27  va_end(args);
28 }
HANDLE OutputHandle
Definition: lpcclt.c:16
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLuint buffer
Definition: glext.h:5915
Definition: match.c:390
#define va_end(ap)
Definition: acmsvcex.h:90
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleA(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
Definition: readwrite.c:1470
smooth NULL
Definition: ftsmooth.c:416
char * va_list
Definition: acmsvcex.h:78
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define args
Definition: format.c:66
Definition: dsound.c:943

◆ 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 31 of file lpcclt.c.

32 {
33  UNICODE_STRING PortName = ROS_STRING_INITIALIZER(TEST_PORT_NAME_U);
35  HANDLE PortHandle;
36  LPC_MAX_MESSAGE Request;
37  ULONG ConnectInfo;
38  ULONG ConnectInfoLength = 0;
40 
41  printf("%s: Lpc test client\n", MyName);
42 
43  printf("%s: Connecting to port \"%s\"...\n", MyName, TEST_PORT_NAME);
44  ConnectInfoLength = 0;
45  ZeroMemory (& Sqos, sizeof Sqos);
46  Status = NtConnectPort(&PortHandle,
47  &PortName,
48  & Sqos,
49  0,
50  0,
51  0,
52  NULL,
53  &ConnectInfoLength);
54  if (!NT_SUCCESS(Status))
55  {
56  printf("%s: NtConnectPort() failed with status = 0x%08X.\n", MyName, Status);
57  return EXIT_FAILURE;
58  }
59 
60  printf("%s: Connected to \"%s\" with anonymous port 0x%x.\n", MyName, TEST_PORT_NAME, PortHandle);
61 
62  ZeroMemory(& Request, sizeof Request);
64  Request.Header.DataSize = strlen(Request.Data);
65  Request.Header.MessageSize = sizeof(LPC_MESSAGE) +
66  Request.Header.DataSize;
67 
68  printf("%s: Sending to port 0x%x message \"%s\"...\n",
69  MyName,
70  PortHandle,
71  (char *) Request.Data);
72  Status = NtRequestPort(PortHandle,
73  &Request.Header);
74  if (!NT_SUCCESS(Status))
75  {
76  printf("%s: NtRequestPort(0x%x) failed with status = 0x%8X.\n",
77  MyName,
78  PortHandle,
79  Status);
80  return EXIT_FAILURE;
81  }
82 
83  printf("%s: Sending datagram to port 0x%x succeeded.\n", MyName, PortHandle);
84 
85  Sleep(2000);
86 
87  printf("%s: Disconnecting...", MyName);
88  NtClose (PortHandle);
89 
90  return EXIT_SUCCESS;
91 }
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LONG NTSTATUS
Definition: precomp.h:26
#define ZeroMemory
Definition: winbase.h:1642
_In_ NDIS_HANDLE _In_ PNDIS_REQUEST Request
Definition: ndis.h:5173
#define EXIT_SUCCESS
Definition: rdjpgcom.c:55
struct _LPC_MESSAGE LPC_MESSAGE
smooth NULL
Definition: ftsmooth.c:416
const char * MyName
Definition: lpcclt.c:15
#define TEST_PORT_NAME
Definition: lpctest.h:3
NTSTATUS NTAPI NtConnectPort(OUT PHANDLE PortHandle, IN PUNICODE_STRING PortName, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos, IN OUT PPORT_VIEW ClientView OPTIONAL, IN OUT PREMOTE_PORT_VIEW ServerView OPTIONAL, OUT PULONG MaxMessageLength OPTIONAL, IN OUT PVOID ConnectionInformation OPTIONAL, IN OUT PULONG ConnectionInformationLength OPTIONAL)
Definition: connect.c:753
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define EXIT_FAILURE
Definition: jerror.c:33
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
LPSTR WINAPI GetCommandLineA(VOID)
Definition: proc.c:2003
Status
Definition: gdiplustypes.h:24
#define TEST_PORT_NAME_U
Definition: lpctest.h:4
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI NtRequestPort(IN HANDLE PortHandle, IN PPORT_MESSAGE LpcRequest)
Definition: send.c:440
#define printf
Definition: config.h:203
IN PUNICODE_STRING PortName
Definition: conport.c:35

Variable Documentation

◆ InputHandle

HANDLE InputHandle

Definition at line 17 of file lpcclt.c.

◆ MyName

const char* MyName = "LPC-CLI"

Definition at line 15 of file lpcclt.c.

Referenced by main().

◆ OutputHandle

HANDLE OutputHandle

Definition at line 16 of file lpcclt.c.

Referenced by debug_printf().