mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
Added error reporting to lpcsrv and lpcclt.
svn path=/trunk/; revision=955
This commit is contained in:
parent
5415f6f333
commit
74131ebded
2 changed files with 35 additions and 18 deletions
|
@ -1,7 +1,13 @@
|
|||
/* $Id: lpcclt.c,v 1.5 2000/01/22 22:22:48 ea Exp $
|
||||
*
|
||||
* DESCRIPTION: Simple LPC Client
|
||||
* PROGRAMMER: David Welch
|
||||
*/
|
||||
#include <ddk/ntddk.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
@ -18,7 +24,7 @@ void debug_printf(char* fmt, ...)
|
|||
}
|
||||
|
||||
|
||||
void main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
UNICODE_STRING PortName;
|
||||
NTSTATUS Status;
|
||||
|
@ -30,7 +36,7 @@ void main(int argc, char* argv[])
|
|||
|
||||
RtlInitUnicodeString(&PortName, L"\\TestPort");
|
||||
|
||||
printf("(lpcclt.exe) Connecting to port\n");
|
||||
printf("(lpcclt.exe) Connecting to port \"\\TestPort\"\n");
|
||||
ConnectInfoLength = 0;
|
||||
Status = NtConnectPort(&PortHandle,
|
||||
&PortName,
|
||||
|
@ -42,21 +48,22 @@ void main(int argc, char* argv[])
|
|||
&ConnectInfoLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcclt.exe) Failed to connect\n");
|
||||
return;
|
||||
printf("(lpcclt.exe) Failed to connect (Status = 0x%08X)\n", Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
strcpy(Request.MessageData, GetCommandLineA());
|
||||
Request.ActualMessageLength = strlen(Request.MessageData);
|
||||
Request.TotalMessageLength = sizeof(LPCMESSAGE);
|
||||
|
||||
printf("(lpcclt.exe) Sending message\n");
|
||||
printf("(lpcclt.exe) Sending message \"%s\"\n", (char *) Request.MessageData);
|
||||
Status = NtRequestPort(PortHandle, &Request);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcclt.exe) Failed to send request\n");
|
||||
return;
|
||||
printf("(lpcclt.exe) Failed to send request (Status = 0x%=8X)\n", Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("(lpcclt.exe) Succeeded\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
/* $Id: lpcsrv.c,v 1.4 2000/01/22 22:22:48 ea Exp $
|
||||
*
|
||||
* DESCRIPTION: Simple LPC Server
|
||||
* PROGRAMMER: David Welch
|
||||
*/
|
||||
#include <ddk/ntddk.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
@ -18,7 +24,7 @@ void debug_printf(char* fmt, ...)
|
|||
}
|
||||
|
||||
|
||||
void main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
UNICODE_STRING PortName;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
|
@ -44,8 +50,8 @@ void main(int argc, char* argv[])
|
|||
0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to create port\n");
|
||||
return;
|
||||
printf("(lpcsrv.exe) Failed to create port (Status = 0x%08X)\n", Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,8 +60,8 @@ void main(int argc, char* argv[])
|
|||
&ConnectMsg);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to listen for connections\n");
|
||||
return;
|
||||
printf("(lpcsrv.exe) Failed to listen for connections (Status = 0x%08X)\n", Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("(lpcsrv.exe) Accepting connections\n");
|
||||
|
@ -67,16 +73,16 @@ void main(int argc, char* argv[])
|
|||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to accept connection\n");
|
||||
return;
|
||||
printf("(lpcsrv.exe) Failed to accept connection (Status = 0x%08X)\n", Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("(lpcsrv.exe) Completing connection\n");
|
||||
Status = NtCompleteConnectPort(PortHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to complete connection\n");
|
||||
return;
|
||||
printf("(lpcsrv.exe) Failed to complete connection (Status = 0x%08X)\n", Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
for(;;)
|
||||
|
@ -89,10 +95,14 @@ void main(int argc, char* argv[])
|
|||
&Request);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to receive request\n");
|
||||
return;
|
||||
printf("(lpcsrv.exe) Failed to receive request (Status = 0x%08X)\n", Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("(lpcsrv.exe) Message contents are <%s>\n", Request.MessageData);
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue