ReactOS 0.4.16-dev-319-g6cf4263
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{
22 char buffer[255];
23
27 va_end(args);
28}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define NULL
Definition: types.h:112
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleA(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
Definition: readwrite.c:1468
GLuint buffer
Definition: glext.h:5915
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
HANDLE OutputHandle
Definition: lpcclt.c:16
#define args
Definition: format.c:66
Definition: match.c:390
Definition: dsound.c:943

◆ main()

int main ( int argc  ,
char argv[] 
)

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}
static UNICODE_STRING PortName
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
LPSTR WINAPI GetCommandLineA(VOID)
Definition: proc.c:2009
#define printf
Definition: freeldr.h:97
Status
Definition: gdiplustypes.h:25
#define EXIT_FAILURE
Definition: jerror.c:33
const char * MyName
Definition: lpcclt.c:15
#define TEST_PORT_NAME
Definition: lpctest.h:3
#define TEST_PORT_NAME_U
Definition: lpctest.h:4
struct _LPC_MESSAGE LPC_MESSAGE
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
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:777
NTSTATUS NTAPI NtRequestPort(IN HANDLE PortHandle, IN PPORT_MESSAGE LpcRequest)
Definition: send.c:440
#define EXIT_SUCCESS
Definition: rdjpgcom.c:55
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
#define ZeroMemory
Definition: winbase.h:1737

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().