Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
352d29b1
Commit
352d29b1
authored
Oct 10, 2007
by
Aric Stewart
Committed by
Alexandre Julliard
Oct 11, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msdmo: Improve registration and reading of codecs.
parent
c632a750
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
20 deletions
+77
-20
dmoreg.c
dlls/msdmo/dmoreg.c
+77
-20
No files found.
dlls/msdmo/dmoreg.c
View file @
352d29b1
...
...
@@ -32,6 +32,7 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
msdmo
);
#define MSDMO_MAJOR_VERSION 6
static
const
WCHAR
szDMORootKey
[]
=
{
...
...
@@ -96,6 +97,8 @@ typedef struct
HKEY
hkey
;
}
IEnumDMOImpl
;
static
HRESULT
read_types
(
HKEY
root
,
LPCWSTR
key
,
ULONG
*
supplied
,
ULONG
requested
,
DMO_PARTIAL_MEDIATYPE
*
types
);
static
const
IEnumDMOVtbl
edmovt
;
static
LPWSTR
GUIDToString
(
LPWSTR
lpwstr
,
REFGUID
lpcguid
)
...
...
@@ -119,6 +122,40 @@ static BOOL IsMediaTypeEqual(const DMO_PARTIAL_MEDIATYPE* mt1, const DMO_PARTIAL
IsEqualCLSID
(
&
mt1
->
subtype
,
&
GUID_NULL
));
}
static
HRESULT
write_types
(
HKEY
hkey
,
LPCWSTR
name
,
const
DMO_PARTIAL_MEDIATYPE
*
types
,
DWORD
count
)
{
HRESULT
hres
=
S_OK
;
if
(
MSDMO_MAJOR_VERSION
>
5
)
{
hres
=
RegSetValueExW
(
hkey
,
name
,
0
,
REG_BINARY
,
(
const
BYTE
*
)
types
,
count
*
sizeof
(
DMO_PARTIAL_MEDIATYPE
));
}
else
{
HKEY
skey1
,
skey2
,
skey3
;
DWORD
index
=
0
;
WCHAR
szGuidKey
[
64
];
hres
=
RegCreateKeyExW
(
hkey
,
name
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_WRITE
,
NULL
,
&
skey1
,
NULL
);
while
(
index
<
count
)
{
GUIDToString
(
szGuidKey
,
&
types
[
index
].
type
);
hres
=
RegCreateKeyExW
(
skey1
,
szGuidKey
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_WRITE
,
NULL
,
&
skey2
,
NULL
);
GUIDToString
(
szGuidKey
,
&
types
[
index
].
subtype
);
hres
=
RegCreateKeyExW
(
skey2
,
szGuidKey
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_WRITE
,
NULL
,
&
skey3
,
NULL
);
RegCloseKey
(
skey3
);
RegCloseKey
(
skey2
);
index
++
;
}
RegCloseKey
(
skey1
);
}
return
hres
;
}
/***************************************************************
* DMORegister
*
...
...
@@ -144,7 +181,8 @@ HRESULT WINAPI DMORegister(
TRACE
(
"%s
\n
"
,
debugstr_w
(
szName
));
hres
=
RegOpenKeyExW
(
HKEY_CLASSES_ROOT
,
szDMORootKey
,
0
,
KEY_WRITE
,
&
hrkey
);
hres
=
RegCreateKeyExW
(
HKEY_CLASSES_ROOT
,
szDMORootKey
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_WRITE
,
NULL
,
&
hrkey
,
NULL
);
if
(
ERROR_SUCCESS
!=
hres
)
goto
lend
;
...
...
@@ -156,13 +194,13 @@ HRESULT WINAPI DMORegister(
/* Set default Name value */
hres
=
RegSetValueExW
(
hkey
,
NULL
,
0
,
REG_SZ
,
(
const
BYTE
*
)
szName
,
(
strlenW
(
szName
)
+
1
))
*
sizeof
(
WCHAR
);
(
strlenW
(
szName
)
+
1
)
*
sizeof
(
WCHAR
));
/* Set InputTypes */
hres
=
RegSetValueExW
(
hkey
,
szDMOInputType
,
0
,
REG_BINARY
,
(
const
BYTE
*
)
pInTypes
,
cInTypes
*
sizeof
(
DMO_PARTIAL_MEDIATYPE
));
hres
=
write_types
(
hkey
,
szDMOInputType
,
pInTypes
,
cInTypes
);
/* Set OutputTypes */
hres
=
RegSetValueExW
(
hkey
,
szDMOOutputType
,
0
,
REG_BINARY
,
(
const
BYTE
*
)
pOutTypes
,
cOutTypes
*
sizeof
(
DMO_PARTIAL_MEDIATYPE
));
hres
=
write_types
(
hkey
,
szDMOOutputType
,
pOutTypes
,
cOutTypes
);
if
(
dwFlags
&
DMO_REGISTERF_IS_KEYED
)
{
...
...
@@ -175,13 +213,15 @@ HRESULT WINAPI DMORegister(
}
/* Register the category */
hres
=
RegOpenKeyExW
(
hrkey
,
szDMOCategories
,
0
,
KEY_WRITE
,
&
hckey
);
hres
=
RegCreateKeyExW
(
hrkey
,
szDMOCategories
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_WRITE
,
NULL
,
&
hckey
,
NULL
);
if
(
ERROR_SUCCESS
!=
hres
)
goto
lend
;
RegCloseKey
(
hkey
);
hres
=
RegOpenKeyExW
(
hckey
,
GUIDToString
(
szguid
,
guidCategory
),
0
,
KEY_WRITE
,
&
hkey
);
hres
=
RegCreateKeyExW
(
hckey
,
GUIDToString
(
szguid
,
guidCategory
),
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_WRITE
,
NULL
,
&
hkey
,
NULL
);
if
(
ERROR_SUCCESS
!=
hres
)
goto
lend
;
hres
=
RegCreateKeyExW
(
hkey
,
GUIDToString
(
szguid
,
clsidDMO
),
0
,
NULL
,
...
...
@@ -330,19 +370,25 @@ static IEnumDMO * IEnumDMO_Constructor(
lpedmo
->
guidCategory
=
guidCategory
;
lpedmo
->
dwFlags
=
dwFlags
;
if
(
cInTypes
>
0
)
{
size
=
cInTypes
*
sizeof
(
DMO_PARTIAL_MEDIATYPE
);
lpedmo
->
pInTypes
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
lpedmo
->
pInTypes
)
goto
lerr
;
memcpy
(
lpedmo
->
pInTypes
,
pInTypes
,
size
);
lpedmo
->
cInTypes
=
cInTypes
;
}
if
(
cOutTypes
>
0
)
{
size
=
cOutTypes
*
sizeof
(
DMO_PARTIAL_MEDIATYPE
);
lpedmo
->
pOutTypes
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
lpedmo
->
pOutTypes
)
goto
lerr
;
memcpy
(
lpedmo
->
pOutTypes
,
pOutTypes
,
size
);
lpedmo
->
cOutTypes
=
cOutTypes
;
}
/* If not filtering by category enum from media objects root */
if
(
IsEqualGUID
(
guidCategory
,
&
GUID_NULL
))
...
...
@@ -487,15 +533,16 @@ static HRESULT WINAPI IEnumDMO_fnNext(
DWORD
cInTypes
;
DMO_PARTIAL_MEDIATYPE
*
pInTypes
;
len
=
MAX_PATH
*
sizeof
(
WCHAR
);
hres
=
RegQueryValueExW
(
hkey
,
szDMOInputType
,
NULL
,
NULL
,
(
LPBYTE
)
szValue
,
&
len
);
hres
=
read_types
(
hkey
,
szDMOInputType
,
&
cInTypes
,
sizeof
(
szValue
)
/
sizeof
(
DMO_PARTIAL_MEDIATYPE
),
(
DMO_PARTIAL_MEDIATYPE
*
)
szValue
);
if
(
ERROR_SUCCESS
!=
hres
)
{
RegCloseKey
(
hkey
);
continue
;
}
cInTypes
=
len
/
sizeof
(
DMO_PARTIAL_MEDIATYPE
);
pInTypes
=
(
DMO_PARTIAL_MEDIATYPE
*
)
szValue
;
for
(
i
=
0
;
i
<
This
->
cInTypes
;
i
++
)
...
...
@@ -523,15 +570,16 @@ static HRESULT WINAPI IEnumDMO_fnNext(
DWORD
cOutTypes
;
DMO_PARTIAL_MEDIATYPE
*
pOutTypes
;
len
=
MAX_PATH
*
sizeof
(
WCHAR
);
hres
=
RegQueryValueExW
(
hkey
,
szDMOOutputType
,
NULL
,
NULL
,
(
LPBYTE
)
szValue
,
&
len
);
hres
=
read_types
(
hkey
,
szDMOOutputType
,
&
cOutTypes
,
sizeof
(
szValue
)
/
sizeof
(
DMO_PARTIAL_MEDIATYPE
),
(
DMO_PARTIAL_MEDIATYPE
*
)
szValue
);
if
(
ERROR_SUCCESS
!=
hres
)
{
RegCloseKey
(
hkey
);
continue
;
}
cOutTypes
=
len
/
sizeof
(
DMO_PARTIAL_MEDIATYPE
);
pOutTypes
=
(
DMO_PARTIAL_MEDIATYPE
*
)
szValue
;
for
(
i
=
0
;
i
<
This
->
cOutTypes
;
i
++
)
...
...
@@ -659,9 +707,18 @@ static const IEnumDMOVtbl edmovt =
};
HRESULT
buil
d_types
(
HKEY
root
,
LPCWSTR
key
,
ULONG
*
supplied
,
ULONG
requested
,
DMO_PARTIAL_MEDIATYPE
*
types
)
HRESULT
rea
d_types
(
HKEY
root
,
LPCWSTR
key
,
ULONG
*
supplied
,
ULONG
requested
,
DMO_PARTIAL_MEDIATYPE
*
types
)
{
HRESULT
ret
=
S_OK
;
if
(
MSDMO_MAJOR_VERSION
>
5
)
{
DWORD
len
;
len
=
requested
*
sizeof
(
DMO_PARTIAL_MEDIATYPE
);
ret
=
RegQueryValueExW
(
root
,
key
,
NULL
,
NULL
,
(
LPBYTE
)
types
,
&
len
);
*
supplied
=
len
/
sizeof
(
DMO_PARTIAL_MEDIATYPE
);
}
else
{
HKEY
hkey
;
WCHAR
szGuidKey
[
64
];
...
...
@@ -673,10 +730,9 @@ HRESULT build_types(HKEY root, LPCWSTR key, ULONG *supplied, ULONG requested, DM
DWORD
len
;
LONG
rc
=
ERROR_SUCCESS
;
len
=
MAX_PATH
;
while
(
rc
==
ERROR_SUCCESS
)
{
len
=
MAX_PATH
;
len
=
MAX_PATH
*
sizeof
(
WCHAR
)
;
rc
=
RegEnumKeyExW
(
hkey
,
index
,
szNextKey
,
&
len
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
rc
==
ERROR_SUCCESS
)
{
...
...
@@ -688,7 +744,7 @@ HRESULT build_types(HKEY root, LPCWSTR key, ULONG *supplied, ULONG requested, DM
RegOpenKeyExW
(
hkey
,
szNextKey
,
0
,
KEY_READ
,
&
subk
);
while
(
rcs
==
ERROR_SUCCESS
)
{
len
=
MAX_PATH
;
len
=
MAX_PATH
*
sizeof
(
WCHAR
)
;
rcs
=
RegEnumKeyExW
(
subk
,
sub_index
,
szSubKey
,
&
len
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
rcs
==
ERROR_SUCCESS
)
{
...
...
@@ -718,6 +774,7 @@ HRESULT build_types(HKEY root, LPCWSTR key, ULONG *supplied, ULONG requested, DM
}
RegCloseKey
(
hkey
);
}
}
return
ret
;
}
...
...
@@ -751,7 +808,7 @@ HRESULT WINAPI DMOGetTypes(REFCLSID clsidDMO,
if
(
ulInputTypesRequested
>
0
)
{
ret
=
buil
d_types
(
hkey
,
szDMOInputType
,
pulInputTypesSupplied
,
ulInputTypesRequested
,
pInputTypes
);
ret
=
rea
d_types
(
hkey
,
szDMOInputType
,
pulInputTypesSupplied
,
ulInputTypesRequested
,
pInputTypes
);
}
else
*
pulInputTypesSupplied
=
0
;
...
...
@@ -759,7 +816,7 @@ HRESULT WINAPI DMOGetTypes(REFCLSID clsidDMO,
if
(
ulOutputTypesRequested
>
0
)
{
HRESULT
ret2
;
ret2
=
buil
d_types
(
hkey
,
szDMOOutputType
,
pulOutputTypesSupplied
,
ulOutputTypesRequested
,
pOutputTypes
);
ret2
=
rea
d_types
(
hkey
,
szDMOOutputType
,
pulOutputTypesSupplied
,
ulOutputTypesRequested
,
pOutputTypes
);
if
(
ret
==
S_OK
)
ret
=
ret2
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment