Got rid of THREAD_InitDone.
[wine/multimedia.git] / ole / typelib.c
blobb4bf48d2a35fe85778c28a789eecfafd514d58cc
1 /*
2 * TYPELIB
4 * Copyright 1997 Marcus Meissner
5 */
7 #include <stdlib.h>
8 #include <string.h>
9 #include <assert.h>
10 #include "windef.h"
11 #include "winerror.h"
12 #include "winreg.h"
13 #include "oleauto.h"
14 #include "wine/winbase16.h"
15 #include "heap.h"
16 #include "wine/obj_base.h"
17 #include "debug.h"
18 #include "winversion.h"
20 DEFAULT_DEBUG_CHANNEL(ole)
22 /****************************************************************************
23 * QueryPathOfRegTypeLib16 [TYPELIB.14]
25 * the path is "Classes\Typelib\<guid>\<major>.<minor>\<lcid>\win16\"
26 * RETURNS
27 * path of typelib
29 HRESULT WINAPI
30 QueryPathOfRegTypeLib16(
31 REFGUID guid, /* [in] referenced guid */
32 WORD wMaj, /* [in] major version */
33 WORD wMin, /* [in] minor version */
34 LCID lcid, /* [in] locale id */
35 LPBSTR16 path /* [out] path of typelib */
36 ) {
37 char xguid[80];
38 char typelibkey[100],pathname[260];
39 DWORD plen;
41 if (HIWORD(guid)) {
42 WINE_StringFromCLSID(guid,xguid);
43 sprintf(typelibkey,"SOFTWARE\\Classes\\Typelib\\%s\\%d.%d\\%ld\\win16",
44 xguid,wMaj,wMin,lcid&0xff
46 } else {
47 sprintf(xguid,"<guid 0x%08lx>",(DWORD)guid);
48 FIXME(ole,"(%s,%d,%d,0x%04lx,%p),can't handle non-string guids.\n",xguid,wMaj,wMin,(DWORD)lcid,path);
49 return E_FAIL;
51 plen = sizeof(pathname);
52 if (RegQueryValue16(HKEY_LOCAL_MACHINE,typelibkey,pathname,&plen)) {
53 FIXME(ole,"key %s not found\n",typelibkey);
54 return E_FAIL;
56 *path = SysAllocString16(pathname);
57 return S_OK;
60 /****************************************************************************
61 * QueryPathOfRegTypeLib32 [OLEAUT32.164]
62 * RETURNS
63 * path of typelib
65 HRESULT WINAPI
66 QueryPathOfRegTypeLib(
67 REFGUID guid, /* [in] referenced guid */
68 WORD wMaj, /* [in] major version */
69 WORD wMin, /* [in] minor version */
70 LCID lcid, /* [in] locale id */
71 LPBSTR path /* [out] path of typelib */
72 ) {
73 char xguid[80];
74 char typelibkey[100],pathname[260];
75 DWORD plen;
78 if (HIWORD(guid)) {
79 WINE_StringFromCLSID(guid,xguid);
80 sprintf(typelibkey,"SOFTWARE\\Classes\\Typelib\\%s\\%d.%d\\%ld\\win32",
81 xguid,wMaj,wMin,lcid&0xff
83 } else {
84 sprintf(xguid,"<guid 0x%08lx>",(DWORD)guid);
85 FIXME(ole,"(%s,%d,%d,0x%04lx,%p),stub!\n",xguid,wMaj,wMin,(DWORD)lcid,path);
86 return E_FAIL;
88 plen = sizeof(pathname);
89 if (RegQueryValue16(HKEY_LOCAL_MACHINE,typelibkey,pathname,&plen)) {
90 FIXME(ole,"key %s not found\n",typelibkey);
91 return E_FAIL;
93 *path = HEAP_strdupAtoW(GetProcessHeap(),0,pathname);
94 return S_OK;
97 /******************************************************************************
98 * LoadTypeLib [TYPELIB.3] Loads and registers a type library
99 * NOTES
100 * Docs: OLECHAR32 FAR* szFile
101 * Docs: iTypeLib FAR* FAR* pptLib
103 * RETURNS
104 * Success: S_OK
105 * Failure: Status
107 HRESULT WINAPI LoadTypeLib16(
108 OLECHAR *szFile, /* [in] Name of file to load from */
109 void * *pptLib) /* [out] Pointer to pointer to loaded type library */
111 FIXME(ole, "('%s',%p): stub\n",debugstr_w((LPWSTR)szFile),pptLib);
113 if (pptLib!=0)
114 *pptLib=0;
116 return E_FAIL;
119 /******************************************************************************
120 * LoadTypeLib32 [OLEAUT32.161]
121 * Loads and registers a type library
122 * NOTES
123 * Docs: OLECHAR32 FAR* szFile
124 * Docs: iTypeLib FAR* FAR* pptLib
126 * RETURNS
127 * Success: S_OK
128 * Failure: Status
130 HRESULT WINAPI LoadTypeLib(
131 OLECHAR *szFile, /* [in] Name of file to load from */
132 void * *pptLib) /* [out] Pointer to pointer to loaded type library */
134 FIXME(ole, "('%s',%p): stub\n",debugstr_w(szFile),pptLib);
136 if (pptLib!=0)
137 *pptLib=0;
139 return E_FAIL;
142 /******************************************************************************
143 * LoadRegTypeLib [OLEAUT32.162]
145 HRESULT WINAPI LoadRegTypeLib(
146 REFGUID rguid,
147 unsigned short wVerMajor,
148 unsigned short wVerMinor,
149 LCID lcid,
150 void** pptLib)
152 FIXME(ole, "(): stub\n");
154 if (pptLib!=0)
155 *pptLib=0;
157 return E_FAIL;
160 /******************************************************************************
161 * RegisterTypeLib32 [OLEAUT32.163]
162 * Adds information about a type library to the System Registry
163 * NOTES
164 * Docs: ITypeLib FAR * ptlib
165 * Docs: OLECHAR32 FAR* szFullPath
166 * Docs: OLECHAR32 FAR* szHelpDir
168 * RETURNS
169 * Success: S_OK
170 * Failure: Status
172 HRESULT WINAPI RegisterTypeLib(
173 ITypeLib * ptlib, /*[in] Pointer to the library*/
174 OLECHAR * szFullPath, /*[in] full Path of the library*/
175 OLECHAR * szHelpDir) /*[in] dir to the helpfile for the library, may be NULL*/
176 { FIXME(ole, "(%p,%s,%s): stub\n",ptlib, debugstr_w(szFullPath),debugstr_w(szHelpDir));
177 return S_OK; /* FIXME: pretend everything is OK */
180 /****************************************************************************
181 * OABuildVersion (TYPELIB.15)
182 * RETURNS
183 * path of typelib
185 DWORD WINAPI OABuildVersion16(void)
187 WINDOWS_VERSION ver = VERSION_GetVersion();
189 switch (ver) {
190 case WIN95:
191 return MAKELONG(0xbd0, 0xa); /* Win95A */
192 case WIN31:
193 return MAKELONG(0xbd3, 0x3); /* WfW 3.11 */
194 default:
195 FIXME(ole, "Version value not known yet. Please investigate it !");
196 return MAKELONG(0xbd0, 0xa); /* return Win95A for now */