diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/ole32/dcomss/objex/shrmem/client | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to 'private/ole32/dcomss/objex/shrmem/client')
-rw-r--r-- | private/ole32/dcomss/objex/shrmem/client/clt.cxx | 227 | ||||
-rw-r--r-- | private/ole32/dcomss/objex/shrmem/client/makefile | 1 | ||||
-rw-r--r-- | private/ole32/dcomss/objex/shrmem/client/sources | 109 |
3 files changed, 337 insertions, 0 deletions
diff --git a/private/ole32/dcomss/objex/shrmem/client/clt.cxx b/private/ole32/dcomss/objex/shrmem/client/clt.cxx new file mode 100644 index 000000000..cd2c094e5 --- /dev/null +++ b/private/ole32/dcomss/objex/shrmem/client/clt.cxx @@ -0,0 +1,227 @@ + +#include <or.hxx> +#include <simpleLL.hxx> + +handle_t SMTBinding; + +DECLARE_INFOLEVEL(Cairole) + +void +ClientSetup() +{ + WCHAR other[10]; + RPC_STATUS status = 1; + RPC_NS_HANDLE ImportContext = NULL; + TCHAR * pszStringBinding = NULL; + + /* + + printf("Other = "); + scanf("%S",other); + + WCHAR* entryName = catenate(TEXT("/.:/ShareTest"),other); + + status = RpcNsBindingImportBegin( + NULL, + entryName, + SharedMemoryTest_ClientIfHandle, + NULL, + &ImportContext + ); + + printf("RpcNsBindingImportBegin returned 0x%x\n", status); + if (status) + exit(status); + + if (!ImportContext) { + printf("No Import Context Available", status); + exit(1); + } + + status = RpcNsBindingImportNext( + ImportContext, + &SMTBinding); + + printf("RpcNsBindingImportNext returned 0x%x\n", status); + + if (!status) { + RpcBindingToStringBinding( + SMTBinding, + &pszStringBinding + ); + + printf("Binding = %S\n",pszStringBinding); + RpcStringFree(&pszStringBinding); + } + */ + + status = RpcStringBindingCompose( + NULL, + TEXT("ncalrpc"), + NULL, + NULL, + NULL, + &pszStringBinding + ); + + if (!status) { + RpcBindingFromStringBinding( + pszStringBinding, + &SMTBinding + ); + } + + if (status || !SMTBinding) + { + printf("No Binding Handle Available", status); + exit(1); + } + + /* + status = RpcNsBindingImportDone(&ImportContext); + */ +} + + +void +TestSimple() +{ + long *x = (long*) OrMemAlloc(sizeof(long)); + *x = rand(); + + printf("Calling the remote procedure 'RemoteRead'\n"); + + long answer; + + RpcTryExcept { + RemoteRead((ULONG)OR_OFFSET(x), &answer); // make call with user message + } + RpcExcept(1) { + RPC_STATUS ulCode = RpcExceptionCode(); + printf("Runtime reported exception 0x%lx \n", ulCode); + exit(ulCode); + } + RpcEndExcept + + if (answer == *x) printf("Simple Success!\n"); + else printf("Failure!\n"); +} + +void +TestList() +{ + CSimpleLinkList OR_BASED *pList = NEW_OR_BASED_SIMPLE(CSimpleLinkList); + + unsigned long i; + + for (i = 0; i < 10; i++) + { + unsigned long next = rand(); + pList->insert((void*)next); + printf("Inserted %d\n",next); + } + + CSimpleLinkListIterator Iter(*OR_FULL_POINTER(CSimpleLinkList,pList)); + + SendList((based_ptr) pList); + + unsigned long answer; + + for (i = 0; i < 10; i++) + { + ReadNext(&answer); + if (answer == (unsigned long)Iter.next()) printf("List Success for %d\n",answer); + } +} + +void +TestLocalResolverAPI() +{ + HPROCESS hProcess; + DWORD dwTimeoutInSeconds; + MID LocalMid, Mid; + BOOL DisableDCOM; + DWORD AuthnLevel; + DWORD ImpLevel; + BOOL MutualAuth; + DWORD cServerSvc; + USHORT *aServerSvc; + DWORD cClientSvc; + USHORT *aClientSvc; + + ID Oxid; + + ID aOids[2]; + + long Status; + + OXID_INFO oxidInfo; + + Status = ConnectDCOM( + &hProcess, + &dwTimeoutInSeconds, + &LocalMid, + &DisableDCOM, + &AuthnLevel, + &ImpLevel, + &MutualAuth, + &cServerSvc, + &aServerSvc, + &cClientSvc, + &aClientSvc + ); + + GetIds(&Oxid,&aOids[0]); + + Status = ResolveOXID( + hProcess, + Oxid, + NULL, + FALSE, + oxidInfo, + Mid + ); + + Status = ClientAddOID( + hProcess, + aOids[0], + Oxid, + Mid + ); + + Status = ClientDropOID( + hProcess, + aOids[0], + Mid + ); + + ShutDown(); +} + + +void __cdecl +main() +{ + srand(GetCurrentTime()); + + ClientSetup(); + TestLocalResolverAPI(); + + RPC_STATUS status = RpcBindingFree(&SMTBinding); + printf("RpcBindingFree returned 0x%x\n", status); + if (status) + exit(status); +} + + +/* MIDL allocate and free */ + +void __RPC_FAR * __RPC_API midl_user_allocate(size_t len) +{ + return(malloc(len)); +} + +void __RPC_API midl_user_free(void __RPC_FAR * ptr) +{ + free(ptr); +} diff --git a/private/ole32/dcomss/objex/shrmem/client/makefile b/private/ole32/dcomss/objex/shrmem/client/makefile new file mode 100644 index 000000000..14f79b701 --- /dev/null +++ b/private/ole32/dcomss/objex/shrmem/client/makefile @@ -0,0 +1 @@ +!include $(NTMAKEENV)\makefile.def diff --git a/private/ole32/dcomss/objex/shrmem/client/sources b/private/ole32/dcomss/objex/shrmem/client/sources new file mode 100644 index 000000000..6df535a1c --- /dev/null +++ b/private/ole32/dcomss/objex/shrmem/client/sources @@ -0,0 +1,109 @@ +!IF 0 + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + sources. + +Abstract: + + This file specifies the target component being built and the list of + sources files needed to build that component. Also specifies optional + compiler switches and libraries that are unique for the component being + built. + + +Author: + + David Plummer (davepl) 19-Mar-94 + + Modifed by via awk to include global project include file + and to wrap precompiled header line within a conditional + that can be set in this include file. + + Drew Bliss (DrewB) 21-Dec-1993 + +!ENDIF + +!IF "$(NTDEBUG)" != "ntsd" +CXXCPP_OPTIONS=-DDBG=0 +!else +CXXCPP_OPTIONS=-DDBG=1 +DEBUG_DEFINES=-DLDEBUG +MSC_OPTIMIZATION=/Od +!endif + +MAJORCOMP= cairole +MINORCOMP= stg + +# +# This is the name of the target built from the source files specified +# below. The name should include neither the path nor the file extension. +# + +TARGETNAME= clt + +# +# This specifies where the target is to be built. A private target of +# type LIBRARY or DYNLINK should go to obj, whereas a public target of +# type LIBRARY or DYNLINK should go to $(BASEDIR)\public\sdk\lib. +# + +TARGETPATH= ..\bin + +# +# This specifies the type of the target, such as PROGRAM, DYNLINK, LIBRARY, +# etc. +# + +TARGETTYPE= PROGRAM + +PRECOMPILED_INCLUDE= ..\or.hxx + +# +# The following includes a global include file defined at the +# base of the project for all components +# + +!include \nt\private\ole32\daytona.inc + +INCLUDES=..;..\dcom95;..\stg;C:\nt\private\ole32\dcomss;\nt\private\ole32\ih;\nt\private\ole32\com\inc;\nt\private\ole32\common\daytona;\nt\private\ole32\stg\docfile;\nt\private\ole32\stg\h;C:\nt\private\dcomidl\obj;C:\nt\private\ole32\stg\exp + + +C_DEFINES= \ + $(C_DEFINES) \ + -DMULTIHEAP + +SOURCES= \ + clt.cxx \ + test_c.c + +LIBDIR=$(_NTDRIVE)\nt\public\sdk\lib + +OLEDIR=$(_NTDRIVE)\nt\private\ole32 + +LINKLIBS=$(LIBDIR)\*\Rpcrt4.lib \ + $(LIBDIR)\*\RpcNdr.lib \ + $(LIBDIR)\*\ntdll.lib \ + $(LIBDIR)\*\uuid.lib \ + $(LIBDIR)\*\user32.lib \ + $(LIBDIR)\*\security.lib \ + $(LIBDIR)\*\ole32.lib \ + $(OLEDIR)\common\daytona\obj\*\common.lib \ + $(OLEDIR)\com\inc\daytona\obj\*\inc.lib \ + ..\lib\*\stg.lib \ + ..\lib\*\dcom95.lib \ + ..\lib\*\special.lib + +USE_LIBCMT=1 + +UMTYPE= console +UMAPPL= +UMTEST= +UMLIBS= + +PRECOMPILED_OPTION= +#PRECOMPILED_TARGET=..\obj\*\$(PRECOMPILED_PCH) +PRECOMPILED_CXX= + |