Release 980503
[wine/multimedia.git] / ole / typelib.c
blob9e529fe97cd4686cb95a2559968f94a35833693b
1 /*
2 * TYPELIB
4 * Copyright 1997 Marcus Meissner
5 */
7 #include <stdlib.h>
8 #include <string.h>
9 #include <assert.h>
10 #include "wintypes.h"
11 #include "heap.h"
12 #include "windows.h"
13 #include "winreg.h"
14 #include "winerror.h"
15 #include "ole.h"
16 #include "ole2.h"
17 #include "oleauto.h"
18 #include "compobj.h"
19 #include "debug.h"
21 /****************************************************************************
22 * QueryPathOfRegTypeLib (TYPELIB.14)
23 * the path is "Classes\Typelib\<guid>\<major>.<minor>\<lcid>\win16\"
24 * RETURNS
25 * path of typelib
27 HRESULT WINAPI
28 QueryPathOfRegTypeLib16(
29 REFGUID guid, /* [in] referenced guid */
30 WORD wMaj, /* [in] major version */
31 WORD wMin, /* [in] minor version */
32 LCID lcid, /* [in] locale id */
33 LPBSTR16 path /* [out] path of typelib */
34 ) {
35 char xguid[80];
36 char typelibkey[100],pathname[260];
37 DWORD plen;
39 if (HIWORD(guid)) {
40 WINE_StringFromCLSID(guid,xguid);
41 sprintf(typelibkey,"SOFTWARE\\Classes\\Typelib\\%s\\%d.%d\\%ld\\win16",
42 xguid,wMaj,wMin,lcid&0xff
44 } else {
45 sprintf(xguid,"<guid 0x%08lx>",(DWORD)guid);
46 FIXME(ole,"(%s,%d,%d,0x%04x,%p),can't handle non-string guids.\n",xguid,wMaj,wMin,lcid,path);
47 return E_FAIL;
49 plen = sizeof(pathname);
50 if (RegQueryValue16(HKEY_LOCAL_MACHINE,typelibkey,pathname,&plen)) {
51 FIXME(ole,"key %s not found\n",typelibkey);
52 return E_FAIL;
54 *path = SysAllocString16(pathname);
55 return S_OK;
58 /****************************************************************************
59 * QueryPathOfRegTypeLib (OLEAUT32.164)
60 * RETURNS
61 * path of typelib
63 HRESULT WINAPI
64 QueryPathOfRegTypeLib32(
65 REFGUID guid, /* [in] referenced guid */
66 WORD wMaj, /* [in] major version */
67 WORD wMin, /* [in] minor version */
68 LCID lcid, /* [in] locale id */
69 LPBSTR32 path /* [out] path of typelib */
70 ) {
71 char xguid[80];
72 char typelibkey[100],pathname[260];
73 DWORD plen;
76 if (HIWORD(guid)) {
77 WINE_StringFromCLSID(guid,xguid);
78 sprintf(typelibkey,"SOFTWARE\\Classes\\Typelib\\%s\\%d.%d\\%ld\\win32",
79 xguid,wMaj,wMin,lcid&0xff
81 } else {
82 sprintf(xguid,"<guid 0x%08lx>",(DWORD)guid);
83 FIXME(ole,"(%s,%d,%d,0x%04x,%p),stub!\n",xguid,wMaj,wMin,lcid,path);
84 return E_FAIL;
86 plen = sizeof(pathname);
87 if (RegQueryValue16(HKEY_LOCAL_MACHINE,typelibkey,pathname,&plen)) {
88 FIXME(ole,"key %s not found\n",typelibkey);
89 return E_FAIL;
91 *path = HEAP_strdupAtoW(GetProcessHeap(),0,pathname);
92 return S_OK;
95 /******************************************************************************
96 * LoadTypeLib [TYPELIB.3] Loads and registers a type library
98 * NOTES
99 * Docs: OLECHAR FAR* szFile
100 * Docs: iTypeLib FAR* FAR* pptLib
102 * RETURNS
103 * Success: S_OK
104 * Failure: Status
106 HRESULT WINAPI LoadTypeLib(
107 void *szFile, /* [in] Name of file to load from */
108 void * *pptLib) /* [out] Pointer to pointer to loaded type library */
110 FIXME(ole, "(%s,%p): stub\n",debugstr_a(szFile),pptLib);
111 return E_FAIL;
115 /****************************************************************************
116 * OABuildVersion (TYPELIB.15)
117 * RETURNS
118 * path of typelib
120 DWORD WINAPI OABuildVersion()
122 return MAKELONG(0xbd3, 0x3);