4 * Copyright 1995 Martin von Loewis
11 #include "interfaces.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
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 /******************************************************************************
30 * BSTR_Free [INTERNAL]
32 static void BSTR_Free(BSTR16 in
)
34 SEGPTR_FREE( PTR_SEG_TO_LIN(in
) );
37 /******************************************************************************
38 * BSTR_GetAddr [INTERNAL]
40 static void* BSTR_GetAddr(BSTR16 in
)
42 return in
? PTR_SEG_TO_LIN(in
) : 0;
45 /******************************************************************************
46 * SysAllocString16 [OLE2DISP.2]
48 BSTR16 WINAPI
SysAllocString16(LPOLESTR16 in
)
50 BSTR16 out
=BSTR_AllocBytes(strlen(in
)+1);
52 strcpy(BSTR_GetAddr(out
),in
);
56 /******************************************************************************
57 * SysAllocString32 [OLEAUT32.2]
59 BSTR32 WINAPI
SysAllocString32(LPOLESTR32 in
)
61 return HEAP_strdupW(GetProcessHeap(),0,in
);
64 /******************************************************************************
65 * SysReAllocString16 [OLE2DISP.3]
67 INT16 WINAPI
SysReAllocString16(LPBSTR16 old
,LPOLESTR16 in
)
69 BSTR16
new=SysAllocString16(in
);
75 /******************************************************************************
76 * SysReAllocString32 [OLEAUT32.3]
78 INT32 WINAPI
SysReAllocString32(LPBSTR32 old
,LPOLESTR32 in
)
80 BSTR32
new=SysAllocString32(in
);
81 HeapFree(GetProcessHeap(),0,*old
);
86 /******************************************************************************
87 * SysAllocStringLen16 [OLE2DISP.4]
89 BSTR16 WINAPI
SysAllocStringLen16(char *in
, int len
)
91 BSTR16 out
=BSTR_AllocBytes(len
+1);
93 strcpy(BSTR_GetAddr(out
),in
);
97 /******************************************************************************
98 * SysReAllocStringLen16 [OLE2DISP.5]
100 int WINAPI
SysReAllocStringLen16(BSTR16
*old
,char *in
,int len
)
102 BSTR16
new=SysAllocStringLen16(in
,len
);
108 /******************************************************************************
109 * SysFreeString16 [OLE2DISP.6]
111 void WINAPI
SysFreeString16(BSTR16 in
)
116 /******************************************************************************
117 * SysFreeString32 [OLEAUT32.6]
119 void WINAPI
SysFreeString32(BSTR32 in
)
121 HeapFree(GetProcessHeap(),0,in
);
124 /******************************************************************************
125 * SysStringLen16 [OLE2DISP.7]
127 int WINAPI
SysStringLen16(BSTR16 str
)
129 return strlen(BSTR_GetAddr(str
));
132 /******************************************************************************
133 * CreateDispTypeInfo [OLE2DISP.31]
135 OLESTATUS WINAPI
CreateDispTypeInfo(
136 INTERFACEDATA
*pidata
,
138 LPVOID
**pptinfo
/*ITypeInfo*/
140 FIXME(ole
,"(%p,%ld,%p),stub\n",pidata
,lcid
,pptinfo
);
144 /******************************************************************************
145 * RegisterActiveObject [OLE2DISP.35]
147 OLESTATUS WINAPI
RegisterActiveObject(
148 IUnknown
* punk
,REFCLSID rclsid
,DWORD dwFlags
, DWORD
* pdwRegister
151 WINE_StringFromCLSID(rclsid
,buf
);
152 FIXME(ole
,"(%p,%s,0x%08lx,%p):stub\n",punk
,buf
,dwFlags
,pdwRegister
);