Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 1 | /* |
| 2 | * TYPELIB |
| 3 | * |
| 4 | * Copyright 1997 Marcus Meissner |
| 5 | */ |
| 6 | |
| 7 | #include <stdlib.h> |
| 8 | #include <string.h> |
| 9 | #include <assert.h> |
Jim Aston | 2e1cafa | 1999-03-14 16:35:05 +0000 | [diff] [blame^] | 10 | #include "windef.h" |
Marcus Meissner | 064f170 | 1999-02-28 19:14:33 +0000 | [diff] [blame] | 11 | #include "winerror.h" |
| 12 | #include "winreg.h" |
| 13 | #include "oleauto.h" |
Marcus Meissner | 219cfd8 | 1999-02-24 13:05:13 +0000 | [diff] [blame] | 14 | #include "wine/winbase16.h" |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 15 | #include "heap.h" |
Alexandre Julliard | 638f169 | 1999-01-17 16:32:32 +0000 | [diff] [blame] | 16 | #include "wine/obj_base.h" |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 17 | #include "debug.h" |
Andreas Mohr | 29bbe12 | 1998-11-22 16:36:07 +0000 | [diff] [blame] | 18 | #include "winversion.h" |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 19 | |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 20 | /**************************************************************************** |
Matthew Becker | b05264f | 1998-10-11 14:21:42 +0000 | [diff] [blame] | 21 | * QueryPathOfRegTypeLib16 [TYPELIB.14] |
| 22 | * |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 23 | * the path is "Classes\Typelib\<guid>\<major>.<minor>\<lcid>\win16\" |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 24 | * RETURNS |
| 25 | * path of typelib |
| 26 | */ |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 27 | HRESULT WINAPI |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 28 | QueryPathOfRegTypeLib16( |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 29 | REFGUID guid, /* [in] referenced guid */ |
| 30 | WORD wMaj, /* [in] major version */ |
| 31 | WORD wMin, /* [in] minor version */ |
| 32 | LCID lcid, /* [in] locale id */ |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 33 | LPBSTR16 path /* [out] path of typelib */ |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 34 | ) { |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 35 | char xguid[80]; |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 36 | char typelibkey[100],pathname[260]; |
| 37 | DWORD plen; |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 38 | |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 39 | if (HIWORD(guid)) { |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 40 | WINE_StringFromCLSID(guid,xguid); |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 41 | sprintf(typelibkey,"SOFTWARE\\Classes\\Typelib\\%s\\%d.%d\\%ld\\win16", |
| 42 | xguid,wMaj,wMin,lcid&0xff |
| 43 | ); |
| 44 | } else { |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 45 | sprintf(xguid,"<guid 0x%08lx>",(DWORD)guid); |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 46 | FIXME(ole,"(%s,%d,%d,0x%04lx,%p),can't handle non-string guids.\n",xguid,wMaj,wMin,(DWORD)lcid,path); |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 47 | return E_FAIL; |
| 48 | } |
| 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; |
| 53 | } |
| 54 | *path = SysAllocString16(pathname); |
| 55 | return S_OK; |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 56 | } |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 57 | |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 58 | /**************************************************************************** |
Matthew Becker | b05264f | 1998-10-11 14:21:42 +0000 | [diff] [blame] | 59 | * QueryPathOfRegTypeLib32 [OLEAUT32.164] |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 60 | * RETURNS |
| 61 | * path of typelib |
| 62 | */ |
| 63 | HRESULT WINAPI |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 64 | QueryPathOfRegTypeLib( |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 65 | REFGUID guid, /* [in] referenced guid */ |
| 66 | WORD wMaj, /* [in] major version */ |
| 67 | WORD wMin, /* [in] minor version */ |
| 68 | LCID lcid, /* [in] locale id */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 69 | LPBSTR path /* [out] path of typelib */ |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 70 | ) { |
| 71 | char xguid[80]; |
| 72 | char typelibkey[100],pathname[260]; |
| 73 | DWORD plen; |
| 74 | |
| 75 | |
| 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 |
| 80 | ); |
| 81 | } else { |
| 82 | sprintf(xguid,"<guid 0x%08lx>",(DWORD)guid); |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 83 | FIXME(ole,"(%s,%d,%d,0x%04lx,%p),stub!\n",xguid,wMaj,wMin,(DWORD)lcid,path); |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 84 | return E_FAIL; |
| 85 | } |
| 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; |
| 90 | } |
| 91 | *path = HEAP_strdupAtoW(GetProcessHeap(),0,pathname); |
| 92 | return S_OK; |
| 93 | } |
| 94 | |
| 95 | /****************************************************************************** |
| 96 | * LoadTypeLib [TYPELIB.3] Loads and registers a type library |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 97 | * NOTES |
Jean-Claude Cote | b00cbea | 1998-12-10 10:00:38 +0000 | [diff] [blame] | 98 | * Docs: OLECHAR32 FAR* szFile |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 99 | * Docs: iTypeLib FAR* FAR* pptLib |
| 100 | * |
| 101 | * RETURNS |
| 102 | * Success: S_OK |
| 103 | * Failure: Status |
| 104 | */ |
Andreas Mohr | 7a6228d | 1998-12-11 09:16:48 +0000 | [diff] [blame] | 105 | HRESULT WINAPI LoadTypeLib16( |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 106 | OLECHAR *szFile, /* [in] Name of file to load from */ |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 107 | void * *pptLib) /* [out] Pointer to pointer to loaded type library */ |
| 108 | { |
Juergen Schmied | 69f2ea6 | 1998-12-26 19:44:13 +0000 | [diff] [blame] | 109 | FIXME(ole, "('%s',%p): stub\n",debugstr_w((LPWSTR)szFile),pptLib); |
Francis Beaudet | 4f85ca4 | 1999-01-23 11:53:21 +0000 | [diff] [blame] | 110 | |
| 111 | if (pptLib!=0) |
| 112 | *pptLib=0; |
| 113 | |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 114 | return E_FAIL; |
| 115 | } |
| 116 | |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 117 | /****************************************************************************** |
Matthew Becker | b05264f | 1998-10-11 14:21:42 +0000 | [diff] [blame] | 118 | * LoadTypeLib32 [OLEAUT32.161] |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 119 | * Loads and registers a type library |
| 120 | * NOTES |
Jean-Claude Cote | b00cbea | 1998-12-10 10:00:38 +0000 | [diff] [blame] | 121 | * Docs: OLECHAR32 FAR* szFile |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 122 | * Docs: iTypeLib FAR* FAR* pptLib |
| 123 | * |
| 124 | * RETURNS |
| 125 | * Success: S_OK |
| 126 | * Failure: Status |
| 127 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 128 | HRESULT WINAPI LoadTypeLib( |
| 129 | OLECHAR *szFile, /* [in] Name of file to load from */ |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 130 | void * *pptLib) /* [out] Pointer to pointer to loaded type library */ |
| 131 | { |
Juergen Schmied | 69f2ea6 | 1998-12-26 19:44:13 +0000 | [diff] [blame] | 132 | FIXME(ole, "('%s',%p): stub\n",debugstr_w(szFile),pptLib); |
Francis Beaudet | 4f85ca4 | 1999-01-23 11:53:21 +0000 | [diff] [blame] | 133 | |
| 134 | if (pptLib!=0) |
| 135 | *pptLib=0; |
| 136 | |
| 137 | return E_FAIL; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | /****************************************************************************** |
Francis Beaudet | eb5a29b | 1999-02-20 16:48:53 +0000 | [diff] [blame] | 141 | * LoadRegTypeLib [OLEAUT32.162] |
| 142 | */ |
| 143 | HRESULT WINAPI LoadRegTypeLib( |
| 144 | REFGUID rguid, |
| 145 | unsigned short wVerMajor, |
| 146 | unsigned short wVerMinor, |
| 147 | LCID lcid, |
| 148 | void** pptLib) |
| 149 | { |
| 150 | FIXME(ole, "(): stub\n"); |
| 151 | |
| 152 | if (pptLib!=0) |
| 153 | *pptLib=0; |
| 154 | |
| 155 | return E_FAIL; |
| 156 | } |
| 157 | |
| 158 | /****************************************************************************** |
Matthew Becker | b05264f | 1998-10-11 14:21:42 +0000 | [diff] [blame] | 159 | * RegisterTypeLib32 [OLEAUT32.163] |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 160 | * Adds information about a type library to the System Registry |
| 161 | * NOTES |
| 162 | * Docs: ITypeLib FAR * ptlib |
Jean-Claude Cote | b00cbea | 1998-12-10 10:00:38 +0000 | [diff] [blame] | 163 | * Docs: OLECHAR32 FAR* szFullPath |
| 164 | * Docs: OLECHAR32 FAR* szHelpDir |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 165 | * |
| 166 | * RETURNS |
| 167 | * Success: S_OK |
| 168 | * Failure: Status |
| 169 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 170 | HRESULT WINAPI RegisterTypeLib( |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 171 | ITypeLib * ptlib, /*[in] Pointer to the library*/ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 172 | OLECHAR * szFullPath, /*[in] full Path of the library*/ |
| 173 | OLECHAR * szHelpDir) /*[in] dir to the helpfile for the library, may be NULL*/ |
Juergen Schmied | 69f2ea6 | 1998-12-26 19:44:13 +0000 | [diff] [blame] | 174 | { FIXME(ole, "(%p,%s,%s): stub\n",ptlib, debugstr_w(szFullPath),debugstr_w(szHelpDir)); |
Andreas Mohr | 29bbe12 | 1998-11-22 16:36:07 +0000 | [diff] [blame] | 175 | return S_OK; /* FIXME: pretend everything is OK */ |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 176 | } |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 177 | |
| 178 | /**************************************************************************** |
| 179 | * OABuildVersion (TYPELIB.15) |
| 180 | * RETURNS |
| 181 | * path of typelib |
| 182 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 183 | DWORD WINAPI OABuildVersion16(void) |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 184 | { |
Andreas Mohr | 29bbe12 | 1998-11-22 16:36:07 +0000 | [diff] [blame] | 185 | WINDOWS_VERSION ver = VERSION_GetVersion(); |
| 186 | |
| 187 | switch (ver) { |
| 188 | case WIN95: |
| 189 | return MAKELONG(0xbd0, 0xa); /* Win95A */ |
| 190 | case WIN31: |
| 191 | return MAKELONG(0xbd3, 0x3); /* WfW 3.11 */ |
| 192 | default: |
| 193 | FIXME(ole, "Version value not known yet. Please investigate it !"); |
| 194 | return MAKELONG(0xbd0, 0xa); /* return Win95A for now */ |
| 195 | } |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 196 | } |