mfplat: Fail to create user queues on uninitialized platform.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
48b713efab
commit
5e1b3b2f5a
|
@ -521,6 +521,11 @@ HRESULT WINAPI MFUnlockPlatform(void)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
BOOL is_platform_locked(void)
|
||||
{
|
||||
return platform_lock > 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MFCopyImage (mfplat.@)
|
||||
*/
|
||||
|
|
|
@ -18,3 +18,4 @@
|
|||
|
||||
extern void init_system_queues(void) DECLSPEC_HIDDEN;
|
||||
extern void shutdown_system_queues(void) DECLSPEC_HIDDEN;
|
||||
extern BOOL is_platform_locked(void) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -543,6 +543,9 @@ static HRESULT alloc_user_queue(MFASYNC_WORKQUEUE_TYPE queue_type, DWORD *queue_
|
|||
|
||||
*queue_id = MFASYNC_CALLBACK_QUEUE_UNDEFINED;
|
||||
|
||||
if (!is_platform_locked())
|
||||
return MF_E_SHUTDOWN;
|
||||
|
||||
queue = heap_alloc_zero(sizeof(*queue));
|
||||
if (!queue)
|
||||
return E_OUTOFMEMORY;
|
||||
|
|
|
@ -837,6 +837,7 @@ static void test_MFCreateAsyncResult(void)
|
|||
|
||||
static void test_startup(void)
|
||||
{
|
||||
DWORD queue;
|
||||
HRESULT hr;
|
||||
|
||||
hr = MFStartup(MAKELONG(MF_API_VERSION, 0xdead), MFSTARTUP_FULL);
|
||||
|
@ -845,8 +846,58 @@ static void test_startup(void)
|
|||
hr = MFStartup(MF_VERSION, MFSTARTUP_FULL);
|
||||
ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr);
|
||||
|
||||
hr = MFAllocateWorkQueue(&queue);
|
||||
ok(hr == S_OK, "Failed to allocate a queue, hr %#x.\n", hr);
|
||||
hr = MFUnlockWorkQueue(queue);
|
||||
ok(hr == S_OK, "Failed to unlock the queue, hr %#x.\n", hr);
|
||||
|
||||
hr = MFShutdown();
|
||||
ok(hr == S_OK, "Failed to shutdown, hr %#x.\n", hr);
|
||||
ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
|
||||
|
||||
hr = MFAllocateWorkQueue(&queue);
|
||||
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
/* Already shut down, has no effect. */
|
||||
hr = MFShutdown();
|
||||
ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
|
||||
|
||||
hr = MFStartup(MF_VERSION, MFSTARTUP_FULL);
|
||||
ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr);
|
||||
|
||||
hr = MFAllocateWorkQueue(&queue);
|
||||
ok(hr == S_OK, "Failed to allocate a queue, hr %#x.\n", hr);
|
||||
hr = MFUnlockWorkQueue(queue);
|
||||
ok(hr == S_OK, "Failed to unlock the queue, hr %#x.\n", hr);
|
||||
|
||||
hr = MFShutdown();
|
||||
ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
|
||||
|
||||
/* Platform lock. */
|
||||
hr = MFStartup(MF_VERSION, MFSTARTUP_FULL);
|
||||
ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr);
|
||||
|
||||
hr = MFAllocateWorkQueue(&queue);
|
||||
ok(hr == S_OK, "Failed to allocate a queue, hr %#x.\n", hr);
|
||||
hr = MFUnlockWorkQueue(queue);
|
||||
ok(hr == S_OK, "Failed to unlock the queue, hr %#x.\n", hr);
|
||||
|
||||
/* Unlocking implies shutdown. */
|
||||
hr = MFUnlockPlatform();
|
||||
ok(hr == S_OK, "Failed to unlock, %#x.\n", hr);
|
||||
|
||||
hr = MFAllocateWorkQueue(&queue);
|
||||
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = MFLockPlatform();
|
||||
ok(hr == S_OK, "Failed to lock, %#x.\n", hr);
|
||||
|
||||
hr = MFAllocateWorkQueue(&queue);
|
||||
ok(hr == S_OK, "Failed to allocate a queue, hr %#x.\n", hr);
|
||||
hr = MFUnlockWorkQueue(queue);
|
||||
ok(hr == S_OK, "Failed to unlock the queue, hr %#x.\n", hr);
|
||||
|
||||
hr = MFShutdown();
|
||||
ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
|
||||
}
|
||||
|
||||
static void test_allocate_queue(void)
|
||||
|
|
Loading…
Reference in New Issue