Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
3ff496b9
Commit
3ff496b9
authored
Mar 06, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Mar 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvfw32: Get rid of enum_drivers().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
07a1f8d9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
81 deletions
+65
-81
msvideo_main.c
dlls/msvfw32/msvideo_main.c
+61
-74
msvfw.c
dlls/msvfw32/tests/msvfw.c
+4
-7
No files found.
dlls/msvfw32/msvideo_main.c
View file @
3ff496b9
...
...
@@ -234,53 +234,6 @@ static DWORD get_size_image(LONG width, LONG height, WORD depth)
return
ret
;
}
typedef
BOOL
(
*
enum_handler_t
)(
const
char
*
name
,
const
char
*
driver
,
unsigned
int
index
,
void
*
param
);
static
BOOL
enum_drivers
(
DWORD
fccType
,
enum_handler_t
handler
,
void
*
param
)
{
char
fccTypeStr
[
4
];
char
name_buf
[
10
];
char
buf
[
2048
];
DWORD
i
,
cnt
=
0
,
lRet
;
BOOL
result
=
FALSE
;
HKEY
hKey
;
fourcc_to_string
(
fccTypeStr
,
fccType
);
/* first, go through the registry entries */
lRet
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
HKLM_DRIVERS32
,
0
,
KEY_QUERY_VALUE
,
&
hKey
);
if
(
lRet
==
ERROR_SUCCESS
)
{
i
=
0
;
for
(;;)
{
DWORD
name_len
=
10
,
driver_len
=
128
;
lRet
=
RegEnumValueA
(
hKey
,
i
++
,
name_buf
,
&
name_len
,
0
,
0
,
(
BYTE
*
)
buf
,
&
driver_len
);
if
(
lRet
==
ERROR_NO_MORE_ITEMS
)
break
;
if
(
name_len
!=
9
||
name_buf
[
4
]
!=
'.'
)
continue
;
if
(
fccType
&&
strncasecmp
(
name_buf
,
fccTypeStr
,
4
))
continue
;
if
((
result
=
handler
(
name_buf
,
buf
,
cnt
++
,
param
)))
break
;
}
RegCloseKey
(
hKey
);
}
if
(
result
)
return
result
;
/* if that didn't work, go through the values in system.ini */
if
(
GetPrivateProfileSectionA
(
"drivers32"
,
buf
,
sizeof
(
buf
),
"system.ini"
))
{
char
*
s
;
for
(
s
=
buf
;
*
s
;
s
+=
strlen
(
s
)
+
1
)
{
if
(
s
[
4
]
!=
'.'
||
s
[
9
]
!=
'='
)
continue
;
if
(
fccType
&&
strncasecmp
(
s
,
fccTypeStr
,
4
))
continue
;
if
((
result
=
handler
(
s
,
s
+
10
,
cnt
++
,
param
)))
break
;
}
}
return
result
;
}
/******************************************************************
* MSVIDEO_GetHicPtr
*
...
...
@@ -305,27 +258,6 @@ DWORD WINAPI VideoForWindowsVersion(void)
return
0x040003B6
;
/* 4.950 */
}
static
BOOL
ICInfo_enum_handler
(
const
char
*
name
,
const
char
*
driver
,
unsigned
int
nr
,
void
*
param
)
{
ICINFO
*
lpicinfo
=
param
;
DWORD
fccType
=
mmioStringToFOURCCA
(
name
,
0
);
DWORD
fccHandler
=
mmioStringToFOURCCA
(
name
+
5
,
0
);
if
(
lpicinfo
->
fccHandler
!=
nr
&&
compare_fourcc
(
lpicinfo
->
fccHandler
,
fccHandler
))
return
FALSE
;
lpicinfo
->
fccType
=
fccType
;
lpicinfo
->
fccHandler
=
fccHandler
;
lpicinfo
->
dwFlags
=
0
;
lpicinfo
->
dwVersion
=
0
;
lpicinfo
->
dwVersionICM
=
ICVERSION
;
lpicinfo
->
szName
[
0
]
=
0
;
lpicinfo
->
szDescription
[
0
]
=
0
;
MultiByteToWideChar
(
CP_ACP
,
0
,
driver
,
-
1
,
lpicinfo
->
szDriver
,
ARRAY_SIZE
(
lpicinfo
->
szDriver
));
return
TRUE
;
}
/***********************************************************************
* ICInfo [MSVFW32.@]
* Get information about an installable compressor. Return TRUE if there
...
...
@@ -336,14 +268,69 @@ static BOOL ICInfo_enum_handler(const char *name, const char *driver, unsigned i
* fccHandler [I] real fcc for handler or <n>th compressor
* lpicinfo [O] information about compressor
*/
BOOL
VFWAPI
ICInfo
(
DWORD
fccType
,
DWORD
fccHandler
,
ICINFO
*
lpic
info
)
BOOL
VFWAPI
ICInfo
(
DWORD
type
,
DWORD
handler
,
ICINFO
*
info
)
{
TRACE
(
"(%s,%s,%p)
\n
"
,
wine_dbgstr_fcc
(
fccType
),
wine_dbgstr_fcc
(
fccHandler
),
lpicinfo
);
char
name_buf
[
10
],
buf
[
2048
];
DWORD
ret_type
,
ret_handler
;
DWORD
i
,
count
=
0
;
LONG
res
;
HKEY
key
;
TRACE
(
"type %s, handler %s, info %p.
\n
"
,
wine_dbgstr_fcc
(
type
),
wine_dbgstr_fcc
(
handler
),
info
);
memset
(
info
,
0
,
sizeof
(
*
info
));
info
->
dwSize
=
sizeof
(
*
info
);
info
->
dwVersionICM
=
ICVERSION
;
if
(
!
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
HKLM_DRIVERS32
,
0
,
KEY_QUERY_VALUE
,
&
key
))
{
i
=
0
;
for
(;;)
{
DWORD
name_len
=
ARRAY_SIZE
(
name_buf
),
driver_len
=
ARRAY_SIZE
(
info
->
szDriver
);
lpicinfo
->
fccType
=
fccType
;
lpicinfo
->
fccHandler
=
fccHandler
;
return
enum_drivers
(
fccType
,
ICInfo_enum_handler
,
lpicinfo
);
res
=
RegEnumValueA
(
key
,
i
++
,
name_buf
,
&
name_len
,
0
,
0
,
(
BYTE
*
)
buf
,
&
driver_len
);
if
(
res
==
ERROR_NO_MORE_ITEMS
)
break
;
if
(
name_len
!=
9
||
name_buf
[
4
]
!=
'.'
)
continue
;
ret_type
=
mmioStringToFOURCCA
(
name_buf
,
0
);
ret_handler
=
mmioStringToFOURCCA
(
name_buf
+
5
,
0
);
if
(
type
&&
compare_fourcc
(
type
,
ret_type
))
continue
;
if
(
compare_fourcc
(
handler
,
ret_handler
)
&&
handler
!=
count
++
)
continue
;
info
->
fccType
=
ret_type
;
info
->
fccHandler
=
ret_handler
;
MultiByteToWideChar
(
CP_ACP
,
0
,
buf
,
-
1
,
info
->
szDriver
,
ARRAY_SIZE
(
info
->
szDriver
));
TRACE
(
"Returning codec %s, driver %s.
\n
"
,
debugstr_a
(
name_buf
),
debugstr_a
(
buf
));
return
TRUE
;
}
RegCloseKey
(
key
);
}
if
(
GetPrivateProfileSectionA
(
"drivers32"
,
buf
,
sizeof
(
buf
),
"system.ini"
))
{
char
*
s
;
for
(
s
=
buf
;
*
s
;
s
+=
strlen
(
s
)
+
1
)
{
if
(
s
[
4
]
!=
'.'
||
s
[
9
]
!=
'='
)
continue
;
ret_type
=
mmioStringToFOURCCA
(
s
,
0
);
ret_handler
=
mmioStringToFOURCCA
(
s
+
5
,
0
);
if
(
type
&&
compare_fourcc
(
type
,
ret_type
))
continue
;
if
(
compare_fourcc
(
handler
,
ret_handler
)
&&
handler
!=
count
++
)
continue
;
info
->
fccType
=
ret_type
;
info
->
fccHandler
=
ret_handler
;
MultiByteToWideChar
(
CP_ACP
,
0
,
s
+
10
,
-
1
,
info
->
szDriver
,
ARRAY_SIZE
(
info
->
szDriver
));
TRACE
(
"Returning codec %s, driver %s.
\n
"
,
debugstr_an
(
s
,
8
),
debugstr_a
(
s
+
10
));
return
TRUE
;
}
}
info
->
fccType
=
type
;
info
->
fccHandler
=
handler
;
WARN
(
"No driver found for codec %s.%s.
\n
"
,
wine_dbgstr_fcc
(
type
),
wine_dbgstr_fcc
(
handler
));
return
FALSE
;
}
static
DWORD
IC_HandleRef
=
1
;
...
...
dlls/msvfw32/tests/msvfw.c
View file @
3ff496b9
...
...
@@ -358,14 +358,12 @@ static void test_ICInfo(void)
ok
(
!
ICInfo
(
ICTYPE_VIDEO
,
mmioFOURCC
(
'f'
,
'a'
,
'k'
,
'e'
),
&
info
),
"expected failure
\n
"
);
ok
(
info
.
fccType
==
ICTYPE_VIDEO
,
"got 0x%08x
\n
"
,
info
.
fccType
);
ok
(
info
.
fccHandler
==
mmioFOURCC
(
'f'
,
'a'
,
'k'
,
'e'
),
"got 0x%08x
\n
"
,
info
.
fccHandler
);
todo_wine
{
ok
(
!
info
.
dwFlags
,
"Got unexpected flags %#x.
\n
"
,
info
.
dwFlags
);
ok
(
!
info
.
dwVersion
,
"Got unexpected version %#x.
\n
"
,
info
.
dwVersion
);
ok
(
info
.
dwVersionICM
==
ICVERSION
,
"Got unexpected ICM version %#x.
\n
"
,
info
.
dwVersionICM
);
ok
(
!
info
.
szName
[
0
],
"Got unexpected name %s.
\n
"
,
wine_dbgstr_w
(
info
.
szName
));
ok
(
!
info
.
szDescription
[
0
],
"Got unexpected name %s.
\n
"
,
wine_dbgstr_w
(
info
.
szDescription
));
ok
(
!
info
.
szDriver
[
0
],
"Got unexpected driver %s.
\n
"
,
wine_dbgstr_w
(
info
.
szDriver
));
}
if
(
!
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows NT"
"
\\
CurrentVersion
\\
Drivers32"
,
0
,
KEY_ALL_ACCESS
,
&
key
))
...
...
@@ -386,14 +384,13 @@ todo_wine
ok
(
ICInfo
(
test_type
,
test_handler
,
&
info
),
"Expected success.
\n
"
);
ok
(
info
.
fccType
==
test_type
,
"Got unexpected type %#x.
\n
"
,
info
.
fccType
);
ok
(
info
.
fccHandler
==
test_handler
,
"Got unexpected handler %#x.
\n
"
,
info
.
fccHandler
);
todo_wine
{
ok
(
!
info
.
dwFlags
,
"Got unexpected flags %#x.
\n
"
,
info
.
dwFlags
);
ok
(
!
info
.
dwVersion
,
"Got unexpected version %#x.
\n
"
,
info
.
dwVersion
);
ok
(
info
.
dwVersionICM
==
ICVERSION
,
"Got unexpected ICM version %#x.
\n
"
,
info
.
dwVersionICM
);
ok
(
!
info
.
szName
[
0
],
"Got unexpected name %s.
\n
"
,
wine_dbgstr_w
(
info
.
szName
));
ok
(
!
info
.
szDescription
[
0
],
"Got unexpected name %s.
\n
"
,
wine_dbgstr_w
(
info
.
szDescription
));
todo_wine
ok
(
!
lstrcmpW
(
info
.
szDriver
,
bogusW
),
"Got unexpected driver %s.
\n
"
,
wine_dbgstr_w
(
info
.
szDriver
));
}
/* Drivers installed after msvfw32 is loaded are not enumerated. */
ok
(
!
ICInfo
(
test_type
,
0
,
&
info
),
"Expected failure.
\n
"
);
...
...
@@ -439,13 +436,14 @@ todo_wine {
ok
(
ICInfo
(
test_type
,
test_handler
,
&
enum_info
),
"Expected success.
\n
"
);
ok
(
!
enum_info
.
fccType
,
"Got unexpected type %#x.
\n
"
,
enum_info
.
fccType
);
ok
(
!
enum_info
.
fccHandler
,
"Got unexpected handler %#x.
\n
"
,
enum_info
.
fccHandler
);
}
ok
(
!
enum_info
.
dwFlags
,
"Got unexpected flags %#x.
\n
"
,
enum_info
.
dwFlags
);
todo_wine
ok
(
enum_info
.
dwVersion
==
0xdeadbeef
,
"Got unexpected version %#x.
\n
"
,
enum_info
.
dwVersion
);
ok
(
enum_info
.
dwVersionICM
==
ICVERSION
,
"Got unexpected ICM version %#x.
\n
"
,
enum_info
.
dwVersionICM
);
ok
(
!
enum_info
.
szName
[
0
],
"Got unexpected name %s.
\n
"
,
wine_dbgstr_w
(
enum_info
.
szName
));
ok
(
!
enum_info
.
szDescription
[
0
],
"Got unexpected name %s.
\n
"
,
wine_dbgstr_w
(
enum_info
.
szDescription
));
ok
(
!
enum_info
.
szDriver
[
0
],
"Got unexpected driver %s.
\n
"
,
wine_dbgstr_w
(
enum_info
.
szDriver
));
}
/* Functions installed after msvfw32 is loaded are enumerated. */
memset
(
&
enum_info
,
0x55
,
sizeof
(
enum_info
));
...
...
@@ -455,14 +453,13 @@ todo_wine {
ok
(
!
enum_info
.
fccType
,
"Got unexpected type %#x.
\n
"
,
enum_info
.
fccType
);
}
ok
(
!
enum_info
.
fccHandler
,
"Got unexpected handler %#x.
\n
"
,
enum_info
.
fccHandler
);
todo_wine
{
ok
(
!
enum_info
.
dwFlags
,
"Got unexpected flags %#x.
\n
"
,
enum_info
.
dwFlags
);
todo_wine
ok
(
enum_info
.
dwVersion
==
0xdeadbeef
,
"Got unexpected version %#x.
\n
"
,
enum_info
.
dwVersion
);
ok
(
enum_info
.
dwVersionICM
==
ICVERSION
,
"Got unexpected ICM version %#x.
\n
"
,
enum_info
.
dwVersionICM
);
ok
(
!
enum_info
.
szName
[
0
],
"Got unexpected name %s.
\n
"
,
wine_dbgstr_w
(
enum_info
.
szName
));
ok
(
!
enum_info
.
szDescription
[
0
],
"Got unexpected name %s.
\n
"
,
wine_dbgstr_w
(
enum_info
.
szDescription
));
ok
(
!
enum_info
.
szDriver
[
0
],
"Got unexpected driver %s.
\n
"
,
wine_dbgstr_w
(
enum_info
.
szDriver
));
}
ret
=
ICRemove
(
test_type
,
test_handler
,
0
);
ok
(
ret
,
"Failed to remove driver.
\n
"
);
...
...
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