Wine-Devel
Threads by month
- ----- 2026 -----
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 4 participants
- 84517 discussions
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/winealsa.drv/alsa.c | 56 +++++++++++++++++----
dlls/winealsa.drv/mmdevdrv.c | 97 ++----------------------------------
dlls/winealsa.drv/unixlib.h | 17 +++----
3 files changed, 59 insertions(+), 111 deletions(-)
diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c
index d455a3787e8..a5558718f47 100644
--- a/dlls/winealsa.drv/alsa.c
+++ b/dlls/winealsa.drv/alsa.c
@@ -1214,13 +1214,6 @@ static snd_pcm_sframes_t alsa_write_best_effort(struct alsa_stream *stream, BYTE
return written;
}
-static NTSTATUS write_best_effort(void *args)
-{
- struct write_best_effort_tmp_params *params = args;
- *params->written = alsa_write_best_effort(params->stream, params->buf, params->frames);
- return STATUS_SUCCESS;
-}
-
static snd_pcm_sframes_t alsa_write_buffer_wrap(struct alsa_stream *stream, BYTE *buf,
snd_pcm_uframes_t buflen, snd_pcm_uframes_t offs,
snd_pcm_uframes_t to_write)
@@ -1416,6 +1409,52 @@ exit:
NtSetEvent(stream->event, NULL);
}
+static NTSTATUS start(void *args)
+{
+ struct start_params *params = args;
+ struct alsa_stream *stream = params->stream;
+
+ alsa_lock(stream);
+
+ if((stream->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) && !stream->event)
+ return alsa_unlock_result(stream, ¶ms->result, AUDCLNT_E_EVENTHANDLE_NOT_SET);
+
+ if(stream->started)
+ return alsa_unlock_result(stream, ¶ms->result, AUDCLNT_E_NOT_STOPPED);
+
+ if(stream->flow == eCapture){
+ /* dump any data that might be leftover in the ALSA capture buffer */
+ snd_pcm_readi(stream->pcm_handle, stream->local_buffer,
+ stream->bufsize_frames);
+ }else{
+ snd_pcm_sframes_t avail, written;
+ snd_pcm_uframes_t offs;
+
+ avail = snd_pcm_avail_update(stream->pcm_handle);
+ avail = min(avail, stream->held_frames);
+
+ if(stream->wri_offs_frames < stream->held_frames)
+ offs = stream->bufsize_frames - stream->held_frames + stream->wri_offs_frames;
+ else
+ offs = stream->wri_offs_frames - stream->held_frames;
+
+ /* fill it with data */
+ written = alsa_write_buffer_wrap(stream, stream->local_buffer,
+ stream->bufsize_frames, offs, avail);
+
+ if(written > 0){
+ stream->lcl_offs_frames = (offs + written) % stream->bufsize_frames;
+ stream->data_in_alsa_frames = written;
+ }else{
+ stream->lcl_offs_frames = offs;
+ stream->data_in_alsa_frames = 0;
+ }
+ }
+ stream->started = TRUE;
+
+ return alsa_unlock_result(stream, ¶ms->result, S_OK);
+}
+
static NTSTATUS timer_loop(void *args)
{
struct timer_loop_params *params = args;
@@ -1761,12 +1800,11 @@ unixlib_entry_t __wine_unix_call_funcs[] =
get_endpoint_ids,
create_stream,
release_stream,
+ start,
timer_loop,
is_format_supported,
get_mix_format,
get_buffer_size,
get_latency,
get_current_padding,
-
- write_best_effort /* temporary */
};
diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c
index 2748cc552a6..5eab548e606 100644
--- a/dlls/winealsa.drv/mmdevdrv.c
+++ b/dlls/winealsa.drv/mmdevdrv.c
@@ -963,51 +963,6 @@ static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface,
return S_OK;
}
-static snd_pcm_sframes_t alsa_write_best_effort(struct alsa_stream *stream, BYTE *buf, snd_pcm_uframes_t frames)
-{
- struct write_best_effort_tmp_params params;
- snd_pcm_sframes_t written;
-
- params.stream = stream;
- params.buf = buf;
- params.frames = frames;
- params.written = &written;
-
- ALSA_CALL(write_best_effort_tmp, ¶ms);
-
- return written;
-}
-
-static snd_pcm_sframes_t alsa_write_buffer_wrap(struct alsa_stream *stream, BYTE *buf,
- snd_pcm_uframes_t buflen, snd_pcm_uframes_t offs,
- snd_pcm_uframes_t to_write)
-{
- snd_pcm_sframes_t ret = 0;
-
- while(to_write){
- snd_pcm_uframes_t chunk;
- snd_pcm_sframes_t tmp;
-
- if(offs + to_write > buflen)
- chunk = buflen - offs;
- else
- chunk = to_write;
-
- tmp = alsa_write_best_effort(stream, buf + offs * stream->fmt->nBlockAlign, chunk);
- if(tmp < 0)
- return ret;
- if(!tmp)
- break;
-
- ret += tmp;
- to_write -= tmp;
- offs += tmp;
- offs %= buflen;
- }
-
- return ret;
-}
-
static snd_pcm_uframes_t interp_elapsed_frames(struct alsa_stream *stream)
{
LARGE_INTEGER time_freq, current_time, time_diff;
@@ -1053,7 +1008,7 @@ static int alsa_rewind_best_effort(ACImpl *This)
static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
{
ACImpl *This = impl_from_IAudioClient3(iface);
- struct alsa_stream *stream = This->stream;
+ struct start_params params;
TRACE("(%p)\n", This);
@@ -1064,60 +1019,18 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
return AUDCLNT_E_NOT_INITIALIZED;
}
- alsa_lock(stream);
-
- if((stream->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) && !stream->event){
- alsa_unlock(stream);
- LeaveCriticalSection(&g_sessions_lock);
- return AUDCLNT_E_EVENTHANDLE_NOT_SET;
- }
-
- if(stream->started){
- alsa_unlock(stream);
- LeaveCriticalSection(&g_sessions_lock);
- return AUDCLNT_E_NOT_STOPPED;
- }
-
- if(stream->flow == eCapture){
- /* dump any data that might be leftover in the ALSA capture buffer */
- snd_pcm_readi(stream->pcm_handle, stream->local_buffer,
- stream->bufsize_frames);
- }else{
- snd_pcm_sframes_t avail, written;
- snd_pcm_uframes_t offs;
-
- avail = snd_pcm_avail_update(stream->pcm_handle);
- avail = min(avail, stream->held_frames);
-
- if(stream->wri_offs_frames < stream->held_frames)
- offs = stream->bufsize_frames - stream->held_frames + stream->wri_offs_frames;
- else
- offs = stream->wri_offs_frames - stream->held_frames;
+ params.stream = This->stream;
- /* fill it with data */
- written = alsa_write_buffer_wrap(stream, stream->local_buffer,
- stream->bufsize_frames, offs, avail);
+ ALSA_CALL(start, ¶ms);
- if(written > 0){
- stream->lcl_offs_frames = (offs + written) % stream->bufsize_frames;
- stream->data_in_alsa_frames = written;
- }else{
- stream->lcl_offs_frames = offs;
- stream->data_in_alsa_frames = 0;
- }
- }
-
- if(!This->timer_thread){
+ if(SUCCEEDED(params.result) && !This->timer_thread){
This->timer_thread = CreateThread(NULL, 0, alsa_timer_thread, This->stream, 0, NULL);
SetThreadPriority(This->timer_thread, THREAD_PRIORITY_TIME_CRITICAL);
}
- stream->started = TRUE;
-
- alsa_unlock(stream);
LeaveCriticalSection(&g_sessions_lock);
- return S_OK;
+ return params.result;
}
static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface)
diff --git a/dlls/winealsa.drv/unixlib.h b/dlls/winealsa.drv/unixlib.h
index 4acbbcbcf11..c058a920b6e 100644
--- a/dlls/winealsa.drv/unixlib.h
+++ b/dlls/winealsa.drv/unixlib.h
@@ -91,6 +91,12 @@ struct release_stream_params
HRESULT result;
};
+struct start_params
+{
+ struct alsa_stream *stream;
+ HRESULT result;
+};
+
struct timer_loop_params
{
struct alsa_stream *stream;
@@ -135,27 +141,18 @@ struct get_current_padding_params
UINT32 *padding;
};
-struct write_best_effort_tmp_params
-{
- struct alsa_stream *stream;
- BYTE *buf;
- snd_pcm_uframes_t frames;
- snd_pcm_sframes_t *written;
-};
-
enum alsa_funcs
{
alsa_get_endpoint_ids,
alsa_create_stream,
alsa_release_stream,
+ alsa_start,
alsa_timer_loop,
alsa_is_format_supported,
alsa_get_mix_format,
alsa_get_buffer_size,
alsa_get_latency,
alsa_get_current_padding,
-
- alsa_write_best_effort_tmp
};
extern unixlib_handle_t alsa_handle;
--
2.25.1
2
1
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/winealsa.drv/alsa.c | 240 +++++++++++++++++++++++++++++++++++
dlls/winealsa.drv/mmdevdrv.c | 229 +++------------------------------
dlls/winealsa.drv/unixlib.h | 9 +-
3 files changed, 268 insertions(+), 210 deletions(-)
diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c
index 73971c0f8bb..d455a3787e8 100644
--- a/dlls/winealsa.drv/alsa.c
+++ b/dlls/winealsa.drv/alsa.c
@@ -960,6 +960,12 @@ static NTSTATUS release_stream(void *args)
struct alsa_stream *stream = params->stream;
SIZE_T size;
+ if(params->timer_thread){
+ stream->please_quit = TRUE;
+ NtWaitForSingleObject(params->timer_thread, FALSE, NULL);
+ NtClose(params->timer_thread);
+ }
+
snd_pcm_drop(stream->pcm_handle);
snd_pcm_close(stream->pcm_handle);
if(stream->local_buffer){
@@ -1215,6 +1221,239 @@ static NTSTATUS write_best_effort(void *args)
return STATUS_SUCCESS;
}
+static snd_pcm_sframes_t alsa_write_buffer_wrap(struct alsa_stream *stream, BYTE *buf,
+ snd_pcm_uframes_t buflen, snd_pcm_uframes_t offs,
+ snd_pcm_uframes_t to_write)
+{
+ snd_pcm_sframes_t ret = 0;
+
+ while(to_write){
+ snd_pcm_uframes_t chunk;
+ snd_pcm_sframes_t tmp;
+
+ if(offs + to_write > buflen)
+ chunk = buflen - offs;
+ else
+ chunk = to_write;
+
+ tmp = alsa_write_best_effort(stream, buf + offs * stream->fmt->nBlockAlign, chunk);
+ if(tmp < 0)
+ return ret;
+ if(!tmp)
+ break;
+
+ ret += tmp;
+ to_write -= tmp;
+ offs += tmp;
+ offs %= buflen;
+ }
+
+ return ret;
+}
+
+static UINT buf_ptr_diff(UINT left, UINT right, UINT bufsize)
+{
+ if(left <= right)
+ return right - left;
+ return bufsize - (left - right);
+}
+
+static UINT data_not_in_alsa(struct alsa_stream *stream)
+{
+ UINT32 diff;
+
+ diff = buf_ptr_diff(stream->lcl_offs_frames, stream->wri_offs_frames, stream->bufsize_frames);
+ if(diff)
+ return diff;
+
+ return stream->held_frames - stream->data_in_alsa_frames;
+}
+
+/* Here's the buffer setup:
+ *
+ * vvvvvvvv sent to HW already
+ * vvvvvvvv in ALSA buffer but rewindable
+ * [dddddddddddddddd] ALSA buffer
+ * [dddddddddddddddd--------] mmdevapi buffer
+ * ^^^^^^^^ data_in_alsa_frames
+ * ^^^^^^^^^^^^^^^^ held_frames
+ * ^ lcl_offs_frames
+ * ^ wri_offs_frames
+ *
+ * GetCurrentPadding is held_frames
+ *
+ * During period callback, we decrement held_frames, fill ALSA buffer, and move
+ * lcl_offs forward
+ *
+ * During Stop, we rewind the ALSA buffer
+ */
+static void alsa_write_data(struct alsa_stream *stream)
+{
+ snd_pcm_sframes_t written;
+ snd_pcm_uframes_t avail, max_copy_frames, data_frames_played;
+ int err;
+
+ /* this call seems to be required to get an accurate snd_pcm_state() */
+ avail = snd_pcm_avail_update(stream->pcm_handle);
+
+ if(snd_pcm_state(stream->pcm_handle) == SND_PCM_STATE_XRUN){
+ TRACE("XRun state, recovering\n");
+
+ avail = stream->alsa_bufsize_frames;
+
+ if((err = snd_pcm_recover(stream->pcm_handle, -EPIPE, 1)) < 0)
+ WARN("snd_pcm_recover failed: %d (%s)\n", err, snd_strerror(err));
+
+ if((err = snd_pcm_reset(stream->pcm_handle)) < 0)
+ WARN("snd_pcm_reset failed: %d (%s)\n", err, snd_strerror(err));
+
+ if((err = snd_pcm_prepare(stream->pcm_handle)) < 0)
+ WARN("snd_pcm_prepare failed: %d (%s)\n", err, snd_strerror(err));
+ }
+
+ TRACE("avail: %ld\n", avail);
+
+ /* Add a lead-in when starting with too few frames to ensure
+ * continuous rendering. Additional benefit: Force ALSA to start. */
+ if(stream->data_in_alsa_frames == 0 && stream->held_frames < stream->alsa_period_frames)
+ {
+ alsa_write_best_effort(stream, stream->silence_buf,
+ stream->alsa_period_frames - stream->held_frames);
+ stream->vol_adjusted_frames = 0;
+ }
+
+ if(stream->started)
+ max_copy_frames = data_not_in_alsa(stream);
+ else
+ max_copy_frames = 0;
+
+ data_frames_played = min(stream->data_in_alsa_frames, avail);
+ stream->data_in_alsa_frames -= data_frames_played;
+
+ if(stream->held_frames > data_frames_played){
+ if(stream->started)
+ stream->held_frames -= data_frames_played;
+ }else
+ stream->held_frames = 0;
+
+ while(avail && max_copy_frames){
+ snd_pcm_uframes_t to_write;
+
+ to_write = min(avail, max_copy_frames);
+
+ written = alsa_write_buffer_wrap(stream, stream->local_buffer,
+ stream->bufsize_frames, stream->lcl_offs_frames, to_write);
+ if(written <= 0)
+ break;
+
+ avail -= written;
+ stream->lcl_offs_frames += written;
+ stream->lcl_offs_frames %= stream->bufsize_frames;
+ stream->data_in_alsa_frames += written;
+ max_copy_frames -= written;
+ }
+
+ if(stream->event)
+ NtSetEvent(stream->event, NULL);
+}
+
+static void alsa_read_data(struct alsa_stream *stream)
+{
+ snd_pcm_sframes_t nread;
+ UINT32 pos = stream->wri_offs_frames, limit = stream->held_frames;
+ unsigned int i;
+
+ if(!stream->started)
+ goto exit;
+
+ /* FIXME: Detect overrun and signal DATA_DISCONTINUITY
+ * How to count overrun frames and report them as position increase? */
+ limit = stream->bufsize_frames - max(limit, pos);
+
+ nread = snd_pcm_readi(stream->pcm_handle,
+ stream->local_buffer + pos * stream->fmt->nBlockAlign, limit);
+ TRACE("read %ld from %u limit %u\n", nread, pos, limit);
+ if(nread < 0){
+ int ret;
+
+ if(nread == -EAGAIN) /* no data yet */
+ return;
+
+ WARN("read failed, recovering: %ld (%s)\n", nread, snd_strerror(nread));
+
+ ret = snd_pcm_recover(stream->pcm_handle, nread, 0);
+ if(ret < 0){
+ WARN("Recover failed: %d (%s)\n", ret, snd_strerror(ret));
+ return;
+ }
+
+ nread = snd_pcm_readi(stream->pcm_handle,
+ stream->local_buffer + pos * stream->fmt->nBlockAlign, limit);
+ if(nread < 0){
+ WARN("read failed: %ld (%s)\n", nread, snd_strerror(nread));
+ return;
+ }
+ }
+
+ for(i = 0; i < stream->fmt->nChannels; i++)
+ if(stream->vols[i] != 0.0f)
+ break;
+ if(i == stream->fmt->nChannels){ /* mute */
+ int err;
+ if((err = snd_pcm_format_set_silence(stream->alsa_format,
+ stream->local_buffer + pos * stream->fmt->nBlockAlign,
+ nread)) < 0)
+ WARN("Setting buffer to silence failed: %d (%s)\n", err,
+ snd_strerror(err));
+ }
+
+ stream->wri_offs_frames += nread;
+ stream->wri_offs_frames %= stream->bufsize_frames;
+ stream->held_frames += nread;
+
+exit:
+ if(stream->event)
+ NtSetEvent(stream->event, NULL);
+}
+
+static NTSTATUS timer_loop(void *args)
+{
+ struct timer_loop_params *params = args;
+ struct alsa_stream *stream = params->stream;
+ LARGE_INTEGER delay, next;
+ int adjust;
+
+ alsa_lock(stream);
+
+ delay.QuadPart = -stream->mmdev_period_rt;
+ NtQueryPerformanceCounter(&stream->last_period_time, NULL);
+ next.QuadPart = stream->last_period_time.QuadPart + stream->mmdev_period_rt;
+
+ while(!stream->please_quit){
+ if(stream->flow == eRender)
+ alsa_write_data(stream);
+ else if(stream->flow == eCapture)
+ alsa_read_data(stream);
+ alsa_unlock(stream);
+
+ NtDelayExecution(FALSE, &delay);
+
+ alsa_lock(stream);
+ NtQueryPerformanceCounter(&stream->last_period_time, NULL);
+ adjust = next.QuadPart - stream->last_period_time.QuadPart;
+ if(adjust > stream->mmdev_period_rt / 2)
+ adjust = stream->mmdev_period_rt / 2;
+ else if(adjust < -stream->mmdev_period_rt / 2)
+ adjust = -stream->mmdev_period_rt / 2;
+ delay.QuadPart = -(stream->mmdev_period_rt + adjust);
+ next.QuadPart += stream->mmdev_period_rt;
+ }
+
+ alsa_unlock(stream);
+
+ return STATUS_SUCCESS;
+}
+
static NTSTATUS is_format_supported(void *args)
{
struct is_format_supported_params *params = args;
@@ -1522,6 +1761,7 @@ unixlib_entry_t __wine_unix_call_funcs[] =
get_endpoint_ids,
create_stream,
release_stream,
+ timer_loop,
is_format_supported,
get_mix_format,
get_buffer_size,
diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c
index c06b08709f2..2748cc552a6 100644
--- a/dlls/winealsa.drv/mmdevdrv.c
+++ b/dlls/winealsa.drv/mmdevdrv.c
@@ -109,7 +109,7 @@ struct ACImpl {
UINT32 channel_count;
struct alsa_stream *stream;
- HANDLE timer;
+ HANDLE timer_thread;
AudioSession *session;
AudioSessionWrapper *session_wrapper;
@@ -128,8 +128,6 @@ typedef struct _SessionMgr {
IMMDevice *device;
} SessionMgr;
-static HANDLE g_timer_q;
-
static CRITICAL_SECTION g_sessions_lock;
static CRITICAL_SECTION_DEBUG g_sessions_lock_debug =
{
@@ -216,9 +214,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
if(NtQueryVirtualMemory(GetCurrentProcess(), dll, MemoryWineUnixFuncs,
&alsa_handle, sizeof(alsa_handle), NULL))
return FALSE;
- g_timer_q = CreateTimerQueue();
- if(!g_timer_q)
- return FALSE;
break;
case DLL_PROCESS_DETACH:
@@ -252,17 +247,30 @@ static void alsa_unlock(struct alsa_stream *stream)
pthread_mutex_unlock(&stream->lock);
}
-static HRESULT alsa_stream_release(struct alsa_stream *stream)
+static HRESULT alsa_stream_release(struct alsa_stream *stream, HANDLE timer_thread)
{
struct release_stream_params params;
params.stream = stream;
+ params.timer_thread = timer_thread;
ALSA_CALL(release_stream, ¶ms);
return params.result;
}
+static DWORD WINAPI alsa_timer_thread(void *user)
+{
+ struct alsa_stream *stream = user;
+ struct timer_loop_params params;
+
+ params.stream = stream;
+
+ ALSA_CALL(timer_loop, ¶ms);
+
+ return 0;
+}
+
static void set_device_guid(EDataFlow flow, HKEY drv_key, const WCHAR *key_name,
GUID *guid)
{
@@ -552,17 +560,6 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface)
ref = InterlockedDecrement(&This->ref);
TRACE("(%p) Refcount now %u\n", This, ref);
if(!ref){
- if(This->timer){
- HANDLE event;
- DWORD wait;
- event = CreateEventW(NULL, TRUE, FALSE, NULL);
- wait = !DeleteTimerQueueTimer(g_timer_q, This->timer, event);
- wait = wait && GetLastError() == ERROR_IO_PENDING;
- if(event && wait)
- WaitForSingleObject(event, INFINITE);
- CloseHandle(event);
- }
-
IAudioClient3_Stop(iface);
IMMDevice_Release(This->parent);
IUnknown_Release(This->pUnkFTMarshal);
@@ -573,7 +570,7 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface)
}
HeapFree(GetProcessHeap(), 0, This->vols);
if (This->stream)
- alsa_stream_release(This->stream);
+ alsa_stream_release(This->stream, This->timer_thread);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
@@ -807,7 +804,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
exit:
if(FAILED(params.result)){
- alsa_stream_release(stream);
+ alsa_stream_release(stream, NULL);
HeapFree(GetProcessHeap(), 0, This->vols);
This->vols = NULL;
}else{
@@ -1011,187 +1008,6 @@ static snd_pcm_sframes_t alsa_write_buffer_wrap(struct alsa_stream *stream, BYTE
return ret;
}
-static UINT buf_ptr_diff(UINT left, UINT right, UINT bufsize)
-{
- if(left <= right)
- return right - left;
- return bufsize - (left - right);
-}
-
-static UINT data_not_in_alsa(struct alsa_stream *stream)
-{
- UINT32 diff;
-
- diff = buf_ptr_diff(stream->lcl_offs_frames, stream->wri_offs_frames, stream->bufsize_frames);
- if(diff)
- return diff;
-
- return stream->held_frames - stream->data_in_alsa_frames;
-}
-/* Here's the buffer setup:
- *
- * vvvvvvvv sent to HW already
- * vvvvvvvv in ALSA buffer but rewindable
- * [dddddddddddddddd] ALSA buffer
- * [dddddddddddddddd--------] mmdevapi buffer
- * ^^^^^^^^ data_in_alsa_frames
- * ^^^^^^^^^^^^^^^^ held_frames
- * ^ lcl_offs_frames
- * ^ wri_offs_frames
- *
- * GetCurrentPadding is held_frames
- *
- * During period callback, we decrement held_frames, fill ALSA buffer, and move
- * lcl_offs forward
- *
- * During Stop, we rewind the ALSA buffer
- */
-static void alsa_write_data(struct alsa_stream *stream)
-{
- snd_pcm_sframes_t written;
- snd_pcm_uframes_t avail, max_copy_frames, data_frames_played;
- int err;
-
- /* this call seems to be required to get an accurate snd_pcm_state() */
- avail = snd_pcm_avail_update(stream->pcm_handle);
-
- if(snd_pcm_state(stream->pcm_handle) == SND_PCM_STATE_XRUN){
- TRACE("XRun state, recovering\n");
-
- avail = stream->alsa_bufsize_frames;
-
- if((err = snd_pcm_recover(stream->pcm_handle, -EPIPE, 1)) < 0)
- WARN("snd_pcm_recover failed: %d (%s)\n", err, snd_strerror(err));
-
- if((err = snd_pcm_reset(stream->pcm_handle)) < 0)
- WARN("snd_pcm_reset failed: %d (%s)\n", err, snd_strerror(err));
-
- if((err = snd_pcm_prepare(stream->pcm_handle)) < 0)
- WARN("snd_pcm_prepare failed: %d (%s)\n", err, snd_strerror(err));
- }
-
- TRACE("avail: %ld\n", avail);
-
- /* Add a lead-in when starting with too few frames to ensure
- * continuous rendering. Additional benefit: Force ALSA to start. */
- if(stream->data_in_alsa_frames == 0 && stream->held_frames < stream->alsa_period_frames)
- {
- alsa_write_best_effort(stream, stream->silence_buf,
- stream->alsa_period_frames - stream->held_frames);
- stream->vol_adjusted_frames = 0;
- }
-
- if(stream->started)
- max_copy_frames = data_not_in_alsa(stream);
- else
- max_copy_frames = 0;
-
- data_frames_played = min(stream->data_in_alsa_frames, avail);
- stream->data_in_alsa_frames -= data_frames_played;
-
- if(stream->held_frames > data_frames_played){
- if(stream->started)
- stream->held_frames -= data_frames_played;
- }else
- stream->held_frames = 0;
-
- while(avail && max_copy_frames){
- snd_pcm_uframes_t to_write;
-
- to_write = min(avail, max_copy_frames);
-
- written = alsa_write_buffer_wrap(stream, stream->local_buffer,
- stream->bufsize_frames, stream->lcl_offs_frames, to_write);
- if(written <= 0)
- break;
-
- avail -= written;
- stream->lcl_offs_frames += written;
- stream->lcl_offs_frames %= stream->bufsize_frames;
- stream->data_in_alsa_frames += written;
- max_copy_frames -= written;
- }
-
- if(stream->event)
- SetEvent(stream->event);
-}
-
-static void alsa_read_data(struct alsa_stream *stream)
-{
- snd_pcm_sframes_t nread;
- UINT32 pos = stream->wri_offs_frames, limit = stream->held_frames;
- unsigned int i;
-
- if(!stream->started)
- goto exit;
-
- /* FIXME: Detect overrun and signal DATA_DISCONTINUITY
- * How to count overrun frames and report them as position increase? */
- limit = stream->bufsize_frames - max(limit, pos);
-
- nread = snd_pcm_readi(stream->pcm_handle,
- stream->local_buffer + pos * stream->fmt->nBlockAlign, limit);
- TRACE("read %ld from %u limit %u\n", nread, pos, limit);
- if(nread < 0){
- int ret;
-
- if(nread == -EAGAIN) /* no data yet */
- return;
-
- WARN("read failed, recovering: %ld (%s)\n", nread, snd_strerror(nread));
-
- ret = snd_pcm_recover(stream->pcm_handle, nread, 0);
- if(ret < 0){
- WARN("Recover failed: %d (%s)\n", ret, snd_strerror(ret));
- return;
- }
-
- nread = snd_pcm_readi(stream->pcm_handle,
- stream->local_buffer + pos * stream->fmt->nBlockAlign, limit);
- if(nread < 0){
- WARN("read failed: %ld (%s)\n", nread, snd_strerror(nread));
- return;
- }
- }
-
- for(i = 0; i < stream->fmt->nChannels; i++)
- if(stream->vols[i] != 0.0f)
- break;
- if(i == stream->fmt->nChannels){ /* mute */
- int err;
- if((err = snd_pcm_format_set_silence(stream->alsa_format,
- stream->local_buffer + pos * stream->fmt->nBlockAlign,
- nread)) < 0)
- WARN("Setting buffer to silence failed: %d (%s)\n", err,
- snd_strerror(err));
- }
-
- stream->wri_offs_frames += nread;
- stream->wri_offs_frames %= stream->bufsize_frames;
- stream->held_frames += nread;
-
-exit:
- if(stream->event)
- SetEvent(stream->event);
-}
-
-static void CALLBACK alsa_push_buffer_data(void *user, BOOLEAN timer)
-{
- ACImpl *This = user;
- struct alsa_stream *stream = This->stream;
-
- alsa_lock(stream);
-
- QueryPerformanceCounter(&stream->last_period_time);
-
- if(stream->flow == eRender)
- alsa_write_data(stream);
- else if(stream->flow == eCapture)
- alsa_read_data(stream);
-
- alsa_unlock(stream);
-}
-
static snd_pcm_uframes_t interp_elapsed_frames(struct alsa_stream *stream)
{
LARGE_INTEGER time_freq, current_time, time_diff;
@@ -1291,14 +1107,9 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
}
}
- if(!This->timer){
- if(!CreateTimerQueueTimer(&This->timer, g_timer_q, alsa_push_buffer_data,
- This, 0, stream->mmdev_period_rt / 10000, WT_EXECUTEINTIMERTHREAD)){
- alsa_unlock(stream);
- LeaveCriticalSection(&g_sessions_lock);
- WARN("Unable to create timer: %u\n", GetLastError());
- return E_OUTOFMEMORY;
- }
+ if(!This->timer_thread){
+ This->timer_thread = CreateThread(NULL, 0, alsa_timer_thread, This->stream, 0, NULL);
+ SetThreadPriority(This->timer_thread, THREAD_PRIORITY_TIME_CRITICAL);
}
stream->started = TRUE;
diff --git a/dlls/winealsa.drv/unixlib.h b/dlls/winealsa.drv/unixlib.h
index 3fd6d2a73ee..4acbbcbcf11 100644
--- a/dlls/winealsa.drv/unixlib.h
+++ b/dlls/winealsa.drv/unixlib.h
@@ -37,7 +37,7 @@ struct alsa_stream
int alsa_channels;
int alsa_channel_map[32];
- BOOL started;
+ BOOL started, please_quit;
REFERENCE_TIME mmdev_period_rt;
UINT64 written_frames, last_pos_frames;
UINT32 bufsize_frames, held_frames, tmp_buffer_frames, mmdev_period_frames;
@@ -87,9 +87,15 @@ struct create_stream_params
struct release_stream_params
{
struct alsa_stream *stream;
+ HANDLE timer_thread;
HRESULT result;
};
+struct timer_loop_params
+{
+ struct alsa_stream *stream;
+};
+
struct is_format_supported_params
{
const char *alsa_name;
@@ -142,6 +148,7 @@ enum alsa_funcs
alsa_get_endpoint_ids,
alsa_create_stream,
alsa_release_stream,
+ alsa_timer_loop,
alsa_is_format_supported,
alsa_get_mix_format,
alsa_get_buffer_size,
--
2.25.1
2
1
March 3, 2022
This will allow the timing loop to move over without needing
to move "start" at the same time.
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/winealsa.drv/alsa.c | 237 ++++++++++++++++++++++++++++++++++-
dlls/winealsa.drv/mmdevdrv.c | 230 +--------------------------------
dlls/winealsa.drv/unixlib.h | 10 ++
3 files changed, 252 insertions(+), 225 deletions(-)
diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c
index c73490ebfe6..73971c0f8bb 100644
--- a/dlls/winealsa.drv/alsa.c
+++ b/dlls/winealsa.drv/alsa.c
@@ -970,7 +970,7 @@ static NTSTATUS release_stream(void *args)
size = 0;
NtFreeVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, &size, MEM_RELEASE);
}
- /* free(stream->remapping_buf); */
+ free(stream->remapping_buf);
free(stream->silence_buf);
free(stream->hw_params);
free(stream->fmt);
@@ -982,6 +982,239 @@ static NTSTATUS release_stream(void *args)
return STATUS_SUCCESS;
}
+static BYTE *remap_channels(struct alsa_stream *stream, BYTE *buf, snd_pcm_uframes_t frames)
+{
+ snd_pcm_uframes_t i;
+ UINT c;
+ UINT bytes_per_sample = stream->fmt->wBitsPerSample / 8;
+
+ if(!stream->need_remapping)
+ return buf;
+
+ if(stream->remapping_buf_frames < frames){
+ stream->remapping_buf = realloc(stream->remapping_buf,
+ bytes_per_sample * stream->alsa_channels * frames);
+ stream->remapping_buf_frames = frames;
+ }
+
+ snd_pcm_format_set_silence(stream->alsa_format, stream->remapping_buf,
+ frames * stream->alsa_channels);
+
+ switch(stream->fmt->wBitsPerSample){
+ case 8: {
+ UINT8 *tgt_buf, *src_buf;
+ tgt_buf = stream->remapping_buf;
+ src_buf = buf;
+ for(i = 0; i < frames; ++i){
+ for(c = 0; c < stream->fmt->nChannels; ++c)
+ tgt_buf[stream->alsa_channel_map[c]] = src_buf[c];
+ tgt_buf += stream->alsa_channels;
+ src_buf += stream->fmt->nChannels;
+ }
+ break;
+ }
+ case 16: {
+ UINT16 *tgt_buf, *src_buf;
+ tgt_buf = (UINT16*)stream->remapping_buf;
+ src_buf = (UINT16*)buf;
+ for(i = 0; i < frames; ++i){
+ for(c = 0; c < stream->fmt->nChannels; ++c)
+ tgt_buf[stream->alsa_channel_map[c]] = src_buf[c];
+ tgt_buf += stream->alsa_channels;
+ src_buf += stream->fmt->nChannels;
+ }
+ }
+ break;
+ case 32: {
+ UINT32 *tgt_buf, *src_buf;
+ tgt_buf = (UINT32*)stream->remapping_buf;
+ src_buf = (UINT32*)buf;
+ for(i = 0; i < frames; ++i){
+ for(c = 0; c < stream->fmt->nChannels; ++c)
+ tgt_buf[stream->alsa_channel_map[c]] = src_buf[c];
+ tgt_buf += stream->alsa_channels;
+ src_buf += stream->fmt->nChannels;
+ }
+ }
+ break;
+ default: {
+ BYTE *tgt_buf, *src_buf;
+ tgt_buf = stream->remapping_buf;
+ src_buf = buf;
+ for(i = 0; i < frames; ++i){
+ for(c = 0; c < stream->fmt->nChannels; ++c)
+ memcpy(&tgt_buf[stream->alsa_channel_map[c] * bytes_per_sample],
+ &src_buf[c * bytes_per_sample], bytes_per_sample);
+ tgt_buf += stream->alsa_channels * bytes_per_sample;
+ src_buf += stream->fmt->nChannels * bytes_per_sample;
+ }
+ }
+ break;
+ }
+
+ return stream->remapping_buf;
+}
+
+static void adjust_buffer_volume(const struct alsa_stream *stream, BYTE *buf, snd_pcm_uframes_t frames)
+{
+ BOOL adjust = FALSE;
+ UINT32 i, channels, mute = 0;
+ BYTE *end;
+
+ if (stream->vol_adjusted_frames >= frames)
+ return;
+ channels = stream->fmt->nChannels;
+
+ /* Adjust the buffer based on the volume for each channel */
+ for (i = 0; i < channels; i++)
+ {
+ adjust |= stream->vols[i] != 1.0f;
+ if (stream->vols[i] == 0.0f)
+ mute++;
+ }
+
+ if (mute == channels)
+ {
+ int err = snd_pcm_format_set_silence(stream->alsa_format, buf, frames * channels);
+ if (err < 0)
+ WARN("Setting buffer to silence failed: %d (%s)\n", err, snd_strerror(err));
+ return;
+ }
+ if (!adjust) return;
+
+ /* Skip the frames we've already adjusted before */
+ end = buf + frames * stream->fmt->nBlockAlign;
+ buf += stream->vol_adjusted_frames * stream->fmt->nBlockAlign;
+
+ switch (stream->alsa_format)
+ {
+#ifndef WORDS_BIGENDIAN
+#define PROCESS_BUFFER(type) do \
+{ \
+ type *p = (type*)buf; \
+ do \
+ { \
+ for (i = 0; i < channels; i++) \
+ p[i] = p[i] * stream->vols[i]; \
+ p += i; \
+ } while ((BYTE*)p != end); \
+} while (0)
+ case SND_PCM_FORMAT_S16_LE:
+ PROCESS_BUFFER(INT16);
+ break;
+ case SND_PCM_FORMAT_S32_LE:
+ PROCESS_BUFFER(INT32);
+ break;
+ case SND_PCM_FORMAT_FLOAT_LE:
+ PROCESS_BUFFER(float);
+ break;
+ case SND_PCM_FORMAT_FLOAT64_LE:
+ PROCESS_BUFFER(double);
+ break;
+#undef PROCESS_BUFFER
+ case SND_PCM_FORMAT_S20_3LE:
+ case SND_PCM_FORMAT_S24_3LE:
+ {
+ /* Do it 12 bytes at a time until it is no longer possible */
+ UINT32 *q = (UINT32*)buf, mask = ~0xff;
+ BYTE *p;
+
+ /* After we adjust the volume, we need to mask out low bits */
+ if (stream->alsa_format == SND_PCM_FORMAT_S20_3LE)
+ mask = ~0x0fff;
+
+ i = 0;
+ while (end - (BYTE*)q >= 12)
+ {
+ UINT32 v[4], k;
+ v[0] = q[0] << 8;
+ v[1] = q[1] << 16 | (q[0] >> 16 & ~0xff);
+ v[2] = q[2] << 24 | (q[1] >> 8 & ~0xff);
+ v[3] = q[2] & ~0xff;
+ for (k = 0; k < 4; k++)
+ {
+ v[k] = (INT32)((INT32)v[k] * stream->vols[i]);
+ v[k] &= mask;
+ if (++i == channels) i = 0;
+ }
+ *q++ = v[0] >> 8 | v[1] << 16;
+ *q++ = v[1] >> 16 | v[2] << 8;
+ *q++ = v[2] >> 24 | v[3];
+ }
+ p = (BYTE*)q;
+ while (p != end)
+ {
+ UINT32 v = (INT32)((INT32)(p[0] << 8 | p[1] << 16 | p[2] << 24) * stream->vols[i]);
+ v &= mask;
+ *p++ = v >> 8 & 0xff;
+ *p++ = v >> 16 & 0xff;
+ *p++ = v >> 24;
+ if (++i == channels) i = 0;
+ }
+ break;
+ }
+#endif
+ case SND_PCM_FORMAT_U8:
+ {
+ UINT8 *p = (UINT8*)buf;
+ do
+ {
+ for (i = 0; i < channels; i++)
+ p[i] = (int)((p[i] - 128) * stream->vols[i]) + 128;
+ p += i;
+ } while ((BYTE*)p != end);
+ break;
+ }
+ default:
+ TRACE("Unhandled format %i, not adjusting volume.\n", stream->alsa_format);
+ break;
+ }
+}
+
+static snd_pcm_sframes_t alsa_write_best_effort(struct alsa_stream *stream, BYTE *buf, snd_pcm_uframes_t frames)
+{
+ snd_pcm_sframes_t written;
+
+ adjust_buffer_volume(stream, buf, frames);
+
+ /* Mark the frames we've already adjusted */
+ if (stream->vol_adjusted_frames < frames)
+ stream->vol_adjusted_frames = frames;
+
+ buf = remap_channels(stream, buf, frames);
+
+ written = snd_pcm_writei(stream->pcm_handle, buf, frames);
+ if(written < 0){
+ int ret;
+
+ if(written == -EAGAIN)
+ /* buffer full */
+ return 0;
+
+ WARN("writei failed, recovering: %ld (%s)\n", written,
+ snd_strerror(written));
+
+ ret = snd_pcm_recover(stream->pcm_handle, written, 0);
+ if(ret < 0){
+ WARN("Could not recover: %d (%s)\n", ret, snd_strerror(ret));
+ return ret;
+ }
+
+ written = snd_pcm_writei(stream->pcm_handle, buf, frames);
+ }
+
+ if (written > 0)
+ stream->vol_adjusted_frames -= written;
+ return written;
+}
+
+static NTSTATUS write_best_effort(void *args)
+{
+ struct write_best_effort_tmp_params *params = args;
+ *params->written = alsa_write_best_effort(params->stream, params->buf, params->frames);
+ return STATUS_SUCCESS;
+}
+
static NTSTATUS is_format_supported(void *args)
{
struct is_format_supported_params *params = args;
@@ -1294,4 +1527,6 @@ unixlib_entry_t __wine_unix_call_funcs[] =
get_buffer_size,
get_latency,
get_current_padding,
+
+ write_best_effort /* temporary */
};
diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c
index a4ab0e179d1..c06b08709f2 100644
--- a/dlls/winealsa.drv/mmdevdrv.c
+++ b/dlls/winealsa.drv/mmdevdrv.c
@@ -256,9 +256,6 @@ static HRESULT alsa_stream_release(struct alsa_stream *stream)
{
struct release_stream_params params;
- /* FIXME: to be moved with remap_channels() */
- HeapFree(GetProcessHeap(), 0, stream->remapping_buf);
-
params.stream = stream;
ALSA_CALL(release_stream, ¶ms);
@@ -969,233 +966,18 @@ static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface,
return S_OK;
}
-static BYTE *remap_channels(struct alsa_stream *stream, BYTE *buf, snd_pcm_uframes_t frames)
-{
- snd_pcm_uframes_t i;
- UINT c;
- UINT bytes_per_sample = stream->fmt->wBitsPerSample / 8;
-
- if(!stream->need_remapping)
- return buf;
-
- if(!stream->remapping_buf){
- stream->remapping_buf = HeapAlloc(GetProcessHeap(), 0,
- bytes_per_sample * stream->alsa_channels * frames);
- stream->remapping_buf_frames = frames;
- }else if(stream->remapping_buf_frames < frames){
- stream->remapping_buf = HeapReAlloc(GetProcessHeap(), 0, stream->remapping_buf,
- bytes_per_sample * stream->alsa_channels * frames);
- stream->remapping_buf_frames = frames;
- }
-
- snd_pcm_format_set_silence(stream->alsa_format, stream->remapping_buf,
- frames * stream->alsa_channels);
-
- switch(stream->fmt->wBitsPerSample){
- case 8: {
- UINT8 *tgt_buf, *src_buf;
- tgt_buf = stream->remapping_buf;
- src_buf = buf;
- for(i = 0; i < frames; ++i){
- for(c = 0; c < stream->fmt->nChannels; ++c)
- tgt_buf[stream->alsa_channel_map[c]] = src_buf[c];
- tgt_buf += stream->alsa_channels;
- src_buf += stream->fmt->nChannels;
- }
- break;
- }
- case 16: {
- UINT16 *tgt_buf, *src_buf;
- tgt_buf = (UINT16*)stream->remapping_buf;
- src_buf = (UINT16*)buf;
- for(i = 0; i < frames; ++i){
- for(c = 0; c < stream->fmt->nChannels; ++c)
- tgt_buf[stream->alsa_channel_map[c]] = src_buf[c];
- tgt_buf += stream->alsa_channels;
- src_buf += stream->fmt->nChannels;
- }
- }
- break;
- case 32: {
- UINT32 *tgt_buf, *src_buf;
- tgt_buf = (UINT32*)stream->remapping_buf;
- src_buf = (UINT32*)buf;
- for(i = 0; i < frames; ++i){
- for(c = 0; c < stream->fmt->nChannels; ++c)
- tgt_buf[stream->alsa_channel_map[c]] = src_buf[c];
- tgt_buf += stream->alsa_channels;
- src_buf += stream->fmt->nChannels;
- }
- }
- break;
- default: {
- BYTE *tgt_buf, *src_buf;
- tgt_buf = stream->remapping_buf;
- src_buf = buf;
- for(i = 0; i < frames; ++i){
- for(c = 0; c < stream->fmt->nChannels; ++c)
- memcpy(&tgt_buf[stream->alsa_channel_map[c] * bytes_per_sample],
- &src_buf[c * bytes_per_sample], bytes_per_sample);
- tgt_buf += stream->alsa_channels * bytes_per_sample;
- src_buf += stream->fmt->nChannels * bytes_per_sample;
- }
- }
- break;
- }
-
- return stream->remapping_buf;
-}
-
-static void adjust_buffer_volume(const struct alsa_stream *stream, BYTE *buf, snd_pcm_uframes_t frames)
-{
- BOOL adjust = FALSE;
- UINT32 i, channels, mute = 0;
- BYTE *end;
-
- if (stream->vol_adjusted_frames >= frames)
- return;
- channels = stream->fmt->nChannels;
-
- /* Adjust the buffer based on the volume for each channel */
- for (i = 0; i < channels; i++)
- {
- adjust |= stream->vols[i] != 1.0f;
- if (stream->vols[i] == 0.0f)
- mute++;
- }
-
- if (mute == channels)
- {
- int err = snd_pcm_format_set_silence(stream->alsa_format, buf, frames * channels);
- if (err < 0)
- WARN("Setting buffer to silence failed: %d (%s)\n", err, snd_strerror(err));
- return;
- }
- if (!adjust) return;
-
- /* Skip the frames we've already adjusted before */
- end = buf + frames * stream->fmt->nBlockAlign;
- buf += stream->vol_adjusted_frames * stream->fmt->nBlockAlign;
-
- switch (stream->alsa_format)
- {
-#ifndef WORDS_BIGENDIAN
-#define PROCESS_BUFFER(type) do \
-{ \
- type *p = (type*)buf; \
- do \
- { \
- for (i = 0; i < channels; i++) \
- p[i] = p[i] * stream->vols[i]; \
- p += i; \
- } while ((BYTE*)p != end); \
-} while (0)
- case SND_PCM_FORMAT_S16_LE:
- PROCESS_BUFFER(INT16);
- break;
- case SND_PCM_FORMAT_S32_LE:
- PROCESS_BUFFER(INT32);
- break;
- case SND_PCM_FORMAT_FLOAT_LE:
- PROCESS_BUFFER(float);
- break;
- case SND_PCM_FORMAT_FLOAT64_LE:
- PROCESS_BUFFER(double);
- break;
-#undef PROCESS_BUFFER
- case SND_PCM_FORMAT_S20_3LE:
- case SND_PCM_FORMAT_S24_3LE:
- {
- /* Do it 12 bytes at a time until it is no longer possible */
- UINT32 *q = (UINT32*)buf, mask = ~0xff;
- BYTE *p;
-
- /* After we adjust the volume, we need to mask out low bits */
- if (stream->alsa_format == SND_PCM_FORMAT_S20_3LE)
- mask = ~0x0fff;
-
- i = 0;
- while (end - (BYTE*)q >= 12)
- {
- UINT32 v[4], k;
- v[0] = q[0] << 8;
- v[1] = q[1] << 16 | (q[0] >> 16 & ~0xff);
- v[2] = q[2] << 24 | (q[1] >> 8 & ~0xff);
- v[3] = q[2] & ~0xff;
- for (k = 0; k < 4; k++)
- {
- v[k] = (INT32)((INT32)v[k] * stream->vols[i]);
- v[k] &= mask;
- if (++i == channels) i = 0;
- }
- *q++ = v[0] >> 8 | v[1] << 16;
- *q++ = v[1] >> 16 | v[2] << 8;
- *q++ = v[2] >> 24 | v[3];
- }
- p = (BYTE*)q;
- while (p != end)
- {
- UINT32 v = (INT32)((INT32)(p[0] << 8 | p[1] << 16 | p[2] << 24) * stream->vols[i]);
- v &= mask;
- *p++ = v >> 8 & 0xff;
- *p++ = v >> 16 & 0xff;
- *p++ = v >> 24;
- if (++i == channels) i = 0;
- }
- break;
- }
-#endif
- case SND_PCM_FORMAT_U8:
- {
- UINT8 *p = (UINT8*)buf;
- do
- {
- for (i = 0; i < channels; i++)
- p[i] = (int)((p[i] - 128) * stream->vols[i]) + 128;
- p += i;
- } while ((BYTE*)p != end);
- break;
- }
- default:
- TRACE("Unhandled format %i, not adjusting volume.\n", stream->alsa_format);
- break;
- }
-}
-
static snd_pcm_sframes_t alsa_write_best_effort(struct alsa_stream *stream, BYTE *buf, snd_pcm_uframes_t frames)
{
+ struct write_best_effort_tmp_params params;
snd_pcm_sframes_t written;
- adjust_buffer_volume(stream, buf, frames);
-
- /* Mark the frames we've already adjusted */
- if (stream->vol_adjusted_frames < frames)
- stream->vol_adjusted_frames = frames;
-
- buf = remap_channels(stream, buf, frames);
-
- written = snd_pcm_writei(stream->pcm_handle, buf, frames);
- if(written < 0){
- int ret;
-
- if(written == -EAGAIN)
- /* buffer full */
- return 0;
-
- WARN("writei failed, recovering: %ld (%s)\n", written,
- snd_strerror(written));
-
- ret = snd_pcm_recover(stream->pcm_handle, written, 0);
- if(ret < 0){
- WARN("Could not recover: %d (%s)\n", ret, snd_strerror(ret));
- return ret;
- }
+ params.stream = stream;
+ params.buf = buf;
+ params.frames = frames;
+ params.written = &written;
- written = snd_pcm_writei(stream->pcm_handle, buf, frames);
- }
+ ALSA_CALL(write_best_effort_tmp, ¶ms);
- if (written > 0)
- stream->vol_adjusted_frames -= written;
return written;
}
diff --git a/dlls/winealsa.drv/unixlib.h b/dlls/winealsa.drv/unixlib.h
index 2484fca8c90..3fd6d2a73ee 100644
--- a/dlls/winealsa.drv/unixlib.h
+++ b/dlls/winealsa.drv/unixlib.h
@@ -129,6 +129,14 @@ struct get_current_padding_params
UINT32 *padding;
};
+struct write_best_effort_tmp_params
+{
+ struct alsa_stream *stream;
+ BYTE *buf;
+ snd_pcm_uframes_t frames;
+ snd_pcm_sframes_t *written;
+};
+
enum alsa_funcs
{
alsa_get_endpoint_ids,
@@ -139,6 +147,8 @@ enum alsa_funcs
alsa_get_buffer_size,
alsa_get_latency,
alsa_get_current_padding,
+
+ alsa_write_best_effort_tmp
};
extern unixlib_handle_t alsa_handle;
--
2.25.1
2
1
March 3, 2022
On non-AVX CPUs, CONTEXT_EX is not being initialized.
In WOW64 mode, this results in invalid exception records when
dispatch_wow_exception() uses RtlCopyContext().
Signed-off-by: Brendan Shanks <bshanks(a)codeweavers.com>
---
- The XState/All lengths come from RtlInitializeExtendedContext2().
- I only experienced the bug on x86_64, but made the i386 change for
consistency.
dlls/ntdll/unix/signal_i386.c | 23 +++++++++++++++++++----
dlls/ntdll/unix/signal_x86_64.c | 23 +++++++++++++++++++----
2 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c
index 6bb5649e2b5..e2a6148d609 100644
--- a/dlls/ntdll/unix/signal_i386.c
+++ b/dlls/ntdll/unix/signal_i386.c
@@ -581,12 +581,23 @@ static inline void context_init_xstate( CONTEXT *context, void *xstate_buffer )
xctx->Legacy.Length = sizeof(CONTEXT);
xctx->Legacy.Offset = -(LONG)sizeof(CONTEXT);
- xctx->XState.Length = sizeof(XSTATE);
- xctx->XState.Offset = (BYTE *)xstate_buffer - (BYTE *)xctx;
+ if (xstate_buffer)
+ {
+ xctx->XState.Length = sizeof(XSTATE);
+ xctx->XState.Offset = (BYTE *)xstate_buffer - (BYTE *)xctx;
+ context->ContextFlags |= CONTEXT_XSTATE;
+
+ xctx->All.Length = sizeof(CONTEXT) + xctx->XState.Offset + xctx->XState.Length;
+ }
+ else
+ {
+ xctx->XState.Length = 25;
+ xctx->XState.Offset = 0;
+
+ xctx->All.Length = sizeof(CONTEXT) + 24; /* sizeof(CONTEXT_EX) minus 8 alignment bytes on x64. */
+ }
- xctx->All.Length = sizeof(CONTEXT) + xctx->XState.Offset + xctx->XState.Length;
xctx->All.Offset = -(LONG)sizeof(CONTEXT);
- context->ContextFlags |= CONTEXT_XSTATE;
}
@@ -1456,6 +1467,10 @@ C_ASSERT( (offsetof(struct stack_layout, xstate) == sizeof(struct stack_layout))
memcpy( &dst_xs->YmmContext, &src_xs->YmmContext, sizeof(dst_xs->YmmContext) );
}
}
+ else
+ {
+ context_init_xstate( &stack->context, NULL );
+ }
stack->rec_ptr = &stack->rec;
stack->context_ptr = &stack->context;
diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c
index ac67e12240a..29096261723 100644
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -413,12 +413,23 @@ static inline void context_init_xstate( CONTEXT *context, void *xstate_buffer )
xctx->Legacy.Length = sizeof(CONTEXT);
xctx->Legacy.Offset = -(LONG)sizeof(CONTEXT);
- xctx->XState.Length = sizeof(XSTATE);
- xctx->XState.Offset = (BYTE *)xstate_buffer - (BYTE *)xctx;
+ if (xstate_buffer)
+ {
+ xctx->XState.Length = sizeof(XSTATE);
+ xctx->XState.Offset = (BYTE *)xstate_buffer - (BYTE *)xctx;
+ context->ContextFlags |= CONTEXT_XSTATE;
+
+ xctx->All.Length = sizeof(CONTEXT) + xctx->XState.Offset + xctx->XState.Length;
+ }
+ else
+ {
+ xctx->XState.Length = 25;
+ xctx->XState.Offset = 0;
+
+ xctx->All.Length = sizeof(CONTEXT) + 24; /* sizeof(CONTEXT_EX) minus 8 alignment bytes on x64. */
+ }
- xctx->All.Length = sizeof(CONTEXT) + xctx->XState.Offset + xctx->XState.Length;
xctx->All.Offset = -(LONG)sizeof(CONTEXT);
- context->ContextFlags |= CONTEXT_XSTATE;
}
static USHORT cs32_sel; /* selector for %cs in 32-bit mode */
@@ -2198,6 +2209,10 @@ static void setup_raise_exception( ucontext_t *sigcontext, EXCEPTION_RECORD *rec
memcpy( &dst_xs->YmmContext, &src_xs->YmmContext, sizeof(dst_xs->YmmContext) );
}
}
+ else
+ {
+ context_init_xstate( &stack->context, NULL );
+ }
CS_sig(sigcontext) = cs64_sel;
RIP_sig(sigcontext) = (ULONG_PTR)pKiUserExceptionDispatcher;
--
2.32.0 (Apple Git-132)
1
0
March 3, 2022
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
---
dlls/devenum/tests/Makefile.in | 1
dlls/devenum/tests/devenum.c | 266 ++++++++++++++++++++--------------------
2 files changed, 133 insertions(+), 134 deletions(-)
diff --git a/dlls/devenum/tests/Makefile.in b/dlls/devenum/tests/Makefile.in
index 762c007deee..2d6ec2d87ea 100644
--- a/dlls/devenum/tests/Makefile.in
+++ b/dlls/devenum/tests/Makefile.in
@@ -1,4 +1,3 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = devenum.dll
IMPORTS = advapi32 dsound msdmo msvfw32 oleaut32 ole32 winmm
diff --git a/dlls/devenum/tests/devenum.c b/dlls/devenum/tests/devenum.c
index 3e0d6f57dc3..d91f8699985 100644
--- a/dlls/devenum/tests/devenum.c
+++ b/dlls/devenum/tests/devenum.c
@@ -48,26 +48,26 @@ static void test_devenum(void)
hr = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
&IID_ICreateDevEnum, (LPVOID*)&create_devenum);
- ok(hr == S_OK, "Failed to create devenum: %#x\n", hr);
+ ok(hr == S_OK, "Failed to create devenum: %#lx\n", hr);
hr = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_ActiveMovieCategories, &enum_cat, 0);
- ok(hr == S_OK, "Failed to enum categories: %#x\n", hr);
+ ok(hr == S_OK, "Failed to enum categories: %#lx\n", hr);
while (IEnumMoniker_Next(enum_cat, 1, &moniker, NULL) == S_OK)
{
hr = IMoniker_BindToStorage(moniker, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "IMoniker_BindToStorage failed: %#x\n", hr);
+ ok(hr == S_OK, "IMoniker_BindToStorage failed: %#lx\n", hr);
VariantInit(&var);
hr = IPropertyBag_Read(prop_bag, L"CLSID", &var, NULL);
- ok(hr == S_OK, "Failed to read CLSID: %#x\n", hr);
+ ok(hr == S_OK, "Failed to read CLSID: %#lx\n", hr);
hr = CLSIDFromString(V_BSTR(&var), &cat_guid);
- ok(hr == S_OK, "got %#x\n", hr);
+ ok(hr == S_OK, "got %#lx\n", hr);
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == S_OK, "Failed to read FriendlyName: %#x\n", hr);
+ ok(hr == S_OK, "Failed to read FriendlyName: %#lx\n", hr);
if (winetest_debug > 1)
trace("%s %s:\n", wine_dbgstr_guid(&cat_guid), wine_dbgstr_w(V_BSTR(&var)));
@@ -77,7 +77,7 @@ static void test_devenum(void)
IMoniker_Release(moniker);
hr = ICreateDevEnum_CreateClassEnumerator(create_devenum, &cat_guid, &enum_moniker, 0);
- ok(SUCCEEDED(hr), "Failed to enum devices: %#x\n", hr);
+ ok(SUCCEEDED(hr), "Failed to enum devices: %#lx\n", hr);
if (hr == S_OK)
{
@@ -86,29 +86,29 @@ static void test_devenum(void)
while (IEnumMoniker_Next(enum_moniker, 1, &moniker, NULL) == S_OK)
{
hr = IMoniker_GetDisplayName(moniker, NULL, NULL, &displayname);
- ok(hr == S_OK, "got %#x\n", hr);
+ ok(hr == S_OK, "got %#lx\n", hr);
hr = IMoniker_GetClassID(moniker, NULL);
- ok(hr == E_INVALIDARG, "IMoniker_GetClassID should failed %x\n", hr);
+ ok(hr == E_INVALIDARG, "IMoniker_GetClassID should failed %lx\n", hr);
hr = IMoniker_GetClassID(moniker, &clsid);
- ok(hr == S_OK, "IMoniker_GetClassID failed with error %x\n", hr);
+ ok(hr == S_OK, "IMoniker_GetClassID failed with error %lx\n", hr);
ok(IsEqualGUID(&clsid, &CLSID_CDeviceMoniker),
"Expected CLSID_CDeviceMoniker got %s\n", wine_dbgstr_guid(&clsid));
VariantInit(&var);
hr = IMoniker_BindToStorage(moniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&prop_bag);
- ok(hr == S_OK, "IMoniker_BindToStorage failed with error %x\n", hr);
+ ok(hr == S_OK, "IMoniker_BindToStorage failed with error %lx\n", hr);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
ok((hr == S_OK) | (hr == ERROR_KEY_DOES_NOT_EXIST),
- "IPropertyBag_Read failed: %#x\n", hr);
+ "IPropertyBag_Read failed: %#lx\n", hr);
if (winetest_debug > 1)
trace(" %s %s\n", wine_dbgstr_w(displayname), wine_dbgstr_w(V_BSTR(&var)));
hr = IMoniker_BindToObject(moniker, NULL, NULL, &IID_IUnknown, NULL);
- ok(hr == E_POINTER, "got %#x\n", hr);
+ ok(hr == E_POINTER, "got %#lx\n", hr);
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"CLSID", &var, NULL);
@@ -122,13 +122,13 @@ static void test_devenum(void)
&IID_IUnknown, (void **)&unk);
if (hr2 == S_OK)
IUnknown_Release(unk);
- ok(hr2 == hr, "Expected hr %#x, got %#x.\n", hr, hr2);
+ ok(hr2 == hr, "Expected hr %#lx, got %#lx.\n", hr, hr2);
}
hr = CreateBindCtx(0, &bindctx);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IPropertyBag, (LPVOID*)&prop_bag);
- ok(hr == S_OK, "IMoniker_BindToStorage failed with error %x\n", hr);
+ ok(hr == S_OK, "IMoniker_BindToStorage failed with error %lx\n", hr);
IPropertyBag_Release(prop_bag);
IBindCtx_Release(bindctx);
@@ -159,22 +159,22 @@ static void test_moniker_isequal(void)
&IID_ICreateDevEnum, (LPVOID*)&create_devenum);
if (FAILED(res))
{
- skip("Cannot create SystemDeviceEnum object (%x)\n", res);
+ skip("Cannot create SystemDeviceEnum object (%lx)\n", res);
return;
}
res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker0, 0);
- ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
+ ok(SUCCEEDED(res), "Cannot create enum moniker (res = %lx)\n", res);
if (SUCCEEDED(res))
{
if (IEnumMoniker_Next(enum_moniker0, 1, &moniker0, NULL) == S_OK &&
IEnumMoniker_Next(enum_moniker0, 1, &moniker1, NULL) == S_OK)
{
res = IMoniker_IsEqual(moniker0, moniker1);
- ok(res == S_FALSE, "IMoniker_IsEqual should fail (res = %x)\n", res);
+ ok(res == S_FALSE, "IMoniker_IsEqual should fail (res = %lx)\n", res);
res = IMoniker_IsEqual(moniker1, moniker0);
- ok(res == S_FALSE, "IMoniker_IsEqual should fail (res = %x)\n", res);
+ ok(res == S_FALSE, "IMoniker_IsEqual should fail (res = %lx)\n", res);
IMoniker_Release(moniker0);
IMoniker_Release(moniker1);
@@ -185,19 +185,19 @@ static void test_moniker_isequal(void)
IEnumMoniker_Release(enum_moniker0);
res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker0, 0);
- ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
+ ok(SUCCEEDED(res), "Cannot create enum moniker (res = %lx)\n", res);
res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_AudioRendererCategory, &enum_moniker1, 0);
- ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
+ ok(SUCCEEDED(res), "Cannot create enum moniker (res = %lx)\n", res);
if (SUCCEEDED(res))
{
if (IEnumMoniker_Next(enum_moniker0, 1, &moniker0, NULL) == S_OK &&
IEnumMoniker_Next(enum_moniker1, 1, &moniker1, NULL) == S_OK)
{
res = IMoniker_IsEqual(moniker0, moniker1);
- ok(res == S_FALSE, "IMoniker_IsEqual should failed (res = %x)\n", res);
+ ok(res == S_FALSE, "IMoniker_IsEqual should failed (res = %lx)\n", res);
res = IMoniker_IsEqual(moniker1, moniker0);
- ok(res == S_FALSE, "IMoniker_IsEqual should failed (res = %x)\n", res);
+ ok(res == S_FALSE, "IMoniker_IsEqual should failed (res = %lx)\n", res);
IMoniker_Release(moniker0);
IMoniker_Release(moniker1);
@@ -209,19 +209,19 @@ static void test_moniker_isequal(void)
IEnumMoniker_Release(enum_moniker1);
res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker0, 0);
- ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
+ ok(SUCCEEDED(res), "Cannot create enum moniker (res = %lx)\n", res);
res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker1, 0);
- ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
+ ok(SUCCEEDED(res), "Cannot create enum moniker (res = %lx)\n", res);
if (SUCCEEDED(res))
{
if (IEnumMoniker_Next(enum_moniker0, 1, &moniker0, NULL) == S_OK &&
IEnumMoniker_Next(enum_moniker1, 1, &moniker1, NULL) == S_OK)
{
res = IMoniker_IsEqual(moniker0, moniker1);
- ok(res == S_OK, "IMoniker_IsEqual failed (res = %x)\n", res);
+ ok(res == S_OK, "IMoniker_IsEqual failed (res = %lx)\n", res);
res = IMoniker_IsEqual(moniker1, moniker0);
- ok(res == S_OK, "IMoniker_IsEqual failed (res = %x)\n", res);
+ ok(res == S_OK, "IMoniker_IsEqual failed (res = %lx)\n", res);
IMoniker_Release(moniker0);
IMoniker_Release(moniker1);
@@ -271,7 +271,7 @@ static void test_register_filter(void)
HRESULT hr;
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC, &IID_IFilterMapper2, (void **)&mapper2);
- ok(hr == S_OK, "Failed to create FilterMapper2: %#x\n", hr);
+ ok(hr == S_OK, "Failed to create FilterMapper2: %#lx\n", hr);
rgf2.dwVersion = 2;
rgf2.dwMerit = MERIT_UNLIKELY;
@@ -284,24 +284,24 @@ static void test_register_filter(void)
IFilterMapper2_Release(mapper2);
return;
}
- ok(hr == S_OK, "RegisterFilter failed: %#x\n", hr);
+ ok(hr == S_OK, "RegisterFilter failed: %#lx\n", hr);
ok(find_moniker(&CLSID_LegacyAmFilterCategory, mon), "filter should be registered\n");
hr = IFilterMapper2_UnregisterFilter(mapper2, NULL, NULL, &CLSID_TestFilter);
- ok(hr == S_OK, "UnregisterFilter failed: %#x\n", hr);
+ ok(hr == S_OK, "UnregisterFilter failed: %#lx\n", hr);
ok(!find_moniker(&CLSID_LegacyAmFilterCategory, mon), "filter should not be registered\n");
IMoniker_Release(mon);
mon = NULL;
hr = IFilterMapper2_RegisterFilter(mapper2, &CLSID_TestFilter, L"devenum test", &mon, &CLSID_AudioRendererCategory, NULL, &rgf2);
- ok(hr == S_OK, "RegisterFilter failed: %#x\n", hr);
+ ok(hr == S_OK, "RegisterFilter failed: %#lx\n", hr);
ok(find_moniker(&CLSID_AudioRendererCategory, mon), "filter should be registered\n");
hr = IFilterMapper2_UnregisterFilter(mapper2, &CLSID_AudioRendererCategory, NULL, &CLSID_TestFilter);
- ok(hr == S_OK, "UnregisterFilter failed: %#x\n", hr);
+ ok(hr == S_OK, "UnregisterFilter failed: %#lx\n", hr);
ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "filter should not be registered\n");
IMoniker_Release(mon);
@@ -317,10 +317,10 @@ static IMoniker *check_display_name_(int line, IParseDisplayName *parser, WCHAR
WCHAR *str;
hr = IParseDisplayName_ParseDisplayName(parser, NULL, buffer, &eaten, &mon);
- ok_(__FILE__, line)(hr == S_OK, "ParseDisplayName failed: %#x\n", hr);
+ ok_(__FILE__, line)(hr == S_OK, "ParseDisplayName failed: %#lx\n", hr);
hr = IMoniker_GetDisplayName(mon, NULL, NULL, &str);
- ok_(__FILE__, line)(hr == S_OK, "GetDisplayName failed: %#x\n", hr);
+ ok_(__FILE__, line)(hr == S_OK, "GetDisplayName failed: %#lx\n", hr);
ok_(__FILE__, line)(!wcscmp(str, buffer), "got %s\n", wine_dbgstr_w(str));
CoTaskMemFree(str);
@@ -343,7 +343,7 @@ static void test_directshow_filter(void)
/* Test ParseDisplayName and GetDisplayName */
hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
- ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
+ ok(hr == S_OK, "Failed to create ParseDisplayName: %#lx\n", hr);
wcscpy(buffer, L"@device:sw:");
StringFromGUID2(&CLSID_AudioRendererCategory, buffer + wcslen(buffer), CHARS_IN_GUID);
@@ -354,11 +354,11 @@ static void test_directshow_filter(void)
ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "filter should not be registered\n");
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
+ ok(hr == S_OK, "BindToStorage failed: %#lx\n", hr);
VariantInit(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got %#x\n", hr);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got %#lx\n", hr);
/* writing causes the key to be created */
V_VT(&var) = VT_BSTR;
@@ -366,60 +366,60 @@ static void test_directshow_filter(void)
hr = IPropertyBag_Write(prop_bag, L"FriendlyName", &var);
if (hr != E_ACCESSDENIED)
{
- ok(hr == S_OK, "Write failed: %#x\n", hr);
+ ok(hr == S_OK, "Write failed: %#lx\n", hr);
ok(find_moniker(&CLSID_AudioRendererCategory, mon), "filter should be registered\n");
VariantClear(&var);
V_VT(&var) = VT_EMPTY;
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(V_VT(&var) == VT_BSTR, "Got type %#x.\n", V_VT(&var));
ok(!wcscmp(V_BSTR(&var), L"test"), "Got name %s.\n", wine_dbgstr_w(V_BSTR(&var)));
VariantClear(&var);
V_VT(&var) = VT_LPWSTR;
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
V_VT(&var) = VT_BSTR;
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(V_VT(&var) == VT_BSTR, "Got type %#x.\n", V_VT(&var));
ok(!wcscmp(V_BSTR(&var), L"test"), "Got name %s.\n", wine_dbgstr_w(V_BSTR(&var)));
V_VT(&var) = VT_LPWSTR;
hr = IPropertyBag_Write(prop_bag, L"FriendlyName", &var);
- ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
VariantClear(&var);
V_VT(&var) = VT_I4;
V_I4(&var) = 0xdeadbeef;
hr = IPropertyBag_Write(prop_bag, L"foobar", &var);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
V_VT(&var) = VT_EMPTY;
hr = IPropertyBag_Read(prop_bag, L"foobar", &var, NULL);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(V_VT(&var) == VT_I4, "Got type %#x.\n", V_VT(&var));
- ok(V_I4(&var) == 0xdeadbeef, "Got value %#x.\n", V_I4(&var));
+ ok(V_I4(&var) == 0xdeadbeef, "Got value %#lx.\n", V_I4(&var));
V_VT(&var) = VT_UI4;
hr = IPropertyBag_Read(prop_bag, L"foobar", &var, NULL);
- ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
V_VT(&var) = VT_BSTR;
hr = IPropertyBag_Read(prop_bag, L"foobar", &var, NULL);
- ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
V_VT(&var) = VT_I4;
hr = IPropertyBag_Read(prop_bag, L"foobar", &var, NULL);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(V_VT(&var) == VT_I4, "Got type %#x.\n", V_VT(&var));
- ok(V_I4(&var) == 0xdeadbeef, "Got value %#x.\n", V_I4(&var));
+ ok(V_I4(&var) == 0xdeadbeef, "Got value %#lx.\n", V_I4(&var));
V_VT(&var) = VT_UI4;
hr = IPropertyBag_Write(prop_bag, L"foobar", &var);
- ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
V_VT(&var) = VT_ARRAY | VT_UI1;
V_ARRAY(&var) = SafeArrayCreate(VT_UI1, 1, &bound);
@@ -427,12 +427,12 @@ static void test_directshow_filter(void)
memcpy(array_data, "test data", 10);
SafeArrayUnaccessData(V_ARRAY(&var));
hr = IPropertyBag_Write(prop_bag, L"foobar", &var);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
VariantClear(&var);
V_VT(&var) = VT_EMPTY;
hr = IPropertyBag_Read(prop_bag, L"foobar", &var, NULL);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(V_VT(&var) == (VT_ARRAY | VT_UI1), "Got type %#x.\n", V_VT(&var));
SafeArrayAccessData(V_ARRAY(&var), &array_data);
ok(!memcmp(array_data, "test data", 10), "Got wrong data.\n");
@@ -445,7 +445,7 @@ static void test_directshow_filter(void)
StringFromGUID2(&CLSID_AudioRendererCategory, buffer + wcslen(buffer), CHARS_IN_GUID);
wcscat(buffer, L"\\Instance\\test");
res = RegDeleteKeyW(HKEY_CLASSES_ROOT, buffer);
- ok(!res, "RegDeleteKey failed: %lu\n", res);
+ ok(!res, "RegDeleteKey failed: %Iu\n", res);
}
VariantClear(&var);
@@ -457,22 +457,22 @@ static void test_directshow_filter(void)
mon = check_display_name(parser, buffer);
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
+ ok(hr == S_OK, "BindToStorage failed: %#lx\n", hr);
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got %#x\n", hr);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got %#lx\n", hr);
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = SysAllocString(L"test");
hr = IPropertyBag_Write(prop_bag, L"FriendlyName", &var);
if (hr != E_ACCESSDENIED)
{
- ok(hr == S_OK, "Write failed: %#x\n", hr);
+ ok(hr == S_OK, "Write failed: %#lx\n", hr);
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
ok(!wcscmp(V_BSTR(&var), L"test"), "got %s\n", wine_dbgstr_w(V_BSTR(&var)));
IMoniker_Release(mon);
@@ -481,7 +481,7 @@ static void test_directshow_filter(void)
RegDeleteKeyA(HKEY_CLASSES_ROOT, "CLSID\\test\\Instance");
res = RegDeleteKeyA(HKEY_CLASSES_ROOT, "CLSID\\test");
- ok(!res, "RegDeleteKey failed: %lu\n", res);
+ ok(!res, "RegDeleteKey failed: %Iu\n", res);
}
VariantClear(&var);
@@ -502,7 +502,7 @@ static void test_codec(void)
/* Test ParseDisplayName and GetDisplayName */
hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
- ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
+ ok(hr == S_OK, "Failed to create ParseDisplayName: %#lx\n", hr);
wcscpy(buffer, L"@device:cm:");
StringFromGUID2(&CLSID_AudioRendererCategory, buffer + wcslen(buffer), CHARS_IN_GUID);
@@ -513,66 +513,66 @@ static void test_codec(void)
ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "codec should not be registered\n");
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
+ ok(hr == S_OK, "BindToStorage failed: %#lx\n", hr);
VariantInit(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got %#x\n", hr);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got %#lx\n", hr);
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = SysAllocString(L"test");
hr = IPropertyBag_Write(prop_bag, L"FriendlyName", &var);
- ok(hr == S_OK, "Write failed: %#x\n", hr);
+ ok(hr == S_OK, "Write failed: %#lx\n", hr);
V_VT(&var) = VT_LPWSTR;
hr = IPropertyBag_Write(prop_bag, L"FriendlyName", &var);
- ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
VariantClear(&var);
V_VT(&var) = VT_EMPTY;
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(V_VT(&var) == VT_BSTR, "Got type %#x.\n", V_VT(&var));
ok(!wcscmp(V_BSTR(&var), L"test"), "Got name %s.\n", wine_dbgstr_w(V_BSTR(&var)));
VariantClear(&var);
V_VT(&var) = VT_LPWSTR;
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
V_VT(&var) = VT_BSTR;
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(V_VT(&var) == VT_BSTR, "Got type %#x.\n", V_VT(&var));
ok(!wcscmp(V_BSTR(&var), L"test"), "Got name %s.\n", wine_dbgstr_w(V_BSTR(&var)));
V_VT(&var) = VT_I4;
V_I4(&var) = 0xdeadbeef;
hr = IPropertyBag_Write(prop_bag, L"foobar", &var);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
V_VT(&var) = VT_EMPTY;
hr = IPropertyBag_Read(prop_bag, L"foobar", &var, NULL);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(V_VT(&var) == VT_I4, "Got type %#x.\n", V_VT(&var));
- ok(V_I4(&var) == 0xdeadbeef, "Got value %#x.\n", V_I4(&var));
+ ok(V_I4(&var) == 0xdeadbeef, "Got value %#lx.\n", V_I4(&var));
V_VT(&var) = VT_UI4;
hr = IPropertyBag_Read(prop_bag, L"foobar", &var, NULL);
- ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
V_VT(&var) = VT_BSTR;
hr = IPropertyBag_Read(prop_bag, L"foobar", &var, NULL);
- ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
V_VT(&var) = VT_I4;
hr = IPropertyBag_Read(prop_bag, L"foobar", &var, NULL);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(V_VT(&var) == VT_I4, "Got type %#x.\n", V_VT(&var));
- ok(V_I4(&var) == 0xdeadbeef, "Got value %#x.\n", V_I4(&var));
+ ok(V_I4(&var) == 0xdeadbeef, "Got value %#lx.\n", V_I4(&var));
V_VT(&var) = VT_UI4;
hr = IPropertyBag_Write(prop_bag, L"foobar", &var);
- ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
V_VT(&var) = VT_ARRAY | VT_UI1;
V_ARRAY(&var) = SafeArrayCreate(VT_UI1, 1, &bound);
@@ -580,7 +580,7 @@ static void test_codec(void)
memcpy(array_data, "test data", 10);
SafeArrayUnaccessData(V_ARRAY(&var));
hr = IPropertyBag_Write(prop_bag, L"foobar", &var);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
/* unlike DirectShow filters, these are automatically generated, so
* enumerating them will destroy the key */
@@ -588,7 +588,7 @@ static void test_codec(void)
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got %#x\n", hr);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got %#lx\n", hr);
IPropertyBag_Release(prop_bag);
IMoniker_Release(mon);
@@ -611,7 +611,7 @@ static void test_dmo(const GUID *dmo_category, const GUID *enum_category)
GUID clsid;
hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
- ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
+ ok(hr == S_OK, "Failed to create ParseDisplayName: %#lx\n", hr);
wcscpy(buffer, L"@device:dmo:");
StringFromGUID2(&CLSID_TestFilter, buffer + wcslen(buffer), CHARS_IN_GUID);
@@ -621,47 +621,47 @@ static void test_dmo(const GUID *dmo_category, const GUID *enum_category)
ok(!find_moniker(enum_category, mon), "DMO should not be registered\n");
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "got %#x\n", hr);
+ ok(hr == S_OK, "got %#lx\n", hr);
VariantInit(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == E_FAIL, "got %#x\n", hr);
+ ok(hr == E_FAIL, "got %#lx\n", hr);
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = SysAllocString(L"devenum test");
hr = IPropertyBag_Write(prop_bag, L"FriendlyName", &var);
- ok(hr == E_ACCESSDENIED, "Write failed: %#x\n", hr);
+ ok(hr == E_ACCESSDENIED, "Write failed: %#lx\n", hr);
hr = DMORegister(L"devenum test", &CLSID_TestFilter, dmo_category, 0, 0, NULL, 0, NULL);
if (hr != E_FAIL)
{
- ok(hr == S_OK, "got %#x\n", hr);
+ ok(hr == S_OK, "got %#lx\n", hr);
ok(find_moniker(enum_category, mon), "DMO should be registered\n");
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == S_OK, "got %#x\n", hr);
+ ok(hr == S_OK, "got %#lx\n", hr);
ok(!wcscmp(V_BSTR(&var), L"devenum test"), "got %s\n", wine_dbgstr_w(V_BSTR(&var)));
VariantClear(&var);
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = SysAllocString(L"devenum test");
hr = IPropertyBag_Write(prop_bag, L"FriendlyName", &var);
- ok(hr == E_ACCESSDENIED, "Write failed: %#x\n", hr);
+ ok(hr == E_ACCESSDENIED, "Write failed: %#lx\n", hr);
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"CLSID", &var, NULL);
- ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "got %#x\n", hr);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "got %#lx\n", hr);
hr = DMOUnregister(&CLSID_TestFilter, dmo_category);
- ok(hr == S_OK, "got %#x\n", hr);
+ ok(hr == S_OK, "got %#lx\n", hr);
}
IPropertyBag_Release(prop_bag);
IMoniker_Release(mon);
hr = DMOEnum(&DMOCATEGORY_AUDIO_DECODER, 0, 0, NULL, 0, NULL, &enumdmo);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
while (IEnumDMO_Next(enumdmo, 1, &clsid, &name, NULL) == S_OK)
{
@@ -672,35 +672,35 @@ static void test_dmo(const GUID *dmo_category, const GUID *enum_category)
ok(find_moniker(&DMOCATEGORY_AUDIO_DECODER, mon), "DMO was not found.\n");
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(hr == S_OK, "Got hr %#lx.\n", hr);
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == S_OK, "got %#x\n", hr);
+ ok(hr == S_OK, "got %#lx\n", hr);
ok(!wcscmp(V_BSTR(&var), name), "got %s\n", wine_dbgstr_w(V_BSTR(&var)));
VariantClear(&var);
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = SysAllocString(L"devenum test");
hr = IPropertyBag_Write(prop_bag, L"FriendlyName", &var);
- ok(hr == E_ACCESSDENIED, "Write failed: %#x\n", hr);
+ ok(hr == E_ACCESSDENIED, "Write failed: %#lx\n", hr);
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"CLSID", &var, NULL);
- ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "got %#x\n", hr);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "got %#lx\n", hr);
IPropertyBag_Release(prop_bag);
CoTaskMemFree(name);
hr = IMoniker_BindToObject(mon, NULL, NULL, &IID_IBaseFilter, (void **)&filter);
- ok(hr == S_OK, "got %#x\n", hr);
+ ok(hr == S_OK, "got %#lx\n", hr);
hr = IBaseFilter_GetClassID(filter, &clsid);
- ok(hr == S_OK, "got %#x\n", hr);
+ ok(hr == S_OK, "got %#lx\n", hr);
ok(IsEqualGUID(&clsid, &CLSID_DMOWrapperFilter), "Got CLSID %s.\n", debugstr_guid(&clsid));
hr = IBaseFilter_QueryInterface(filter, &IID_IMediaObject, (void **)&dmo);
- ok(hr == S_OK, "got %#x\n", hr);
+ ok(hr == S_OK, "got %#lx\n", hr);
IMediaObject_Release(dmo);
IBaseFilter_Release(filter);
@@ -721,10 +721,10 @@ static void test_legacy_filter(void)
HRESULT hr;
hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
- ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
+ ok(hr == S_OK, "Failed to create ParseDisplayName: %#lx\n", hr);
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC, &IID_IFilterMapper, (void **)&mapper);
- ok(hr == S_OK, "Failed to create FilterMapper: %#x\n", hr);
+ ok(hr == S_OK, "Failed to create FilterMapper: %#lx\n", hr);
hr = IFilterMapper_RegisterFilter(mapper, CLSID_TestFilter, L"test", 0xdeadbeef);
if (hr == VFW_E_BAD_KEY)
@@ -732,7 +732,7 @@ static void test_legacy_filter(void)
win_skip("not enough permissions to register filters\n");
goto end;
}
- ok(hr == S_OK, "RegisterFilter failed: %#x\n", hr);
+ ok(hr == S_OK, "RegisterFilter failed: %#lx\n", hr);
wcscpy(buffer, L"@device:cm:");
StringFromGUID2(&CLSID_LegacyAmFilterCategory, buffer + wcslen(buffer), CHARS_IN_GUID);
@@ -743,11 +743,11 @@ static void test_legacy_filter(void)
ok(find_moniker(&CLSID_LegacyAmFilterCategory, mon), "filter should be registered\n");
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
+ ok(hr == S_OK, "BindToStorage failed: %#lx\n", hr);
VariantInit(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
StringFromGUID2(&CLSID_TestFilter, buffer, CHARS_IN_GUID);
ok(!wcscmp(buffer, V_BSTR(&var)), "expected %s, got %s\n",
@@ -755,7 +755,7 @@ static void test_legacy_filter(void)
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"CLSID", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
ok(!wcscmp(buffer, V_BSTR(&var)), "expected %s, got %s\n",
wine_dbgstr_w(buffer), wine_dbgstr_w(V_BSTR(&var)));
@@ -763,7 +763,7 @@ static void test_legacy_filter(void)
IPropertyBag_Release(prop_bag);
hr = IFilterMapper_UnregisterFilter(mapper, CLSID_TestFilter);
- ok(hr == S_OK, "UnregisterFilter failed: %#x\n", hr);
+ ok(hr == S_OK, "UnregisterFilter failed: %#lx\n", hr);
ok(!find_moniker(&CLSID_LegacyAmFilterCategory, mon), "filter should not be registered\n");
IMoniker_Release(mon);
@@ -795,7 +795,7 @@ static BOOL CALLBACK test_dsound(GUID *guid, const WCHAR *desc, const WCHAR *mod
}
hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
- ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
+ ok(hr == S_OK, "Failed to create ParseDisplayName: %#lx\n", hr);
wcscpy(buffer, L"@device:cm:");
StringFromGUID2(&CLSID_AudioRendererCategory, buffer + wcslen(buffer), CHARS_IN_GUID);
@@ -805,7 +805,7 @@ static BOOL CALLBACK test_dsound(GUID *guid, const WCHAR *desc, const WCHAR *mod
mon = check_display_name(parser, buffer);
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
+ ok(hr == S_OK, "BindToStorage failed: %#lx\n", hr);
VariantInit(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
@@ -823,19 +823,19 @@ static BOOL CALLBACK test_dsound(GUID *guid, const WCHAR *desc, const WCHAR *mod
mon = check_display_name(parser, buffer);
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
+ ok(hr == S_OK, "BindToStorage failed: %#lx\n", hr);
VariantInit(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
}
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
ok(!wcscmp(name, V_BSTR(&var)), "expected %s, got %s\n",
wine_dbgstr_w(name), wine_dbgstr_w(V_BSTR(&var)));
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"CLSID", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
StringFromGUID2(&CLSID_DSoundRender, buffer, CHARS_IN_GUID);
ok(!wcscmp(buffer, V_BSTR(&var)), "expected %s, got %s\n",
@@ -843,7 +843,7 @@ static BOOL CALLBACK test_dsound(GUID *guid, const WCHAR *desc, const WCHAR *mod
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"DSGuid", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
StringFromGUID2(guid, buffer, CHARS_IN_GUID);
ok(!wcscmp(buffer, V_BSTR(&var)), "expected %s, got %s\n",
@@ -871,7 +871,7 @@ static void test_waveout(void)
HRESULT hr;
hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
- ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
+ ok(hr == S_OK, "Failed to create ParseDisplayName: %#lx\n", hr);
count = waveOutGetNumDevs();
@@ -892,7 +892,7 @@ static void test_waveout(void)
mon = check_display_name(parser, buffer);
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
+ ok(hr == S_OK, "BindToStorage failed: %#lx\n", hr);
VariantInit(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
@@ -914,18 +914,18 @@ static void test_waveout(void)
mon = check_display_name(parser, buffer);
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
+ ok(hr == S_OK, "BindToStorage failed: %#lx\n", hr);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
}
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
ok(!wcsncmp(name, V_BSTR(&var), wcslen(name)), "expected %s, got %s\n",
wine_dbgstr_w(name), wine_dbgstr_w(V_BSTR(&var)));
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"CLSID", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
StringFromGUID2(&CLSID_AudioRender, buffer, CHARS_IN_GUID);
ok(!wcscmp(buffer, V_BSTR(&var)), "expected %s, got %s\n",
@@ -933,9 +933,9 @@ static void test_waveout(void)
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"WaveOutId", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
- ok(V_I4(&var) == i, "expected %d, got %d\n", i, V_I4(&var));
+ ok(V_I4(&var) == i, "expected %d, got %ld\n", i, V_I4(&var));
IPropertyBag_Release(prop_bag);
IMoniker_Release(mon);
@@ -958,7 +958,7 @@ static void test_wavein(void)
HRESULT hr;
hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
- ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
+ ok(hr == S_OK, "Failed to create ParseDisplayName: %#lx\n", hr);
count = waveInGetNumDevs();
@@ -974,7 +974,7 @@ static void test_wavein(void)
mon = check_display_name(parser, buffer);
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
+ ok(hr == S_OK, "BindToStorage failed: %#lx\n", hr);
VariantInit(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
@@ -996,18 +996,18 @@ static void test_wavein(void)
mon = check_display_name(parser, buffer);
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
+ ok(hr == S_OK, "BindToStorage failed: %#lx\n", hr);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
}
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
ok(!wcsncmp(caps.szPname, V_BSTR(&var), wcslen(caps.szPname)), "expected %s, got %s\n",
wine_dbgstr_w(caps.szPname), wine_dbgstr_w(V_BSTR(&var)));
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"CLSID", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
StringFromGUID2(&CLSID_AudioRecord, buffer, CHARS_IN_GUID);
ok(!wcscmp(buffer, V_BSTR(&var)), "expected %s, got %s\n",
@@ -1015,9 +1015,9 @@ static void test_wavein(void)
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"WaveInId", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
- ok(V_I4(&var) == i, "expected %d, got %d\n", i, V_I4(&var));
+ ok(V_I4(&var) == i, "expected %d, got %ld\n", i, V_I4(&var));
IPropertyBag_Release(prop_bag);
IMoniker_Release(mon);
@@ -1039,7 +1039,7 @@ static void test_midiout(void)
HRESULT hr;
hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
- ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
+ ok(hr == S_OK, "Failed to create ParseDisplayName: %#lx\n", hr);
count = midiOutGetNumDevs();
@@ -1060,18 +1060,18 @@ static void test_midiout(void)
mon = check_display_name(parser, buffer);
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
+ ok(hr == S_OK, "BindToStorage failed: %#lx\n", hr);
VariantInit(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
ok(!wcscmp(name, V_BSTR(&var)), "expected %s, got %s\n",
wine_dbgstr_w(name), wine_dbgstr_w(V_BSTR(&var)));
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"CLSID", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
StringFromGUID2(&CLSID_AVIMIDIRender, buffer, CHARS_IN_GUID);
ok(!wcscmp(buffer, V_BSTR(&var)), "expected %s, got %s\n",
@@ -1079,9 +1079,9 @@ static void test_midiout(void)
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"MidiOutId", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
- ok(V_I4(&var) == i, "expected %d, got %d\n", i, V_I4(&var));
+ ok(V_I4(&var) == i, "expected %d, got %ld\n", i, V_I4(&var));
IPropertyBag_Release(prop_bag);
IMoniker_Release(mon);
@@ -1109,7 +1109,7 @@ static void test_vfw(void)
}
hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
- ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
+ ok(hr == S_OK, "Failed to create ParseDisplayName: %#lx\n", hr);
while (ICInfo(ICTYPE_VIDEO, i++, &info))
{
@@ -1128,18 +1128,18 @@ static void test_vfw(void)
mon = check_display_name(parser, buffer);
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
- ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
+ ok(hr == S_OK, "BindToStorage failed: %#lx\n", hr);
VariantInit(&var);
hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
ok(!wcscmp(info.szDescription, V_BSTR(&var)), "expected %s, got %s\n",
wine_dbgstr_w(info.szDescription), wine_dbgstr_w(V_BSTR(&var)));
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"CLSID", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
StringFromGUID2(&CLSID_AVICo, buffer, CHARS_IN_GUID);
ok(!wcscmp(buffer, V_BSTR(&var)), "expected %s, got %s\n",
@@ -1147,7 +1147,7 @@ static void test_vfw(void)
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, L"FccHandler", &var, NULL);
- ok(hr == S_OK, "Read failed: %#x\n", hr);
+ ok(hr == S_OK, "Read failed: %#lx\n", hr);
ok(!wcscmp(name, V_BSTR(&var)), "expected %s, got %s\n",
wine_dbgstr_w(name), wine_dbgstr_w(V_BSTR(&var)));
@@ -1176,7 +1176,7 @@ START_TEST(devenum)
test_legacy_filter();
hr = DirectSoundEnumerateW(test_dsound, NULL);
- ok(hr == S_OK, "got %#x\n", hr);
+ ok(hr == S_OK, "got %#lx\n", hr);
test_waveout();
test_wavein();
test_midiout();
6
35
[PATCH 01/21] dlls/kernel32/tests/debugger.c: enable compilation with long types
by Eric Pouech March 3, 2022
by Eric Pouech March 3, 2022
March 3, 2022
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
---
dlls/kernel32/tests/debugger.c | 511 ++++++++++++++++++++--------------------
1 file changed, 256 insertions(+), 255 deletions(-)
diff --git a/dlls/kernel32/tests/debugger.c b/dlls/kernel32/tests/debugger.c
index 8b82aaecb9e..2b55da80b34 100644
--- a/dlls/kernel32/tests/debugger.c
+++ b/dlls/kernel32/tests/debugger.c
@@ -17,6 +17,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
#include <stdio.h>
#include <assert.h>
@@ -157,8 +158,8 @@ static int load_blackbox(const char* logfile, void* blackbox, int size)
}
SetLastError(0xdeadbeef);
ret=ReadFile(hFile, blackbox, size, &read, NULL);
- ok(ret, "ReadFile failed: %d\n", GetLastError());
- ok(read == size, "wrong size for '%s': read=%d\n", logfile, read);
+ ok(ret, "ReadFile failed: %ld\n", GetLastError());
+ ok(read == size, "wrong size for '%s': read=%ld\n", logfile, read);
ret = ReadFile(hFile, buf, sizeof(buf) - 1, &read, NULL);
if (ret && read)
{
@@ -259,7 +260,7 @@ static void add_thread(struct debugger_context *ctx, DWORD tid)
static struct debuggee_thread *get_debuggee_thread(struct debugger_context *ctx, DWORD tid)
{
struct wine_rb_entry *entry = wine_rb_get(&ctx->threads, &tid);
- ok(entry != NULL, "unknown thread %x\n", tid);
+ ok(entry != NULL, "unknown thread %lx\n", tid);
return WINE_RB_ENTRY_VALUE(entry, struct debuggee_thread, entry);
}
@@ -301,13 +302,13 @@ static void fetch_thread_context_(unsigned line, struct debuggee_thread *thread)
{
thread->handle = OpenThread(THREAD_GET_CONTEXT | THREAD_SET_CONTEXT | THREAD_QUERY_INFORMATION,
FALSE, thread->tid);
- ok_(__FILE__,line)(thread->handle != NULL, "OpenThread failed: %u\n", GetLastError());
+ ok_(__FILE__,line)(thread->handle != NULL, "OpenThread failed: %lu\n", GetLastError());
}
memset(&thread->ctx, 0xaa, sizeof(thread->ctx));
thread->ctx.ContextFlags = CONTEXT_FULL;
ret = GetThreadContext(thread->handle, &thread->ctx);
- ok_(__FILE__,line)(ret, "GetThreadContext failed: %u\n", GetLastError());
+ ok_(__FILE__,line)(ret, "GetThreadContext failed: %lu\n", GetLastError());
}
#define set_thread_context(a,b) set_thread_context_(__LINE__,a,b)
@@ -315,7 +316,7 @@ static void set_thread_context_(unsigned line, struct debugger_context *ctx, str
{
BOOL ret;
ret = SetThreadContext(thread->handle, &thread->ctx);
- ok_(__FILE__,line)(ret, "SetThreadContext failed: %u\n", GetLastError());
+ ok_(__FILE__,line)(ret, "SetThreadContext failed: %lu\n", GetLastError());
}
static void fetch_process_context(struct debugger_context *ctx)
@@ -343,14 +344,14 @@ static void next_event_(unsigned line, struct debugger_context *ctx, unsigned ti
if (ctx->process_cnt && ctx->ev.dwDebugEventCode != -1)
{
ret = ContinueDebugEvent(ctx->ev.dwProcessId, ctx->ev.dwThreadId, DBG_CONTINUE);
- ok_(__FILE__,line)(ret, "ContinueDebugEvent failed, last error %d.\n", GetLastError());
+ ok_(__FILE__,line)(ret, "ContinueDebugEvent failed, last error %ld.\n", GetLastError());
}
ret = WaitForDebugEvent(&ctx->ev, timeout);
if (!ret)
{
ok_(__FILE__,line)(GetLastError() == ERROR_SEM_TIMEOUT,
- "WaitForDebugEvent failed, last error %d.\n", GetLastError());
+ "WaitForDebugEvent failed, last error %ld.\n", GetLastError());
ctx->ev.dwDebugEventCode = -1;
return;
}
@@ -401,8 +402,8 @@ static void wait_for_breakpoint_(unsigned line, struct debugger_context *ctx)
while (ctx->ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT || ctx->ev.dwDebugEventCode == UNLOAD_DLL_DEBUG_EVENT
|| ctx->ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT);
- ok_(__FILE__,line)(ctx->ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx->ev.dwDebugEventCode);
- ok_(__FILE__,line)(ctx->ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %x\n",
+ ok_(__FILE__,line)(ctx->ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx->ev.dwDebugEventCode);
+ ok_(__FILE__,line)(ctx->ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %lx\n",
ctx->ev.u.Exception.ExceptionRecord.ExceptionCode);
}
@@ -413,12 +414,12 @@ static void process_attach_events(struct debugger_context *ctx, BOOL pass_except
ctx->ev.dwDebugEventCode = -1;
next_event(ctx, 0);
- ok(ctx->ev.dwDebugEventCode == CREATE_PROCESS_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx->ev.dwDebugEventCode);
+ ok(ctx->ev.dwDebugEventCode == CREATE_PROCESS_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx->ev.dwDebugEventCode);
next_event(ctx, 0);
if (ctx->ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT) /* Vista+ reports ntdll.dll before reporting threads */
{
- ok(ctx->ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx->ev.dwDebugEventCode);
+ ok(ctx->ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx->ev.dwDebugEventCode);
ok(ctx->ev.u.LoadDll.lpBaseOfDll == ntdll, "The first reported DLL is not ntdll.dll\n");
next_event(ctx, 0);
}
@@ -430,7 +431,7 @@ static void process_attach_events(struct debugger_context *ctx, BOOL pass_except
{
/* even when there are more pending events, they are not reported until current event is continued */
ret = WaitForDebugEvent(&ev, 10);
- ok(GetLastError() == ERROR_SEM_TIMEOUT, "WaitForDebugEvent returned %x(%u)\n", ret, GetLastError());
+ ok(GetLastError() == ERROR_SEM_TIMEOUT, "WaitForDebugEvent returned %x(%lu)\n", ret, GetLastError());
next_event(ctx, WAIT_EVENT_TIMEOUT);
if (ctx->ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT)
@@ -439,7 +440,7 @@ static void process_attach_events(struct debugger_context *ctx, BOOL pass_except
ok(ctx->dll_cnt > 2, "dll_cnt = %d\n", ctx->dll_cnt);
/* a new thread is created and it executes DbgBreakPoint, which causes the exception */
- ok(ctx->ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx->ev.dwDebugEventCode);
+ ok(ctx->ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx->ev.dwDebugEventCode);
if (ctx->ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT)
{
DWORD last_thread = ctx->ev.dwThreadId;
@@ -447,15 +448,15 @@ static void process_attach_events(struct debugger_context *ctx, BOOL pass_except
ok(ctx->ev.dwThreadId == last_thread, "unexpected thread\n");
}
- ok(ctx->ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx->ev.dwDebugEventCode);
- ok(ctx->ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %x\n",
+ ok(ctx->ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx->ev.dwDebugEventCode);
+ ok(ctx->ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %lx\n",
ctx->ev.u.Exception.ExceptionRecord.ExceptionCode);
ok(ctx->ev.u.Exception.ExceptionRecord.ExceptionAddress == pDbgBreakPoint, "ExceptionAddress != DbgBreakPoint\n");
if (pass_exception)
{
ret = ContinueDebugEvent(ctx->ev.dwProcessId, ctx->ev.dwThreadId, DBG_EXCEPTION_NOT_HANDLED);
- ok(ret, "ContinueDebugEvent failed, last error %d.\n", GetLastError());
+ ok(ret, "ContinueDebugEvent failed, last error %ld.\n", GetLastError());
ctx->ev.dwDebugEventCode = -1;
}
@@ -463,7 +464,7 @@ static void process_attach_events(struct debugger_context *ctx, BOOL pass_except
do next_event(ctx, POLL_EVENT_TIMEOUT);
while (ctx->ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT || ctx->ev.dwDebugEventCode == UNLOAD_DLL_DEBUG_EVENT
|| ctx->ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT || ctx->ev.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT);
- ok(ctx->ev.dwDebugEventCode == -1, "dwDebugEventCode = %d\n", ctx->ev.dwDebugEventCode);
+ ok(ctx->ev.dwDebugEventCode == -1, "dwDebugEventCode = %ld\n", ctx->ev.dwDebugEventCode);
}
static void doDebugger(int argc, char** argv)
@@ -509,8 +510,8 @@ static void doDebugger(int argc, char** argv)
if (strstr(myARGV[2], "process"))
{
next_event(&ctx, WAIT_EVENT_TIMEOUT);
- ok(ctx.ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
- ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionCode == STATUS_ACCESS_VIOLATION, "ExceptionCode = %x\n",
+ ok(ctx.ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionCode == STATUS_ACCESS_VIOLATION, "ExceptionCode = %lx\n",
ctx.ev.u.Exception.ExceptionRecord.ExceptionCode);
}
@@ -594,14 +595,14 @@ static void crash_and_debug(HKEY hkey, const char* argv0, const char* dbgtasks)
return;
}
- ok(ret == ERROR_SUCCESS, "unable to set AeDebug/auto: ret=%d\n", ret);
+ ok(ret == ERROR_SUCCESS, "unable to set AeDebug/auto: ret=%ld\n", ret);
get_file_name(dbglog);
get_events(dbglog, &start_event, &done_event);
cmd=HeapAlloc(GetProcessHeap(), 0, strlen(argv0)+10+strlen(dbgtasks)+1+strlen(dbglog)+2+34+1);
sprintf(cmd, "%s debugger %s \"%s\" %%ld %%ld", argv0, dbgtasks, dbglog);
ret=RegSetValueExA(hkey, "debugger", 0, REG_SZ, (BYTE*)cmd, strlen(cmd)+1);
- ok(ret == ERROR_SUCCESS, "unable to set AeDebug/debugger: ret=%d\n", ret);
+ ok(ret == ERROR_SUCCESS, "unable to set AeDebug/debugger: ret=%ld\n", ret);
HeapFree(GetProcessHeap(), 0, cmd);
cmd = HeapAlloc(GetProcessHeap(), 0, strlen(argv0) + 16);
@@ -613,7 +614,7 @@ static void crash_and_debug(HKEY hkey, const char* argv0, const char* dbgtasks)
startup.dwFlags = STARTF_USESHOWWINDOW;
startup.wShowWindow = SW_SHOWNORMAL;
ret=CreateProcessA(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info);
- ok(ret, "CreateProcess: err=%d\n", GetLastError());
+ ok(ret, "CreateProcess: err=%ld\n", GetLastError());
HeapFree(GetProcessHeap(), 0, cmd);
CloseHandle(info.hThread);
@@ -635,7 +636,7 @@ static void crash_and_debug(HKEY hkey, const char* argv0, const char* dbgtasks)
#endif
ok(wait_code == WAIT_OBJECT_0, "Timed out waiting for the child to crash\n");
bRet = GetExitCodeProcess(info.hProcess, &exit_code);
- ok(bRet, "GetExitCodeProcess failed: err=%d\n", GetLastError());
+ ok(bRet, "GetExitCodeProcess failed: err=%ld\n", GetLastError());
if (strstr(dbgtasks, "code2"))
{
/* If, after attaching to the debuggee, the debugger exits without
@@ -644,12 +645,12 @@ static void crash_and_debug(HKEY hkey, const char* argv0, const char* dbgtasks)
ok(exit_code == STATUS_DEBUGGER_INACTIVE ||
broken(exit_code == STATUS_ACCESS_VIOLATION) || /* Intermittent Vista+ */
broken(exit_code == WAIT_ABANDONED), /* NT4, W2K */
- "wrong exit code : %08x\n", exit_code);
+ "wrong exit code : %08lx\n", exit_code);
}
else
ok(exit_code == STATUS_ACCESS_VIOLATION ||
broken(exit_code == WAIT_ABANDONED), /* NT4, W2K, W2K3 */
- "wrong exit code : %08x\n", exit_code);
+ "wrong exit code : %08lx\n", exit_code);
CloseHandle(info.hProcess);
/* ...before the debugger */
@@ -673,12 +674,12 @@ static void crash_and_debug(HKEY hkey, const char* argv0, const char* dbgtasks)
ok(load_blackbox(dbglog, &dbg_blackbox, sizeof(dbg_blackbox)), "failed to open: %s\n", dbglog);
ok(dbg_blackbox.argc == 6, "wrong debugger argument count: %d\n", dbg_blackbox.argc);
- ok(dbg_blackbox.pid == info.dwProcessId, "the child and debugged pids don't match: %d != %d\n", info.dwProcessId, dbg_blackbox.pid);
- ok(dbg_blackbox.debug_rc, "debugger: SetEvent(debug_event) failed err=%d\n", dbg_blackbox.debug_err);
- ok(dbg_blackbox.attach_rc, "DebugActiveProcess(%d) failed err=%d\n", dbg_blackbox.pid, dbg_blackbox.attach_err);
- ok(dbg_blackbox.nokill_rc, "DebugSetProcessKillOnExit(FALSE) failed err=%d\n", dbg_blackbox.nokill_err);
- ok(dbg_blackbox.detach_rc, "DebugActiveProcessStop(%d) failed err=%d\n", dbg_blackbox.pid, dbg_blackbox.detach_err);
- ok(!dbg_blackbox.failures, "debugger reported %u failures\n", dbg_blackbox.failures);
+ ok(dbg_blackbox.pid == info.dwProcessId, "the child and debugged pids don't match: %ld != %ld\n", info.dwProcessId, dbg_blackbox.pid);
+ ok(dbg_blackbox.debug_rc, "debugger: SetEvent(debug_event) failed err=%ld\n", dbg_blackbox.debug_err);
+ ok(dbg_blackbox.attach_rc, "DebugActiveProcess(%ld) failed err=%ld\n", dbg_blackbox.pid, dbg_blackbox.attach_err);
+ ok(dbg_blackbox.nokill_rc, "DebugSetProcessKillOnExit(FALSE) failed err=%ld\n", dbg_blackbox.nokill_err);
+ ok(dbg_blackbox.detach_rc, "DebugActiveProcessStop(%ld) failed err=%ld\n", dbg_blackbox.pid, dbg_blackbox.detach_err);
+ ok(!dbg_blackbox.failures, "debugger reported %lu failures\n", dbg_blackbox.failures);
DeleteFileA(dbglog);
}
@@ -693,7 +694,7 @@ static void crash_and_winedbg(HKEY hkey, const char* argv0)
DWORD exit_code;
ret=RegSetValueExA(hkey, "auto", 0, REG_SZ, (BYTE*)"1", 2);
- ok(ret == ERROR_SUCCESS, "unable to set AeDebug/auto: ret=%d\n", ret);
+ ok(ret == ERROR_SUCCESS, "unable to set AeDebug/auto: ret=%ld\n", ret);
cmd=HeapAlloc(GetProcessHeap(), 0, strlen(argv0)+15+1);
sprintf(cmd, "%s debugger crash", argv0);
@@ -703,15 +704,15 @@ static void crash_and_winedbg(HKEY hkey, const char* argv0)
startup.dwFlags = STARTF_USESHOWWINDOW;
startup.wShowWindow = SW_SHOWNORMAL;
ret=CreateProcessA(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info);
- ok(ret, "CreateProcess: err=%d\n", GetLastError());
+ ok(ret, "CreateProcess: err=%ld\n", GetLastError());
HeapFree(GetProcessHeap(), 0, cmd);
CloseHandle(info.hThread);
trace("waiting for child exit...\n");
ok(WaitForSingleObject(info.hProcess, 60000) == WAIT_OBJECT_0, "Timed out waiting for the child to crash\n");
bRet = GetExitCodeProcess(info.hProcess, &exit_code);
- ok(bRet, "GetExitCodeProcess failed: err=%d\n", GetLastError());
- ok(exit_code == STATUS_ACCESS_VIOLATION, "exit code = %08x\n", exit_code);
+ ok(bRet, "GetExitCodeProcess failed: err=%ld\n", GetLastError());
+ ok(exit_code == STATUS_ACCESS_VIOLATION, "exit code = %08lx\n", exit_code);
CloseHandle(info.hProcess);
}
@@ -749,7 +750,7 @@ static void test_ExitCode(void)
}
else if (ret != ERROR_FILE_NOT_FOUND)
{
- ok(0, "could not open the AeDebug key: %d\n", ret);
+ ok(0, "could not open the AeDebug key: %ld\n", ret);
return;
}
else
@@ -776,7 +777,7 @@ static void test_ExitCode(void)
RegCloseKey(hkeyWinedbg);
}
else
- ok(0, "Couldn't access WineDbg Key - error %u\n", ret);
+ ok(0, "Couldn't access WineDbg Key - error %lu\n", ret);
}
if (winetest_interactive)
@@ -786,7 +787,7 @@ static void test_ExitCode(void)
crash_and_debug(hkey, test_exe, "dbg,none");
else
skip("\"none\" debugger test needs user interaction\n");
- ok(disposition == REG_OPENED_EXISTING_KEY, "expected REG_OPENED_EXISTING_KEY, got %d\n", disposition);
+ ok(disposition == REG_OPENED_EXISTING_KEY, "expected REG_OPENED_EXISTING_KEY, got %ld\n", disposition);
crash_and_debug(hkey, test_exe, "dbg,event,order");
crash_and_debug(hkey, test_exe, "dbg,attach,event,code2");
crash_and_debug(hkey, test_exe, "dbg,attach,event,nokill");
@@ -820,7 +821,7 @@ static void test_RemoteDebugger(void)
bret = pCheckRemoteDebuggerPresent(GetCurrentProcess(),&present);
ok(bret , "expected CheckRemoteDebuggerPresent to succeed\n");
ok(0xdeadbeef == GetLastError(),
- "expected error to be unchanged, got %d/%x\n",GetLastError(), GetLastError());
+ "expected error to be unchanged, got %ld/%lx\n",GetLastError(), GetLastError());
present = TRUE;
SetLastError(0xdeadbeef);
@@ -828,13 +829,13 @@ static void test_RemoteDebugger(void)
ok(!bret , "expected CheckRemoteDebuggerPresent to fail\n");
ok(present, "expected parameter to be unchanged\n");
ok(ERROR_INVALID_PARAMETER == GetLastError(),
- "expected error ERROR_INVALID_PARAMETER, got %d/%x\n",GetLastError(), GetLastError());
+ "expected error ERROR_INVALID_PARAMETER, got %ld/%lx\n",GetLastError(), GetLastError());
SetLastError(0xdeadbeef);
bret = pCheckRemoteDebuggerPresent(GetCurrentProcess(),NULL);
ok(!bret , "expected CheckRemoteDebuggerPresent to fail\n");
ok(ERROR_INVALID_PARAMETER == GetLastError(),
- "expected error ERROR_INVALID_PARAMETER, got %d/%x\n",GetLastError(), GetLastError());
+ "expected error ERROR_INVALID_PARAMETER, got %ld/%lx\n",GetLastError(), GetLastError());
}
struct child_blackbox
@@ -854,36 +855,36 @@ static void doChild(int argc, char **argv)
BOOL ret;
blackbox_file = argv[4];
- sscanf(argv[3], "%08x", &ppid);
+ sscanf(argv[3], "%08lx", &ppid);
parent = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, ppid);
- child_ok(!!parent, "OpenProcess failed, last error %#x.\n", GetLastError());
+ child_ok(!!parent, "OpenProcess failed, last error %#lx.\n", GetLastError());
ret = pCheckRemoteDebuggerPresent(parent, &debug);
- child_ok(ret, "CheckRemoteDebuggerPresent failed, last error %#x.\n", GetLastError());
+ child_ok(ret, "CheckRemoteDebuggerPresent failed, last error %#lx.\n", GetLastError());
child_ok(!debug, "Expected debug == 0, got %#x.\n", debug);
ret = DebugActiveProcess(ppid);
- child_ok(ret, "DebugActiveProcess failed, last error %#x.\n", GetLastError());
+ child_ok(ret, "DebugActiveProcess failed, last error %#lx.\n", GetLastError());
ret = pCheckRemoteDebuggerPresent(parent, &debug);
- child_ok(ret, "CheckRemoteDebuggerPresent failed, last error %#x.\n", GetLastError());
+ child_ok(ret, "CheckRemoteDebuggerPresent failed, last error %#lx.\n", GetLastError());
child_ok(debug, "Expected debug != 0, got %#x.\n", debug);
ret = DebugActiveProcessStop(ppid);
- child_ok(ret, "DebugActiveProcessStop failed, last error %#x.\n", GetLastError());
+ child_ok(ret, "DebugActiveProcessStop failed, last error %#lx.\n", GetLastError());
ret = pCheckRemoteDebuggerPresent(parent, &debug);
- child_ok(ret, "CheckRemoteDebuggerPresent failed, last error %#x.\n", GetLastError());
+ child_ok(ret, "CheckRemoteDebuggerPresent failed, last error %#lx.\n", GetLastError());
child_ok(!debug, "Expected debug == 0, got %#x.\n", debug);
ret = CloseHandle(parent);
- child_ok(ret, "CloseHandle failed, last error %#x.\n", GetLastError());
+ child_ok(ret, "CloseHandle failed, last error %#lx.\n", GetLastError());
ret = IsDebuggerPresent();
child_ok(ret, "Expected ret != 0, got %#x.\n", ret);
ret = pCheckRemoteDebuggerPresent(GetCurrentProcess(), &debug);
- child_ok(ret, "CheckRemoteDebuggerPresent failed, last error %#x.\n", GetLastError());
+ child_ok(ret, "CheckRemoteDebuggerPresent failed, last error %#lx.\n", GetLastError());
child_ok(debug, "Expected debug != 0, got %#x.\n", debug);
NtCurrentTeb()->Peb->BeingDebugged = FALSE;
@@ -891,7 +892,7 @@ static void doChild(int argc, char **argv)
ret = IsDebuggerPresent();
child_ok(!ret, "Expected ret != 0, got %#x.\n", ret);
ret = pCheckRemoteDebuggerPresent(GetCurrentProcess(), &debug);
- child_ok(ret, "CheckRemoteDebuggerPresent failed, last error %#x.\n", GetLastError());
+ child_ok(ret, "CheckRemoteDebuggerPresent failed, last error %#lx.\n", GetLastError());
child_ok(debug, "Expected debug != 0, got %#x.\n", debug);
NtCurrentTeb()->Peb->BeingDebugged = TRUE;
@@ -902,11 +903,11 @@ static void doChild(int argc, char **argv)
GetSystemDirectoryW( path, MAX_PATH );
wcscat( path, L"\\oleaut32.dll" );
file = CreateFileW( path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
- child_ok( file != INVALID_HANDLE_VALUE, "failed to open %s: %u\n", debugstr_w(path), GetLastError());
+ child_ok( file != INVALID_HANDLE_VALUE, "failed to open %s: %lu\n", debugstr_w(path), GetLastError());
map = CreateFileMappingW( file, NULL, SEC_IMAGE | PAGE_READONLY, 0, 0, NULL );
- child_ok( map != NULL, "failed to create mapping %s: %u\n", debugstr_w(path), GetLastError() );
+ child_ok( map != NULL, "failed to create mapping %s: %lu\n", debugstr_w(path), GetLastError() );
mod = MapViewOfFile( map, FILE_MAP_READ, 0, 0, 0 );
- child_ok( mod != NULL, "failed to map %s: %u\n", debugstr_w(path), GetLastError() );
+ child_ok( mod != NULL, "failed to map %s: %lu\n", debugstr_w(path), GetLastError() );
CloseHandle( file );
CloseHandle( map );
UnmapViewOfFile( mod );
@@ -923,11 +924,11 @@ static void doChild(int argc, char **argv)
else goto done;
file = CreateFileW( path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
- child_ok( file != INVALID_HANDLE_VALUE, "failed to open %s: %u\n", debugstr_w(path), GetLastError());
+ child_ok( file != INVALID_HANDLE_VALUE, "failed to open %s: %lu\n", debugstr_w(path), GetLastError());
map = CreateFileMappingW( file, NULL, SEC_IMAGE | PAGE_READONLY, 0, 0, NULL );
- child_ok( map != NULL, "failed to create mapping %s: %u\n", debugstr_w(path), GetLastError() );
+ child_ok( map != NULL, "failed to create mapping %s: %lu\n", debugstr_w(path), GetLastError() );
mod = MapViewOfFile( map, FILE_MAP_READ, 0, 0, 0 );
- child_ok( mod != NULL, "failed to map %s: %u\n", debugstr_w(path), GetLastError() );
+ child_ok( mod != NULL, "failed to map %s: %lu\n", debugstr_w(path), GetLastError() );
CloseHandle( file );
CloseHandle( map );
UnmapViewOfFile( mod );
@@ -987,17 +988,17 @@ static void test_debug_loop(int argc, char **argv)
get_file_name(blackbox_file);
cmd = HeapAlloc(GetProcessHeap(), 0, strlen(argv[0]) + strlen(arguments) + strlen(blackbox_file) + 2 + 10);
- sprintf(cmd, "%s%s%08x \"%s\"", argv[0], arguments, pid, blackbox_file);
+ sprintf(cmd, "%s%s%08lx \"%s\"", argv[0], arguments, pid, blackbox_file);
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
ret = CreateProcessA(NULL, cmd, NULL, NULL, FALSE, DEBUG_PROCESS, NULL, NULL, &si, &pi);
- ok(ret, "CreateProcess failed, last error %#x.\n", GetLastError());
+ ok(ret, "CreateProcess failed, last error %#lx.\n", GetLastError());
HeapFree(GetProcessHeap(), 0, cmd);
ret = pCheckRemoteDebuggerPresent(pi.hProcess, &debug);
- ok(ret, "CheckRemoteDebuggerPresent failed, last error %#x.\n", GetLastError());
+ ok(ret, "CheckRemoteDebuggerPresent failed, last error %#lx.\n", GetLastError());
ok(debug, "Expected debug != 0, got %#x.\n", debug);
for (;;)
@@ -1005,7 +1006,7 @@ static void test_debug_loop(int argc, char **argv)
DEBUG_EVENT ev;
ret = WaitForDebugEvent(&ev, INFINITE);
- ok(ret, "WaitForDebugEvent failed, last error %#x.\n", GetLastError());
+ ok(ret, "WaitForDebugEvent failed, last error %#lx.\n", GetLastError());
if (!ret) break;
if (ev.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT) break;
@@ -1020,7 +1021,7 @@ static void test_debug_loop(int argc, char **argv)
}
#endif
ret = ContinueDebugEvent(ev.dwProcessId, ev.dwThreadId, DBG_CONTINUE);
- ok(ret, "ContinueDebugEvent failed, last error %#x.\n", GetLastError());
+ ok(ret, "ContinueDebugEvent failed, last error %#lx.\n", GetLastError());
if (!ret) break;
}
@@ -1033,15 +1034,15 @@ static void test_debug_loop(int argc, char **argv)
#endif
ret = CloseHandle(pi.hThread);
- ok(ret, "CloseHandle failed, last error %#x.\n", GetLastError());
+ ok(ret, "CloseHandle failed, last error %#lx.\n", GetLastError());
ret = CloseHandle(pi.hProcess);
- ok(ret, "CloseHandle failed, last error %#x.\n", GetLastError());
+ ok(ret, "CloseHandle failed, last error %#lx.\n", GetLastError());
load_blackbox(blackbox_file, &blackbox, sizeof(blackbox));
- ok(!blackbox.failures, "Got %d failures from child process.\n", blackbox.failures);
+ ok(!blackbox.failures, "Got %ld failures from child process.\n", blackbox.failures);
ret = DeleteFileA(blackbox_file);
- ok(ret, "DeleteFileA failed, last error %#x.\n", GetLastError());
+ ok(ret, "DeleteFileA failed, last error %#lx.\n", GetLastError());
}
static void doChildren(int argc, char **argv)
@@ -1067,7 +1068,7 @@ static void doChildren(int argc, char **argv)
strcpy(event_name, p);
strcat(event_name, "_init");
event = OpenEventA(EVENT_ALL_ACCESS, FALSE, event_name);
- child_ok(event != NULL, "OpenEvent failed, last error %d.\n", GetLastError());
+ child_ok(event != NULL, "OpenEvent failed, last error %ld.\n", GetLastError());
SetEvent(event);
CloseHandle(event);
@@ -1076,7 +1077,7 @@ static void doChildren(int argc, char **argv)
strcpy(event_name, p);
strcat(event_name, "_attach");
event = OpenEventA(EVENT_ALL_ACCESS, FALSE, event_name);
- child_ok(event != NULL, "OpenEvent failed, last error %d.\n", GetLastError());
+ child_ok(event != NULL, "OpenEvent failed, last error %ld.\n", GetLastError());
WaitForSingleObject(event, INFINITE);
CloseHandle(event);
@@ -1086,15 +1087,15 @@ static void doChildren(int argc, char **argv)
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
ret = CreateProcessA(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
- child_ok(ret, "CreateProcess failed, last error %d.\n", GetLastError());
+ child_ok(ret, "CreateProcess failed, last error %ld.\n", GetLastError());
child_ok(WaitForSingleObject(pi.hProcess, 10000) == WAIT_OBJECT_0,
"Timed out waiting for the child to exit\n");
ret = CloseHandle(pi.hThread);
- child_ok(ret, "CloseHandle failed, last error %d.\n", GetLastError());
+ child_ok(ret, "CloseHandle failed, last error %ld.\n", GetLastError());
ret = CloseHandle(pi.hProcess);
- child_ok(ret, "CloseHandle failed, last error %d.\n", GetLastError());
+ child_ok(ret, "CloseHandle failed, last error %ld.\n", GetLastError());
blackbox.failures = child_failures;
save_blackbox(blackbox_file, &blackbox, sizeof(blackbox), NULL);
@@ -1130,31 +1131,31 @@ static void test_debug_children(const char *name, DWORD flag, BOOL debug_child,
strcpy(event_name, p);
strcat(event_name, "_init");
event_init = CreateEventA(NULL, FALSE, FALSE, event_name);
- ok(event_init != NULL, "OpenEvent failed, last error %d.\n", GetLastError());
+ ok(event_init != NULL, "OpenEvent failed, last error %ld.\n", GetLastError());
p = strrchr(blackbox_file, '\\');
p = p ? p+1 : blackbox_file;
strcpy(event_name, p);
strcat(event_name, "_attach");
event_attach = CreateEventA(NULL, FALSE, flag!=0, event_name);
- ok(event_attach != NULL, "CreateEvent failed, last error %d.\n", GetLastError());
+ ok(event_attach != NULL, "CreateEvent failed, last error %ld.\n", GetLastError());
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
ret = CreateProcessA(NULL, cmd, NULL, NULL, FALSE, flag, NULL, NULL, &si, &pi);
- ok(ret, "CreateProcess failed, last error %d.\n", GetLastError());
+ ok(ret, "CreateProcess failed, last error %ld.\n", GetLastError());
HeapFree(GetProcessHeap(), 0, cmd);
if (!flag)
{
WaitForSingleObject(event_init, INFINITE);
Sleep(100);
ret = DebugActiveProcess(pi.dwProcessId);
- ok(ret, "DebugActiveProcess failed, last error %d.\n", GetLastError());
+ ok(ret, "DebugActiveProcess failed, last error %ld.\n", GetLastError());
}
ret = pCheckRemoteDebuggerPresent(pi.hProcess, &debug);
- ok(ret, "CheckRemoteDebuggerPresent failed, last error %d.\n", GetLastError());
+ ok(ret, "CheckRemoteDebuggerPresent failed, last error %ld.\n", GetLastError());
ok(debug, "Expected debug != 0, got %x.\n", debug);
trace("starting debugger loop\n");
@@ -1164,19 +1165,19 @@ static void test_debug_children(const char *name, DWORD flag, BOOL debug_child,
DWORD last_thread;
next_event(&ctx, WAIT_EVENT_TIMEOUT);
- ok(ctx.ev.dwDebugEventCode == CREATE_PROCESS_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.dwDebugEventCode == CREATE_PROCESS_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
ok(ctx.pid == pi.dwProcessId, "unexpected dwProcessId %x\n", ctx.ev.dwProcessId == ctx.pid);
next_event(&ctx, WAIT_EVENT_TIMEOUT);
- ok(ctx.ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
last_thread = ctx.ev.dwThreadId;
wait_for_breakpoint(&ctx);
ok(ctx.dll_cnt > 2, "dll_cnt = %d\n", ctx.dll_cnt);
- ok(ctx.ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
ok(ctx.ev.dwThreadId == last_thread, "unexpected thread\n");
- ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %x\n",
+ ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %lx\n",
ctx.ev.u.Exception.ExceptionRecord.ExceptionCode);
/* Except for wxppro and w2008, the initial breakpoint is now somewhere else, possibly within LdrInitShimEngineDynamic,
@@ -1195,11 +1196,11 @@ static void test_debug_children(const char *name, DWORD flag, BOOL debug_child,
if (pass_exception)
{
ret = ContinueDebugEvent(ctx.ev.dwProcessId, ctx.ev.dwThreadId, DBG_EXCEPTION_NOT_HANDLED);
- ok(ret, "ContinueDebugEvent failed, last error %d.\n", GetLastError());
+ ok(ret, "ContinueDebugEvent failed, last error %ld.\n", GetLastError());
ctx.ev.dwDebugEventCode = -1;
next_event(&ctx, WAIT_EVENT_TIMEOUT);
- ok(ctx.ev.dwDebugEventCode != EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.dwDebugEventCode != EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
}
}
else
@@ -1207,32 +1208,32 @@ static void test_debug_children(const char *name, DWORD flag, BOOL debug_child,
DWORD last_thread;
process_attach_events(&ctx, pass_exception);
- ok(ctx.pid == pi.dwProcessId, "unexpected dwProcessId %x\n", ctx.pid);
+ ok(ctx.pid == pi.dwProcessId, "unexpected dwProcessId %lx\n", ctx.pid);
ret = DebugBreakProcess(pi.hProcess);
- ok(ret, "BreakProcess failed: %u\n", GetLastError());
+ ok(ret, "BreakProcess failed: %lu\n", GetLastError());
/* a new thread, which executes DbgBreakPoint, is created */
next_event(&ctx, WAIT_EVENT_TIMEOUT);
- ok(ctx.ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
last_thread = ctx.ev.dwThreadId;
if (ctx.ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT)
next_event(&ctx, WAIT_EVENT_TIMEOUT);
- ok(ctx.ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
ok(ctx.ev.dwThreadId == last_thread, "unexpected thread\n");
- ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %x\n",
+ ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %lx\n",
ctx.ev.u.Exception.ExceptionRecord.ExceptionCode);
ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress == pDbgBreakPoint, "ExceptionAddress != DbgBreakPoint\n");
ret = SetEvent(event_attach);
- ok(ret, "SetEvent failed, last error %d.\n", GetLastError());
+ ok(ret, "SetEvent failed, last error %ld.\n", GetLastError());
if (pass_exception)
{
ret = ContinueDebugEvent(ctx.ev.dwProcessId, ctx.ev.dwThreadId, DBG_EXCEPTION_NOT_HANDLED);
- ok(ret, "ContinueDebugEvent failed, last error %d.\n", GetLastError());
+ ok(ret, "ContinueDebugEvent failed, last error %ld.\n", GetLastError());
ctx.ev.dwDebugEventCode = -1;
}
}
@@ -1241,27 +1242,27 @@ static void test_debug_children(const char *name, DWORD flag, BOOL debug_child,
while (ctx.ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT || ctx.ev.dwDebugEventCode == UNLOAD_DLL_DEBUG_EVENT
|| ctx.ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT || ctx.ev.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT);
- ok(ctx.ev.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
ret = ContinueDebugEvent(ctx.ev.dwProcessId, ctx.ev.dwThreadId, DBG_CONTINUE);
- ok(ret, "ContinueDebugEvent failed, last error %d.\n", GetLastError());
+ ok(ret, "ContinueDebugEvent failed, last error %ld.\n", GetLastError());
if(debug_child)
- ok(ctx.process_cnt == 2, "didn't get any child events (flag: %x).\n", flag);
+ ok(ctx.process_cnt == 2, "didn't get any child events (flag: %lx).\n", flag);
else
- ok(ctx.process_cnt == 1, "got child event (flag: %x).\n", flag);
+ ok(ctx.process_cnt == 1, "got child event (flag: %lx).\n", flag);
CloseHandle(event_init);
CloseHandle(event_attach);
ret = CloseHandle(pi.hThread);
- ok(ret, "CloseHandle failed, last error %d.\n", GetLastError());
+ ok(ret, "CloseHandle failed, last error %ld.\n", GetLastError());
ret = CloseHandle(pi.hProcess);
- ok(ret, "CloseHandle failed, last error %d.\n", GetLastError());
+ ok(ret, "CloseHandle failed, last error %ld.\n", GetLastError());
load_blackbox(blackbox_file, &blackbox, sizeof(blackbox));
- ok(!blackbox.failures, "Got %d failures from child process.\n", blackbox.failures);
+ ok(!blackbox.failures, "Got %ld failures from child process.\n", blackbox.failures);
ret = DeleteFileA(blackbox_file);
- ok(ret, "DeleteFileA failed, last error %d.\n", GetLastError());
+ ok(ret, "DeleteFileA failed, last error %ld.\n", GetLastError());
}
static void wait_debugger(HANDLE event, unsigned int cnt)
@@ -1274,7 +1275,7 @@ static void wait_debugger(HANDLE event, unsigned int cnt)
static void expect_event_(unsigned line, struct debugger_context *ctx, DWORD event_code)
{
next_event(ctx, WAIT_EVENT_TIMEOUT);
- ok_(__FILE__,line)(ctx->ev.dwDebugEventCode == event_code, "dwDebugEventCode = %d expected %d\n",
+ ok_(__FILE__,line)(ctx->ev.dwDebugEventCode == event_code, "dwDebugEventCode = %ld expected %ld\n",
ctx->ev.dwDebugEventCode, event_code);
}
@@ -1282,7 +1283,7 @@ static void expect_event_(unsigned line, struct debugger_context *ctx, DWORD eve
static void expect_exception_(unsigned line, struct debugger_context *ctx, DWORD exception_code)
{
expect_event_(line, ctx, EXCEPTION_DEBUG_EVENT);
- ok_(__FILE__,line)(ctx->ev.u.Exception.ExceptionRecord.ExceptionCode == exception_code, "ExceptionCode = %x expected %x\n",
+ ok_(__FILE__,line)(ctx->ev.u.Exception.ExceptionRecord.ExceptionCode == exception_code, "ExceptionCode = %lx expected %lx\n",
ctx->ev.u.Exception.ExceptionRecord.ExceptionCode, exception_code);
}
@@ -1313,7 +1314,7 @@ static void single_step_(unsigned line, struct debugger_context *ctx, struct deb
fetch_thread_context(thread);
ok_(__FILE__,line)(get_ip(&thread->ctx) == expect_addr, "unexpected instruction pointer %p expected %p\n",
get_ip(&thread->ctx), expect_addr);
- ok_(__FILE__,line)(!(thread->ctx.EFlags & 0x100), "EFlags = %x\n", thread->ctx.EFlags);
+ ok_(__FILE__,line)(!(thread->ctx.EFlags & 0x100), "EFlags = %lx\n", thread->ctx.EFlags);
#endif
}
@@ -1393,19 +1394,19 @@ static void test_debugger(const char *argv0)
BOOL ret;
event = CreateEventW(&sa, FALSE, FALSE, NULL);
- ok(event != NULL, "CreateEvent failed: %u\n", GetLastError());
+ ok(event != NULL, "CreateEvent failed: %lu\n", GetLastError());
cmd = heap_alloc(strlen(argv0) + strlen(arguments) + 16);
- sprintf(cmd, "%s%s%x %u\n", argv0, arguments, (DWORD)(DWORD_PTR)event, OP_BP ? 3 : 1);
+ sprintf(cmd, "%s%s%lx %u\n", argv0, arguments, (DWORD)(DWORD_PTR)event, OP_BP ? 3 : 1);
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
ret = CreateProcessA(NULL, cmd, NULL, NULL, TRUE, DEBUG_PROCESS, NULL, NULL, &si, &pi);
- ok(ret, "CreateProcess failed, last error %#x.\n", GetLastError());
+ ok(ret, "CreateProcess failed, last error %#lx.\n", GetLastError());
heap_free(cmd);
next_event(&ctx, WAIT_EVENT_TIMEOUT);
- ok(ctx.ev.dwDebugEventCode == CREATE_PROCESS_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.dwDebugEventCode == CREATE_PROCESS_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
if ((skip_reply_later = !ContinueDebugEvent(ctx.ev.dwProcessId, ctx.ev.dwThreadId, DBG_REPLY_LATER)))
win_skip("Skipping unsupported DBG_REPLY_LATER tests\n");
@@ -1417,49 +1418,49 @@ static void test_debugger(const char *argv0)
ctx.ev.dwDebugEventCode = -1;
next_event(&ctx, WAIT_EVENT_TIMEOUT);
ok(de.dwDebugEventCode == ctx.ev.dwDebugEventCode,
- "dwDebugEventCode differs: %x (was %x)\n", ctx.ev.dwDebugEventCode, de.dwDebugEventCode);
+ "dwDebugEventCode differs: %lx (was %lx)\n", ctx.ev.dwDebugEventCode, de.dwDebugEventCode);
ok(de.dwProcessId == ctx.ev.dwProcessId,
- "dwProcessId differs: %x (was %x)\n", ctx.ev.dwProcessId, de.dwProcessId);
+ "dwProcessId differs: %lx (was %lx)\n", ctx.ev.dwProcessId, de.dwProcessId);
ok(de.dwThreadId == ctx.ev.dwThreadId,
- "dwThreadId differs: %x (was %x)\n", ctx.ev.dwThreadId, de.dwThreadId);
+ "dwThreadId differs: %lx (was %lx)\n", ctx.ev.dwThreadId, de.dwThreadId);
/* Suspending the thread should prevent other attach debug events
* to be received until it's resumed */
thread = OpenThread(THREAD_SUSPEND_RESUME, FALSE, ctx.ev.dwThreadId);
- ok(thread != INVALID_HANDLE_VALUE, "OpenThread failed, last error:%u\n", GetLastError());
+ ok(thread != INVALID_HANDLE_VALUE, "OpenThread failed, last error:%lu\n", GetLastError());
status = NtSuspendThread(thread, NULL);
- ok(!status, "NtSuspendThread failed, last error:%u\n", GetLastError());
+ ok(!status, "NtSuspendThread failed, last error:%lu\n", GetLastError());
ret = ContinueDebugEvent(ctx.ev.dwProcessId, ctx.ev.dwThreadId, DBG_REPLY_LATER);
- ok(ret, "ContinueDebugEvent failed, last error:%u\n", GetLastError());
+ ok(ret, "ContinueDebugEvent failed, last error:%lu\n", GetLastError());
ok(!WaitForDebugEvent(&ctx.ev, POLL_EVENT_TIMEOUT), "WaitForDebugEvent succeeded.\n");
status = NtResumeThread(thread, NULL);
- ok(!status, "NtResumeThread failed, last error:%u\n", GetLastError());
+ ok(!status, "NtResumeThread failed, last error:%lu\n", GetLastError());
ret = CloseHandle(thread);
- ok(ret, "CloseHandle failed, last error %d.\n", GetLastError());
+ ok(ret, "CloseHandle failed, last error %ld.\n", GetLastError());
ok(WaitForDebugEvent(&ctx.ev, POLL_EVENT_TIMEOUT), "WaitForDebugEvent failed.\n");
ok(de.dwDebugEventCode == ctx.ev.dwDebugEventCode,
- "dwDebugEventCode differs: %x (was %x)\n", ctx.ev.dwDebugEventCode, de.dwDebugEventCode);
+ "dwDebugEventCode differs: %lx (was %lx)\n", ctx.ev.dwDebugEventCode, de.dwDebugEventCode);
next_event(&ctx, WAIT_EVENT_TIMEOUT);
- ok(ctx.ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
de = ctx.ev;
ret = ContinueDebugEvent(ctx.ev.dwProcessId, ctx.ev.dwThreadId, DBG_REPLY_LATER);
- ok(ret, "ContinueDebugEvent failed, last error:%u\n", GetLastError());
+ ok(ret, "ContinueDebugEvent failed, last error:%lu\n", GetLastError());
ctx.ev.dwDebugEventCode = -1;
next_event(&ctx, WAIT_EVENT_TIMEOUT);
ok(de.dwDebugEventCode == ctx.ev.dwDebugEventCode,
- "dwDebugEventCode differs: %x (was %x)\n", ctx.ev.dwDebugEventCode, de.dwDebugEventCode);
+ "dwDebugEventCode differs: %lx (was %lx)\n", ctx.ev.dwDebugEventCode, de.dwDebugEventCode);
ok(de.dwProcessId == ctx.ev.dwProcessId,
- "dwProcessId differs: %x (was %x)\n", ctx.ev.dwProcessId, de.dwProcessId);
+ "dwProcessId differs: %lx (was %lx)\n", ctx.ev.dwProcessId, de.dwProcessId);
ok(de.dwThreadId == ctx.ev.dwThreadId,
- "dwThreadId differs: %x (was %x)\n", ctx.ev.dwThreadId, de.dwThreadId);
+ "dwThreadId differs: %lx (was %lx)\n", ctx.ev.dwThreadId, de.dwThreadId);
}
wait_for_breakpoint(&ctx);
@@ -1467,7 +1468,7 @@ static void test_debugger(const char *argv0)
while(ctx.ev.dwDebugEventCode != -1);
mem = VirtualAllocEx(pi.hProcess, NULL, sizeof(buf), MEM_COMMIT, PAGE_EXECUTE_READWRITE);
- ok(mem != NULL, "VirtualAllocEx failed: %u\n", GetLastError());
+ ok(mem != NULL, "VirtualAllocEx failed: %lu\n", GetLastError());
proc_code = buf + 1024;
thread_proc = mem + 1024;
@@ -1478,10 +1479,10 @@ static void test_debugger(const char *argv0)
memcpy(proc_code, &loop_code, sizeof(loop_code));
proc_code[0] = OP_BP; /* set a breakpoint */
ret = WriteProcessMemory(pi.hProcess, mem, buf, sizeof(buf), NULL);
- ok(ret, "WriteProcessMemory failed: %u\n", GetLastError());
+ ok(ret, "WriteProcessMemory failed: %lu\n", GetLastError());
thread = CreateRemoteThread(pi.hProcess, NULL, 0, (void*)thread_proc, NULL, 0, NULL);
- ok(thread != NULL, "CreateRemoteThread failed: %u\n", GetLastError());
+ ok(thread != NULL, "CreateRemoteThread failed: %lu\n", GetLastError());
expect_event(&ctx, CREATE_THREAD_DEBUG_EVENT);
debuggee_thread = get_debuggee_thread(&ctx, ctx.ev.dwThreadId);
@@ -1499,7 +1500,7 @@ static void test_debugger(const char *argv0)
byte = 0xc3; /* ret */
ret = WriteProcessMemory(pi.hProcess, thread_proc, &byte, 1, NULL);
- ok(ret, "WriteProcessMemory failed: %u\n", GetLastError());
+ ok(ret, "WriteProcessMemory failed: %lu\n", GetLastError());
expect_event(&ctx, EXIT_THREAD_DEBUG_EVENT);
}
@@ -1511,23 +1512,23 @@ static void test_debugger(const char *argv0)
memset(buf, OP_BP, sizeof(buf));
memcpy(proc_code, call_debug_service_code, sizeof(call_debug_service_code));
ret = WriteProcessMemory(pi.hProcess, mem, buf, sizeof(buf), NULL);
- ok(ret, "WriteProcessMemory failed: %u\n", GetLastError());
+ ok(ret, "WriteProcessMemory failed: %lu\n", GetLastError());
/* BREAKPOINT_PRINT */
thread = CreateRemoteThread(pi.hProcess, NULL, 0, (void*)thread_proc, (void*)2, 0, NULL);
- ok(thread != NULL, "CreateRemoteThread failed: %u\n", GetLastError());
+ ok(thread != NULL, "CreateRemoteThread failed: %lu\n", GetLastError());
expect_event(&ctx, CREATE_THREAD_DEBUG_EVENT);
expect_breakpoint_exception(&ctx, NULL);
expect_event(&ctx, EXIT_THREAD_DEBUG_EVENT);
/* BREAKPOINT_PROMPT */
thread = CreateRemoteThread(pi.hProcess, NULL, 0, (void*)thread_proc, (void*)1, 0, NULL);
- ok(thread != NULL, "CreateRemoteThread failed: %u\n", GetLastError());
+ ok(thread != NULL, "CreateRemoteThread failed: %lu\n", GetLastError());
expect_event(&ctx, CREATE_THREAD_DEBUG_EVENT);
next_event(&ctx, WAIT_EVENT_TIMEOUT);
/* some 32-bit Windows versions report exception to the debugger */
if (sizeof(void *) == 4 && ctx.ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT) next_event(&ctx, WAIT_EVENT_TIMEOUT);
- ok(ctx.ev.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT, "unexpected debug event %u\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT, "unexpected debug event %lu\n", ctx.ev.dwDebugEventCode);
}
else win_skip("call_debug_service_code not supported on this architecture\n");
@@ -1541,64 +1542,64 @@ static void test_debugger(const char *argv0)
memset(buf, OP_BP, sizeof(buf));
memcpy(proc_code, &loop_code, sizeof(loop_code));
ret = WriteProcessMemory(pi.hProcess, mem, buf, sizeof(buf), NULL);
- ok(ret, "WriteProcessMemory failed: %u\n", GetLastError());
+ ok(ret, "WriteProcessMemory failed: %lu\n", GetLastError());
byte = OP_BP;
ret = WriteProcessMemory(pi.hProcess, thread_proc + 1, &byte, 1, NULL);
- ok(ret, "WriteProcessMemory failed: %u\n", GetLastError());
+ ok(ret, "WriteProcessMemory failed: %lu\n", GetLastError());
thread_a = CreateRemoteThread(pi.hProcess, NULL, 0, (void*)thread_proc, NULL, 0, NULL);
- ok(thread_a != NULL, "CreateRemoteThread failed: %u\n", GetLastError());
+ ok(thread_a != NULL, "CreateRemoteThread failed: %lu\n", GetLastError());
next_event(&ctx, WAIT_EVENT_TIMEOUT);
- ok(ctx.ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
de_a = ctx.ev;
thread_b = CreateRemoteThread(pi.hProcess, NULL, 0, (void*)thread_proc, NULL, 0, NULL);
- ok(thread_b != NULL, "CreateRemoteThread failed: %u\n", GetLastError());
+ ok(thread_b != NULL, "CreateRemoteThread failed: %lu\n", GetLastError());
do next_event(&ctx, POLL_EVENT_TIMEOUT);
while(ctx.ev.dwDebugEventCode != CREATE_THREAD_DEBUG_EVENT);
de_b = ctx.ev;
status = NtSuspendThread(thread_b, NULL);
- ok(!status, "NtSuspendThread failed, last error:%u\n", GetLastError());
+ ok(!status, "NtSuspendThread failed, last error:%lu\n", GetLastError());
ret = ContinueDebugEvent(ctx.ev.dwProcessId, ctx.ev.dwThreadId, DBG_REPLY_LATER);
- ok(ret, "ContinueDebugEvent failed, last error:%u\n", GetLastError());
+ ok(ret, "ContinueDebugEvent failed, last error:%lu\n", GetLastError());
ctx.ev.dwDebugEventCode = -1;
next_event(&ctx, WAIT_EVENT_TIMEOUT);
ok(ctx.ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT,
- "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
ok(de_a.dwProcessId == ctx.ev.dwProcessId,
- "dwProcessId differs: %x (was %x)\n", ctx.ev.dwProcessId, de_a.dwProcessId);
+ "dwProcessId differs: %lx (was %lx)\n", ctx.ev.dwProcessId, de_a.dwProcessId);
ok(de_a.dwThreadId == ctx.ev.dwThreadId,
- "dwThreadId differs: %x (was %x)\n", ctx.ev.dwThreadId, de_a.dwThreadId);
+ "dwThreadId differs: %lx (was %lx)\n", ctx.ev.dwThreadId, de_a.dwThreadId);
de_a = ctx.ev;
byte = 0xc3; /* ret */
ret = WriteProcessMemory(pi.hProcess, thread_proc + 1, &byte, 1, NULL);
- ok(ret, "WriteProcessMemory failed: %u\n", GetLastError());
+ ok(ret, "WriteProcessMemory failed: %lu\n", GetLastError());
ok(pNtSuspendProcess != NULL, "NtSuspendProcess not found\n");
ok(pNtResumeProcess != NULL, "pNtResumeProcess not found\n");
if (pNtSuspendProcess && pNtResumeProcess)
{
status = pNtSuspendProcess(pi.hProcess);
- ok(!status, "NtSuspendProcess failed, last error:%u\n", GetLastError());
+ ok(!status, "NtSuspendProcess failed, last error:%lu\n", GetLastError());
ret = ContinueDebugEvent(ctx.ev.dwProcessId, ctx.ev.dwThreadId, DBG_REPLY_LATER);
- ok(ret, "ContinueDebugEvent failed, last error:%u\n", GetLastError());
+ ok(ret, "ContinueDebugEvent failed, last error:%lu\n", GetLastError());
ok(!WaitForDebugEvent(&ctx.ev, POLL_EVENT_TIMEOUT), "WaitForDebugEvent succeeded.\n");
status = NtResumeThread(thread_b, NULL);
- ok(!status, "NtResumeThread failed, last error:%u\n", GetLastError());
+ ok(!status, "NtResumeThread failed, last error:%lu\n", GetLastError());
ok(!WaitForDebugEvent(&ctx.ev, POLL_EVENT_TIMEOUT), "WaitForDebugEvent succeeded.\n");
status = pNtResumeProcess(pi.hProcess);
- ok(!status, "pNtResumeProcess failed, last error:%u\n", GetLastError());
+ ok(!status, "pNtResumeProcess failed, last error:%lu\n", GetLastError());
}
else
{
status = NtResumeThread(thread_b, NULL);
- ok(!status, "NtResumeThread failed, last error:%u\n", GetLastError());
+ ok(!status, "NtResumeThread failed, last error:%lu\n", GetLastError());
ok(!WaitForDebugEvent(&ctx.ev, POLL_EVENT_TIMEOUT), "WaitForDebugEvent succeeded.\n");
}
@@ -1622,74 +1623,74 @@ static void test_debugger(const char *argv0)
if (ctx.ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT)
{
ok(de_a.dwDebugEventCode == ctx.ev.dwDebugEventCode,
- "dwDebugEventCode differs: %x (was %x)\n", ctx.ev.dwDebugEventCode, de_a.dwDebugEventCode);
+ "dwDebugEventCode differs: %lx (was %lx)\n", ctx.ev.dwDebugEventCode, de_a.dwDebugEventCode);
ok(de_a.dwProcessId == ctx.ev.dwProcessId,
- "dwProcessId differs: %x (was %x)\n", ctx.ev.dwProcessId, de_a.dwProcessId);
+ "dwProcessId differs: %lx (was %lx)\n", ctx.ev.dwProcessId, de_a.dwProcessId);
ok(de_a.dwThreadId == ctx.ev.dwThreadId,
- "dwThreadId differs: %x (was %x)\n", ctx.ev.dwThreadId, de_a.dwThreadId);
+ "dwThreadId differs: %lx (was %lx)\n", ctx.ev.dwThreadId, de_a.dwThreadId);
next_event(&ctx, POLL_EVENT_TIMEOUT);
if (ctx.ev.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT)
{
ok(de_a.dwProcessId == ctx.ev.dwProcessId,
- "dwProcessId differs: %x (was %x)\n", ctx.ev.dwProcessId, de_a.dwProcessId);
+ "dwProcessId differs: %lx (was %lx)\n", ctx.ev.dwProcessId, de_a.dwProcessId);
ok(de_a.dwThreadId == ctx.ev.dwThreadId,
- "dwThreadId differs: %x (was %x)\n", ctx.ev.dwThreadId, de_a.dwThreadId);
+ "dwThreadId differs: %lx (was %lx)\n", ctx.ev.dwThreadId, de_a.dwThreadId);
ret = CloseHandle(thread_a);
- ok(ret, "CloseHandle failed, last error %d.\n", GetLastError());
+ ok(ret, "CloseHandle failed, last error %ld.\n", GetLastError());
thread_a = NULL;
next_event(&ctx, POLL_EVENT_TIMEOUT);
}
ok(de_b.dwDebugEventCode == ctx.ev.dwDebugEventCode,
- "dwDebugEventCode differs: %x (was %x)\n", ctx.ev.dwDebugEventCode, de_b.dwDebugEventCode);
+ "dwDebugEventCode differs: %lx (was %lx)\n", ctx.ev.dwDebugEventCode, de_b.dwDebugEventCode);
ok(de_b.dwProcessId == ctx.ev.dwProcessId,
- "dwProcessId differs: %x (was %x)\n", ctx.ev.dwProcessId, de_b.dwProcessId);
+ "dwProcessId differs: %lx (was %lx)\n", ctx.ev.dwProcessId, de_b.dwProcessId);
ok(de_b.dwThreadId == ctx.ev.dwThreadId,
- "dwThreadId differs: %x (was %x)\n", ctx.ev.dwThreadId, de_b.dwThreadId);
+ "dwThreadId differs: %lx (was %lx)\n", ctx.ev.dwThreadId, de_b.dwThreadId);
}
else
{
ok(de_b.dwDebugEventCode == ctx.ev.dwDebugEventCode,
- "dwDebugEventCode differs: %x (was %x)\n", ctx.ev.dwDebugEventCode, de_b.dwDebugEventCode);
+ "dwDebugEventCode differs: %lx (was %lx)\n", ctx.ev.dwDebugEventCode, de_b.dwDebugEventCode);
ok(de_b.dwProcessId == ctx.ev.dwProcessId,
- "dwProcessId differs: %x (was %x)\n", ctx.ev.dwProcessId, de_b.dwProcessId);
+ "dwProcessId differs: %lx (was %lx)\n", ctx.ev.dwProcessId, de_b.dwProcessId);
ok(de_b.dwThreadId == ctx.ev.dwThreadId,
- "dwThreadId differs: %x (was %x)\n", ctx.ev.dwThreadId, de_b.dwThreadId);
+ "dwThreadId differs: %lx (was %lx)\n", ctx.ev.dwThreadId, de_b.dwThreadId);
next_event(&ctx, POLL_EVENT_TIMEOUT);
if (ctx.ev.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT)
{
ok(de_b.dwProcessId == ctx.ev.dwProcessId,
- "dwProcessId differs: %x (was %x)\n", ctx.ev.dwProcessId, de_b.dwProcessId);
+ "dwProcessId differs: %lx (was %lx)\n", ctx.ev.dwProcessId, de_b.dwProcessId);
ok(de_b.dwThreadId == ctx.ev.dwThreadId,
- "dwThreadId differs: %x (was %x)\n", ctx.ev.dwThreadId, de_b.dwThreadId);
+ "dwThreadId differs: %lx (was %lx)\n", ctx.ev.dwThreadId, de_b.dwThreadId);
ret = CloseHandle(thread_b);
- ok(ret, "CloseHandle failed, last error %d.\n", GetLastError());
+ ok(ret, "CloseHandle failed, last error %ld.\n", GetLastError());
thread_b = NULL;
next_event(&ctx, POLL_EVENT_TIMEOUT);
}
ok(de_a.dwDebugEventCode == ctx.ev.dwDebugEventCode,
- "dwDebugEventCode differs: %x (was %x)\n", ctx.ev.dwDebugEventCode, de_a.dwDebugEventCode);
+ "dwDebugEventCode differs: %lx (was %lx)\n", ctx.ev.dwDebugEventCode, de_a.dwDebugEventCode);
ok(de_a.dwProcessId == ctx.ev.dwProcessId,
- "dwProcessId differs: %x (was %x)\n", ctx.ev.dwProcessId, de_a.dwProcessId);
+ "dwProcessId differs: %lx (was %lx)\n", ctx.ev.dwProcessId, de_a.dwProcessId);
ok(de_a.dwThreadId == ctx.ev.dwThreadId,
- "dwThreadId differs: %x (was %x)\n", ctx.ev.dwThreadId, de_a.dwThreadId);
+ "dwThreadId differs: %lx (was %lx)\n", ctx.ev.dwThreadId, de_a.dwThreadId);
}
if (thread_a)
{
next_event(&ctx, POLL_EVENT_TIMEOUT);
ok(ctx.ev.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT,
- "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
ret = CloseHandle(thread_a);
- ok(ret, "CloseHandle failed, last error %d.\n", GetLastError());
+ ok(ret, "CloseHandle failed, last error %ld.\n", GetLastError());
}
@@ -1697,10 +1698,10 @@ static void test_debugger(const char *argv0)
{
next_event(&ctx, POLL_EVENT_TIMEOUT);
ok(ctx.ev.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT,
- "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
ret = CloseHandle(thread_b);
- ok(ret, "CloseHandle failed, last error %d.\n", GetLastError());
+ ok(ret, "CloseHandle failed, last error %ld.\n", GetLastError());
}
}
@@ -1711,7 +1712,7 @@ static void test_debugger(const char *argv0)
memset(buf, OP_BP, sizeof(buf));
memcpy(proc_code, &loop_code, sizeof(loop_code));
ret = WriteProcessMemory(pi.hProcess, mem, buf, sizeof(buf), NULL);
- ok(ret, "WriteProcessMemory failed: %u\n", GetLastError());
+ ok(ret, "WriteProcessMemory failed: %lu\n", GetLastError());
ctx.thread_tag = 1;
@@ -1719,18 +1720,18 @@ static void test_debugger(const char *argv0)
for (i = 0; i < worker_cnt; i++)
{
thread = CreateRemoteThread(pi.hProcess, NULL, 0, (void*)thread_proc, NULL, 0, NULL);
- ok(thread != NULL, "CreateRemoteThread failed: %u\n", GetLastError());
+ ok(thread != NULL, "CreateRemoteThread failed: %lu\n", GetLastError());
next_event(&ctx, WAIT_EVENT_TIMEOUT);
- ok(ctx.ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
ret = CloseHandle(thread);
- ok(ret, "CloseHandle failed, last error %d.\n", GetLastError());
+ ok(ret, "CloseHandle failed, last error %ld.\n", GetLastError());
}
byte = OP_BP;
ret = WriteProcessMemory(pi.hProcess, thread_proc + 1, &byte, 1, NULL);
- ok(ret, "WriteProcessMemory failed: %u\n", GetLastError());
+ ok(ret, "WriteProcessMemory failed: %lu\n", GetLastError());
expect_breakpoint_exception(&ctx, thread_proc + 1);
exception_cnt = 1;
@@ -1740,7 +1741,7 @@ static void test_debugger(const char *argv0)
byte = 0xc3; /* ret */
ret = WriteProcessMemory(pi.hProcess, thread_proc + 1, &byte, 1, NULL);
- ok(ret, "WriteProcessMemory failed: %u\n", GetLastError());
+ ok(ret, "WriteProcessMemory failed: %lu\n", GetLastError());
for (;;)
{
@@ -1748,12 +1749,12 @@ static void test_debugger(const char *argv0)
/* even when there are more pending events, they are not reported until current event is continued */
ret = WaitForDebugEvent(&ev, 10);
- ok(GetLastError() == ERROR_SEM_TIMEOUT, "WaitForDebugEvent returned %x(%u)\n", ret, GetLastError());
+ ok(GetLastError() == ERROR_SEM_TIMEOUT, "WaitForDebugEvent returned %x(%lu)\n", ret, GetLastError());
next_event(&ctx, POLL_EVENT_TIMEOUT);
if (ctx.ev.dwDebugEventCode != EXCEPTION_DEBUG_EVENT) break;
- trace("exception at %p in thread %04x\n", ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress, ctx.ev.dwThreadId);
- ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %x\n",
+ trace("exception at %p in thread %04lx\n", ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress, ctx.ev.dwThreadId);
+ ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %lx\n",
ctx.ev.u.Exception.ExceptionRecord.ExceptionCode);
ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress == thread_proc + 1,
"ExceptionAddress = %p\n", ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress);
@@ -1775,7 +1776,7 @@ static void test_debugger(const char *argv0)
{
ok(ctx.ev.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT
|| broken(ctx.ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT), /* sometimes happens on vista */
- "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
+ "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
if (ctx.ev.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT && !--worker_cnt) break;
next_event(&ctx, WAIT_EVENT_TIMEOUT);
}
@@ -1792,7 +1793,7 @@ static void test_debugger(const char *argv0)
fetch_thread_context(ctx.main_thread);
ret = ReadProcessMemory(pi.hProcess, get_ip(&ctx.main_thread->ctx), &instr, 1, NULL);
- ok(ret, "ReadProcessMemory failed: %u\n", GetLastError());
+ ok(ret, "ReadProcessMemory failed: %lu\n", GetLastError());
orig_context = ctx.main_thread->ctx;
ip = get_ip(&ctx.main_thread->ctx);
@@ -1825,36 +1826,36 @@ static void test_debugger(const char *argv0)
fetch_thread_context(ctx.main_thread);
#if defined(__i386__)
/* win2k8 do not preserve eax, rcx and edx; newer versions do */
- ok(ctx.main_thread->ctx.Ebx == 102, "Ebx = %x\n", ctx.main_thread->ctx.Ebx);
- ok(ctx.main_thread->ctx.Esi == 105, "Esi = %x\n", ctx.main_thread->ctx.Esi);
- ok(ctx.main_thread->ctx.Edi == 106, "Edi = %x\n", ctx.main_thread->ctx.Edi);
+ ok(ctx.main_thread->ctx.Ebx == 102, "Ebx = %lx\n", ctx.main_thread->ctx.Ebx);
+ ok(ctx.main_thread->ctx.Esi == 105, "Esi = %lx\n", ctx.main_thread->ctx.Esi);
+ ok(ctx.main_thread->ctx.Edi == 106, "Edi = %lx\n", ctx.main_thread->ctx.Edi);
#elif defined(__x86_64__)
- ok(ctx.main_thread->ctx.Rax == 101, "Rax = %x\n", ctx.main_thread->ctx.Rax);
- ok(ctx.main_thread->ctx.Rbx == 102, "Rbx = %x\n", ctx.main_thread->ctx.Rbx);
- ok(ctx.main_thread->ctx.Rcx == 103, "Rcx = %x\n", ctx.main_thread->ctx.Rcx);
- ok(ctx.main_thread->ctx.Rdx == 104, "Rdx = %x\n", ctx.main_thread->ctx.Rdx);
- ok(ctx.main_thread->ctx.Rsi == 105, "Rsi = %x\n", ctx.main_thread->ctx.Rsi);
- ok(ctx.main_thread->ctx.Rdi == 106, "Rdi = %x\n", ctx.main_thread->ctx.Rdi);
- ok(ctx.main_thread->ctx.R8 == 107, "R8 = %x\n", ctx.main_thread->ctx.R8);
- ok(ctx.main_thread->ctx.R9 == 108, "R9 = %x\n", ctx.main_thread->ctx.R9);
- ok(ctx.main_thread->ctx.R10 == 109, "R10 = %x\n", ctx.main_thread->ctx.R10);
- ok(ctx.main_thread->ctx.R11 == 110, "R11 = %x\n", ctx.main_thread->ctx.R11);
- ok(ctx.main_thread->ctx.R12 == 111, "R12 = %x\n", ctx.main_thread->ctx.R12);
- ok(ctx.main_thread->ctx.R13 == 112, "R13 = %x\n", ctx.main_thread->ctx.R13);
- ok(ctx.main_thread->ctx.R14 == 113, "R14 = %x\n", ctx.main_thread->ctx.R14);
- ok(ctx.main_thread->ctx.R15 == 114, "R15 = %x\n", ctx.main_thread->ctx.R15);
+ ok(ctx.main_thread->ctx.Rax == 101, "Rax = %llx\n", ctx.main_thread->ctx.Rax);
+ ok(ctx.main_thread->ctx.Rbx == 102, "Rbx = %llx\n", ctx.main_thread->ctx.Rbx);
+ ok(ctx.main_thread->ctx.Rcx == 103, "Rcx = %llx\n", ctx.main_thread->ctx.Rcx);
+ ok(ctx.main_thread->ctx.Rdx == 104, "Rdx = %llx\n", ctx.main_thread->ctx.Rdx);
+ ok(ctx.main_thread->ctx.Rsi == 105, "Rsi = %llx\n", ctx.main_thread->ctx.Rsi);
+ ok(ctx.main_thread->ctx.Rdi == 106, "Rdi = %llx\n", ctx.main_thread->ctx.Rdi);
+ ok(ctx.main_thread->ctx.R8 == 107, "R8 = %llx\n", ctx.main_thread->ctx.R8);
+ ok(ctx.main_thread->ctx.R9 == 108, "R9 = %llx\n", ctx.main_thread->ctx.R9);
+ ok(ctx.main_thread->ctx.R10 == 109, "R10 = %llx\n", ctx.main_thread->ctx.R10);
+ ok(ctx.main_thread->ctx.R11 == 110, "R11 = %llx\n", ctx.main_thread->ctx.R11);
+ ok(ctx.main_thread->ctx.R12 == 111, "R12 = %llx\n", ctx.main_thread->ctx.R12);
+ ok(ctx.main_thread->ctx.R13 == 112, "R13 = %llx\n", ctx.main_thread->ctx.R13);
+ ok(ctx.main_thread->ctx.R14 == 113, "R14 = %llx\n", ctx.main_thread->ctx.R14);
+ ok(ctx.main_thread->ctx.R15 == 114, "R15 = %llx\n", ctx.main_thread->ctx.R15);
#endif
byte = OP_BP;
ret = WriteProcessMemory(pi.hProcess, ip, &byte, 1, NULL);
- ok(ret, "WriteProcessMemory failed: %u\n", GetLastError());
+ ok(ret, "WriteProcessMemory failed: %lu\n", GetLastError());
SetEvent(event);
ResumeThread(ctx.main_thread->handle);
next_event(&ctx, 2000);
- ok(ctx.ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
- ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %x\n",
+ ok(ctx.ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %lx\n",
ctx.ev.u.Exception.ExceptionRecord.ExceptionCode);
ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress == ip,
"ExceptionAddress = %p\n", ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress);
@@ -1863,27 +1864,27 @@ static void test_debugger(const char *argv0)
ok(get_ip(&ctx.main_thread->ctx) == ip + 1, "unexpected instruction pointer %p\n", get_ip(&ctx.main_thread->ctx));
#if defined(__i386__)
- ok(ctx.main_thread->ctx.Eax == 0, "Eax = %x\n", ctx.main_thread->ctx.Eax);
- ok(ctx.main_thread->ctx.Ebx == 102, "Ebx = %x\n", ctx.main_thread->ctx.Ebx);
- ok(ctx.main_thread->ctx.Ecx != 103, "Ecx = %x\n", ctx.main_thread->ctx.Ecx);
- ok(ctx.main_thread->ctx.Edx != 104, "Edx = %x\n", ctx.main_thread->ctx.Edx);
- ok(ctx.main_thread->ctx.Esi == 105, "Esi = %x\n", ctx.main_thread->ctx.Esi);
- ok(ctx.main_thread->ctx.Edi == 106, "Edi = %x\n", ctx.main_thread->ctx.Edi);
+ ok(ctx.main_thread->ctx.Eax == 0, "Eax = %lx\n", ctx.main_thread->ctx.Eax);
+ ok(ctx.main_thread->ctx.Ebx == 102, "Ebx = %lx\n", ctx.main_thread->ctx.Ebx);
+ ok(ctx.main_thread->ctx.Ecx != 103, "Ecx = %lx\n", ctx.main_thread->ctx.Ecx);
+ ok(ctx.main_thread->ctx.Edx != 104, "Edx = %lx\n", ctx.main_thread->ctx.Edx);
+ ok(ctx.main_thread->ctx.Esi == 105, "Esi = %lx\n", ctx.main_thread->ctx.Esi);
+ ok(ctx.main_thread->ctx.Edi == 106, "Edi = %lx\n", ctx.main_thread->ctx.Edi);
#elif defined(__x86_64__)
- ok(ctx.main_thread->ctx.Rax == 0, "Rax = %x\n", ctx.main_thread->ctx.Rax);
- ok(ctx.main_thread->ctx.Rbx == 102, "Rbx = %x\n", ctx.main_thread->ctx.Rbx);
- ok(ctx.main_thread->ctx.Rcx != 103, "Rcx = %x\n", ctx.main_thread->ctx.Rcx);
- ok(ctx.main_thread->ctx.Rdx != 104, "Rdx = %x\n", ctx.main_thread->ctx.Rdx);
- ok(ctx.main_thread->ctx.Rsi == 105, "Rsi = %x\n", ctx.main_thread->ctx.Rsi);
- ok(ctx.main_thread->ctx.Rdi == 106, "Rdi = %x\n", ctx.main_thread->ctx.Rdi);
- ok(ctx.main_thread->ctx.R8 != 107, "R8 = %x\n", ctx.main_thread->ctx.R8);
- ok(ctx.main_thread->ctx.R9 != 108, "R9 = %x\n", ctx.main_thread->ctx.R9);
- ok(ctx.main_thread->ctx.R10 != 109, "R10 = %x\n", ctx.main_thread->ctx.R10);
- ok(ctx.main_thread->ctx.R11 != 110, "R11 = %x\n", ctx.main_thread->ctx.R11);
- ok(ctx.main_thread->ctx.R12 == 111, "R12 = %x\n", ctx.main_thread->ctx.R12);
- ok(ctx.main_thread->ctx.R13 == 112, "R13 = %x\n", ctx.main_thread->ctx.R13);
- ok(ctx.main_thread->ctx.R14 == 113, "R14 = %x\n", ctx.main_thread->ctx.R14);
- ok(ctx.main_thread->ctx.R15 == 114, "R15 = %x\n", ctx.main_thread->ctx.R15);
+ ok(ctx.main_thread->ctx.Rax == 0, "Rax = %llx\n", ctx.main_thread->ctx.Rax);
+ ok(ctx.main_thread->ctx.Rbx == 102, "Rbx = %llx\n", ctx.main_thread->ctx.Rbx);
+ ok(ctx.main_thread->ctx.Rcx != 103, "Rcx = %llx\n", ctx.main_thread->ctx.Rcx);
+ ok(ctx.main_thread->ctx.Rdx != 104, "Rdx = %llx\n", ctx.main_thread->ctx.Rdx);
+ ok(ctx.main_thread->ctx.Rsi == 105, "Rsi = %llx\n", ctx.main_thread->ctx.Rsi);
+ ok(ctx.main_thread->ctx.Rdi == 106, "Rdi = %llx\n", ctx.main_thread->ctx.Rdi);
+ ok(ctx.main_thread->ctx.R8 != 107, "R8 = %llx\n", ctx.main_thread->ctx.R8);
+ ok(ctx.main_thread->ctx.R9 != 108, "R9 = %llx\n", ctx.main_thread->ctx.R9);
+ ok(ctx.main_thread->ctx.R10 != 109, "R10 = %llx\n", ctx.main_thread->ctx.R10);
+ ok(ctx.main_thread->ctx.R11 != 110, "R11 = %llx\n", ctx.main_thread->ctx.R11);
+ ok(ctx.main_thread->ctx.R12 == 111, "R12 = %llx\n", ctx.main_thread->ctx.R12);
+ ok(ctx.main_thread->ctx.R13 == 112, "R13 = %llx\n", ctx.main_thread->ctx.R13);
+ ok(ctx.main_thread->ctx.R14 == 113, "R14 = %llx\n", ctx.main_thread->ctx.R14);
+ ok(ctx.main_thread->ctx.R15 == 114, "R15 = %llx\n", ctx.main_thread->ctx.R15);
#endif
ctx.main_thread->ctx = orig_context;
@@ -1891,11 +1892,11 @@ static void test_debugger(const char *argv0)
set_thread_context(&ctx, ctx.main_thread);
ret = WriteProcessMemory(pi.hProcess, ip, &instr, 1, NULL);
- ok(ret, "WriteProcessMemory failed: %u\n", GetLastError());
+ ok(ret, "WriteProcessMemory failed: %lu\n", GetLastError());
memset(buf + 10, 0x90, 10); /* nop */
ret = WriteProcessMemory(pi.hProcess, mem + 10, buf + 10, 10, NULL);
- ok(ret, "WriteProcessMemory failed: %u\n", GetLastError());
+ ok(ret, "WriteProcessMemory failed: %lu\n", GetLastError());
next_event(&ctx, POLL_EVENT_TIMEOUT);
@@ -1918,8 +1919,8 @@ static void test_debugger(const char *argv0)
next_event(&ctx, WAIT_EVENT_TIMEOUT);
if (sizeof(void*) != 4 || ctx.ev.u.Exception.ExceptionRecord.ExceptionCode != EXCEPTION_BREAKPOINT)
{
- ok(ctx.ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx.ev.dwDebugEventCode);
- ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_SINGLE_STEP, "ExceptionCode = %x\n",
+ ok(ctx.ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %ld\n", ctx.ev.dwDebugEventCode);
+ ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_SINGLE_STEP, "ExceptionCode = %lx\n",
ctx.ev.u.Exception.ExceptionRecord.ExceptionCode);
ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress == mem + 10 ||
ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress == mem + 11,
@@ -1946,11 +1947,11 @@ static void test_debugger(const char *argv0)
while (ctx.ev.dwDebugEventCode != EXIT_PROCESS_DEBUG_EVENT);
ret = CloseHandle(event);
- ok(ret, "CloseHandle failed, last error %d.\n", GetLastError());
+ ok(ret, "CloseHandle failed, last error %ld.\n", GetLastError());
ret = CloseHandle(pi.hThread);
- ok(ret, "CloseHandle failed, last error %d.\n", GetLastError());
+ ok(ret, "CloseHandle failed, last error %ld.\n", GetLastError());
ret = CloseHandle(pi.hProcess);
- ok(ret, "CloseHandle failed, last error %d.\n", GetLastError());
+ ok(ret, "CloseHandle failed, last error %ld.\n", GetLastError());
}
static DWORD run_child_wait( char *cmd, HANDLE event )
@@ -1961,14 +1962,14 @@ static DWORD run_child_wait( char *cmd, HANDLE event )
DWORD exit_code;
ret = CreateProcessA(NULL, cmd, NULL, NULL, TRUE, DEBUG_PROCESS, NULL, NULL, &si, &pi);
- ok(ret, "CreateProcess failed, last error %#x.\n", GetLastError());
+ ok(ret, "CreateProcess failed, last error %#lx.\n", GetLastError());
Sleep(200);
CloseHandle( pDbgUiGetThreadDebugObject() );
pDbgUiSetThreadDebugObject( 0 );
SetEvent( event );
WaitForSingleObject( pi.hProcess, 1000 );
ret = GetExitCodeProcess( pi.hProcess, &exit_code );
- ok( ret, "GetExitCodeProcess failed err=%d\n", GetLastError());
+ ok( ret, "GetExitCodeProcess failed err=%ld\n", GetLastError());
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
return exit_code;
@@ -1986,11 +1987,11 @@ static DWORD WINAPI debug_and_exit(void *arg)
BOOL ret;
ret = CreateProcessA(NULL, cmd, NULL, NULL, TRUE, DEBUG_PROCESS, NULL, NULL, &si, &pi);
- ok(ret, "CreateProcess failed, last error %#x.\n", GetLastError());
+ ok(ret, "CreateProcess failed, last error %#lx.\n", GetLastError());
debug = pDbgUiGetThreadDebugObject();
status = pNtSetInformationDebugObject( debug, DebugObjectKillProcessOnExitInformation,
&val, sizeof(val), NULL );
- ok( !status, "NtSetInformationDebugObject failed %x\n", status );
+ ok( !status, "NtSetInformationDebugObject failed %lx\n", status );
*(HANDLE *)arg = debug;
Sleep(200);
ExitThread(0);
@@ -2006,11 +2007,11 @@ static DWORD WINAPI debug_and_wait(void *arg)
pDbgUiSetThreadDebugObject( debug );
ret = CreateProcessA(NULL, cmd, NULL, NULL, TRUE, DEBUG_PROCESS, NULL, NULL, &si, &pi);
- ok(ret, "CreateProcess failed, last error %#x.\n", GetLastError());
+ ok(ret, "CreateProcess failed, last error %#lx.\n", GetLastError());
debug = pDbgUiGetThreadDebugObject();
status = pNtSetInformationDebugObject( debug, DebugObjectKillProcessOnExitInformation,
&val, sizeof(val), NULL );
- ok( !status, "NtSetInformationDebugObject failed %x\n", status );
+ ok( !status, "NtSetInformationDebugObject failed %lx\n", status );
Sleep(INFINITE);
ExitThread(0);
}
@@ -2020,7 +2021,7 @@ static DWORD WINAPI create_debug_port(void *arg)
STARTUPINFOA si = { sizeof(si) };
NTSTATUS status = pDbgUiConnectToDbg();
- ok( !status, "DbgUiConnectToDbg failed %x\n", status );
+ ok( !status, "DbgUiConnectToDbg failed %lx\n", status );
*(HANDLE *)arg = pDbgUiGetThreadDebugObject();
Sleep( INFINITE );
ExitThread(0);
@@ -2037,50 +2038,50 @@ static void test_kill_on_exit(const char *argv0)
ULONG val;
event = CreateEventW(&sa, FALSE, FALSE, NULL);
- ok(event != NULL, "CreateEvent failed: %u\n", GetLastError());
+ ok(event != NULL, "CreateEvent failed: %lu\n", GetLastError());
cmd = heap_alloc(strlen(argv0) + strlen(arguments) + 16);
- sprintf(cmd, "%s%s%x\n", argv0, arguments, (DWORD)(DWORD_PTR)event);
+ sprintf(cmd, "%s%s%lx\n", argv0, arguments, (DWORD)(DWORD_PTR)event);
status = pNtCreateDebugObject( &debug, DEBUG_ALL_ACCESS, &attr, 0 );
- ok( !status, "NtCreateDebugObject failed %x\n", status );
+ ok( !status, "NtCreateDebugObject failed %lx\n", status );
pDbgUiSetThreadDebugObject( debug );
exit_code = run_child_wait( cmd, event );
- ok( exit_code == 0, "exit code = %08x\n", exit_code);
+ ok( exit_code == 0, "exit code = %08lx\n", exit_code);
status = pNtCreateDebugObject( &debug, DEBUG_ALL_ACCESS, &attr, DEBUG_KILL_ON_CLOSE );
- ok( !status, "NtCreateDebugObject failed %x\n", status );
+ ok( !status, "NtCreateDebugObject failed %lx\n", status );
pDbgUiSetThreadDebugObject( debug );
exit_code = run_child_wait( cmd, event );
- ok( exit_code == STATUS_DEBUGGER_INACTIVE, "exit code = %08x\n", exit_code);
+ ok( exit_code == STATUS_DEBUGGER_INACTIVE, "exit code = %08lx\n", exit_code);
status = pNtCreateDebugObject( &debug, DEBUG_ALL_ACCESS, &attr, 0xfffe );
- ok( status == STATUS_INVALID_PARAMETER, "NtCreateDebugObject failed %x\n", status );
+ ok( status == STATUS_INVALID_PARAMETER, "NtCreateDebugObject failed %lx\n", status );
status = pNtCreateDebugObject( &debug, DEBUG_ALL_ACCESS, &attr, 0 );
- ok( !status, "NtCreateDebugObject failed %x\n", status );
+ ok( !status, "NtCreateDebugObject failed %lx\n", status );
pDbgUiSetThreadDebugObject( debug );
val = DEBUG_KILL_ON_CLOSE;
status = pNtSetInformationDebugObject( debug, DebugObjectKillProcessOnExitInformation,
&val, sizeof(val), NULL );
- ok( !status, "NtSetInformationDebugObject failed %x\n", status );
+ ok( !status, "NtSetInformationDebugObject failed %lx\n", status );
exit_code = run_child_wait( cmd, event );
- ok( exit_code == STATUS_DEBUGGER_INACTIVE, "exit code = %08x\n", exit_code);
+ ok( exit_code == STATUS_DEBUGGER_INACTIVE, "exit code = %08lx\n", exit_code);
status = pNtCreateDebugObject( &debug, DEBUG_ALL_ACCESS, &attr, DEBUG_KILL_ON_CLOSE );
- ok( !status, "NtCreateDebugObject failed %x\n", status );
+ ok( !status, "NtCreateDebugObject failed %lx\n", status );
pDbgUiSetThreadDebugObject( debug );
val = 0;
status = pNtSetInformationDebugObject( debug, DebugObjectKillProcessOnExitInformation,
&val, sizeof(val), NULL );
- ok( !status, "NtSetInformationDebugObject failed %x\n", status );
+ ok( !status, "NtSetInformationDebugObject failed %lx\n", status );
exit_code = run_child_wait( cmd, event );
- ok( exit_code == 0, "exit code = %08x\n", exit_code);
+ ok( exit_code == 0, "exit code = %08lx\n", exit_code);
status = pDbgUiConnectToDbg();
- ok( !status, "DbgUiConnectToDbg failed %x\n", status );
+ ok( !status, "DbgUiConnectToDbg failed %lx\n", status );
exit_code = run_child_wait( cmd, event );
- ok( exit_code == STATUS_DEBUGGER_INACTIVE, "exit code = %08x\n", exit_code);
+ ok( exit_code == STATUS_DEBUGGER_INACTIVE, "exit code = %08lx\n", exit_code);
/* test that threads close the debug port on exit */
thread = CreateThread(NULL, 0, debug_and_exit, &debug, 0, &tid);
@@ -2090,41 +2091,41 @@ static void test_kill_on_exit(const char *argv0)
status = pNtSetInformationDebugObject( debug, DebugObjectKillProcessOnExitInformation,
&val, sizeof(val), NULL );
ok( status == STATUS_INVALID_HANDLE || broken(status == STATUS_SUCCESS), /* wow64 */
- "NtSetInformationDebugObject failed %x\n", status );
+ "NtSetInformationDebugObject failed %lx\n", status );
SetEvent( event );
if (!status)
{
WaitForSingleObject( pi.hProcess, 100 );
GetExitCodeProcess( pi.hProcess, &exit_code );
- ok( exit_code == STILL_ACTIVE, "exit code = %08x\n", exit_code);
+ ok( exit_code == STILL_ACTIVE, "exit code = %08lx\n", exit_code);
CloseHandle( debug );
}
WaitForSingleObject( pi.hProcess, 1000 );
GetExitCodeProcess( pi.hProcess, &exit_code );
- ok( exit_code == 0, "exit code = %08x\n", exit_code);
+ ok( exit_code == 0, "exit code = %08lx\n", exit_code);
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
CloseHandle( thread );
/* but not on forced exit */
status = pNtCreateDebugObject( &debug, DEBUG_ALL_ACCESS, &attr, DEBUG_KILL_ON_CLOSE );
- ok( !status, "NtCreateDebugObject failed %x\n", status );
+ ok( !status, "NtCreateDebugObject failed %lx\n", status );
thread = CreateThread(NULL, 0, debug_and_wait, &debug, 0, &tid);
Sleep( 100 );
ok( debug != 0, "no debug port\n" );
val = 1;
status = pNtSetInformationDebugObject( debug, DebugObjectKillProcessOnExitInformation,
&val, sizeof(val), NULL );
- ok( status == STATUS_SUCCESS, "NtSetInformationDebugObject failed %x\n", status );
+ ok( status == STATUS_SUCCESS, "NtSetInformationDebugObject failed %lx\n", status );
TerminateThread( thread, 0 );
status = pNtSetInformationDebugObject( debug, DebugObjectKillProcessOnExitInformation,
&val, sizeof(val), NULL );
- ok( status == STATUS_SUCCESS, "NtSetInformationDebugObject failed %x\n", status );
+ ok( status == STATUS_SUCCESS, "NtSetInformationDebugObject failed %lx\n", status );
WaitForSingleObject( pi.hProcess, 300 );
GetExitCodeProcess( pi.hProcess, &exit_code );
todo_wine
ok( exit_code == STATUS_DEBUGGER_INACTIVE || broken(exit_code == STILL_ACTIVE), /* wow64 */
- "exit code = %08x\n", exit_code);
+ "exit code = %08lx\n", exit_code);
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
CloseHandle( thread );
@@ -2137,11 +2138,11 @@ static void test_kill_on_exit(const char *argv0)
val = 0;
status = pNtSetInformationDebugObject( debug, DebugObjectKillProcessOnExitInformation,
&val, sizeof(val), NULL );
- ok( status == STATUS_SUCCESS, "NtSetInformationDebugObject failed %x\n", status );
+ ok( status == STATUS_SUCCESS, "NtSetInformationDebugObject failed %lx\n", status );
TerminateThread( thread, 0 );
status = pNtSetInformationDebugObject( debug, DebugObjectKillProcessOnExitInformation,
&val, sizeof(val), NULL );
- ok( status == STATUS_SUCCESS, "NtSetInformationDebugObject failed %x\n", status );
+ ok( status == STATUS_SUCCESS, "NtSetInformationDebugObject failed %lx\n", status );
CloseHandle( debug );
CloseHandle( thread );
@@ -2191,7 +2192,7 @@ START_TEST(debugger)
else if (myARGC >= 4 && !strcmp(myARGV[2], "wait"))
{
DWORD event, cnt = 1;
- sscanf(myARGV[3], "%x", &event);
+ sscanf(myARGV[3], "%lx", &event);
if (myARGC >= 5) cnt = atoi(myARGV[4]);
wait_debugger((HANDLE)(DWORD_PTR)event, cnt);
}
3
26
[PATCH v2 1/5] devenum/tests: Remove workarounds from test_moniker_isequal().
by Zebediah Figura March 3, 2022
by Zebediah Figura March 3, 2022
March 3, 2022
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
v2: New patch.
dlls/devenum/tests/devenum.c | 113 +++++++++++++++++------------------
1 file changed, 54 insertions(+), 59 deletions(-)
diff --git a/dlls/devenum/tests/devenum.c b/dlls/devenum/tests/devenum.c
index 3e0d6f57dc3..1a1e48e1a4b 100644
--- a/dlls/devenum/tests/devenum.c
+++ b/dlls/devenum/tests/devenum.c
@@ -150,91 +150,85 @@ static void test_devenum(void)
static void test_moniker_isequal(void)
{
- HRESULT res;
ICreateDevEnum *create_devenum = NULL;
IEnumMoniker *enum_moniker0 = NULL, *enum_moniker1 = NULL;
IMoniker *moniker0 = NULL, *moniker1 = NULL;
+ HRESULT hr;
- res = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
+ hr = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
&IID_ICreateDevEnum, (LPVOID*)&create_devenum);
- if (FAILED(res))
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker0, 0);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ if (IEnumMoniker_Next(enum_moniker0, 1, &moniker0, NULL) == S_OK
+ && IEnumMoniker_Next(enum_moniker0, 1, &moniker1, NULL) == S_OK)
{
- skip("Cannot create SystemDeviceEnum object (%x)\n", res);
- return;
+ hr = IMoniker_IsEqual(moniker0, moniker1);
+ ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+
+ hr = IMoniker_IsEqual(moniker1, moniker0);
+ ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+
+ IMoniker_Release(moniker0);
+ IMoniker_Release(moniker1);
}
-
- res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker0, 0);
- ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
- if (SUCCEEDED(res))
+ else
{
- if (IEnumMoniker_Next(enum_moniker0, 1, &moniker0, NULL) == S_OK &&
- IEnumMoniker_Next(enum_moniker0, 1, &moniker1, NULL) == S_OK)
- {
- res = IMoniker_IsEqual(moniker0, moniker1);
- ok(res == S_FALSE, "IMoniker_IsEqual should fail (res = %x)\n", res);
-
- res = IMoniker_IsEqual(moniker1, moniker0);
- ok(res == S_FALSE, "IMoniker_IsEqual should fail (res = %x)\n", res);
-
- IMoniker_Release(moniker0);
- IMoniker_Release(moniker1);
- }
- else
- skip("Cannot get moniker for testing.\n");
+ skip("Cannot get moniker for testing.\n");
}
IEnumMoniker_Release(enum_moniker0);
- res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker0, 0);
- ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
- res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_AudioRendererCategory, &enum_moniker1, 0);
- ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
- if (SUCCEEDED(res))
+ hr = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker0, 0);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_AudioRendererCategory, &enum_moniker1, 0);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ if (IEnumMoniker_Next(enum_moniker0, 1, &moniker0, NULL) == S_OK
+ && IEnumMoniker_Next(enum_moniker1, 1, &moniker1, NULL) == S_OK)
{
- if (IEnumMoniker_Next(enum_moniker0, 1, &moniker0, NULL) == S_OK &&
- IEnumMoniker_Next(enum_moniker1, 1, &moniker1, NULL) == S_OK)
- {
- res = IMoniker_IsEqual(moniker0, moniker1);
- ok(res == S_FALSE, "IMoniker_IsEqual should failed (res = %x)\n", res);
+ hr = IMoniker_IsEqual(moniker0, moniker1);
+ ok(hr == S_FALSE, "Got hr %#x.\n", hr);
- res = IMoniker_IsEqual(moniker1, moniker0);
- ok(res == S_FALSE, "IMoniker_IsEqual should failed (res = %x)\n", res);
+ hr = IMoniker_IsEqual(moniker1, moniker0);
+ ok(hr == S_FALSE, "Got hr %#x.\n", hr);
- IMoniker_Release(moniker0);
- IMoniker_Release(moniker1);
- }
- else
- skip("Cannot get moniker for testing.\n");
+ IMoniker_Release(moniker0);
+ IMoniker_Release(moniker1);
+ }
+ else
+ {
+ skip("Cannot get moniker for testing.\n");
}
IEnumMoniker_Release(enum_moniker0);
IEnumMoniker_Release(enum_moniker1);
- res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker0, 0);
- ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
- res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker1, 0);
- ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
- if (SUCCEEDED(res))
+ hr = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker0, 0);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker1, 0);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ if (IEnumMoniker_Next(enum_moniker0, 1, &moniker0, NULL) == S_OK
+ && IEnumMoniker_Next(enum_moniker1, 1, &moniker1, NULL) == S_OK)
{
- if (IEnumMoniker_Next(enum_moniker0, 1, &moniker0, NULL) == S_OK &&
- IEnumMoniker_Next(enum_moniker1, 1, &moniker1, NULL) == S_OK)
- {
- res = IMoniker_IsEqual(moniker0, moniker1);
- ok(res == S_OK, "IMoniker_IsEqual failed (res = %x)\n", res);
+ hr = IMoniker_IsEqual(moniker0, moniker1);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
- res = IMoniker_IsEqual(moniker1, moniker0);
- ok(res == S_OK, "IMoniker_IsEqual failed (res = %x)\n", res);
+ hr = IMoniker_IsEqual(moniker1, moniker0);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
- IMoniker_Release(moniker0);
- IMoniker_Release(moniker1);
- }
- else
- skip("Cannot get moniker for testing.\n");
+ IMoniker_Release(moniker0);
+ IMoniker_Release(moniker1);
+ }
+ else
+ {
+ skip("Cannot get moniker for testing.\n");
}
IEnumMoniker_Release(enum_moniker0);
IEnumMoniker_Release(enum_moniker1);
ICreateDevEnum_Release(create_devenum);
-
- return;
}
static BOOL find_moniker(const GUID *class, IMoniker *needle)
@@ -277,6 +271,7 @@ static void test_register_filter(void)
rgf2.dwMerit = MERIT_UNLIKELY;
S2(U(rgf2)).cPins2 = 0;
+
hr = IFilterMapper2_RegisterFilter(mapper2, &CLSID_TestFilter, L"devenum test", &mon, NULL, NULL, &rgf2);
if (hr == E_ACCESSDENIED)
{
--
2.35.1
1
4
[tools] testbot/cgi: Move CallGetEscapedDisplayValue() next to its target.
by Francois Gouget March 3, 2022
by Francois Gouget March 3, 2022
March 3, 2022
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/ObjectModel/CGI/CollectionBlock.pm | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
index 3af2a14ce5..a5e8187009 100644
--- a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
+++ b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
@@ -435,13 +435,6 @@ sub DisplayProperty($$)
return $PropertyDescriptor->GetClass ne "Detailref";
}
-sub CallGetEscapedDisplayValue($$$)
-{
- my ($self, $Item, $PropertyDescriptor) = @_;
-
- return $self->GetEscapedDisplayValue($Item, $PropertyDescriptor);
-}
-
sub CallGetDisplayValue($$$)
{
my ($self, $Item, $PropertyDescriptor) = @_;
@@ -495,6 +488,13 @@ sub GetDisplayValue($$$)
return $Value;
}
+sub CallGetEscapedDisplayValue($$$)
+{
+ my ($self, $Item, $PropertyDescriptor) = @_;
+
+ return $self->GetEscapedDisplayValue($Item, $PropertyDescriptor);
+}
+
sub GetEscapedDisplayValue($$$)
{
my ($self, $Item, $PropertyDescriptor) = @_;
--
2.30.2
1
0
March 3, 2022
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
It's really just a naming convention.
---
testbot/lib/ObjectModel/CGI/FormPage.pm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/FormPage.pm b/testbot/lib/ObjectModel/CGI/FormPage.pm
index 0ac599e137..03ddea64f2 100644
--- a/testbot/lib/ObjectModel/CGI/FormPage.pm
+++ b/testbot/lib/ObjectModel/CGI/FormPage.pm
@@ -391,8 +391,7 @@ sub Save($)
return !1 if (!$self->SaveProperties());
- my $ErrKey;
- ($ErrKey, $self->{ErrField}, $self->{ErrMessage}) = $self->{Collection}->Save();
+ (my $_ErrKey, $self->{ErrField}, $self->{ErrMessage}) = $self->{Collection}->Save();
return ! defined($self->{ErrMessage});
}
--
2.30.2
1
0
[tools] testbot/web: Override the default form actions instead of appending.
by Francois Gouget March 3, 2022
by Francois Gouget March 3, 2022
March 3, 2022
Note that the parent FormPage class has no action anyway.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
I cannot think of any case where it would make sense to add a default
set of actions to the base FormPage class that would make sense in any
of these pages. So simplify the implementation by just specifying the
set of actions that these web pages support.
---
testbot/web/Feedback.pl | 8 ++------
testbot/web/ForgotPassword.pl | 8 ++------
testbot/web/Login.pl | 5 +----
testbot/web/ResetPassword.pl | 8 ++------
testbot/web/Stats.pl | 7 ++-----
testbot/web/Submit.pl | 28 +++++-----------------------
testbot/web/admin/Log.pl | 8 ++------
testbot/web/admin/SpecialJobs.pl | 7 ++-----
8 files changed, 18 insertions(+), 61 deletions(-)
diff --git a/testbot/web/Feedback.pl b/testbot/web/Feedback.pl
index b43397fda0..9eba086ace 100644
--- a/testbot/web/Feedback.pl
+++ b/testbot/web/Feedback.pl
@@ -72,12 +72,8 @@ sub GetHeaderText($)
sub GetActions($)
{
- my ($self) = @_;
-
- my $Actions = $self->SUPER::GetActions();
- push @$Actions, "Send";
-
- return $Actions;
+ #my ($self) = @_;
+ return ["Send"];
}
sub OnSend($)
diff --git a/testbot/web/ForgotPassword.pl b/testbot/web/ForgotPassword.pl
index 4e1c508b23..cc0cd455d3 100644
--- a/testbot/web/ForgotPassword.pl
+++ b/testbot/web/ForgotPassword.pl
@@ -58,12 +58,8 @@ sub GetHeaderText($)
sub GetActions($)
{
- my ($self) = @_;
-
- my $Actions = $self->SUPER::GetActions();
- push @$Actions, "Reset password";
-
- return $Actions;
+ #my ($self) = @_;
+ return ["Reset password"];
}
sub OnResetPassword($)
diff --git a/testbot/web/Login.pl b/testbot/web/Login.pl
index 3c93dd869d..ef3f4cb064 100644
--- a/testbot/web/Login.pl
+++ b/testbot/web/Login.pl
@@ -89,10 +89,7 @@ sub GetActions($)
{
my ($self) = @_;
- my $Actions = $self->SUPER::GetActions();
- push @$Actions, "Log in";
-
- return $Actions;
+ return ["Log in"];
}
sub OnLogIn($)
diff --git a/testbot/web/ResetPassword.pl b/testbot/web/ResetPassword.pl
index 1e2b94d031..81655e0c4f 100644
--- a/testbot/web/ResetPassword.pl
+++ b/testbot/web/ResetPassword.pl
@@ -73,12 +73,8 @@ sub GetInputType($$)
sub GetActions($)
{
- my ($self) = @_;
-
- my $Actions = $self->SUPER::GetActions();
- push @$Actions, "Change password";
-
- return $Actions;
+ #my ($self) = @_;
+ return ["Change password"];
}
sub Validate($)
diff --git a/testbot/web/Stats.pl b/testbot/web/Stats.pl
index 803fc59f9f..ab086976f7 100644
--- a/testbot/web/Stats.pl
+++ b/testbot/web/Stats.pl
@@ -394,11 +394,8 @@ sub GetDisplayValue($$)
sub GetActions($)
{
- my ($self) = @_;
-
- my $Actions = $self->SUPER::GetActions();
- push @$Actions, "Update";
- return $Actions;
+ #my ($self) = @_;
+ return ["Update"];
}
sub OnAction($$)
diff --git a/testbot/web/Submit.pl b/testbot/web/Submit.pl
index 76069bbc3f..9a7ac0b3e7 100644
--- a/testbot/web/Submit.pl
+++ b/testbot/web/Submit.pl
@@ -913,29 +913,11 @@ sub GetActions($)
{
my ($self) = @_;
- my $Actions = $self->SUPER::GetActions();
- if ($self->{Page} == 0)
- {
- push @$Actions, "OK";
- }
- elsif ($self->{Page} == 1)
- {
- push @$Actions, "Single Page", "Next >";
- }
- elsif ($self->{Page} == 2)
- {
- push @$Actions, "< Prev", "Next >";
- }
- elsif ($self->{Page} == 3)
- {
- push @$Actions, "< Prev", "Submit";
- }
- elsif ($self->{Page} == 4)
- {
- push @$Actions, "Submit";
- }
-
- return $Actions;
+ return ["Single Page", "Next >"] if ($self->{Page} == 1);
+ return ["< Prev", "Next >"] if ($self->{Page} == 2);
+ return ["< Prev", "Submit"] if ($self->{Page} == 3);
+ return ["Submit"] if ($self->{Page} == 4);
+ return ["OK"]; # Page == 0 (error case)
}
sub DisplayProperty($$)
diff --git a/testbot/web/admin/Log.pl b/testbot/web/admin/Log.pl
index f0ac524681..cb253bd03e 100644
--- a/testbot/web/admin/Log.pl
+++ b/testbot/web/admin/Log.pl
@@ -64,12 +64,8 @@ sub GetHeaderText($)
sub GetActions($)
{
- my ($self) = @_;
-
- my $Actions = $self->SUPER::GetActions();
- push @$Actions, "Download";
-
- return $Actions;
+ #my ($self) = @_;
+ return ["Download"];
}
sub OnDownload($)
diff --git a/testbot/web/admin/SpecialJobs.pl b/testbot/web/admin/SpecialJobs.pl
index c5a8f6587f..534336c483 100644
--- a/testbot/web/admin/SpecialJobs.pl
+++ b/testbot/web/admin/SpecialJobs.pl
@@ -145,11 +145,8 @@ sub GenerateFields($)
sub GetActions($)
{
- my ($self) = @_;
-
- my $Actions = $self->SUPER::GetActions();
- push @$Actions, "Submit";
- return $Actions;
+ #my ($self) = @_;
+ return ["Submit"];
}
--
2.30.2
1
0