2 * Implements dmoreg APIs.
4 * Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #include "wine/obj_base.h"
35 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(msdmo);
41 NOTE: You may build this dll as a native dll and
42 use with native non-DirectX8 environment(NT 4.0 etc).
46 static const WCHAR wszDMOPath[] =
47 {'D','i','r','e','c','t','S','h','o','w','\\',
48 'M','e','d','i','a','O','b','j','e','c','t','s',0};
49 static const WCHAR wszDMOCatPath[] =
50 {'D','i','r','e','c','t','S','h','o','w','\\',
51 'M','e','d','i','a','O','b','j','e','c','t','s','\\',
52 'C','a','t','e','g','o','r','i','e','s',0};
53 static const WCHAR wszInputTypes[] =
54 {'I','n','p','u','t','T','y','p','e','s',0};
55 static const WCHAR wszOutputTypes[] =
56 {'O','u','t','p','u','t','T','y','p','e','s',0};
58 static const WCHAR QUARTZ_wszREG_SZ[] = {'R','E','G','_','S','Z',0};
60 /*************************************************************************/
63 static void QUARTZ_CatPathSepW( WCHAR* pBuf )
65 int len = lstrlenW(pBuf);
70 static void QUARTZ_GUIDtoString( WCHAR* pBuf, const GUID* pguid )
72 /* W"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}" */
73 static const WCHAR wszFmt[] =
74 {'{','%','0','8','X','-','%','0','4','X','-','%','0','4','X',
75 '-','%','0','2','X','%','0','2','X','-','%','0','2','X','%',
76 '0','2','X','%','0','2','X','%','0','2','X','%','0','2','X',
77 '%','0','2','X','}',0};
79 wsprintfW( pBuf, wszFmt,
80 pguid->Data1, pguid->Data2, pguid->Data3,
81 pguid->Data4[0], pguid->Data4[1],
82 pguid->Data4[2], pguid->Data4[3],
83 pguid->Data4[4], pguid->Data4[5],
84 pguid->Data4[6], pguid->Data4[7] );
88 LONG QUARTZ_RegOpenKeyW(
89 HKEY hkRoot, LPCWSTR lpszPath,
90 REGSAM rsAccess, HKEY* phKey,
94 WCHAR wszREG_SZ[ sizeof(QUARTZ_wszREG_SZ)/sizeof(QUARTZ_wszREG_SZ[0]) ];
96 memcpy(wszREG_SZ,QUARTZ_wszREG_SZ,sizeof(QUARTZ_wszREG_SZ) );
99 return RegCreateKeyExW(
100 hkRoot, lpszPath, 0, wszREG_SZ,
101 REG_OPTION_NON_VOLATILE, rsAccess, NULL, phKey, &dwDisp );
103 return RegOpenKeyExW(
104 hkRoot, lpszPath, 0, rsAccess, phKey );
108 LONG QUARTZ_RegSetValueString(
109 HKEY hKey, LPCWSTR lpszName, LPCWSTR lpValue )
111 return RegSetValueExW(
112 hKey, lpszName, 0, REG_SZ,
113 (const BYTE*)lpValue,
114 sizeof(lpValue[0]) * (lstrlenW(lpValue)+1) );
118 LONG QUARTZ_RegSetValueBinary(
119 HKEY hKey, LPCWSTR lpszName,
120 const BYTE* pData, int iLenOfData )
122 return RegSetValueExW(
123 hKey, lpszName, 0, REG_BINARY, pData, iLenOfData );
127 /*************************************************************************/
130 HRESULT WINAPI DMOEnum( REFGUID rguidCat, DWORD dwFlags, DWORD dwCountOfInTypes, const DMO_PARTIAL_MEDIATYPE* pInTypes, DWORD dwCountOfOutTypes, const DMO_PARTIAL_MEDIATYPE* pOutTypes, IEnumDMO** ppEnum )
136 HRESULT WINAPI DMOGetName( REFCLSID rclsid, WCHAR* pwszName )
143 HRESULT WINAPI DMOGetTypes( REFCLSID rclsid, unsigned long ulInputTypesReq, unsigned long* pulInputTypesRet, unsigned long ulOutputTypesReq, unsigned long* pulOutputTypesRet, const DMO_PARTIAL_MEDIATYPE* pOutTypes )
149 HRESULT WINAPI DMOGuidToStrA( void* pv1, void* pv2 )
151 FIXME( "(%p,%p) stub!\n", pv1, pv2 );
155 HRESULT WINAPI DMOGuidToStrW( void* pv1, void* pv2 )
157 FIXME( "(%p,%p) stub!\n", pv1, pv2 );
161 HRESULT WINAPI DMORegister( LPCWSTR pwszName, REFCLSID rclsid, REFGUID rguidCat, DWORD dwFlags, DWORD dwCountOfInTypes, const DMO_PARTIAL_MEDIATYPE* pInTypes, DWORD dwCountOfOutTypes, const DMO_PARTIAL_MEDIATYPE* pOutTypes )
167 FIXME( "() not tested!\n" );
171 memcpy(wszPath,wszDMOPath,sizeof(wszDMOPath));
172 QUARTZ_CatPathSepW(wszPath);
173 QUARTZ_GUIDtoString(&wszPath[lstrlenW(wszPath)],rclsid);
174 if ( QUARTZ_RegOpenKeyW( HKEY_CLASSES_ROOT,
175 wszPath, KEY_ALL_ACCESS, &hKey, TRUE ) != ERROR_SUCCESS )
177 if ( pwszName != NULL && QUARTZ_RegSetValueString(
178 hKey, NULL, pwszName ) != ERROR_SUCCESS )
180 if ( dwCountOfInTypes > 0 && QUARTZ_RegSetValueBinary(
181 hKey, wszInputTypes, (const BYTE*)pInTypes,
182 dwCountOfInTypes * sizeof(DMO_PARTIAL_MEDIATYPE) ) != ERROR_SUCCESS )
184 if ( dwCountOfOutTypes > 0 && QUARTZ_RegSetValueBinary(
185 hKey, wszOutputTypes, (const BYTE*)pOutTypes,
186 dwCountOfOutTypes * sizeof(DMO_PARTIAL_MEDIATYPE) ) != ERROR_SUCCESS )
192 memcpy(wszPath,wszDMOCatPath,sizeof(wszDMOCatPath));
193 QUARTZ_CatPathSepW(wszPath);
194 QUARTZ_GUIDtoString(&wszPath[lstrlenW(wszPath)],rguidCat);
195 QUARTZ_CatPathSepW(wszPath);
196 QUARTZ_GUIDtoString(&wszPath[lstrlenW(wszPath)],rclsid);
197 if ( QUARTZ_RegOpenKeyW( HKEY_CLASSES_ROOT,
198 wszPath, KEY_ALL_ACCESS, &hKey, TRUE ) != ERROR_SUCCESS )
207 HRESULT WINAPI DMOStrToGuidA( void* pv1, void* pv2 )
209 FIXME( "(%p,%p) stub!\n", pv1, pv2 );
213 HRESULT WINAPI DMOStrToGuidW( void* pv1, void* pv2 )
215 FIXME( "(%p,%p) stub!\n", pv1, pv2 );
219 HRESULT WINAPI DMOUnregister( REFCLSID rclsid, REFGUID rguidCat )