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
6f92e484
Commit
6f92e484
authored
Oct 27, 2020
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Oct 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmp: Use wide-char string literals.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ebd92b98
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
56 deletions
+36
-56
oleobj.c
dlls/wmp/oleobj.c
+2
-4
player.c
dlls/wmp/player.c
+12
-17
media.c
dlls/wmp/tests/media.c
+19
-30
oleobj.c
dlls/wmp/tests/oleobj.c
+3
-5
No files found.
dlls/wmp/oleobj.c
View file @
6f92e484
...
...
@@ -95,13 +95,11 @@ static ATOM wmp_class;
static
BOOL
WINAPI
register_wmp_class
(
INIT_ONCE
*
once
,
void
*
param
,
void
**
context
)
{
/* It seems that native uses ATL for this. We use a fake name to make tests happy. */
static
const
WCHAR
atl_wmpW
[]
=
{
'A'
,
'T'
,
'L'
,
':'
,
'W'
,
'M'
,
'P'
,
0
};
static
WNDCLASSEXW
wndclass
=
{
sizeof
(
wndclass
),
CS_DBLCLKS
,
wmp_wnd_proc
,
0
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
atl_wmpW
,
NULL
/* It seems that native uses ATL for this. We use a fake name to make tests happy. */
L"ATL:WMP"
,
NULL
};
wndclass
.
hInstance
=
wmp_instance
;
...
...
dlls/wmp/player.c
View file @
6f92e484
...
...
@@ -28,8 +28,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(wmp);
static
ATOM
player_msg_class
;
static
INIT_ONCE
class_init_once
;
static
UINT
WM_WMPEVENT
;
static
const
WCHAR
WMPmessageW
[]
=
{
'_'
,
'W'
,
'M'
,
'P'
,
'M'
,
'e'
,
's'
,
's'
,
'a'
,
'g'
,
'e'
,
0
};
static
const
WCHAR
emptyW
[]
=
{
0
};
static
void
update_state
(
WindowsMediaPlayer
*
wmp
,
LONG
type
,
LONG
state
)
{
...
...
@@ -142,7 +140,7 @@ static HRESULT WINAPI WMPPlayer4_get_URL(IWMPPlayer4 *iface, BSTR *url)
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
url
);
if
(
!
This
->
media
)
return
return_bstr
(
emptyW
,
url
);
return
return_bstr
(
L""
,
url
);
return
return_bstr
(
This
->
media
->
url
,
url
);
}
...
...
@@ -258,7 +256,6 @@ static HRESULT WINAPI WMPPlayer4_get_playlistCollection(IWMPPlayer4 *iface, IWMP
static
HRESULT
WINAPI
WMPPlayer4_get_versionInfo
(
IWMPPlayer4
*
iface
,
BSTR
*
version
)
{
static
const
WCHAR
versionW
[]
=
{
'1'
,
'2'
,
'.'
,
'0'
,
'.'
,
'7'
,
'6'
,
'0'
,
'1'
,
'.'
,
'1'
,
'6'
,
'9'
,
'8'
,
'2'
,
0
};
WindowsMediaPlayer
*
This
=
impl_from_IWMPPlayer4
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
version
);
...
...
@@ -266,7 +263,7 @@ static HRESULT WINAPI WMPPlayer4_get_versionInfo(IWMPPlayer4 *iface, BSTR *versi
if
(
!
version
)
return
E_POINTER
;
return
return_bstr
(
versionW
,
version
);
return
return_bstr
(
L"12.0.7601.16982"
,
version
);
}
static
HRESULT
WINAPI
WMPPlayer4_launchURL
(
IWMPPlayer4
*
iface
,
BSTR
url
)
...
...
@@ -1447,11 +1444,10 @@ static HRESULT WINAPI WMPControls_Invoke(IWMPControls *iface, DISPID dispIdMembe
static
HRESULT
WINAPI
WMPControls_get_isAvailable
(
IWMPControls
*
iface
,
BSTR
bstrItem
,
VARIANT_BOOL
*
pIsAvailable
)
{
WindowsMediaPlayer
*
This
=
impl_from_IWMPControls
(
iface
);
static
const
WCHAR
currentPosition
[]
=
{
'c'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'P'
,
'o'
,
's'
,
'i'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
bstrItem
),
pIsAvailable
);
if
(
!
This
->
filter_graph
)
{
*
pIsAvailable
=
VARIANT_FALSE
;
}
else
if
(
wcscmp
(
currentPosition
,
bstrItem
)
==
0
)
{
}
else
if
(
wcscmp
(
L"currentPosition"
,
bstrItem
)
==
0
)
{
DWORD
capabilities
;
IMediaSeeking_GetCapabilities
(
This
->
media_seeking
,
&
capabilities
);
*
pIsAvailable
=
(
capabilities
&
AM_SEEKING_CanSeekAbsolute
)
?
...
...
@@ -2202,12 +2198,12 @@ static BOOL WINAPI register_player_msg_class(INIT_ONCE *once, void *param, void
static
WNDCLASSEXW
wndclass
=
{
sizeof
(
wndclass
),
CS_DBLCLKS
,
player_wnd_proc
,
0
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
WMPmessageW
,
NULL
L"_WMPMessage"
,
NULL
};
wndclass
.
hInstance
=
wmp_instance
;
player_msg_class
=
RegisterClassExW
(
&
wndclass
);
WM_WMPEVENT
=
RegisterWindowMessageW
(
WMPmessageW
);
WM_WMPEVENT
=
RegisterWindowMessageW
(
L"_WMPMessage"
);
return
TRUE
;
}
...
...
@@ -2220,7 +2216,6 @@ BOOL init_player(WindowsMediaPlayer *wmp)
{
IWMPPlaylist
*
playlist
;
BSTR
name
;
static
const
WCHAR
nameW
[]
=
{
'P'
,
'l'
,
'a'
,
'y'
,
'l'
,
'i'
,
's'
,
't'
,
'1'
,
0
};
InitOnceExecuteOnce
(
&
class_init_once
,
register_player_msg_class
,
NULL
,
NULL
);
wmp
->
msg_window
=
CreateWindowW
(
MAKEINTRESOURCEW
(
player_msg_class
),
NULL
,
0
,
0
,
...
...
@@ -2240,7 +2235,7 @@ BOOL init_player(WindowsMediaPlayer *wmp)
wmp
->
IWMPControls_iface
.
lpVtbl
=
&
WMPControlsVtbl
;
wmp
->
IWMPNetwork_iface
.
lpVtbl
=
&
WMPNetworkVtbl
;
name
=
SysAllocString
(
nameW
);
name
=
SysAllocString
(
L"Playlist1"
);
if
(
SUCCEEDED
(
create_playlist
(
name
,
NULL
,
0
,
&
playlist
)))
wmp
->
playlist
=
unsafe_impl_from_IWMPPlaylist
(
playlist
);
else
...
...
@@ -2285,7 +2280,7 @@ HRESULT create_media_from_url(BSTR url, double duration, IWMPMedia **ppMedia)
IUri
*
uri
;
BSTR
path
;
HRESULT
hr
;
WCHAR
*
name_dup
,
slashW
[]
=
{
'/'
,
0
}
;
WCHAR
*
name_dup
;
media
=
heap_alloc_zero
(
sizeof
(
*
media
));
if
(
!
media
)
...
...
@@ -2317,7 +2312,7 @@ HRESULT create_media_from_url(BSTR url, double duration, IWMPMedia **ppMedia)
/* GetPath() will return "/" for invalid uri's
* only strip extension when uri is valid
*/
if
(
wcscmp
(
path
,
slashW
)
!=
0
)
if
(
wcscmp
(
path
,
L"/"
)
!=
0
)
PathRemoveExtensionW
(
name_dup
);
PathStripPathW
(
name_dup
);
...
...
@@ -2328,8 +2323,8 @@ HRESULT create_media_from_url(BSTR url, double duration, IWMPMedia **ppMedia)
}
else
{
media
->
url
=
heap_strdupW
(
emptyW
);
media
->
name
=
heap_strdupW
(
emptyW
);
media
->
url
=
heap_strdupW
(
L""
);
media
->
name
=
heap_strdupW
(
L""
);
}
media
->
duration
=
duration
;
...
...
@@ -2353,8 +2348,8 @@ HRESULT create_playlist(BSTR name, BSTR url, LONG count, IWMPPlaylist **ppPlayli
return
E_OUTOFMEMORY
;
playlist
->
IWMPPlaylist_iface
.
lpVtbl
=
&
WMPPlaylistVtbl
;
playlist
->
url
=
url
?
heap_strdupW
(
url
)
:
heap_strdupW
(
emptyW
);
playlist
->
name
=
name
?
heap_strdupW
(
name
)
:
heap_strdupW
(
emptyW
);
playlist
->
url
=
heap_strdupW
(
url
?
url
:
L""
);
playlist
->
name
=
heap_strdupW
(
name
?
name
:
L""
);
playlist
->
ref
=
1
;
playlist
->
count
=
count
;
...
...
dlls/wmp/tests/media.c
View file @
6f92e484
...
...
@@ -67,8 +67,8 @@ static HANDLE playing_event;
static
HANDLE
completed_event
;
static
DWORD
main_thread_id
;
static
const
WCHAR
mp3file
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'.'
,
'm'
,
'p'
,
'3'
,
0
}
;
static
const
WCHAR
mp3file1s
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'1'
,
's'
,
'.'
,
'm'
,
'p'
,
'3'
,
0
}
;
static
const
WCHAR
mp3file
[]
=
L"test.mp3"
;
static
const
WCHAR
mp3file1s
[]
=
L"test1s.mp3"
;
static
inline
WCHAR
*
load_resource
(
const
WCHAR
*
name
)
{
static
WCHAR
pathW
[
MAX_PATH
];
...
...
@@ -308,7 +308,6 @@ static BOOL test_wmp(void)
VARIANT_BOOL
vbool
;
LONG
progress
;
IWMPMedia
*
media
;
static
const
WCHAR
currentPosition
[]
=
{
'c'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'P'
,
'o'
,
's'
,
'i'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
BSTR
bstrcurrentPosition
;
hres
=
CoCreateInstance
(
&
CLSID_WindowsMediaPlayer
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IOleObject
,
(
void
**
)
&
oleobj
);
...
...
@@ -344,7 +343,7 @@ static BOOL test_wmp(void)
ok
(
hres
==
S_OK
,
"get_controls failed: %08x
\n
"
,
hres
);
ok
(
controls
!=
NULL
,
"controls = NULL
\n
"
);
bstrcurrentPosition
=
SysAllocString
(
currentPosition
);
bstrcurrentPosition
=
SysAllocString
(
L"currentPosition"
);
hres
=
IWMPControls_get_isAvailable
(
controls
,
bstrcurrentPosition
,
&
vbool
);
ok
(
hres
==
S_OK
,
"IWMPControls_get_isAvailable failed: %08x
\n
"
,
hres
);
ok
(
vbool
==
VARIANT_FALSE
,
"unexpected value
\n
"
);
...
...
@@ -487,16 +486,6 @@ playback_skip:
static
void
test_media_item
(
void
)
{
static
const
WCHAR
slashW
[]
=
{
'\\'
,
0
};
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
static
const
WCHAR
fooW
[]
=
{
'f'
,
'o'
,
'o'
,
':'
,
'/'
,
'/'
,
0
};
static
const
WCHAR
fileW
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
,
'/'
,
'/'
,
'/'
,
0
};
static
const
WCHAR
httpW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
0
};
static
const
WCHAR
httpsW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
's'
,
':'
,
'/'
,
'/'
,
0
};
static
const
WCHAR
invalidurlW
[]
=
{
'i'
,
'n'
,
'v'
,
'a'
,
'l'
,
'i'
,
'd'
,
'_'
,
'u'
,
'r'
,
'l'
,
0
};
static
const
WCHAR
invalidurlmp3W
[]
=
{
'i'
,
'n'
,
'v'
,
'a'
,
'l'
,
'i'
,
'd'
,
'_'
,
'u'
,
'r'
,
'l'
,
'.'
,
'm'
,
'p'
,
'3'
,
0
};
static
const
WCHAR
winehqurlW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'.'
,
'w'
,
'i'
,
'n'
,
'e'
,
'h'
,
'q'
,
'.'
,
'o'
,
'r'
,
'g'
,
'/'
,
't'
,
'e'
,
's'
,
't'
,
's'
,
'/'
,
't'
,
'e'
,
's'
,
't'
,
'.'
,
'm'
,
'p'
,
'3'
,
0
};
static
WCHAR
pathW
[
MAX_PATH
];
static
WCHAR
currentdirW
[
MAX_PATH
];
struct
{
...
...
@@ -504,17 +493,17 @@ static void test_media_item(void)
const
WCHAR
*
filename
;
const
WCHAR
*
expected
;
}
tests
[]
=
{
{
NULL
,
invalidurlmp3W
,
invalidurlW
},
{
currentdirW
,
mp3file
,
testW
},
{
currentdirW
,
invalidurlmp3W
,
invalidurlW
},
{
httpW
,
winehqurlW
,
testW
},
{
httpW
,
invalidurlmp3W
,
invalidurlmp3W
},
{
httpsW
,
winehqurlW
,
testW
},
{
httpsW
,
invalidurlmp3W
,
invalidurlmp3W
},
{
fileW
,
mp3file
,
testW
},
{
fileW
,
invalidurlmp3W
,
invalidurlW
},
{
fooW
,
mp3file
,
mp3file
},
{
fooW
,
invalidurlmp3W
,
invalidurlmp3W
}
{
NULL
,
L"invalid_url.mp3"
,
L"invalid_url"
},
{
currentdirW
,
mp3file
,
L"test"
},
{
currentdirW
,
L"invalid_url.mp3"
,
L"invalid_url"
},
{
L"http://"
,
L"test.winehq.org/tests/test.mp3"
,
L"test"
},
{
L"http://"
,
L"invalid_url.mp3"
,
L"invalid_url.mp3"
},
{
L"https://"
,
L"test.winehq.org/tests/test.mp3"
,
L"test"
},
{
L"https://"
,
L"invalid_url.mp3"
,
L"invalid_url.mp3"
},
{
L"file:///"
,
mp3file
,
L"test"
},
{
L"file:///"
,
L"invalid_url.mp3"
,
L"invalid_url"
},
{
L"foo://"
,
mp3file
,
mp3file
},
{
L"foo://"
,
L"invalid_url.mp3"
,
L"invalid_url.mp3"
}
};
IWMPMedia
*
media
,
*
media2
;
IWMPPlayer4
*
player
;
...
...
@@ -570,13 +559,13 @@ static void test_media_item(void)
SysFreeString
(
str
);
hr
=
IWMPMedia_get_name
(
media
,
&
str
);
ok
(
hr
==
S_OK
,
"Failed to get item name, hr %#x.
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
testW
),
"Expected %s, got %s
\n
"
,
wine_dbgstr_w
(
testW
),
wine_dbgstr_w
(
str
));
ok
(
!
lstrcmpW
(
str
,
L"test"
),
"Expected %s, got %s
\n
"
,
wine_dbgstr_w
(
L"test"
),
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
hr
=
IWMPMedia_put_name
(
media
,
NULL
);
ok
(
hr
==
E_POINTER
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IWMPMedia_get_name
(
media
,
&
str
);
ok
(
hr
==
S_OK
,
"Failed to get item name, hr %#x.
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
testW
),
"Expected %s, got %s
\n
"
,
wine_dbgstr_w
(
testW
),
wine_dbgstr_w
(
str
));
ok
(
!
lstrcmpW
(
str
,
L"test"
),
"Expected %s, got %s
\n
"
,
wine_dbgstr_w
(
L"test"
),
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
hr
=
IWMPPlayer4_put_currentMedia
(
player
,
media
);
...
...
@@ -588,12 +577,12 @@ static void test_media_item(void)
ok
(
media2
!=
NULL
,
"Unexpected media instance.
\n
"
);
hr
=
IWMPMedia_get_name
(
media2
,
&
str
);
ok
(
hr
==
S_OK
,
"Failed to get item name, hr %#x.
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
testW
),
"Expected %s, got %s
\n
"
,
wine_dbgstr_w
(
testW
),
wine_dbgstr_w
(
str
));
ok
(
!
lstrcmpW
(
str
,
L"test"
),
"Expected %s, got %s
\n
"
,
wine_dbgstr_w
(
L"test"
),
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
IWMPMedia_Release
(
media2
);
GetCurrentDirectoryW
(
ARRAY_SIZE
(
currentdirW
),
currentdirW
);
lstrcatW
(
currentdirW
,
slashW
);
lstrcatW
(
currentdirW
,
L"
\\
"
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
tests
);
i
++
)
{
...
...
@@ -671,7 +660,7 @@ static void test_playlist(void)
HRESULT
hr
;
BSTR
str
,
str2
;
LONG
count
;
static
const
WCHAR
nameW
[]
=
{
'P'
,
'l'
,
'a'
,
'y'
,
'l'
,
'i'
,
's'
,
't'
,
'1'
,
0
}
;
static
const
WCHAR
nameW
[]
=
L"Playlist1"
;
hr
=
CoCreateInstance
(
&
CLSID_WindowsMediaPlayer
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IWMPPlayer4
,
(
void
**
)
&
player
);
if
(
hr
==
REGDB_E_CLASSNOTREG
)
...
...
dlls/wmp/tests/oleobj.c
View file @
6f92e484
...
...
@@ -70,7 +70,7 @@ DEFINE_EXPECT(GetWindowContext);
DEFINE_EXPECT
(
ShowObject
);
DEFINE_EXPECT
(
OnShowWindow_FALSE
);
static
const
WCHAR
mp3file
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'.'
,
'm'
,
'p'
,
'3'
,
0
}
;
static
const
WCHAR
mp3file
[]
=
L"test.mp3"
;
static
inline
WCHAR
*
load_resource
(
const
WCHAR
*
name
)
{
static
WCHAR
pathW
[
MAX_PATH
];
...
...
@@ -1372,19 +1372,17 @@ static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
static
void
create_container_window
(
void
)
{
static
const
WCHAR
wmp_testW
[]
=
{
'W'
,
'M'
,
'P'
,
'T'
,
'e'
,
's'
,
't'
,
0
};
static
WNDCLASSEXW
wndclass
=
{
sizeof
(
WNDCLASSEXW
),
0
,
wnd_proc
,
0
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
wmp_testW
,
L"WMPTest"
,
NULL
};
RegisterClassExW
(
&
wndclass
);
container_hwnd
=
CreateWindowW
(
wmp_testW
,
wmp_testW
,
container_hwnd
=
CreateWindowW
(
L"WMPTest"
,
L"WMPTest"
,
WS_OVERLAPPEDWINDOW
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
515
,
530
,
NULL
,
NULL
,
NULL
,
NULL
);
ShowWindow
(
container_hwnd
,
SW_SHOW
);
...
...
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