Purge traces of the old relay debug mechanism and document new
[wine.git] / dlls / oleaut32 / ole2disp.c
blobb06c61664e39b0988ffcd828c6ed1c15844c85dc
1 /*
2 * OLE2DISP library
4 * Copyright 1995 Martin von Loewis
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
23 #include <string.h>
25 #include "wine/windef16.h"
26 #include "ole2.h"
27 #include "oleauto.h"
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winerror.h"
31 #include "wingdi.h"
32 #include "winuser.h"
34 #include "ole2disp.h"
35 #include "olectl.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(ole);
41 /* This implementation of the BSTR API is 16-bit only. It
42 represents BSTR as a 16:16 far pointer, and the strings
43 as ISO-8859 */
45 /******************************************************************************
46 * BSTR_AllocBytes [Internal]
48 static BSTR16 BSTR_AllocBytes(int n)
50 void *ptr = HeapAlloc( GetProcessHeap(), 0, n );
51 return (BSTR16)MapLS(ptr);
54 /******************************************************************************
55 * BSTR_Free [INTERNAL]
57 static void BSTR_Free(BSTR16 in)
59 void *ptr = MapSL( (SEGPTR)in );
60 UnMapLS( (SEGPTR)in );
61 HeapFree( GetProcessHeap(), 0, ptr );
64 /******************************************************************************
65 * BSTR_GetAddr [INTERNAL]
67 static void* BSTR_GetAddr(BSTR16 in)
69 return in ? MapSL((SEGPTR)in) : 0;
72 /******************************************************************************
73 * SysAllocString [OLE2DISP.2]
75 BSTR16 WINAPI SysAllocString16(LPCOLESTR16 in)
77 BSTR16 out;
79 if (!in) return 0;
81 out = BSTR_AllocBytes(strlen(in)+1);
82 if (!out) return 0;
83 strcpy(BSTR_GetAddr(out),in);
84 return out;
87 /******************************************************************************
88 * SysReallocString [OLE2DISP.3]
90 INT16 WINAPI SysReAllocString16(LPBSTR16 old,LPCOLESTR16 in)
92 BSTR16 new=SysAllocString16(in);
93 BSTR_Free(*old);
94 *old=new;
95 return 1;
98 /******************************************************************************
99 * SysAllocStringLen [OLE2DISP.4]
101 BSTR16 WINAPI SysAllocStringLen16(const char *in, int len)
103 BSTR16 out=BSTR_AllocBytes(len+1);
105 if (!out)
106 return 0;
109 * Copy the information in the buffer.
110 * Since it is valid to pass a NULL pointer here, we'll initialize the
111 * buffer to nul if it is the case.
113 if (in != 0)
114 strcpy(BSTR_GetAddr(out),in);
115 else
116 memset(BSTR_GetAddr(out), 0, len+1);
118 return out;
121 /******************************************************************************
122 * SysReAllocStringLen [OLE2DISP.5]
124 int WINAPI SysReAllocStringLen16(BSTR16 *old,const char *in,int len)
126 BSTR16 new=SysAllocStringLen16(in,len);
127 BSTR_Free(*old);
128 *old=new;
129 return 1;
132 /******************************************************************************
133 * SysFreeString [OLE2DISP.6]
135 void WINAPI SysFreeString16(BSTR16 in)
137 BSTR_Free(in);
140 /******************************************************************************
141 * SysStringLen [OLE2DISP.7]
143 int WINAPI SysStringLen16(BSTR16 str)
145 return strlen(BSTR_GetAddr(str));
148 /******************************************************************************
149 * CreateDispTypeInfo [OLE2DISP.31]
151 HRESULT WINAPI CreateDispTypeInfo16(
152 INTERFACEDATA *pidata,
153 LCID lcid,
154 ITypeInfo **pptinfo)
156 FIXME("(%p,%ld,%p),stub\n",pidata,lcid,pptinfo);
157 return E_NOTIMPL;
160 /******************************************************************************
161 * CreateStdDispatch [OLE2DISP.32]
163 HRESULT WINAPI CreateStdDispatch16(
164 IUnknown* punkOuter,
165 void* pvThis,
166 ITypeInfo* ptinfo,
167 IUnknown** ppunkStdDisp)
169 FIXME("(%p,%p,%p,%p),stub\n",punkOuter, pvThis, ptinfo,
170 ppunkStdDisp);
171 return 0;
174 /******************************************************************************
175 * RegisterActiveObject [OLE2DISP.35]
177 HRESULT WINAPI RegisterActiveObject16(
178 IUnknown *punk, REFCLSID rclsid, DWORD dwFlags, unsigned long *pdwRegister
180 FIXME("(%p,%s,0x%08lx,%p):stub\n",punk,debugstr_guid(rclsid),dwFlags,pdwRegister);
181 return E_NOTIMPL;