Administrivia: From now on, I'm naming these rpc-series patches using the more compact notation rpc_X##.diff. There is no rpc_K00.diff; I botched the numbers so this series gets to start at 01; subsequent series will continue the tradition of zero-indexing. Note that, if rpc_Xnn-r1 is ever labelled, it is a replacement for rpc_Xnn. Within a given letter designation, the idea is that you can run the latest "release" of a given numerical patch-level against CVS. So, if I made rpc_X00.diff, rpc_X01.diff, and rpc_X02.diff, the expectation would be that they be applied to CVS in that order. If some update to CVS broke rpc_X01.diff, I might release rpc_X01-r1.diff, which would "fix" the old rpc_X01 patchlevel. This scheme hasn't changed since the old naming scheme, but I thought I'd just remind others (myself?) what the point of these fancy names is supposed to be. I set out to build a test and encountered some bugs and missing functionality along the way, which are fixed with this patch. I used the "/prefix" option to MIDL, however, since widl doesn't support this, I used the MIDL-generated .h file, for now. License: X11 / Bugroff (http://tunes.org/legalese/bugroff.html) Changelog: * ./dlls/rpcrt4: ndr_midl.c, rpc_server.c, rpcrt4_main.c ./dlls/rpcrt4/tests: Makefile.in, rpc.c, gen.bat (new), stringinput.acf (new), stringinput.h (new), stringinput.idl (new), stringinput_c.c (new), stringinput_s.c (new) ./include: rpcndr.h ./programs/rpcss: rpcss.h: Greg Turner <gmturner007@ameritech.net> - add an actual cross-process RPC test, using MIDL-generated headers with some minor modifications for missing functionality - increase the default RPCSS timeout - add the NdrFc{Short,Long} macros - fix some handling of the End pointers for Ndr marshalling - fix some traces with missing \n's. -- diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/dlls/rpcrt4/ndr_midl.c ./dlls/rpcrt4/ndr_midl.c --- ../wine.test/dlls/rpcrt4/ndr_midl.c 2002-12-05 15:05:46.000000000 -0600 +++ ./dlls/rpcrt4/ndr_midl.c 2003-01-03 21:25:50.000000000 -0600 @@ -214,6 +214,7 @@ pStubMsg->RpcMsg = pRpcMsg; pStubMsg->Buffer = pRpcMsg->Buffer; pStubMsg->BufferLength = pRpcMsg->BufferLength; + pStubMsg->BufferEnd = pStubMsg->Buffer + pStubMsg->BufferLength; /* FIXME: determine the proper return value */ return NULL; @@ -236,8 +237,9 @@ return NULL; stubmsg->BufferLength = stubmsg->RpcMsg->BufferLength; - stubmsg->BufferEnd = stubmsg->BufferStart = 0; - return (stubmsg->Buffer = (unsigned char *)stubmsg->RpcMsg->Buffer); + stubmsg->Buffer = stubmsg->BufferStart = (unsigned char *)stubmsg->RpcMsg->Buffer; + stubmsg->BufferEnd = stubmsg->Buffer + stubmsg->BufferLength; + return (stubmsg->Buffer); } /*********************************************************************** * NdrFreeBuffer [RPCRT4.@] @@ -247,7 +249,7 @@ TRACE("(pStubMsg == ^%p): wild guess.\n", pStubMsg); I_RpcFreeBuffer(pStubMsg->RpcMsg); pStubMsg->BufferLength = 0; - pStubMsg->Buffer = (unsigned char *)(pStubMsg->RpcMsg->Buffer = NULL); + pStubMsg->Buffer = pStubMsg->BufferEnd = (unsigned char *)(pStubMsg->RpcMsg->Buffer = NULL); } /************************************************************************ diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/dlls/rpcrt4/rpc_server.c ./dlls/rpcrt4/rpc_server.c --- ../wine.test/dlls/rpcrt4/rpc_server.c 2002-10-31 20:13:50.000000000 -0600 +++ ./dlls/rpcrt4/rpc_server.c 2003-01-05 04:30:06.000000000 -0600 @@ -458,7 +458,7 @@ */ RPC_STATUS WINAPI RpcServerUseProtseqA(LPSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor) { - TRACE("(Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)", debugstr_a(Protseq), MaxCalls, SecurityDescriptor); + TRACE("(Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)\n", debugstr_a(Protseq), MaxCalls, SecurityDescriptor); return RpcServerUseProtseqEpA(Protseq, MaxCalls, NULL, SecurityDescriptor); } @@ -467,7 +467,7 @@ */ RPC_STATUS WINAPI RpcServerUseProtseqW(LPWSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor) { - TRACE("Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)", debugstr_w(Protseq), MaxCalls, SecurityDescriptor); + TRACE("Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)\n", debugstr_w(Protseq), MaxCalls, SecurityDescriptor); return RpcServerUseProtseqEpW(Protseq, MaxCalls, NULL, SecurityDescriptor); } diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/dlls/rpcrt4/rpcrt4_main.c ./dlls/rpcrt4/rpcrt4_main.c --- ../wine.test/dlls/rpcrt4/rpcrt4_main.c 2002-12-23 19:09:52.000000000 -0600 +++ ./dlls/rpcrt4/rpcrt4_main.c 2003-01-05 04:49:26.000000000 -0600 @@ -696,17 +696,20 @@ { PROCESS_INFORMATION pi; STARTUPINFOA si; - static char cmd[6]; + static char cmd[MAX_PATH], ev[MAX_PATH]; BOOL rslt; + ZeroMemory(cmd, MAX_PATH); ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); ZeroMemory(&si, sizeof(STARTUPINFOA)); + si.cb = sizeof(STARTUPINFOA); - /* apparently it's not OK to use a constant string below */ - CopyMemory(cmd, "rpcss", 6); + if (GetEnvironmentVariableA("WINERPCSS", ev, MAX_PATH) > 0) + CopyMemory(cmd, ev, strlen(ev)); + else + CopyMemory(cmd, "rpcss", 6); - /* FIXME: will this do the right thing when run as a test? */ rslt = CreateProcessA( NULL, /* executable */ cmd, /* command line */ diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/dlls/rpcrt4/tests/Makefile.in ./dlls/rpcrt4/tests/Makefile.in --- ../wine.test/dlls/rpcrt4/tests/Makefile.in 2002-10-07 16:54:07.000000000 -0500 +++ ./dlls/rpcrt4/tests/Makefile.in 2003-01-03 21:25:50.000000000 -0600 @@ -6,7 +6,9 @@ IMPORTS = rpcrt4 CTESTS = \ - rpc.c + rpc.c \ + stringinput_c.c \ + stringinput_s.c @MAKE_TEST_RULES@ diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/dlls/rpcrt4/tests/rpc.c ./dlls/rpcrt4/tests/rpc.c --- ../wine.test/dlls/rpcrt4/tests/rpc.c 2002-12-23 19:09:52.000000000 -0600 +++ ./dlls/rpcrt4/tests/rpc.c 2003-01-05 04:58:21.000000000 -0600 @@ -22,10 +22,42 @@ #include <winbase.h> #include <winnt.h> #include <winerror.h> +#include <stdio.h> #include "wine/unicode.h" #include "rpc.h" +#include "stringinput.h" + +static char base[MAX_PATH]; +static char selfname[MAX_PATH]; + +static int myARGC; +static char** myARGV; + +/* appease testlist.c */ +void func_stringinput_c(void) { } +void func_stringinput_s(void) { } + +/****************************************************************** + * init + * + * generates basic information like: + * base: absolute path to curr dir + * selfname: the way to reinvoke ourselves + */ +static int init(void) +{ + myARGC = winetest_get_mainargs( &myARGV ); + if (!GetCurrentDirectoryA(sizeof(base), base)) return 0; + strcpy(selfname, myARGV[0]); + return 1; +} + +/*************************************************************** + * UUID Tests + */ + static UUID Uuid_Table[10] = { { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }, /* 0 (null) */ { 0xdeadbeef, 0xdead, 0xbeef, {0x10, 0x21, 0x35, 0x56, 0x89, 0xa0, 0xf4, 0x8a} }, /* 1 */ @@ -119,8 +151,221 @@ } } +/************************************************************* + * StringInput tests + */ + +/* here we define all the protocol sequences RPC currently works with. */ +#define SPSCount 1 +static char *SupportedProtocolSequences[SPSCount] = { + "ncalrpc" +}; + +#define RCCount 10 +static char *RandomCruds[RCCount] = { + "This is just some random crud", + "Designed \r\n to \r\n test \n", + "098172365 the RPC capabilities", + "!#$^*@%$*()*)", + "of this thing.\n", + "x", + "blabalbablab ablab abla", + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEFG", + "", + "\001\002\003\004\005\006\007\008\009\010\011\012\013\014\015\016" + "\017\018\019\020\021\022\023\024\025\026\027\028\029\030\031\032" + "\033\034\035\036\037\038\039\040\041\042\043\044\045\046\047\048" + "\049\050\051\052\053\054\055\056\057\058\059\060\061\062\063\064" + "\065\066\067\068\069\070\071\072\073\074\075\076\077\078\079\080" + "\081\082\083\084\085\086\087\088\089\090\091\092\093\094\095\096" + "\097\098\099\100\101\102\103\104\105\106\107\108\109\110\111\112" + "\113\114\115\116\117\118\119\120\121\122\123\124\125\126\127\128" + "\129\130\131\132\133\134\135\136\137\138\139\140\141\142\143\144" + "\145\146\147\148\149\150\151\152\153\154\155\156\157\158\159\160" + "\161\162\163\164\165\166\167\168\169\170\171\172\173\174\175\176" + "\177\178\179\180\181\182\183\184\185\186\187\188\189\190\191\192" + "\193\194\195\196\197\198\199\200\201\202\203\204\205\206\207\208" + "\209\210\211\212\213\214\215\216\217\218\219\220\221\222\223\224" + "\225\226\227\228\229\230\231\232\233\234\235\236\237\238\239\240" + "\241\242\243\244\245\246\247\248\249\250\251\252\253\254\255" +}; + +unsigned int sRCIndex; + +void *__RPC_USER MIDL_user_allocate(size_t size) +{ + trace ( "Wow, __MIDL_user_allocate was called.\n" ); + return malloc(size); +} + +void __RPC_USER MIDL_user_free(void *ptr) +{ + trace ( "Wow, __MIDL_user_free was called.\n" ); + free(ptr); +} + +/* this test implements the server side of the stringinput rpc server; + * it spawns the client side as a separate process (same exe). + */ +void StringInputViaRPC() +{ + unsigned int MaxCalls = 50; + unsigned int PSIndex; + UINT32 status; + unsigned char *pszProtocolSequence; + RPC_BINDING_VECTOR *pbvBindings; + char buffer[MAX_PATH]; + PROCESS_INFORMATION info; + STARTUPINFOA si; + + /* set the WINERPCSS environment variable to ensure we test from the build tree */ + SetEnvironmentVariableA("WINERPCSS", "..\\..\\..\\programs\\rpcss\\rpcss.exe.so -t 15"); + + for (PSIndex = 0; PSIndex < SPSCount; PSIndex++) { + pszProtocolSequence = SupportedProtocolSequences[PSIndex]; + + /* ready the stringinput server */ + status = RpcServerUseProtseq(pszProtocolSequence, MaxCalls ,0); + ok( (!status), "RpcServerUseProtseq failed" ); + + status = RpcServerInqBindings(&pbvBindings); + ok( (!status), "RpcServerInqBindings failed" ); + + status = RpcEpRegister(si_manager_stringinput_v1_0_s_ifspec, pbvBindings, 0, 0); + ok( (!status), "RpcEpRegister failed" ); + + status = RpcServerRegisterIf(si_manager_stringinput_v1_0_s_ifspec, 0, 0); + ok( (!status), "RpcServerRegisterIf failed" ); + + /* spawn the stringinput client process (ourselves, with different arguments) */ + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + + sprintf(buffer, "%s tests/rpc.c stringinput %s", selfname, pszProtocolSequence); + ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, 0L, NULL, NULL, &si, &info), "CreateProcess"); + + /* init the expected server inputs */ + sRCIndex = 0; + + /* start stringinput services. termination should occur due to a call from the client */ + status = RpcServerListen(1, MaxCalls, 0); + ok( (!status), "RpcServerListen failed"); + + /* make sure the client process shut down and succeeded */ + ok(WaitForSingleObject(info.hProcess, 5000) == WAIT_OBJECT_0, "Child process termination"); + + /* FIXME: this doesn't seem to work as expected, why? */ + GetExitCodeProcess(info.hProcess, (LPDWORD)&status); + ok( (!status), "Client process failed" ); + + CloseHandle(info.hProcess); + CloseHandle(info.hThread); + + /* shut down stringinput server */ + status = RpcServerUnregisterIf(si_manager_stringinput_v1_0_s_ifspec, 0, 0); + ok( (!status), "RpcServerUnregisterIf failed"); + + status = RpcEpUnregister(si_manager_stringinput_v1_0_s_ifspec, pbvBindings, 0); + ok( (!status), "RpcEpUnregister failed"); + + status = RpcBindingVectorFree(&pbvBindings); + ok( (!status), "RpcBindingVectorFree failed"); + } +} + +void doStringInputClient(char *pszProtocolSequence) +{ + UINT32 status; + LPSTR pszStringBinding; + char *theMessage; + unsigned int cRCIndex; + + trace( "String Input Client is running with PS %s.\n", pszProtocolSequence ); + + /* prepare ourselves to be the client */ + status = RpcStringBindingComposeA(0, pszProtocolSequence, NULL, NULL, 0, &pszStringBinding); + ok( (!status), "RpcStringBindingCompose failed"); + + status = RpcBindingFromStringBindingA(pszStringBinding, &stringinput_binding_handle); + + ok( (!status), "RpcBindingFromStringBinding failed"); + + status = RpcStringFreeA((unsigned char**)&pszStringBinding); + ok( (!status), "RpcStringFree failed"); + + for (cRCIndex = 0; cRCIndex < RCCount; cRCIndex++) { + theMessage = RandomCruds[cRCIndex]; + + /* hmm, perhaps StringReceive was not such a smart name... + here we are /sending/ the string. */ + si_entry_StringReceive(theMessage); + } + + si_entry_ShutdownServer(); + + status = RpcBindingFree(&stringinput_binding_handle); + ok( (!status), "RpcBindingFree failed"); +} + +/* StringInput "manager" routines (server-side implementations) */ +void si_manager_StringReceive(unsigned char *msg) +{ + trace( "received message: checking string %d\n", sRCIndex); + ok( (sRCIndex < RCCount), "too many messages received"); + ok( (!strcmp(msg, RandomCruds[sRCIndex++])), "message mismatch"); +} + +void si_manager_ShutdownServer() +{ + UINT32 status; + trace( "Shutdown request received.\n" ); + status = RpcMgmtStopServerListening(0); + ok( (!status), "RpcMgmtStopServerListening failed"); +} + START_TEST( rpc ) { + int b = init(); + ok(b, "Basic init of RPC test"); + if (!b) return; + + if ((myARGC >= 4) && (!strcmp(myARGV[2], "stringinput"))) { + doStringInputClient(myARGV[3]); + return; + } + trace ( " ** Uuid Conversion and Comparison Tests **\n" ); UuidConversionAndComparison(); + trace ( " ** StringInput via RPC Tests **\n" ); + StringInputViaRPC(); } diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/include/rpcndr.h ./include/rpcndr.h --- ../wine.test/include/rpcndr.h 2002-12-02 23:52:12.000000000 -0600 +++ ./include/rpcndr.h 2003-01-03 21:25:51.000000000 -0600 @@ -95,6 +95,10 @@ #define __RPC_CALLEE WINAPI #define RPC_VAR_ENTRY WINAPIV +#define NdrFcShort(s) (unsigned char)(s & 0xff), (unsigned char)(s >> 8) +#define NdrFcLong(s) (unsigned char)(s & 0xff), (unsigned char)((s & 0x0000ff00) >> 8), \ + (unsigned char)((s & 0x00ff0000) >> 16), (unsigned char)(s >> 24) + typedef struct { void *pad[2]; diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/programs/rpcss/rpcss.h ./programs/rpcss/rpcss.h --- ../wine.test/programs/rpcss/rpcss.h 2002-12-02 15:17:04.000000000 -0600 +++ ./programs/rpcss/rpcss.h 2003-01-05 04:41:33.000000000 -0600 @@ -25,7 +25,7 @@ #include "windows.h" /* in seconds */ -#define RPCSS_DEFAULT_MAX_LAZY_TIMEOUT 30 +#define RPCSS_DEFAULT_MAX_LAZY_TIMEOUT 60 /* rpcss_main.c */ HANDLE RPCSS_GetMasterMutex(void); --- /dev/null 1969-12-31 18:00:00.000000000 -0600 +++ ./dlls/rpcrt4/tests/gen.bat 2003-01-04 23:28:12.000000000 -0600 @@ -0,0 +1,13 @@ +echo off +echo GEN.BAT +echo * +echo Used by Greg to generate stringinput_c.c, stringinput_h.c. +echo * +echo FIXME +echo * +echo DO NOT RUN ME UNLESS YOU KNOW WHAT YOU ARE DOING +echo PRESS CTRL-C OTHERWISE. +echo * +pause +call c:\windows\system\vcvars32.bat +midl /prefix client si_entry_ /prefix server si_manager_ /no_format_opt stringinput.idl --- /dev/null 1969-12-31 18:00:00.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput.acf 2003-01-04 15:10:55.000000000 -0600 @@ -0,0 +1,4 @@ +[ implicit_handle(handle_t stringinput_binding_handle) ] +interface stringinput +{ +} --- /dev/null 1969-12-31 18:00:00.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput.h 2003-01-05 05:00:44.000000000 -0600 @@ -0,0 +1,74 @@ +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + +/* File created by MIDL compiler version 5.01.0164 */ +/* at Sun Jan 05 03:00:57 2003 + */ +/* Compiler settings for stringinput.idl: + Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data , no_format_optimization +*/ +//@@MIDL_FILE_HEADING( ) + + +/* verify that the <rpcndr.h> version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 440 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __stringinput_h__ +#define __stringinput_h__ + +#ifdef __cplusplus +extern "C"{ +#endif + +/* Forward Declarations */ + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void __RPC_FAR * ); + +#ifndef __stringinput_INTERFACE_DEFINED__ +#define __stringinput_INTERFACE_DEFINED__ + +/* interface stringinput */ +/* [implicit_handle][version][uuid] */ + +/* client prototype */ +void si_entry_StringReceive( + /* [ref][string][in] */ unsigned char __RPC_FAR *thestring); +/* server prototype */ +void si_manager_StringReceive( + /* [ref][string][in] */ unsigned char __RPC_FAR *thestring); +/* switch prototype */ +void StringReceive( + /* [ref][string][in] */ unsigned char __RPC_FAR *thestring); + +/* client prototype */ +void si_entry_ShutdownServer( void); +/* server prototype */ +void si_manager_ShutdownServer( void); +/* switch prototype */ +void ShutdownServer( void); + + +extern handle_t stringinput_binding_handle; + + +extern RPC_IF_HANDLE si_entry_stringinput_v1_0_c_ifspec; +extern RPC_IF_HANDLE stringinput_v1_0_c_ifspec; +extern RPC_IF_HANDLE si_manager_stringinput_v1_0_s_ifspec; +#endif /* __stringinput_INTERFACE_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif --- /dev/null 1969-12-31 18:00:00.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput.idl 2003-01-04 15:11:12.000000000 -0600 @@ -0,0 +1,15 @@ +/* + * this defines a super-simple RPC service which passes a + * single string to the server and returns nothing. + */ + +[ + uuid(cdf93a7e-2622-4ede-99b3-aa4a0dac8615), + version(1.0) +] + +interface stringinput +{ +void StringReceive([in, string, ref] unsigned char *thestring); +void ShutdownServer(void); +} --- /dev/null 1969-12-31 18:00:00.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput_c.c 2003-01-05 05:01:13.000000000 -0600 @@ -0,0 +1,232 @@ +/* this ALWAYS GENERATED file contains the RPC client stubs */ + + +/* File created by MIDL compiler version 5.01.0164 */ +/* at Sat Jan 04 23:37:58 2003 + */ +/* Compiler settings for stringinput.idl: + Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data , no_format_optimization +*/ +//@@MIDL_FILE_HEADING( ) + +#include <string.h> + +/* warning: slightly hacked on by greg: + * all #if 0's, and the following two + * lines, deviate from midl's output + */ +#include <assert.h> +#define RpcRaiseException(xyz) assert(FALSE) + +#if defined( _ALPHA_ ) +#include <stdarg.h> +#endif + +#include "stringinput.h" + +#define TYPE_FORMAT_STRING_SIZE 7 +#define PROC_FORMAT_STRING_SIZE 9 + +typedef struct _MIDL_TYPE_FORMAT_STRING + { + short Pad; + unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; + } MIDL_TYPE_FORMAT_STRING; + +typedef struct _MIDL_PROC_FORMAT_STRING + { + short Pad; + unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; + } MIDL_PROC_FORMAT_STRING; + + +extern const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString; +extern const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString; + +/* Standard interface: stringinput, ver. 1.0, + GUID={0xcdf93a7e,0x2622,0x4ede,{0x99,0xb3,0xaa,0x4a,0x0d,0xac,0x86,0x15}} */ + +handle_t stringinput_binding_handle; + + +static const RPC_CLIENT_INTERFACE stringinput___RpcClientInterface = + { + sizeof(RPC_CLIENT_INTERFACE), + {{0xcdf93a7e,0x2622,0x4ede,{0x99,0xb3,0xaa,0x4a,0x0d,0xac,0x86,0x15}},{1,0}}, + {{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}, + 0, + 0, + 0, + 0, + 0, + 0 + }; +RPC_IF_HANDLE si_entry_stringinput_v1_0_c_ifspec = (RPC_IF_HANDLE)& stringinput___RpcClientInterface; + +extern const MIDL_STUB_DESC stringinput_StubDesc; + +/* Greg commented this to avoid a 'not used' warning. */ +/* static RPC_BINDING_HANDLE stringinput__MIDL_AutoBindHandle; */ + + +void si_entry_StringReceive( + /* [ref][string][in] */ unsigned char __RPC_FAR *thestring) +{ + + RPC_BINDING_HANDLE _Handle = 0; + + RPC_MESSAGE _RpcMessage; + + MIDL_STUB_MESSAGE _StubMsg; + + if(!thestring) + { + RpcRaiseException(RPC_X_NULL_REF_POINTER); + } + #if 0 + RpcTryFinally + { + #endif + NdrClientInitializeNew( + ( PRPC_MESSAGE )&_RpcMessage, + ( PMIDL_STUB_MESSAGE )&_StubMsg, + ( PMIDL_STUB_DESC )&stringinput_StubDesc, + 0); + + + _Handle = stringinput_binding_handle; + + + _StubMsg.BufferLength = 12U; + NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg, + (unsigned char __RPC_FAR *)thestring, + (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[4] ); + + NdrGetBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg, _StubMsg.BufferLength, _Handle ); + + NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg, + (unsigned char __RPC_FAR *)thestring, + (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[4] ); + + NdrSendReceive( (PMIDL_STUB_MESSAGE) &_StubMsg, (unsigned char __RPC_FAR *) _StubMsg.Buffer ); + + #if 0 + } + RpcFinally + { + #endif + NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg ); + #if 0 + } + RpcEndFinally + #endif +} + + +void si_entry_ShutdownServer( void) +{ + + RPC_BINDING_HANDLE _Handle = 0; + + RPC_MESSAGE _RpcMessage; + + MIDL_STUB_MESSAGE _StubMsg; + #if 0 + RpcTryFinally + { + #endif + NdrClientInitializeNew( + ( PRPC_MESSAGE )&_RpcMessage, + ( PMIDL_STUB_MESSAGE )&_StubMsg, + ( PMIDL_STUB_DESC )&stringinput_StubDesc, + 1); + + + _Handle = stringinput_binding_handle; + + + _StubMsg.BufferLength = 0U; + NdrGetBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg, _StubMsg.BufferLength, _Handle ); + + NdrSendReceive( (PMIDL_STUB_MESSAGE) &_StubMsg, (unsigned char __RPC_FAR *) _StubMsg.Buffer ); + + #if 0 + } + RpcFinally + { + #endif + NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg ); + + #if 0 + } + RpcEndFinally + #endif + +} + + +static const MIDL_STUB_DESC stringinput_StubDesc = + { + (void __RPC_FAR *)& stringinput___RpcClientInterface, + MIDL_user_allocate, + MIDL_user_free, + /* bracketed to avoid compiler warning, presumably caused by union in our struct? */ + { &stringinput_binding_handle }, + 0, + 0, + 0, + 0, + __MIDL_TypeFormatString.Format, + 1, /* -error bounds_check flag */ + 0x10001, /* Ndr library version */ + 0, + 0x50100a4, /* MIDL Version 5.1.164 */ + 0, + 0, + 0, /* notify & notify_flag routine table */ + 1, /* Flags */ + 0, /* Reserved3 */ + 0, /* Reserved4 */ + 0 /* Reserved5 */ + }; + +#if !defined(__RPC_WIN32__) +#error Invalid build platform for this stub. +#endif + +static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString = + { + 0, + { + + 0x4d, /* FC_IN_PARAM */ +#ifndef _ALPHA_ + 0x1, /* x86, MIPS & PPC Stack size = 1 */ +#else + 0x2, /* Alpha Stack size = 2 */ +#endif +/* 2 */ NdrFcShort( 0x2 ), /* Type Offset=2 */ +/* 4 */ 0x5b, /* FC_END */ + 0x5c, /* FC_PAD */ +/* 6 */ 0x5b, /* FC_END */ + 0x5c, /* FC_PAD */ + + 0x0 + } + }; + +static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString = + { + 0, + { + NdrFcShort( 0x0 ), /* 0 */ +/* 2 */ + 0x11, 0x8, /* FC_RP [simple_pointer] */ +/* 4 */ + 0x22, /* FC_C_CSTRING */ + 0x5c, /* FC_PAD */ + + 0x0 + } + }; --- /dev/null 1969-12-31 18:00:00.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput_s.c 2003-01-05 05:00:59.000000000 -0600 @@ -0,0 +1,241 @@ +/* this ALWAYS GENERATED file contains the RPC server stubs */ + + +/* File created by MIDL compiler version 5.01.0164 */ +/* at Sat Jan 04 23:37:58 2003 + */ +/* Compiler settings for stringinput.idl: + Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data , no_format_optimization +*/ +//@@MIDL_FILE_HEADING( ) + +#include <string.h> + +/* warning: slightly hacked on by greg: + * all #if 0's, and the following two + * lines, deviate from midl's output + */ +#include <assert.h> +#define RpcRaiseException(xyz) assert(FALSE) + +#include "stringinput.h" + +#define TYPE_FORMAT_STRING_SIZE 7 +#define PROC_FORMAT_STRING_SIZE 9 + +typedef struct _MIDL_TYPE_FORMAT_STRING + { + short Pad; + unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; + } MIDL_TYPE_FORMAT_STRING; + +typedef struct _MIDL_PROC_FORMAT_STRING + { + short Pad; + unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; + } MIDL_PROC_FORMAT_STRING; + +extern const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString; +extern const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString; + +/* Standard interface: stringinput, ver. 1.0, + GUID={0xcdf93a7e,0x2622,0x4ede,{0x99,0xb3,0xaa,0x4a,0x0d,0xac,0x86,0x15}} */ + + +extern RPC_DISPATCH_TABLE stringinput_v1_0_DispatchTable; + +static const RPC_SERVER_INTERFACE stringinput___RpcServerInterface = + { + sizeof(RPC_SERVER_INTERFACE), + {{0xcdf93a7e,0x2622,0x4ede,{0x99,0xb3,0xaa,0x4a,0x0d,0xac,0x86,0x15}},{1,0}}, + {{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}, + &stringinput_v1_0_DispatchTable, + 0, + 0, + 0, + 0, + 0 + }; +RPC_IF_HANDLE si_manager_stringinput_v1_0_s_ifspec = (RPC_IF_HANDLE)& stringinput___RpcServerInterface; + +extern const MIDL_STUB_DESC stringinput_StubDesc; + +void __RPC_STUB +stringinput_StringReceive( + PRPC_MESSAGE _pRpcMessage ) +{ + MIDL_STUB_MESSAGE _StubMsg; + unsigned char __RPC_FAR *thestring; + RPC_STATUS _Status; + + ((void)(_Status)); + NdrServerInitializeNew( + _pRpcMessage, + &_StubMsg, + &stringinput_StubDesc); + + ( unsigned char __RPC_FAR * )thestring = 0; + #if 0 + RpcTryFinally + { + RpcTryExcept + { + #endif + if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION ) + NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0] ); + + NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg, + (unsigned char __RPC_FAR * __RPC_FAR *)&thestring, + (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[4], + (unsigned char)0 ); + + if(_StubMsg.Buffer > _StubMsg.BufferEnd) + { + RpcRaiseException(RPC_X_BAD_STUB_DATA); + } + #if 0 + } + RpcExcept( RPC_BAD_STUB_DATA_EXCEPTION_FILTER ) + { + RpcRaiseException(RPC_X_BAD_STUB_DATA); + } + RpcEndExcept + #endif + + si_manager_StringReceive(thestring); + + #if 0 + } + RpcFinally + { + } + RpcEndFinally + #endif + _pRpcMessage->BufferLength = + (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer); + +} + +void __RPC_STUB +stringinput_ShutdownServer( + PRPC_MESSAGE _pRpcMessage ) +{ + MIDL_STUB_MESSAGE _StubMsg; + RPC_STATUS _Status; + + ((void)(_Status)); + NdrServerInitializeNew( + _pRpcMessage, + &_StubMsg, + &stringinput_StubDesc); + + #if 0 + RpcTryFinally + { + RpcTryExcept + { + #endif + if(_StubMsg.Buffer > _StubMsg.BufferEnd) + { + RpcRaiseException(RPC_X_BAD_STUB_DATA); + } + #if 0 + } + RpcExcept( RPC_BAD_STUB_DATA_EXCEPTION_FILTER ) + { + RpcRaiseException(RPC_X_BAD_STUB_DATA); + } + RpcEndExcept + #endif + si_manager_ShutdownServer(); + + #if 0 + } + RpcFinally + { + } + RpcEndFinally + #endif + _pRpcMessage->BufferLength = + (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer); + +} + + +static const MIDL_STUB_DESC stringinput_StubDesc = + { + (void __RPC_FAR *)& stringinput___RpcServerInterface, + MIDL_user_allocate, + MIDL_user_free, + /* Greg added these brackets to avoid a compiler warning. */ + { 0 }, + 0, + 0, + 0, + 0, + __MIDL_TypeFormatString.Format, + 1, /* -error bounds_check flag */ + 0x10001, /* Ndr library version */ + 0, + 0x50100a4, /* MIDL Version 5.1.164 */ + 0, + 0, + 0, /* notify & notify_flag routine table */ + 1, /* Flags */ + 0, /* Reserved3 */ + 0, /* Reserved4 */ + 0 /* Reserved5 */ + }; + +static RPC_DISPATCH_FUNCTION stringinput_table[] = + { + stringinput_StringReceive, + stringinput_ShutdownServer, + 0 + }; +RPC_DISPATCH_TABLE stringinput_v1_0_DispatchTable = + { + 2, + stringinput_table + }; + +#if !defined(__RPC_WIN32__) +#error Invalid build platform for this stub. +#endif + +static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString = + { + 0, + { + + 0x4d, /* FC_IN_PARAM */ +#ifndef _ALPHA_ + 0x1, /* x86, MIPS & PPC Stack size = 1 */ +#else + 0x2, /* Alpha Stack size = 2 */ +#endif +/* 2 */ NdrFcShort( 0x2 ), /* Type Offset=2 */ +/* 4 */ 0x5b, /* FC_END */ + 0x5c, /* FC_PAD */ +/* 6 */ 0x5b, /* FC_END */ + 0x5c, /* FC_PAD */ + + 0x0 + } + }; + +static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString = + { + 0, + { + NdrFcShort( 0x0 ), /* 0 */ +/* 2 */ + 0x11, 0x8, /* FC_RP [simple_pointer] */ +/* 4 */ + 0x22, /* FC_C_CSTRING */ + 0x5c, /* FC_PAD */ + + 0x0 + } + }; -- gmt "It does not take a majority to prevail ... but rather an irate, tireless minority, keen on setting brushfires of freedom in the minds of men." --Samuel Adams, Patriot