mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-31 04:13:37 +00:00
Update tests
svn path=/trunk/; revision=21673
This commit is contained in:
@@ -337,26 +337,42 @@ void m_CtxClose(
|
||||
|
||||
}
|
||||
|
||||
int interactive = 0;
|
||||
void interact()
|
||||
{
|
||||
if(interactive)
|
||||
{
|
||||
printf("\nPress any key to continue...");
|
||||
getch();
|
||||
printf("\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
void main(int argc, char **argv)
|
||||
{
|
||||
RPC_STATUS status;
|
||||
unsigned long ulCode;
|
||||
PCTXTYPE hContext;
|
||||
char *pszStringBinding = NULL;
|
||||
int test_num = 0;
|
||||
RPC_BINDING_HANDLE Handle = 0;
|
||||
char buffer[255];
|
||||
|
||||
int test_num = 0;
|
||||
int test_value = 31337;
|
||||
|
||||
if(argc<2)
|
||||
{
|
||||
printf("USAGE: client.exe <test_number>\n"
|
||||
printf("USAGE: client.exe <test_number> [test_value] [interactive]\n"
|
||||
"Available tests:\n"
|
||||
"0. General test\n"
|
||||
"1. NULL pointer test\n");
|
||||
"1. NULL pointer test\n"
|
||||
"2. Context rundown routine");
|
||||
return;
|
||||
}
|
||||
|
||||
test_num = atoi(argv[1]);
|
||||
if(argc>2) test_value = atoi(argv[2]);
|
||||
if(argc>3) interactive = 1;
|
||||
|
||||
status = RpcStringBindingCompose(NULL,
|
||||
"ncacn_np",
|
||||
@@ -384,9 +400,10 @@ void main(int argc, char **argv)
|
||||
switch(test_num)
|
||||
{
|
||||
case 0:
|
||||
m_CtxOpen(&hContext, 31337);
|
||||
m_CtxOpen(&hContext, test_value);
|
||||
RpcBindingFree(&hBinding);
|
||||
m_CtxHello(hContext);
|
||||
interact();
|
||||
m_CtxClose(&hContext);
|
||||
break;
|
||||
case 1:
|
||||
@@ -402,7 +419,7 @@ void main(int argc, char **argv)
|
||||
}
|
||||
RpcEndExcept
|
||||
|
||||
m_CtxOpen2(&hContext, 31337);
|
||||
m_CtxOpen2(&hContext, test_value);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
RpcTryExcept
|
||||
@@ -415,10 +432,13 @@ void main(int argc, char **argv)
|
||||
printf("NDRCContextMarshall(NULL) reported exception = %d\n", RpcExceptionCode());
|
||||
}
|
||||
RpcEndExcept
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
break;
|
||||
case 2:
|
||||
CtxOpen(&hContext, test_value);
|
||||
interact();
|
||||
ExitProcess(0);
|
||||
break;
|
||||
default:
|
||||
printf("Unknown test %d\n", test_num);
|
||||
}
|
||||
|
||||
@@ -6,19 +6,19 @@
|
||||
void CtxOpen( PCTXTYPE *pphContext,
|
||||
long Value)
|
||||
{
|
||||
printf("CtxOpen()\n");
|
||||
printf("CtxOpen(): Value=%d\n",Value);
|
||||
*pphContext = (PCTXTYPE)midl_user_allocate( sizeof(CTXTYPE) );
|
||||
**pphContext = Value;
|
||||
}
|
||||
|
||||
void CtxHello( PCTXTYPE phContext )
|
||||
{
|
||||
printf("Hello, World! Context value: %d\n", *phContext);
|
||||
printf("CtxHello(): Hello, World! Context value: %d\n", *phContext);
|
||||
}
|
||||
|
||||
void CtxClose(PCTXTYPE *pphContext )
|
||||
{
|
||||
printf("CtxClose()\n");
|
||||
printf("CtxClose(): %d\n", **pphContext);
|
||||
midl_user_free(*pphContext);
|
||||
*pphContext = NULL;
|
||||
}
|
||||
@@ -62,7 +62,8 @@ void main()
|
||||
void __RPC_USER PCTXTYPE_rundown(
|
||||
PCTXTYPE hContext)
|
||||
{
|
||||
printf("Context rundown \n");
|
||||
PCTXTYPE pCtx = (PCTXTYPE)hContext;
|
||||
printf("Context rundown: Value=%d \n", *pCtx);
|
||||
midl_user_free(hContext);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user