Bugfixes, shellview uses DPA's now, IShellView_GetItemObject implemented.
[wine/multimedia.git] / ole / ole2disp.c
blobd5963e05060845b95dcdd48845a113c3a13eb3e9
1 /*
2 * OLE2DISP library
4 * Copyright 1995 Martin von Loewis
5 */
7 #include "windows.h"
8 #include "ole.h"
9 #include "ole2.h"
10 #include "oleauto.h"
11 #include "interfaces.h"
12 #include "heap.h"
13 #include "ldt.h"
14 #include "debug.h"
16 /* This implementation of the BSTR API is 16-bit only. It
17 represents BSTR as a 16:16 far pointer, and the strings
18 as ISO-8859 */
20 /******************************************************************************
21 * BSTR_AllocBytes [Internal]
23 static BSTR16 BSTR_AllocBytes(int n)
25 void *ptr = SEGPTR_ALLOC(n);
26 return (BSTR16)SEGPTR_GET(ptr);
29 static void BSTR_Free(BSTR16 in)
31 SEGPTR_FREE( PTR_SEG_TO_LIN(in) );
34 static void* BSTR_GetAddr(BSTR16 in)
36 return in ? PTR_SEG_TO_LIN(in) : 0;
39 /******************************************************************************
40 * SysAllocString16 [OLE2DISP.2]
42 BSTR16 WINAPI SysAllocString16(LPOLESTR16 in)
44 BSTR16 out=BSTR_AllocBytes(strlen(in)+1);
45 if(!out)return 0;
46 strcpy(BSTR_GetAddr(out),in);
47 return out;
50 /******************************************************************************
51 * SysAllocString32 [OLEAUT32.2]
53 BSTR32 WINAPI SysAllocString32(LPOLESTR32 in)
55 return HEAP_strdupW(GetProcessHeap(),0,in);
58 /******************************************************************************
59 * SysReAllocString16 [OLE2DISP.3]
61 INT16 WINAPI SysReAllocString16(LPBSTR16 old,LPOLESTR16 in)
63 BSTR16 new=SysAllocString16(in);
64 BSTR_Free(*old);
65 *old=new;
66 return 1;
69 /******************************************************************************
70 * SysReAllocString32 [OLEAUT32.3]
72 INT32 WINAPI SysReAllocString32(LPBSTR32 old,LPOLESTR32 in)
74 BSTR32 new=SysAllocString32(in);
75 HeapFree(GetProcessHeap(),0,*old);
76 *old=new;
77 return 1;
80 /******************************************************************************
81 * SysAllocStringLen16 [OLE2DISP.4]
83 BSTR16 WINAPI SysAllocStringLen16(char *in, int len)
85 BSTR16 out=BSTR_AllocBytes(len+1);
86 if(!out)return 0;
87 strcpy(BSTR_GetAddr(out),in);
88 return out;
91 /******************************************************************************
92 * SysReAllocStringLen16 [OLE2DISP.5]
94 int WINAPI SysReAllocStringLen16(BSTR16 *old,char *in,int len)
96 BSTR16 new=SysAllocStringLen16(in,len);
97 BSTR_Free(*old);
98 *old=new;
99 return 1;
102 /******************************************************************************
103 * SysFreeString16 [OLE2DISP.6]
105 void WINAPI SysFreeString16(BSTR16 in)
107 BSTR_Free(in);
110 /******************************************************************************
111 * SysFreeString32 [OLEAUT32.6]
113 void WINAPI SysFreeString32(BSTR32 in)
115 HeapFree(GetProcessHeap(),0,in);
118 /******************************************************************************
119 * SysStringLen16 [OLE2DISP.7]
121 int WINAPI SysStringLen16(BSTR16 str)
123 return strlen(BSTR_GetAddr(str));
126 OLESTATUS WINAPI CreateDispTypeInfo(
127 INTERFACEDATA *pidata,
128 LCID lcid,
129 LPVOID **pptinfo /*ITypeInfo*/
131 FIXME(ole,"(%p,%ld,%p),stub\n",pidata,lcid,pptinfo);
132 return 0;
135 OLESTATUS WINAPI RegisterActiveObject(
136 IUnknown * punk,REFCLSID rclsid,DWORD dwFlags, DWORD * pdwRegister
138 char buf[80];
139 WINE_StringFromCLSID(rclsid,buf);
140 FIXME(ole,"RegisterActiveObject(%p,%s,0x%08lx,%p),stub\n",punk,buf,dwFlags,pdwRegister);
141 return 0;