In addition to implementing Alexandre's advice to eliminate the rpcss.exe.so-specific environment-variable override by using PATH instead, this also adds the following: o Uses the midl-generated _c.c and _s.c files almost unmodified, using the macros from my previous patchset. o Supposedly supports linux/ppc -- this is the only other platform my MIDL supports. Other platforms should skip the test entirely via #ifdef's. Note that the difference between the PPC and W32 versions are quite small. This suggests widl could generate cross-platform proxy/stub code with #ifdef's around platform-specific portions, something MIDL doesn't do. o Now has separate server and client executables (the rpc test itself is the client, the server is to be found in dlls/rpcrt4/tests/stringinput_server. Depends on the seh_try_macros series of patches. A rollup of the seh_try_macros is enclosed as seh_try_macros-0to7.bz2. You will need to run autoconf after applying this patch. Note to Alexandre: I am not 100% sure I'm doing the right stuff with the Makefiles. You probably ought to review this part and decide if there is a better way to hook this into the wine build process. Note to Ove: widl_scraps.h contains those things that I needed, but which were not generated by midl. As you can see, it's quite short. As for the .acf thing: I think there is an option in MIDL to embed the .acf stuff right in the .idl... but I didn't use it yet. Let me know if I should switch to that approach, or at least try. License: X11 / Bugroff Changelog: * ./: configure.ac; ./dlls/kernel: kernel32.spec; ./dlls/rpcrt4: ndr_midl.c, rpc_server.c, rpcrt4_main.c, Makefile.in, rpcrt4.spec; ./dlls/rpcrt4/tests: Makefile.in, rpc.c, gen.sh (new), stringinput.acf (new), stringinput.h (new), widl_scraps.h (new), stringinput.idl (new), stringinput_x86_c.c (new), stringinput_ppc_c.c (new), RC.h (new), midlbat.bat (new); ./dlls/rpcrt4/tests/stringinput_server (new dir): stringinput_manager.c (new), stringinput_server_main.c (new), stringinput_x86_s.c (new), stringinput_ppc_s.c (new), Makefile.in (new); ./include: rpcndr.h, rpc.h, rpcdce.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. - route CmdBatNotification to NOOP (fixes batch-file execution under w2k's cmd.exe - a stub for RpcRaiseException - implement the RPC_BAD_STUB_DATA_EXCEPTION_FILTER macro - a little script to automate building the various _c and _s files. -- diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/configure.ac ./configure.ac --- ../wine.test/configure.ac 2003-01-14 23:40:20.000000000 -0600 +++ ./configure.ac 2003-01-19 21:54:42.000000000 -0600 @@ -1448,6 +1448,7 @@ dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile +dlls/rpcrt4/tests/stringinput_server/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/dlls/kernel/kernel32.spec ./dlls/kernel/kernel32.spec --- ../wine.test/dlls/kernel/kernel32.spec 2003-01-13 17:24:46.000000000 -0600 +++ ./dlls/kernel/kernel32.spec 2003-01-19 21:54:42.000000000 -0600 @@ -914,7 +914,7 @@ @ stub BaseAttachCompleteThunk @ stub BasepDebugDump @ stub CloseConsoleHandle -@ stub CmdBatNotification +@ stdcall CmdBatNotification() KERNEL_nop @ stub ConsoleMenuControl @ stub ConsoleSubst @ stub CreateVirtualBuffer diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/dlls/rpcrt4/Makefile.in ./dlls/rpcrt4/Makefile.in --- ../wine.test/dlls/rpcrt4/Makefile.in 2003-01-03 19:32:51.000000000 -0600 +++ ./dlls/rpcrt4/Makefile.in 2003-01-19 21:54:42.000000000 -0600 @@ -25,7 +25,7 @@ rpcrt4_main.c \ rpcss_np_client.c -SUBDIRS = tests +SUBDIRS = tests tests/stringinput_server @MAKE_DLL_RULES@ 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 2003-01-14 23:45:29.000000000 -0600 +++ ./dlls/rpcrt4/ndr_midl.c 2003-01-19 21:54:42.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 2003-01-14 23:45:29.000000000 -0600 +++ ./dlls/rpcrt4/rpc_server.c 2003-01-19 21:54:42.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.spec ./dlls/rpcrt4/rpcrt4.spec --- ../wine.test/dlls/rpcrt4/rpcrt4.spec 2002-12-02 23:52:12.000000000 -0600 +++ ./dlls/rpcrt4/rpcrt4.spec 2003-01-19 21:54:42.000000000 -0600 @@ -109,7 +109,7 @@ @ stub RpcObjectSetType @ stub RpcProtseqVectorFreeA @ stub RpcProtseqVectorFreeW -@ stub RpcRaiseException +@ stdcall RpcRaiseException(long) RpcRaiseException @ stub RpcRegisterAsyncInfo @ stub RpcRevertToSelf @ stub RpcRevertToSelfEx 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 2003-01-14 23:45:29.000000000 -0600 +++ ./dlls/rpcrt4/rpcrt4_main.c 2003-01-19 21:54:42.000000000 -0600 @@ -706,7 +706,6 @@ /* apparently it's not OK to use a constant string below */ CopyMemory(cmd, "rpcss", 6); - /* FIXME: will this do the right thing when run as a test? */ rslt = CreateProcessA( NULL, /* executable */ cmd, /* command line */ @@ -784,3 +783,20 @@ return TRUE; } + +/*********************************************************************** + * RpcRaiseException + * + * Raise an Exception. + * + * PARAMS + * exception [I] RPC_STATUS describing the "problem". + * + * RETURNS + * doesn't. + */ +void WINAPI RPC_ENTRY RpcRaiseException( RPC_STATUS exception ) +{ + FIXME("RpcRaiseException: stub, will assert(FALSE)\n"); + assert(FALSE); +} 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 2003-01-14 23:45:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/Makefile.in 2003-01-19 21:54:42.000000000 -0600 @@ -3,10 +3,12 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ TESTDLL = rpcrt4.dll -IMPORTS = rpcrt4 +IMPORTS = rpcrt4 ntdll CTESTS = \ - rpc.c + rpc.c \ + stringinput_ppc_c.c \ + stringinput_x86_c.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 2003-01-14 23:45:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/rpc.c 2003-01-19 22:52:17.000000000 -0600 @@ -18,14 +18,27 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <assert.h> #include "wine/test.h" #include <winbase.h> #include <winnt.h> #include <winerror.h> +#include <stdio.h> #include "wine/unicode.h" #include "rpc.h" +#include "stringinput.h" +#include "widl_scraps.h" + +/* appease testlist.c */ +void func_stringinput_x86_c(void) { } +void func_stringinput_ppc_c(void) { } + +/*************************************************************** + * 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 +132,127 @@ } } +/************************************************************* + * StringInput tests + */ + +#include "RC.h" + +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); +} + +void doStringInputClient(char *pszProtocolSequence) +{ + #if defined( __RPC_WIN32__ ) || ( defined( __RPC_MAC__ ) && defined( _MPPC_ ) ) + 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 = (char *)RandomCruds[cRCIndex]; + + /* hmm, perhaps StringReceive was not such a smart name... + here we are /sending/ the string. */ + StringReceive(theMessage); + } + + ShutdownServer(); + + status = RpcBindingFree(&stringinput_binding_handle); + ok( (!status), "RpcBindingFree failed"); + #endif /* __RPC_WIN32__ || ( __RPC_MAC__ && _MPPC_ ) */ +} + +#define HUGE_PATH 2000 + +/* here we define all the protocol sequences RPC currently works with. */ +static const int SPSCount = 1; +static const char *SupportedProtocolSequences[] = { + "ncalrpc" +}; + +/* this test implements the server side of the stringinput rpc server; + * it spawns the client side as a separate process (same exe). + */ +void StringInputViaRPC() +{ + #if defined( __RPC_WIN32__ ) || ( defined( __RPC_MAC__ ) && defined( _MPPC_ ) ) + const char *ForcePath = "..\\..\\..\\programs\\rpcss"; + UINT32 status; + unsigned char *pszProtocolSequence; + unsigned int PSIndex; + char buffer[HUGE_PATH], buffer2[HUGE_PATH]; + PROCESS_INFORMATION info; + STARTUPINFOA si; + + /* set the PATH environment variable to ensure we test from the build tree */ + ZeroMemory(buffer, HUGE_PATH); + ZeroMemory(buffer2, HUGE_PATH); + if ((status = GetEnvironmentVariableA("PATH", buffer, HUGE_PATH)) > 0) { + /* if this fails, you are probably a PATH abuser. trim it down. */ + assert((status + strlen(ForcePath) + 2) < HUGE_PATH); + sprintf(buffer2, "%s;%s", ForcePath, buffer); + SetEnvironmentVariableA("PATH", buffer2); + } else { + SetEnvironmentVariableA("PATH", ForcePath); + } + ZeroMemory(buffer, HUGE_PATH); + + for (PSIndex = 0; PSIndex < SPSCount; PSIndex++) { + pszProtocolSequence = (unsigned char *)SupportedProtocolSequences[PSIndex]; + + /* spawn the stringinput client process (ourselves, with different arguments) */ + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + sprintf(buffer, "stringinput_server\\stringinput_server.exe.so %s", pszProtocolSequence); + ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, 0L, NULL, NULL, &si, &info), "CreateProcess"); + + /* give it "plenty" of time to start up (TODO: find a better way) */ + Sleep(5000); + + doStringInputClient(pszProtocolSequence); + + /* make sure the server process shut down and succeeded */ + ok(WaitForSingleObject(info.hProcess, 10000) == WAIT_OBJECT_0, "Child process termination"); + + GetExitCodeProcess(info.hProcess, (LPDWORD)&status); + ok( (!status), "server process failed: %u", status ); + + CloseHandle(info.hProcess); + CloseHandle(info.hThread); + } + #endif /* __RPC_WIN32__ || ( __RPC_MAC__ && _MPPC_ ) */ +} + START_TEST( rpc ) { 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/rpc.h ./include/rpc.h --- ../wine.test/include/rpc.h 2003-01-15 20:50:29.000000000 -0600 +++ ./include/rpc.h 2003-01-19 21:54:42.000000000 -0600 @@ -25,8 +25,9 @@ #ifndef __WINE_RPC_H #define __WINE_RPC_H -#if defined(__PPC__) || defined(_MAC) /* ? */ +#if defined(__PPC__) /* ? */ #define __RPC_MAC__ + #define _MPPC_ /* FIXME: does this really belong here? */ #elif defined(_WIN64) #define __RPC_WIN64__ #else diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/include/rpcdce.h ./include/rpcdce.h --- ../wine.test/include/rpcdce.h 2003-01-03 19:32:52.000000000 -0600 +++ ./include/rpcdce.h 2003-01-19 21:54:42.000000000 -0600 @@ -282,6 +282,9 @@ RPCRTAPI int RPC_ENTRY UuidIsNil( UUID* Uuid, RPC_STATUS* Status_ ); +RPCRTAPI void RPC_ENTRY + RpcRaiseException( RPC_STATUS exception ); + #include "rpcdcep.h" #endif /*__WINE_RPCDCE_H */ diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/include/rpcndr.h ./include/rpcndr.h --- ../wine.test/include/rpcndr.h 2003-01-14 23:45:29.000000000 -0600 +++ ./include/rpcndr.h 2003-01-19 21:54:42.000000000 -0600 @@ -18,7 +18,7 @@ #ifndef __RPCNDR_H_VERSION__ /* FIXME: What version? Perhaps something is better than nothing, however incorrect */ -#define __RPCNDR_H_VERSION__ ( 399 ) +#define __RPCNDR_H_VERSION__ ( 440 ) #endif #ifndef __WINE_RPCNDR_H @@ -81,6 +81,13 @@ #define NDR_LOCAL_ENDIAN ((unsigned long) __NDR_LOCAL_ENDIAN) +#define RPC_BAD_STUB_DATA_EXCEPTION_FILTER ( \ + (RpcExceptionCode()==STATUS_ACCESS_VIOLATION) || \ + (RpcExceptionCode()==STATUS_DATATYPE_MISALIGNMENT) || \ + (RpcExceptionCode()==RPC_X_BAD_STUB_DATA) || \ + (RpcExceptionCode()==RPC_S_INVALID_BOUND) \ +) + #define TARGET_IS_NT50_OR_LATER 1 #define TARGET_IS_NT40_OR_LATER 1 #define TARGET_IS_NT351_OR_WIN95_OR_LATER 1 @@ -95,6 +102,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]; --- /dev/null 2002-11-28 07:03:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/RC.h 2003-01-19 22:52:04.000000000 -0600 @@ -0,0 +1,85 @@ +/* + * Unit test suite for rpc functions + * + * Copyright 2002 Greg Turner + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __RNDCRD_H_ +#define __RNDCRD_H_ + +#include <winnt.h> + +static const int RCCount = 10; +static const char *RandomCruds[] = { + "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,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDE30" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCD29" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABC28" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzAB27" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABC26" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCD25" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDE24" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDE23" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCD22" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABC21" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzAB20" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABC19" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCD18" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDE17" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCD16" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABC15" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzAB14" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABC13" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCD12" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDE11" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDE10" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEF9" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEF8" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEF7" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEF6" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEF5" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEF4" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEF3" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEF2" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEF1" + "<><><><><,.,.____&&&&&&_+-=_+-=_+jjjjjjj,.,.,><><><>,.,.<><????????abcdefghijklmnopqrstuvwxyzABCDEF0", + "", + "\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" +}; + +#endif /* __RNDCRD_ */ --- /dev/null 2002-11-28 07:03:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/gen.sh 2003-01-19 21:54:42.000000000 -0600 @@ -0,0 +1,72 @@ +#/bin/bash + +echorun() \ +{ \ + echo '>>>' $@ && \ + (echo " $@ " | bash -C -) +} +echorunsimple() \ +{ \ + echo '>>>' $@ && \ + $@ +} + +domidl() \ +{ \ + echo '*' && \ + echo '* generating' $1_$2 stub/proxy && \ + echo '*' && \ + echorun rm -rvf $1'_server/'$1'_'$2'_s.c' './'$1'_'$2'_c.c' workdir && \ + echorun mkdir workdir && \ + echorunsimple cd workdir && \ + echorun cp -v ../$1.{idl,acf} . + echorun wine --debugmsg -all cmd /c ..\\\\midlbat.bat /$3 $5 $6 $7 $8 $9 $1.idl && \ + echorun dos2unix $1'_'{s,c}.c && \ + echorun 'echo "#include \"rpc.h\"" >' $1'_'c.c.tmp && \ + echorun 'echo "#include \"rpc.h\"" >' $1'_'s.c.tmp && \ + echorun 'echo "#if defined(' $4 ')" >>' $1'_'c.c.tmp && \ + echorun 'echo "#if defined(' $4 ')" >>' $1'_'s.c.tmp && \ + echorun 'echo "#include \"widl_scraps.h\"" >>' $1'_'c.c.tmp && \ + echorun 'echo "#include \"widl_scraps.h\"" >>' $1'_'s.c.tmp && \ + echorun 'cat' $1'_c.c >>' $1'_'c.c.tmp && + echorun 'cat' $1'_s.c >>' $1'_'s.c.tmp && + echorun 'echo "#endif" /\*' $4 '\*/ >>' $1'_'c.c.tmp && \ + echorun 'echo "#endif" /\*' $4 '\*/ >>' $1'_'s.c.tmp && \ + echorun mv -v $1'_'c.c.tmp ../$1'_'$2'_c.c' && \ + echorun mv -v $1'_'s.c.tmp ../$1'_server/'$1'_'$2'_s.c' && \ + echorunsimple cd .. && \ + echorun rm -rvf workdir +} + +widlmidl() \ +{ \ + domidl $1 x86 win32 __RPC_WIN32__ $2 $3 $4 $5 $6 && \ + domidl $1 ppc powermac __RPC_MAC__ $2 $3 $4 $5 $6 && \ + echorun rm -vf $1.h && \ + echorun widl $1.idl +} + +echo '*' +echo '* gen.sh: bash script Used by Greg to generate stringinput_c.c, stringinput_s.c.' +echo '* Requires a working MIDL and undocumented environment variables and other stuff.' +echo '* FIXME: Due to some unidentified bug, wcmd (the wrapper) /c doesnt work yet, missing' +echo '* several of the command-line parameters I try to pass it. Probably I just did something' +echo '* stupid, but for now, I use native "cmd" to process the batch file. This also' +echo '* requires at least a working midl.exe and "c:\windows\system\vcvars32.bat", and' +echo '* something called "dos2unix". Of course, it also requires for wine to be installed.' +echo '*' +echo '* TODO: teach widl how to generate the stringinput_{c,s}.c and integrate properly with autothingies' +echo '*' +echo '!!!!! This will probably break your wine' +echo '!!!!! (or your hardware, for all I know)' +echo '!!!!!' +echo '!!!!! ************************' +echo '!!!!! *** PRESS ^C NOW !!! ***' +echo '!!!!! ************************' +echo '*' +echorun sleep 10 && \ +widlmidl stringinput /no_format_opt && \ +echo '*' && \ +echo '* Done' && \ +echo '*' + --- /dev/null 2002-11-28 07:03:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/midlbat.bat 2003-01-19 21:54:42.000000000 -0600 @@ -0,0 +1,4 @@ +echo off +echo (MIDLBAT.BAT... - expects to find C:\windows\system\vcvars32.bat!!) +call C:\windows\system\vcvars32.bat +midl %1 %2 %3 %4 %5 %6 %7 %8 %9 --- /dev/null 2002-11-28 07:03:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput.acf 2003-01-19 21:54:42.000000000 -0600 @@ -0,0 +1,4 @@ +[ implicit_handle(handle_t stringinput_binding_handle) ] +interface stringinput +{ +} --- /dev/null 2002-11-28 07:03:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput.h 2003-01-19 21:54:42.000000000 -0600 @@ -0,0 +1,24 @@ +/*** Autogenerated by WIDL 0.1 from stringinput.idl - Do not edit ***/ +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __WIDL_STRINGINPUT_H +#define __WIDL_STRINGINPUT_H +#ifdef __cplusplus +extern "C" { +#endif +/***************************************************************************** + * stringinput interface (v1.0) + */ +DEFINE_GUID(IID_stringinput, 0xcdf93a7e, 0x2622, 0x4ede, 0x99,0xb3, 0xaa,0x4a,0x0d,0xac,0x86,0x15); +extern RPC_IF_HANDLE stringinput_v1_0_c_ifspec; +extern RPC_IF_HANDLE stringinput_v1_0_s_ifspec; +void StringReceive( + unsigned char* thestring); +void ShutdownServer( + ); + +#ifdef __cplusplus +} +#endif +#endif /* __WIDL_STRINGINPUT_H */ --- /dev/null 2002-11-28 07:03:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput.idl 2003-01-19 21:54:42.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 2002-11-28 07:03:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput_ppc_c.c 2003-01-19 21:54:42.000000000 -0600 @@ -0,0 +1,214 @@ +#include "rpc.h" +#if defined( __RPC_MAC__ ) +#include "widl_scraps.h" +/* this ALWAYS GENERATED file contains the RPC client stubs */ + + +/* File created by MIDL compiler version 5.01.0164 */ +/* at Sun Jan 19 20:47:16 2003 + */ +/* Compiler settings for stringinput.idl: + Os (OptLev=s), W1, Zp2, env=PowerMac, ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data , no_format_optimization +*/ +//@@MIDL_FILE_HEADING( ) + +#include <string.h> +#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 stringinput_v1_0_c_ifspec = (RPC_IF_HANDLE)& stringinput___RpcClientInterface; + +extern const MIDL_STUB_DESC stringinput_StubDesc; + +static RPC_BINDING_HANDLE stringinput__MIDL_AutoBindHandle; + + +void 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); + } + RpcTryFinally + { + 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 ); + + } + RpcFinally + { + NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg ); + + } + RpcEndFinally + +} + + +void ShutdownServer( void) +{ + + RPC_BINDING_HANDLE _Handle = 0; + + RPC_MESSAGE _RpcMessage; + + MIDL_STUB_MESSAGE _StubMsg; + + RpcTryFinally + { + 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 ); + + } + RpcFinally + { + NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg ); + + } + RpcEndFinally + +} + + +static const MIDL_STUB_DESC stringinput_StubDesc = + { + (void __RPC_FAR *)& stringinput___RpcClientInterface, + MIDL_user_allocate, + MIDL_user_free, + &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_MAC__) || !defined(_MPPC_) +#error Invalid build platform for this stub. +#endif + +static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString = + { + 0, + { + + 0x4d, /* FC_IN_PARAM */ + 0x1, /* Stack size = 1 */ + +/* 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 + } + }; +#endif /* __RPC_MAC__ */ --- /dev/null 2002-11-28 07:03:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput_server/Makefile.in 2003-01-19 21:54:42.000000000 -0600 @@ -0,0 +1,18 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = stringinput_server.exe +APPMODE = cui +EXTRAINCL = -I.. +IMPORTS = ntdll kernel32 rpcrt4 + +C_SRCS = \ + stringinput_manager.c \ + stringinput_ppc_s.c \ + stringinput_server_main.c \ + stringinput_x86_s.c + +@MAKE_PROG_RULES@ + +### Dependencies: --- /dev/null 2002-11-28 07:03:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput_server/stringinput_manager.c 2003-01-19 22:52:47.000000000 -0600 @@ -0,0 +1,76 @@ +/* + * Unit test suite for rpc functions + * + * Copyright 2002 Greg Turner + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <assert.h> +#include <winbase.h> +#include <winnt.h> +#include <winerror.h> +#include <stdio.h> + +#include "wine/unicode.h" +#include "rpc.h" + +#include "stringinput.h" +#include "widl_scraps.h" + +static unsigned int sRCIndex; +static BOOL didfail; +BOOL DidFail() { return didfail; } + +#define HUGE_PATH 2000 + +#include "RC.h" + +void *__RPC_USER MIDL_user_allocate(size_t size) +{ + fprintf(stderr, "Wow, __MIDL_user_allocate was called.\n" ); + return malloc(size); +} + +void __RPC_USER MIDL_user_free(void *ptr) +{ + fprintf(stderr, "Wow, __MIDL_user_free was called.\n" ); + free(ptr); +} + + +/* StringInput "manager" routines (server-side implementations) */ +void StringReceive(unsigned char *msg) +{ + printf("received message: checking string %d\n", sRCIndex); + if (sRCIndex >= RCCount) { + fprintf(stderr, "RCCount limit\n"); + didfail = TRUE; + } else if (strcmp(msg, RandomCruds[sRCIndex++])) { + fprintf(stderr, "Crud mismatch\n"); + didfail = TRUE; + } +} + +void ShutdownServer() +{ + UINT32 status; + printf("Shutdown request received.\n"); + status = RpcMgmtStopServerListening(0); + if (status) { + fprintf(stderr, "RpcMgmtStopServerListening failed\n"); + didfail = TRUE; + } +} --- /dev/null 2002-11-28 07:03:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput_server/stringinput_ppc_s.c 2003-01-19 21:54:42.000000000 -0600 @@ -0,0 +1,222 @@ +#include "rpc.h" +#if defined( __RPC_MAC__ ) +#include "widl_scraps.h" +/* this ALWAYS GENERATED file contains the RPC server stubs */ + + +/* File created by MIDL compiler version 5.01.0164 */ +/* at Sun Jan 19 20:47:16 2003 + */ +/* Compiler settings for stringinput.idl: + Os (OptLev=s), W1, Zp2, env=PowerMac, ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data , no_format_optimization +*/ +//@@MIDL_FILE_HEADING( ) + +#include <string.h> +#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 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; + RpcTryFinally + { + RpcTryExcept + { + 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); + } + } + RpcExcept( RPC_BAD_STUB_DATA_EXCEPTION_FILTER ) + { + RpcRaiseException(RPC_X_BAD_STUB_DATA); + } + RpcEndExcept + + StringReceive(thestring); + + } + RpcFinally + { + } + RpcEndFinally + _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); + + RpcTryFinally + { + RpcTryExcept + { + if(_StubMsg.Buffer > _StubMsg.BufferEnd) + { + RpcRaiseException(RPC_X_BAD_STUB_DATA); + } + } + RpcExcept( RPC_BAD_STUB_DATA_EXCEPTION_FILTER ) + { + RpcRaiseException(RPC_X_BAD_STUB_DATA); + } + RpcEndExcept + + ShutdownServer(); + + } + RpcFinally + { + } + RpcEndFinally + _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, + 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_MAC__) || !defined(_MPPC_) +#error Invalid build platform for this stub. +#endif + +static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString = + { + 0, + { + + 0x4d, /* FC_IN_PARAM */ + 0x1, /* Stack size = 1 */ + +/* 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 + } + }; +#endif /* __RPC_MAC__ */ --- /dev/null 2002-11-28 07:03:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput_server/stringinput_server_main.c 2003-01-19 21:54:42.000000000 -0600 @@ -0,0 +1,104 @@ +/* + * Unit test suite for rpc functions + * + * Copyright 2002 Greg Turner + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <assert.h> +#include <winbase.h> +#include <winnt.h> +#include <winerror.h> +#include <stdio.h> + +#include "rpc.h" + +#include "stringinput.h" +#include "widl_scraps.h" + +extern BOOL DidFail(); + +/* implements the server side of the stringinput rpc server; + * it spawns the client side as a separate process (same exe). + */ +int main(int argc, char *argv[]) +{ + #if defined( __RPC_WIN32__ ) || ( defined( __RPC_MAC__ ) && defined( _MPPC_ ) ) + + unsigned int MaxCalls = 50; + UINT32 status; + unsigned char *pszProtocolSequence; + RPC_BINDING_VECTOR *pbvBindings; + + assert(argc > 1); + pszProtocolSequence = argv[1]; + + /* ready the stringinput server */ + status = RpcServerUseProtseq(pszProtocolSequence, MaxCalls ,0); + if (status) { + fprintf(stderr, "RpcServerUseProtseq failed\n"); + ExitProcess(2); + } + + status = RpcServerInqBindings(&pbvBindings); + if(status) { + fprintf(stderr, "RpcServerInqBindings failed\n"); + ExitProcess(3); + } + + status = RpcEpRegister(stringinput_v1_0_s_ifspec, pbvBindings, 0, 0); + if (status) { + fprintf(stderr, "RpcEpRegister failed\n"); + ExitProcess(4); + } + + status = RpcServerRegisterIf(stringinput_v1_0_s_ifspec, 0, 0); + if (status) { + fprintf(stderr, "RpcServerRegisterIf failed\n"); + ExitProcess(5); + } + + /* start stringinput services. termination should occur due to a call from the client */ + status = RpcServerListen(1, MaxCalls, 0); + if (status) { + fprintf(stderr, "RpcServerListen failed\n"); + ExitProcess(6); + } + + /* shut down stringinput server */ + status = RpcServerUnregisterIf(stringinput_v1_0_s_ifspec, 0, 0); + if (status) { + fprintf(stderr, "RpcServerUnregisterIf failed\n"); + ExitProcess(7); + } + + status = RpcEpUnregister(stringinput_v1_0_s_ifspec, pbvBindings, 0); + if (status) { + fprintf(stderr, "RpcEpUnregister failed\n"); + ExitProcess(8); + } + + status = RpcBindingVectorFree(&pbvBindings); + if (status) { + fprintf(stderr, "RpcBindingVectorFree failed\n"); + ExitProcess(9); + } + if (DidFail()) + ExitProcess(10); + + #endif /* __RPC_WIN32__ || ( __RPC_MAC__ && _MPPC_ ) */ + return 0; +} --- /dev/null 2002-11-28 07:03:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput_server/stringinput_x86_s.c 2003-01-19 21:54:42.000000000 -0600 @@ -0,0 +1,225 @@ +#include "rpc.h" +#if defined( __RPC_WIN32__ ) +#include "widl_scraps.h" +/* this ALWAYS GENERATED file contains the RPC server stubs */ + + +/* File created by MIDL compiler version 5.01.0164 */ +/* at Sun Jan 19 20:47:10 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> +#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 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; + RpcTryFinally + { + RpcTryExcept + { + 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); + } + } + RpcExcept( RPC_BAD_STUB_DATA_EXCEPTION_FILTER ) + { + RpcRaiseException(RPC_X_BAD_STUB_DATA); + } + RpcEndExcept + + StringReceive(thestring); + + } + RpcFinally + { + } + RpcEndFinally + _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); + + RpcTryFinally + { + RpcTryExcept + { + if(_StubMsg.Buffer > _StubMsg.BufferEnd) + { + RpcRaiseException(RPC_X_BAD_STUB_DATA); + } + } + RpcExcept( RPC_BAD_STUB_DATA_EXCEPTION_FILTER ) + { + RpcRaiseException(RPC_X_BAD_STUB_DATA); + } + RpcEndExcept + + ShutdownServer(); + + } + RpcFinally + { + } + RpcEndFinally + _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, + 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 + } + }; +#endif /* __RPC_WIN32__ */ --- /dev/null 2002-11-28 07:03:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/stringinput_x86_c.c 2003-01-19 21:54:42.000000000 -0600 @@ -0,0 +1,217 @@ +#include "rpc.h" +#if defined( __RPC_WIN32__ ) +#include "widl_scraps.h" +/* this ALWAYS GENERATED file contains the RPC client stubs */ + + +/* File created by MIDL compiler version 5.01.0164 */ +/* at Sun Jan 19 20:47:10 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> +#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 stringinput_v1_0_c_ifspec = (RPC_IF_HANDLE)& stringinput___RpcClientInterface; + +extern const MIDL_STUB_DESC stringinput_StubDesc; + +static RPC_BINDING_HANDLE stringinput__MIDL_AutoBindHandle; + + +void 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); + } + RpcTryFinally + { + 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 ); + + } + RpcFinally + { + NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg ); + + } + RpcEndFinally + +} + + +void ShutdownServer( void) +{ + + RPC_BINDING_HANDLE _Handle = 0; + + RPC_MESSAGE _RpcMessage; + + MIDL_STUB_MESSAGE _StubMsg; + + RpcTryFinally + { + 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 ); + + } + RpcFinally + { + NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg ); + + } + RpcEndFinally + +} + + +static const MIDL_STUB_DESC stringinput_StubDesc = + { + (void __RPC_FAR *)& stringinput___RpcClientInterface, + MIDL_user_allocate, + MIDL_user_free, + &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 + } + }; +#endif /* __RPC_WIN32__ */ --- /dev/null 2002-11-28 07:03:29.000000000 -0600 +++ ./dlls/rpcrt4/tests/widl_scraps.h 2003-01-19 21:54:42.000000000 -0600 @@ -0,0 +1,11 @@ +#ifndef __WINE_WIDL_SCRAPS +#define __WINE_WIDL_SCRAPS + +#include "rpcdce.h" + +extern handle_t stringinput_binding_handle; + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void __RPC_FAR * ); + +#endif /* __WINE_WIDL_SCRAPS */ -- gmt "Everything that is really great and inspiring is created by the individual who can labor in freedom." --Albert Einstein
Attachment:
seh_try_macros-0to7.bz2
Description: BZip2 compressed data