2 Unix SMB/CIFS implementation.
3 run the "simple" example DCOM program
5 Copyright (C) Jelmer Vernooij 2004
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "librpc/gen_ndr/ndr_dcom.h"
24 #include "librpc/gen_ndr/ndr_oxidresolver.h"
26 #define CLSID_SIMPLE "5e9ddec7-5767-11cf-beab-00aa006c3606"
27 #define DEFAULT_TRANS 4096
29 BOOL torture_dcom_simple(void)
32 struct dcerpc_pipe *p;
38 char pv[DEFAULT_TRANS];
39 struct dcom_interface *interfaces;
40 struct IStream_Read r_read;
41 struct IStream_Write r_write;
43 mem_ctx = talloc_init("torture_dcom_simple");
45 GUID_from_string(DCERPC_ISTREAM_UUID, &IID[0]);
46 GUID_from_string(DCERPC_IUNKNOWN_UUID, &IID[1]);
47 GUID_from_string(CLSID_SIMPLE, &clsid);
48 error = dcom_create_object(mem_ctx, &clsid, "192.168.4.28", 2, IID, &interfaces);
50 if (!W_ERROR_IS_OK(error)) {
51 printf("dcom_create_object failed - %s\n", win_errstr(error));
56 status = dcerpc_IStream_Read(interfaces[0].pipe, &interfaces[0].ipid, mem_ctx, &r_read);
57 if (NT_STATUS_IS_ERR(error)) {
58 printf("IStream::Read() failed - %s\n", win_errstr(error));
63 status = dcerpc_IStream_Write(interfaces[0].pipe, &interfaces[0].ipid, mem_ctx, &r_write);
64 if (NT_STATUS_IS_ERR(error)) {
65 printf("IStream::Write() failed - %s\n", win_errstr(error));
69 /*FIXME: dcerpc_IUnknown_Release();*/
71 talloc_destroy(mem_ctx);