Wine-Devel
Threads by month
- ----- 2026 -----
- May
- 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
- 5 participants
- 84534 discussions
[PATCH] winex11.drv: Clarify parent in struct x11drv_win_data comments.
by Zhiyi Zhang Nov. 17, 2020
by Zhiyi Zhang Nov. 17, 2020
Nov. 17, 2020
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/winex11.drv/x11drv.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 173d94b9efa..45855976607 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -563,9 +563,9 @@ struct x11drv_win_data
HWND hwnd; /* hwnd that this private data belongs to */
Window whole_window; /* X window for the complete window */
Window client_window; /* X window for the client area */
- RECT window_rect; /* USER window rectangle relative to parent */
- RECT whole_rect; /* X window rectangle for the whole window relative to parent */
- RECT client_rect; /* client area relative to parent */
+ RECT window_rect; /* USER window rectangle relative to win32 parent window client area */
+ RECT whole_rect; /* X window rectangle for the whole window relative to win32 parent window client area */
+ RECT client_rect; /* client area relative to win32 parent window client area */
XIC xic; /* X input context */
BOOL managed : 1; /* is window managed? */
BOOL mapped : 1; /* is window mapped? (in either normal or iconic state) */
--
2.27.0
1
0
[PATCH v2 1/4] quartz/tests: Pass an IMediaControl to some functions.
by Zebediah Figura Nov. 17, 2020
by Zebediah Figura Nov. 17, 2020
Nov. 17, 2020
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/quartz/tests/dsoundrender.c | 12 ++++-----
dlls/quartz/tests/videorenderer.c | 43 ++++++++++---------------------
dlls/quartz/tests/vmr7.c | 27 +++++++------------
3 files changed, 28 insertions(+), 54 deletions(-)
diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c
index 9506abc7977..9aa9a796c9f 100644
--- a/dlls/quartz/tests/dsoundrender.c
+++ b/dlls/quartz/tests/dsoundrender.c
@@ -746,14 +746,11 @@ static HRESULT send_frame(IMemInputPin *sink)
return ret;
}
-static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
+static void test_filter_state(IMemInputPin *input, IMediaControl *control)
{
- IMediaControl *control;
OAFilterState state;
HRESULT hr;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-
hr = send_frame(input);
ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
@@ -833,8 +830,6 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
/* The DirectSound renderer will silently refuse to transition to running
* if it hasn't finished pausing yet. Once it does it reports itself as
* completely paused. */
-
- IMediaControl_Release(control);
}
static void test_connect_pin(void)
@@ -860,6 +855,7 @@ static void test_connect_pin(void)
IBaseFilter *filter = create_dsound_render();
struct testfilter source;
IMemAllocator *allocator;
+ IMediaControl *control;
IFilterGraph2 *graph;
IMemInputPin *input;
AM_MEDIA_TYPE mt;
@@ -872,6 +868,7 @@ static void test_connect_pin(void)
CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (void **)&graph);
IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, L"source");
IFilterGraph2_AddFilter(graph, filter, L"sink");
+ IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
IBaseFilter_FindPin(filter, sink_id, &pin);
@@ -913,7 +910,7 @@ static void test_connect_pin(void)
hr = IMemInputPin_ReceiveCanBlock(input);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- test_filter_state(input, graph);
+ test_filter_state(input, control);
hr = IFilterGraph2_Disconnect(graph, pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -934,6 +931,7 @@ static void test_connect_pin(void)
ok(!ref, "Got outstanding refcount %d.\n", ref);
IMemInputPin_Release(input);
IPin_Release(pin);
+ IMediaControl_Release(control);
ref = IFilterGraph2_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
ref = IBaseFilter_Release(filter);
diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c
index ed2639d2736..f84d553f2aa 100644
--- a/dlls/quartz/tests/videorenderer.c
+++ b/dlls/quartz/tests/videorenderer.c
@@ -823,17 +823,14 @@ static HRESULT join_thread_(int line, HANDLE thread)
}
#define join_thread(a) join_thread_(__LINE__, a)
-static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
+static void test_filter_state(IMemInputPin *input, IMediaControl *control)
{
IMemAllocator *allocator;
- IMediaControl *control;
IMediaSample *sample;
OAFilterState state;
HANDLE thread;
HRESULT hr;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-
thread = send_frame(input);
hr = join_thread(thread);
todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr);
@@ -961,18 +958,14 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
ok(hr == S_OK, "Got hr %#x.\n", hr);
IMemAllocator_Release(allocator);
- IMediaControl_Release(control);
}
-static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
+static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control)
{
- IMediaControl *control;
OAFilterState state;
HANDLE thread;
HRESULT hr;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-
hr = IMediaControl_Pause(control);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
@@ -1022,20 +1015,16 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
-
- IMediaControl_Release(control);
}
-static void test_sample_time(IBaseFilter *filter, IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
+static void test_sample_time(IBaseFilter *filter, IPin *pin, IMemInputPin *input, IMediaControl *control)
{
- IMediaControl *control;
IMediaSeeking *seeking;
REFERENCE_TIME time;
OAFilterState state;
HANDLE thread;
HRESULT hr;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
IBaseFilter_QueryInterface(filter, &IID_IMediaSeeking, (void **)&seeking);
hr = IMediaControl_Pause(control);
@@ -1108,7 +1097,6 @@ static void test_sample_time(IBaseFilter *filter, IPin *pin, IMemInputPin *input
ok(hr == S_OK, "Got hr %#x.\n", hr);
IMediaSeeking_Release(seeking);
- IMediaControl_Release(control);
}
static unsigned int check_ec_complete(IMediaEvent *eventsrc, DWORD timeout)
@@ -1134,16 +1122,14 @@ static unsigned int check_ec_complete(IMediaEvent *eventsrc, DWORD timeout)
return ret;
}
-static void test_eos(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
+static void test_eos(IPin *pin, IMemInputPin *input, IMediaControl *control)
{
- IMediaControl *control;
IMediaEvent *eventsrc;
OAFilterState state;
HRESULT hr;
BOOL ret;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
- IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&eventsrc);
+ IMediaControl_QueryInterface(control, &IID_IMediaEvent, (void **)&eventsrc);
hr = IMediaControl_Pause(control);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
@@ -1246,15 +1232,13 @@ static void test_eos(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
ok(!ret, "Got unexpected EC_COMPLETE.\n");
IMediaEvent_Release(eventsrc);
- IMediaControl_Release(control);
}
static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
- IFilterGraph2 *graph, const BITMAPINFOHEADER *expect_bih)
+ IMediaControl *control, const BITMAPINFOHEADER *expect_bih)
{
LONG buffer[(sizeof(BITMAPINFOHEADER) + 32 * 16 * 2) / 4];
const BITMAPINFOHEADER *bih = (BITMAPINFOHEADER *)buffer;
- IMediaControl *control;
OAFilterState state;
IBasicVideo *video;
unsigned int i;
@@ -1262,7 +1246,6 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
HRESULT hr;
LONG size;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
IBaseFilter_QueryInterface(filter, &IID_IBasicVideo, (void **)&video);
hr = IBasicVideo_GetCurrentImage(video, NULL, NULL);
@@ -1321,7 +1304,6 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
ok(hr == S_OK, "Got hr %#x.\n", hr);
IBasicVideo_Release(video);
- IMediaControl_Release(control);
}
static void test_connect_pin(void)
@@ -1347,6 +1329,7 @@ static void test_connect_pin(void)
IFilterGraph2 *graph = create_graph();
struct testfilter source;
IMemAllocator *allocator;
+ IMediaControl *control;
IMemInputPin *input;
AM_MEDIA_TYPE mt;
IPin *pin, *peer;
@@ -1366,6 +1349,7 @@ static void test_connect_pin(void)
IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, NULL);
IFilterGraph2_AddFilter(graph, filter, NULL);
+ IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
IBaseFilter_FindPin(filter, L"In", &pin);
@@ -1424,11 +1408,11 @@ static void test_connect_pin(void)
hr = IMemInputPin_ReceiveCanBlock(input);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- test_filter_state(input, graph);
- test_flushing(pin, input, graph);
- test_sample_time(filter, pin, input, graph);
- test_eos(pin, input, graph);
- test_current_image(filter, input, graph, &vih.bmiHeader);
+ test_filter_state(input, control);
+ test_flushing(pin, input, control);
+ test_sample_time(filter, pin, input, control);
+ test_eos(pin, input, control);
+ test_current_image(filter, input, control, &vih.bmiHeader);
hr = IFilterGraph2_Disconnect(graph, pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -1449,6 +1433,7 @@ static void test_connect_pin(void)
ok(!ref, "Got outstanding refcount %d.\n", ref);
IMemInputPin_Release(input);
IPin_Release(pin);
+ IMediaControl_Release(control);
ref = IFilterGraph2_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
ref = IBaseFilter_Release(filter);
diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c
index 39592afce66..1101a98ab7d 100644
--- a/dlls/quartz/tests/vmr7.c
+++ b/dlls/quartz/tests/vmr7.c
@@ -1022,17 +1022,14 @@ static HRESULT join_thread_(int line, HANDLE thread)
}
#define join_thread(a) join_thread_(__LINE__, a)
-static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
+static void test_filter_state(IMemInputPin *input, IMediaControl *control)
{
IMemAllocator *allocator;
- IMediaControl *control;
IMediaSample *sample;
OAFilterState state;
HANDLE thread;
HRESULT hr;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-
thread = send_frame(input);
hr = join_thread(thread);
ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
@@ -1163,19 +1160,15 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
ok(hr == S_OK, "Got hr %#x.\n", hr);
IMemAllocator_Release(allocator);
- IMediaControl_Release(control);
}
-static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
+static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control)
{
IMemAllocator *allocator;
- IMediaControl *control;
OAFilterState state;
HANDLE thread;
HRESULT hr;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-
hr = IMemInputPin_GetAllocator(input, &allocator);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMemAllocator_Commit(allocator);
@@ -1233,19 +1226,16 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
-
- IMediaControl_Release(control);
}
static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
- IFilterGraph2 *graph, const BITMAPINFOHEADER *req_bih)
+ IMediaControl *control, const BITMAPINFOHEADER *req_bih)
{
LONG buffer[(sizeof(BITMAPINFOHEADER) + 32 * 16 * 4) / 4];
const BITMAPINFOHEADER *bih = (BITMAPINFOHEADER *)buffer;
const DWORD *data = (DWORD *)((char *)buffer + sizeof(BITMAPINFOHEADER));
BITMAPINFOHEADER expect_bih = *req_bih;
IMemAllocator *allocator;
- IMediaControl *control;
OAFilterState state;
IBasicVideo *video;
unsigned int i;
@@ -1258,7 +1248,6 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
expect_bih.biBitCount = 32;
expect_bih.biSizeImage = 32 * 16 * 4;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
IBaseFilter_QueryInterface(filter, &IID_IBasicVideo, (void **)&video);
hr = IBasicVideo_GetCurrentImage(video, NULL, NULL);
@@ -1337,7 +1326,6 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
ok(hr == S_OK, "Got hr %#x.\n", hr);
IBasicVideo_Release(video);
- IMediaControl_Release(control);
}
static void test_connect_pin(void)
@@ -1363,6 +1351,7 @@ static void test_connect_pin(void)
IFilterGraph2 *graph = create_graph();
struct testfilter source;
IMemAllocator *allocator;
+ IMediaControl *control;
IMemInputPin *input;
AM_MEDIA_TYPE mt;
IPin *pin, *peer;
@@ -1382,6 +1371,7 @@ static void test_connect_pin(void)
IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, NULL);
IFilterGraph2_AddFilter(graph, filter, NULL);
+ IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
@@ -1469,9 +1459,9 @@ static void test_connect_pin(void)
hr = IMemInputPin_ReceiveCanBlock(input);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- test_filter_state(input, graph);
- test_flushing(pin, input, graph);
- test_current_image(filter, input, graph, &vih.bmiHeader);
+ test_filter_state(input, control);
+ test_flushing(pin, input, control);
+ test_current_image(filter, input, control, &vih.bmiHeader);
hr = IFilterGraph2_Disconnect(graph, pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -1490,6 +1480,7 @@ static void test_connect_pin(void)
IMemInputPin_Release(input);
IPin_Release(pin);
+ IMediaControl_Release(control);
ref = IFilterGraph2_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
ref = IBaseFilter_Release(filter);
--
2.29.2
2
5
Nov. 16, 2020
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/quartz/tests/dsoundrender.c | 12 ++++-----
dlls/quartz/tests/videorenderer.c | 43 ++++++++++---------------------
dlls/quartz/tests/vmr7.c | 27 +++++++------------
3 files changed, 28 insertions(+), 54 deletions(-)
diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c
index 9506abc7977..9aa9a796c9f 100644
--- a/dlls/quartz/tests/dsoundrender.c
+++ b/dlls/quartz/tests/dsoundrender.c
@@ -746,14 +746,11 @@ static HRESULT send_frame(IMemInputPin *sink)
return ret;
}
-static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
+static void test_filter_state(IMemInputPin *input, IMediaControl *control)
{
- IMediaControl *control;
OAFilterState state;
HRESULT hr;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-
hr = send_frame(input);
ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
@@ -833,8 +830,6 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
/* The DirectSound renderer will silently refuse to transition to running
* if it hasn't finished pausing yet. Once it does it reports itself as
* completely paused. */
-
- IMediaControl_Release(control);
}
static void test_connect_pin(void)
@@ -860,6 +855,7 @@ static void test_connect_pin(void)
IBaseFilter *filter = create_dsound_render();
struct testfilter source;
IMemAllocator *allocator;
+ IMediaControl *control;
IFilterGraph2 *graph;
IMemInputPin *input;
AM_MEDIA_TYPE mt;
@@ -872,6 +868,7 @@ static void test_connect_pin(void)
CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (void **)&graph);
IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, L"source");
IFilterGraph2_AddFilter(graph, filter, L"sink");
+ IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
IBaseFilter_FindPin(filter, sink_id, &pin);
@@ -913,7 +910,7 @@ static void test_connect_pin(void)
hr = IMemInputPin_ReceiveCanBlock(input);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- test_filter_state(input, graph);
+ test_filter_state(input, control);
hr = IFilterGraph2_Disconnect(graph, pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -934,6 +931,7 @@ static void test_connect_pin(void)
ok(!ref, "Got outstanding refcount %d.\n", ref);
IMemInputPin_Release(input);
IPin_Release(pin);
+ IMediaControl_Release(control);
ref = IFilterGraph2_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
ref = IBaseFilter_Release(filter);
diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c
index ed2639d2736..f84d553f2aa 100644
--- a/dlls/quartz/tests/videorenderer.c
+++ b/dlls/quartz/tests/videorenderer.c
@@ -823,17 +823,14 @@ static HRESULT join_thread_(int line, HANDLE thread)
}
#define join_thread(a) join_thread_(__LINE__, a)
-static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
+static void test_filter_state(IMemInputPin *input, IMediaControl *control)
{
IMemAllocator *allocator;
- IMediaControl *control;
IMediaSample *sample;
OAFilterState state;
HANDLE thread;
HRESULT hr;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-
thread = send_frame(input);
hr = join_thread(thread);
todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr);
@@ -961,18 +958,14 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
ok(hr == S_OK, "Got hr %#x.\n", hr);
IMemAllocator_Release(allocator);
- IMediaControl_Release(control);
}
-static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
+static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control)
{
- IMediaControl *control;
OAFilterState state;
HANDLE thread;
HRESULT hr;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-
hr = IMediaControl_Pause(control);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
@@ -1022,20 +1015,16 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
-
- IMediaControl_Release(control);
}
-static void test_sample_time(IBaseFilter *filter, IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
+static void test_sample_time(IBaseFilter *filter, IPin *pin, IMemInputPin *input, IMediaControl *control)
{
- IMediaControl *control;
IMediaSeeking *seeking;
REFERENCE_TIME time;
OAFilterState state;
HANDLE thread;
HRESULT hr;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
IBaseFilter_QueryInterface(filter, &IID_IMediaSeeking, (void **)&seeking);
hr = IMediaControl_Pause(control);
@@ -1108,7 +1097,6 @@ static void test_sample_time(IBaseFilter *filter, IPin *pin, IMemInputPin *input
ok(hr == S_OK, "Got hr %#x.\n", hr);
IMediaSeeking_Release(seeking);
- IMediaControl_Release(control);
}
static unsigned int check_ec_complete(IMediaEvent *eventsrc, DWORD timeout)
@@ -1134,16 +1122,14 @@ static unsigned int check_ec_complete(IMediaEvent *eventsrc, DWORD timeout)
return ret;
}
-static void test_eos(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
+static void test_eos(IPin *pin, IMemInputPin *input, IMediaControl *control)
{
- IMediaControl *control;
IMediaEvent *eventsrc;
OAFilterState state;
HRESULT hr;
BOOL ret;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
- IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&eventsrc);
+ IMediaControl_QueryInterface(control, &IID_IMediaEvent, (void **)&eventsrc);
hr = IMediaControl_Pause(control);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
@@ -1246,15 +1232,13 @@ static void test_eos(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
ok(!ret, "Got unexpected EC_COMPLETE.\n");
IMediaEvent_Release(eventsrc);
- IMediaControl_Release(control);
}
static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
- IFilterGraph2 *graph, const BITMAPINFOHEADER *expect_bih)
+ IMediaControl *control, const BITMAPINFOHEADER *expect_bih)
{
LONG buffer[(sizeof(BITMAPINFOHEADER) + 32 * 16 * 2) / 4];
const BITMAPINFOHEADER *bih = (BITMAPINFOHEADER *)buffer;
- IMediaControl *control;
OAFilterState state;
IBasicVideo *video;
unsigned int i;
@@ -1262,7 +1246,6 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
HRESULT hr;
LONG size;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
IBaseFilter_QueryInterface(filter, &IID_IBasicVideo, (void **)&video);
hr = IBasicVideo_GetCurrentImage(video, NULL, NULL);
@@ -1321,7 +1304,6 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
ok(hr == S_OK, "Got hr %#x.\n", hr);
IBasicVideo_Release(video);
- IMediaControl_Release(control);
}
static void test_connect_pin(void)
@@ -1347,6 +1329,7 @@ static void test_connect_pin(void)
IFilterGraph2 *graph = create_graph();
struct testfilter source;
IMemAllocator *allocator;
+ IMediaControl *control;
IMemInputPin *input;
AM_MEDIA_TYPE mt;
IPin *pin, *peer;
@@ -1366,6 +1349,7 @@ static void test_connect_pin(void)
IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, NULL);
IFilterGraph2_AddFilter(graph, filter, NULL);
+ IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
IBaseFilter_FindPin(filter, L"In", &pin);
@@ -1424,11 +1408,11 @@ static void test_connect_pin(void)
hr = IMemInputPin_ReceiveCanBlock(input);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- test_filter_state(input, graph);
- test_flushing(pin, input, graph);
- test_sample_time(filter, pin, input, graph);
- test_eos(pin, input, graph);
- test_current_image(filter, input, graph, &vih.bmiHeader);
+ test_filter_state(input, control);
+ test_flushing(pin, input, control);
+ test_sample_time(filter, pin, input, control);
+ test_eos(pin, input, control);
+ test_current_image(filter, input, control, &vih.bmiHeader);
hr = IFilterGraph2_Disconnect(graph, pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -1449,6 +1433,7 @@ static void test_connect_pin(void)
ok(!ref, "Got outstanding refcount %d.\n", ref);
IMemInputPin_Release(input);
IPin_Release(pin);
+ IMediaControl_Release(control);
ref = IFilterGraph2_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
ref = IBaseFilter_Release(filter);
diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c
index 39592afce66..1101a98ab7d 100644
--- a/dlls/quartz/tests/vmr7.c
+++ b/dlls/quartz/tests/vmr7.c
@@ -1022,17 +1022,14 @@ static HRESULT join_thread_(int line, HANDLE thread)
}
#define join_thread(a) join_thread_(__LINE__, a)
-static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
+static void test_filter_state(IMemInputPin *input, IMediaControl *control)
{
IMemAllocator *allocator;
- IMediaControl *control;
IMediaSample *sample;
OAFilterState state;
HANDLE thread;
HRESULT hr;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-
thread = send_frame(input);
hr = join_thread(thread);
ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
@@ -1163,19 +1160,15 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
ok(hr == S_OK, "Got hr %#x.\n", hr);
IMemAllocator_Release(allocator);
- IMediaControl_Release(control);
}
-static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
+static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control)
{
IMemAllocator *allocator;
- IMediaControl *control;
OAFilterState state;
HANDLE thread;
HRESULT hr;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-
hr = IMemInputPin_GetAllocator(input, &allocator);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMemAllocator_Commit(allocator);
@@ -1233,19 +1226,16 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
-
- IMediaControl_Release(control);
}
static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
- IFilterGraph2 *graph, const BITMAPINFOHEADER *req_bih)
+ IMediaControl *control, const BITMAPINFOHEADER *req_bih)
{
LONG buffer[(sizeof(BITMAPINFOHEADER) + 32 * 16 * 4) / 4];
const BITMAPINFOHEADER *bih = (BITMAPINFOHEADER *)buffer;
const DWORD *data = (DWORD *)((char *)buffer + sizeof(BITMAPINFOHEADER));
BITMAPINFOHEADER expect_bih = *req_bih;
IMemAllocator *allocator;
- IMediaControl *control;
OAFilterState state;
IBasicVideo *video;
unsigned int i;
@@ -1258,7 +1248,6 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
expect_bih.biBitCount = 32;
expect_bih.biSizeImage = 32 * 16 * 4;
- IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
IBaseFilter_QueryInterface(filter, &IID_IBasicVideo, (void **)&video);
hr = IBasicVideo_GetCurrentImage(video, NULL, NULL);
@@ -1337,7 +1326,6 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
ok(hr == S_OK, "Got hr %#x.\n", hr);
IBasicVideo_Release(video);
- IMediaControl_Release(control);
}
static void test_connect_pin(void)
@@ -1363,6 +1351,7 @@ static void test_connect_pin(void)
IFilterGraph2 *graph = create_graph();
struct testfilter source;
IMemAllocator *allocator;
+ IMediaControl *control;
IMemInputPin *input;
AM_MEDIA_TYPE mt;
IPin *pin, *peer;
@@ -1382,6 +1371,7 @@ static void test_connect_pin(void)
IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, NULL);
IFilterGraph2_AddFilter(graph, filter, NULL);
+ IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
@@ -1469,9 +1459,9 @@ static void test_connect_pin(void)
hr = IMemInputPin_ReceiveCanBlock(input);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- test_filter_state(input, graph);
- test_flushing(pin, input, graph);
- test_current_image(filter, input, graph, &vih.bmiHeader);
+ test_filter_state(input, control);
+ test_flushing(pin, input, control);
+ test_current_image(filter, input, control, &vih.bmiHeader);
hr = IFilterGraph2_Disconnect(graph, pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -1490,6 +1480,7 @@ static void test_connect_pin(void)
IMemInputPin_Release(input);
IPin_Release(pin);
+ IMediaControl_Release(control);
ref = IFilterGraph2_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
ref = IBaseFilter_Release(filter);
--
2.29.2
2
7
[PATCH] urlmon: Reimplement canonicalize_ipv6address on top of ntdll functions
by Alex Henrie Nov. 16, 2020
by Alex Henrie Nov. 16, 2020
Nov. 16, 2020
And add a test for an address that was not canonicalized correctly in
the previous implementation.
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
dlls/urlmon/tests/uri.c | 25 +++
dlls/urlmon/uri.c | 439 +++-------------------------------------
2 files changed, 48 insertions(+), 416 deletions(-)
diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c
index b6d2182a270..b161d1f3eec 100644
--- a/dlls/urlmon/tests/uri.c
+++ b/dlls/urlmon/tests/uri.c
@@ -1725,6 +1725,31 @@ static const uri_properties uri_tests[] = {
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
},
+ { "http://[::5efe:1.2.3.4]", 0, S_OK, FALSE,
+ {
+ {"http://[::5efe:1.2.3.4]/",S_OK,FALSE},
+ {"[::5efe:1.2.3.4]",S_OK,FALSE},
+ {"http://[::5efe:1.2.3.4]/",S_OK,FALSE},
+ {"",S_FALSE,FALSE},
+ {"",S_FALSE,FALSE},
+ {"",S_FALSE,FALSE},
+ {"::5efe:1.2.3.4",S_OK,FALSE},
+ {"",S_FALSE,FALSE},
+ {"/",S_OK,FALSE},
+ {"/",S_OK,FALSE},
+ {"",S_FALSE,FALSE},
+ {"http://[::5efe:1.2.3.4]",S_OK,FALSE},
+ {"http",S_OK,FALSE},
+ {"",S_FALSE,FALSE},
+ {"",S_FALSE,FALSE},
+ },
+ {
+ {Uri_HOST_IPV6,S_OK,FALSE},
+ {80,S_OK,FALSE},
+ {URL_SCHEME_HTTP,S_OK,FALSE},
+ {URLZONE_INVALID,E_NOTIMPL,FALSE}
+ }
+ },
/* Windows doesn't do anything to IPv6's in unknown schemes. */
{ "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
{
diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c
index b16ad07d6a8..953e7ff070c 100644
--- a/dlls/urlmon/uri.c
+++ b/dlls/urlmon/uri.c
@@ -27,6 +27,10 @@
#include "shlwapi.h"
#include "strsafe.h"
+#include "winternl.h"
+#include "inaddr.h"
+#include "in6addr.h"
+#include "ip2string.h"
#define URI_DISPLAY_NO_ABSOLUTE_URI 0x1
#define URI_DISPLAY_NO_DEFAULT_PORT_AUTH 0x2
@@ -128,27 +132,6 @@ typedef struct {
DWORD username_len;
} UriBuilder;
-typedef struct {
- const WCHAR *str;
- DWORD len;
-} h16;
-
-typedef struct {
- /* IPv6 addresses can hold up to 8 h16 components. */
- h16 components[8];
- DWORD h16_count;
-
- /* An IPv6 can have 1 elision ("::"). */
- const WCHAR *elision;
-
- /* An IPv6 can contain 1 IPv4 address as the last 32bits of the address. */
- const WCHAR *ipv4;
- DWORD ipv4_len;
-
- INT components_size;
- INT elision_size;
-} ipv6_address;
-
typedef struct {
BSTR uri;
@@ -173,7 +156,7 @@ typedef struct {
DWORD host_len;
Uri_HOST_TYPE host_type;
- ipv6_address ipv6_address;
+ IN6_ADDR ipv6_address;
BOOL has_port;
const WCHAR *port;
@@ -434,31 +417,6 @@ static inline BOOL is_hierarchical_uri(const WCHAR **ptr, const parse_data *data
return FALSE;
}
-/* Computes the size of the given IPv6 address.
- * Each h16 component is 16 bits. If there is an IPv4 address, it's
- * 32 bits. If there's an elision it can be 16 to 128 bits, depending
- * on the number of other components.
- *
- * Modeled after google-url's CheckIPv6ComponentsSize function
- */
-static void compute_ipv6_comps_size(ipv6_address *address) {
- address->components_size = address->h16_count * 2;
-
- if(address->ipv4)
- /* IPv4 address is 4 bytes. */
- address->components_size += 4;
-
- if(address->elision) {
- /* An elision can be anywhere from 2 bytes up to 16 bytes.
- * Its size depends on the size of the h16 and IPv4 components.
- */
- address->elision_size = 16 - address->components_size;
- if(address->elision_size < 2)
- address->elision_size = 2;
- } else
- address->elision_size = 0;
-}
-
/* Taken from dlls/jscript/lex.c */
static int hex_to_int(WCHAR val) {
if(val >= '0' && val <= '9')
@@ -693,72 +651,6 @@ static INT find_file_extension(const WCHAR *path, DWORD path_len) {
return -1;
}
-/* Computes the location where the elision should occur in the IPv6
- * address using the numerical values of each component stored in
- * 'values'. If the address shouldn't contain an elision then 'index'
- * is assigned -1 as its value. Otherwise 'index' will contain the
- * starting index (into values) where the elision should be, and 'count'
- * will contain the number of cells the elision covers.
- *
- * NOTES:
- * Windows will expand an elision if the elision only represents one h16
- * component of the address.
- *
- * Ex: [1::2:3:4:5:6:7] -> [1:0:2:3:4:5:6:7]
- *
- * If the IPv6 address contains an IPv4 address, the IPv4 address is also
- * considered for being included as part of an elision if all its components
- * are zeros.
- *
- * Ex: [1:2:3:4:5:6:0.0.0.0] -> [1:2:3:4:5:6::]
- */
-static void compute_elision_location(const ipv6_address *address, const USHORT values[8],
- INT *index, DWORD *count) {
- DWORD i, max_len, cur_len;
- INT max_index, cur_index;
-
- max_len = cur_len = 0;
- max_index = cur_index = -1;
- for(i = 0; i < 8; ++i) {
- BOOL check_ipv4 = (address->ipv4 && i == 6);
- BOOL is_end = (check_ipv4 || i == 7);
-
- if(check_ipv4) {
- /* Check if the IPv4 address contains only zeros. */
- if(values[i] == 0 && values[i+1] == 0) {
- if(cur_index == -1)
- cur_index = i;
-
- cur_len += 2;
- ++i;
- }
- } else if(values[i] == 0) {
- if(cur_index == -1)
- cur_index = i;
-
- ++cur_len;
- }
-
- if(is_end || values[i] != 0) {
- /* We only consider it for an elision if it's
- * more than 1 component long.
- */
- if(cur_len > 1 && cur_len > max_len) {
- /* Found the new elision location. */
- max_len = cur_len;
- max_index = cur_index;
- }
-
- /* Reset the current range for the next range of zeros. */
- cur_index = -1;
- cur_len = 0;
- }
- }
-
- *index = max_index;
- *count = max_len;
-}
-
/* Removes all the leading and trailing white spaces or
* control characters from the URI and removes all control
* characters inside of the URI string.
@@ -798,30 +690,6 @@ static BSTR pre_process_uri(LPCWSTR uri) {
return ret;
}
-/* Converts the specified IPv4 address into an uint value.
- *
- * This function assumes that the IPv4 address has already been validated.
- */
-static UINT ipv4toui(const WCHAR *ip, DWORD len) {
- UINT ret = 0;
- DWORD comp_value = 0;
- const WCHAR *ptr;
-
- for(ptr = ip; ptr < ip+len; ++ptr) {
- if(*ptr == '.') {
- ret <<= 8;
- ret += comp_value;
- comp_value = 0;
- } else
- comp_value = comp_value*10 + (*ptr-'0');
- }
-
- ret <<= 8;
- ret += comp_value;
-
- return ret;
-}
-
/* Converts an IPv4 address in numerical form into its fully qualified
* string form. This function returns the number of characters written
* to 'dest'. If 'dest' is NULL this function will return the number of
@@ -863,70 +731,6 @@ static DWORD ui2str(WCHAR *dest, UINT value) {
return ret;
}
-/* Converts a h16 component (from an IPv6 address) into its
- * numerical value.
- *
- * This function assumes that the h16 component has already been validated.
- */
-static USHORT h16tous(h16 component) {
- DWORD i;
- USHORT ret = 0;
-
- for(i = 0; i < component.len; ++i) {
- ret <<= 4;
- ret += hex_to_int(component.str[i]);
- }
-
- return ret;
-}
-
-/* Converts an IPv6 address into its 128 bits (16 bytes) numerical value.
- *
- * This function assumes that the ipv6_address has already been validated.
- */
-static BOOL ipv6_to_number(const ipv6_address *address, USHORT number[8]) {
- DWORD i, cur_component = 0;
- BOOL already_passed_elision = FALSE;
-
- for(i = 0; i < address->h16_count; ++i) {
- if(address->elision) {
- if(address->components[i].str > address->elision && !already_passed_elision) {
- /* Means we just passed the elision and need to add its values to
- * 'number' before we do anything else.
- */
- INT j;
- for(j = 0; j < address->elision_size; j+=2)
- number[cur_component++] = 0;
-
- already_passed_elision = TRUE;
- }
- }
-
- number[cur_component++] = h16tous(address->components[i]);
- }
-
- /* Case when the elision appears after the h16 components. */
- if(!already_passed_elision && address->elision) {
- INT j;
- for(j = 0; j < address->elision_size; j+=2)
- number[cur_component++] = 0;
- }
-
- if(address->ipv4) {
- UINT value = ipv4toui(address->ipv4, address->ipv4_len);
-
- if(cur_component != 6) {
- ERR("(%p %p): Failed sanity check with %d\n", address, number, cur_component);
- return FALSE;
- }
-
- number[cur_component++] = (value >> 16) & 0xffff;
- number[cur_component] = value & 0xffff;
- }
-
- return TRUE;
-}
-
/* Checks if the characters pointed to by 'ptr' are
* a percent encoded data octet.
*
@@ -1566,141 +1370,17 @@ static BOOL parse_reg_name(const WCHAR **ptr, parse_data *data, DWORD extras) {
*
* h16 = 1*4HEXDIG
* ; 16 bits of address represented in hexadecimal.
- *
- * Modeled after google-url's 'DoParseIPv6' function.
*/
static BOOL parse_ipv6address(const WCHAR **ptr, parse_data *data) {
- const WCHAR *start, *cur_start;
- ipv6_address ip;
-
- start = cur_start = *ptr;
- memset(&ip, 0, sizeof(ipv6_address));
-
- for(;; ++(*ptr)) {
- /* Check if we're on the last character of the host. */
- BOOL is_end = (is_auth_delim(**ptr, data->scheme_type != URL_SCHEME_UNKNOWN)
- || **ptr == ']');
-
- BOOL is_split = (**ptr == ':');
- BOOL is_elision = (is_split && !is_end && *(*ptr+1) == ':');
-
- /* Check if we're at the end of a component, or
- * if we're at the end of the IPv6 address.
- */
- if(is_split || is_end) {
- DWORD cur_len = 0;
-
- cur_len = *ptr - cur_start;
-
- /* h16 can't have a length > 4. */
- if(cur_len > 4) {
- *ptr = start;
-
- TRACE("(%p %p): h16 component to long.\n", ptr, data);
- return FALSE;
- }
-
- if(cur_len == 0) {
- /* An h16 component can't have the length of 0 unless
- * the elision is at the beginning of the address, or
- * at the end of the address.
- */
- if(!((*ptr == start && is_elision) ||
- (is_end && (*ptr-2) == ip.elision))) {
- *ptr = start;
- TRACE("(%p %p): IPv6 component cannot have a length of 0.\n", ptr, data);
- return FALSE;
- }
- }
-
- if(cur_len > 0) {
- /* An IPv6 address can have no more than 8 h16 components. */
- if(ip.h16_count >= 8) {
- *ptr = start;
- TRACE("(%p %p): Not a IPv6 address, too many h16 components.\n", ptr, data);
- return FALSE;
- }
-
- ip.components[ip.h16_count].str = cur_start;
- ip.components[ip.h16_count].len = cur_len;
-
- TRACE("(%p %p): Found h16 component %s, len=%d, h16_count=%d\n",
- ptr, data, debugstr_wn(cur_start, cur_len), cur_len,
- ip.h16_count);
- ++ip.h16_count;
- }
- }
-
- if(is_end)
- break;
+ const WCHAR *terminator;
- if(is_elision) {
- /* A IPv6 address can only have 1 elision ('::'). */
- if(ip.elision) {
- *ptr = start;
-
- TRACE("(%p %p): IPv6 address cannot have 2 elisions.\n", ptr, data);
- return FALSE;
- }
-
- ip.elision = *ptr;
- ++(*ptr);
- }
-
- if(is_split)
- cur_start = *ptr+1;
- else {
- if(!check_ipv4address(ptr, TRUE)) {
- if(!is_hexdigit(**ptr)) {
- /* Not a valid character for an IPv6 address. */
- *ptr = start;
- return FALSE;
- }
- } else {
- /* Found an IPv4 address. */
- ip.ipv4 = cur_start;
- ip.ipv4_len = *ptr - cur_start;
-
- TRACE("(%p %p): Found an attached IPv4 address %s len=%d.\n",
- ptr, data, debugstr_wn(ip.ipv4, ip.ipv4_len), ip.ipv4_len);
-
- /* IPv4 addresses can only appear at the end of a IPv6. */
- break;
- }
- }
- }
-
- compute_ipv6_comps_size(&ip);
-
- /* Make sure the IPv6 address adds up to 16 bytes. */
- if(ip.components_size + ip.elision_size != 16) {
- *ptr = start;
- TRACE("(%p %p): Invalid IPv6 address, did not add up to 16 bytes.\n", ptr, data);
+ if(RtlIpv6StringToAddressW(*ptr, &terminator, &data->ipv6_address) != 0)
+ return FALSE;
+ if(*terminator != ']' && !is_auth_delim(*terminator, data->scheme_type != URL_SCHEME_UNKNOWN))
return FALSE;
- }
-
- if(ip.elision_size == 2) {
- /* For some reason on Windows if an elision that represents
- * only one h16 component is encountered at the very begin or
- * end of an IPv6 address, Windows does not consider it a
- * valid IPv6 address.
- *
- * Ex: [::2:3:4:5:6:7] is not valid, even though the sum
- * of all the components == 128bits.
- */
- if(ip.elision < ip.components[0].str ||
- ip.elision > ip.components[ip.h16_count-1].str) {
- *ptr = start;
- TRACE("(%p %p): Invalid IPv6 address. Detected elision of 2 bytes at the beginning or end of the address.\n",
- ptr, data);
- return FALSE;
- }
- }
+ *ptr = terminator;
data->host_type = Uri_HOST_IPV6;
- data->ipv6_address = ip;
-
- TRACE("(%p %p): Found valid IPv6 literal %s len=%d\n", ptr, data, debugstr_wn(start, *ptr-start), (int)(*ptr-start));
return TRUE;
}
@@ -2555,96 +2235,23 @@ static BOOL canonicalize_ipv6address(const parse_data *data, Uri *uri,
memcpy(uri->canon_uri+uri->canon_len, data->host, data->host_len*sizeof(WCHAR));
uri->canon_len += data->host_len;
} else {
- USHORT values[8];
- INT elision_start;
- DWORD i, elision_len;
+ WCHAR buffer[46];
+ ULONG size = ARRAY_SIZE(buffer);
- if(!ipv6_to_number(&(data->ipv6_address), values)) {
- TRACE("(%p %p %x %d): Failed to compute numerical value for IPv6 address.\n",
- data, uri, flags, computeOnly);
- return FALSE;
+ if(computeOnly)
+ {
+ RtlIpv6AddressToStringExW(&data->ipv6_address, 0, 0, buffer, &size);
+ uri->canon_len += size + 1;
}
-
- if(!computeOnly)
+ else
+ {
uri->canon_uri[uri->canon_len] = '[';
- ++uri->canon_len;
-
- /* Find where the elision should occur (if any). */
- compute_elision_location(&(data->ipv6_address), values, &elision_start, &elision_len);
-
- TRACE("%p %p %x %d): Elision starts at %d, len=%u\n", data, uri, flags,
- computeOnly, elision_start, elision_len);
-
- for(i = 0; i < 8; ++i) {
- BOOL in_elision = (elision_start > -1 && i >= elision_start &&
- i < elision_start+elision_len);
- BOOL do_ipv4 = (i == 6 && data->ipv6_address.ipv4 && !in_elision &&
- data->ipv6_address.h16_count == 0);
-
- if(i == elision_start) {
- if(!computeOnly) {
- uri->canon_uri[uri->canon_len] = ':';
- uri->canon_uri[uri->canon_len+1] = ':';
- }
- uri->canon_len += 2;
- }
-
- /* We can ignore the current component if we're in the elision. */
- if(in_elision)
- continue;
-
- /* We only add a ':' if we're not at i == 0, or when we're at
- * the very end of elision range since the ':' colon was handled
- * earlier. Otherwise we would end up with ":::" after elision.
- */
- if(i != 0 && !(elision_start > -1 && i == elision_start+elision_len)) {
- if(!computeOnly)
- uri->canon_uri[uri->canon_len] = ':';
- ++uri->canon_len;
- }
-
- if(do_ipv4) {
- UINT val;
- DWORD len;
-
- /* Combine the two parts of the IPv4 address values. */
- val = values[i];
- val <<= 16;
- val += values[i+1];
-
- if(!computeOnly)
- len = ui2ipv4(uri->canon_uri+uri->canon_len, val);
- else
- len = ui2ipv4(NULL, val);
-
- uri->canon_len += len;
- ++i;
- } else {
- /* Write a regular h16 component to the URI. */
-
- /* Short circuit for the trivial case. */
- if(values[i] == 0) {
- if(!computeOnly)
- uri->canon_uri[uri->canon_len] = '0';
- ++uri->canon_len;
- } else {
- static const WCHAR formatW[] = {'%','x',0};
-
- if(!computeOnly)
- uri->canon_len += swprintf(uri->canon_uri+uri->canon_len, 5,
- formatW, values[i]);
- else {
- WCHAR tmp[5];
- uri->canon_len += swprintf(tmp, ARRAY_SIZE(tmp), formatW, values[i]);
- }
- }
- }
- }
-
- /* Add the closing ']'. */
- if(!computeOnly)
+ ++uri->canon_len;
+ RtlIpv6AddressToStringExW(&data->ipv6_address, 0, 0, uri->canon_uri + uri->canon_len, &size);
+ uri->canon_len += size - 1;
uri->canon_uri[uri->canon_len] = ']';
- ++uri->canon_len;
+ ++uri->canon_len;
+ }
}
uri->host_len = uri->canon_len - uri->host_start;
--
2.29.2
1
0
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/kernel32/comm.c | 54 ++++++++++++++--------------------------
dlls/kernel32/console.c | 5 +---
dlls/kernel32/debugger.c | 12 +++------
dlls/kernel32/file.c | 4 +--
dlls/kernel32/lcformat.c | 3 +--
dlls/kernel32/module.c | 6 ++---
dlls/kernel32/process.c | 5 ++--
dlls/kernel32/profile.c | 41 +++++++++++-------------------
dlls/kernel32/resource.c | 3 +--
dlls/kernel32/volume.c | 4 +--
10 files changed, 47 insertions(+), 90 deletions(-)
diff --git a/dlls/kernel32/comm.c b/dlls/kernel32/comm.c
index 35a510e6881..209a490b623 100644
--- a/dlls/kernel32/comm.c
+++ b/dlls/kernel32/comm.c
@@ -43,11 +43,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(comm);
*/
static LPCWSTR COMM_ParseStart(LPCWSTR ptr)
{
- static const WCHAR comW[] = {'C','O','M',0};
-
/* The device control string may optionally start with "COMx" followed
by an optional ':' and spaces. */
- if(!wcsnicmp(ptr, comW, 3))
+ if(!wcsnicmp(ptr, L"COM", 3))
{
ptr += 3;
@@ -140,9 +138,8 @@ static LPCWSTR COMM_ParseByteSize(LPCWSTR ptr, LPBYTE lpbytesize)
static LPCWSTR COMM_ParseStopBits(LPCWSTR ptr, LPBYTE lpstopbits)
{
DWORD temp;
- static const WCHAR stopbits15W[] = {'1','.','5',0};
- if(!wcsncmp(stopbits15W, ptr, 3))
+ if(!wcsncmp(L"1.5", ptr, 3))
{
ptr += 3;
*lpstopbits = ONE5STOPBITS;
@@ -165,15 +162,12 @@ static LPCWSTR COMM_ParseStopBits(LPCWSTR ptr, LPBYTE lpstopbits)
static LPCWSTR COMM_ParseOnOff(LPCWSTR ptr, LPDWORD lponoff)
{
- static const WCHAR onW[] = {'o','n',0};
- static const WCHAR offW[] = {'o','f','f',0};
-
- if(!wcsnicmp(onW, ptr, 2))
+ if(!wcsnicmp(L"on", ptr, 2))
{
ptr += 2;
*lponoff = 1;
}
- else if(!wcsnicmp(offW, ptr, 3))
+ else if(!wcsnicmp(L"off", ptr, 3))
{
ptr += 3;
*lponoff = 0;
@@ -295,47 +289,36 @@ static BOOL COMM_BuildNewCommDCB(LPCWSTR device, LPDCB lpdcb, LPCOMMTIMEOUTS lpt
{
DWORD temp;
BOOL baud = FALSE, stop = FALSE;
- static const WCHAR baudW[] = {'b','a','u','d','=',0};
- static const WCHAR parityW[] = {'p','a','r','i','t','y','=',0};
- static const WCHAR dataW[] = {'d','a','t','a','=',0};
- static const WCHAR stopW[] = {'s','t','o','p','=',0};
- static const WCHAR toW[] = {'t','o','=',0};
- static const WCHAR xonW[] = {'x','o','n','=',0};
- static const WCHAR odsrW[] = {'o','d','s','r','=',0};
- static const WCHAR octsW[] = {'o','c','t','s','=',0};
- static const WCHAR dtrW[] = {'d','t','r','=',0};
- static const WCHAR rtsW[] = {'r','t','s','=',0};
- static const WCHAR idsrW[] = {'i','d','s','r','=',0};
while(*device)
{
while(*device == ' ') device++;
- if(!wcsnicmp(baudW, device, 5))
+ if(!wcsnicmp(L"baud=", device, 5))
{
baud = TRUE;
-
+
if(!(device = COMM_ParseNumber(device + 5, &lpdcb->BaudRate)))
return FALSE;
}
- else if(!wcsnicmp(parityW, device, 7))
+ else if(!wcsnicmp(L"parity=", device, 7))
{
if(!(device = COMM_ParseParity(device + 7, &lpdcb->Parity)))
return FALSE;
}
- else if(!wcsnicmp(dataW, device, 5))
+ else if(!wcsnicmp(L"data=", device, 5))
{
if(!(device = COMM_ParseByteSize(device + 5, &lpdcb->ByteSize)))
return FALSE;
}
- else if(!wcsnicmp(stopW, device, 5))
+ else if(!wcsnicmp(L"stop=", device, 5))
{
stop = TRUE;
-
+
if(!(device = COMM_ParseStopBits(device + 5, &lpdcb->StopBits)))
return FALSE;
}
- else if(!wcsnicmp(toW, device, 3))
+ else if(!wcsnicmp(L"to=", device, 3))
{
if(!(device = COMM_ParseOnOff(device + 3, &temp)))
return FALSE;
@@ -346,7 +329,7 @@ static BOOL COMM_BuildNewCommDCB(LPCWSTR device, LPDCB lpdcb, LPCOMMTIMEOUTS lpt
lptimeouts->WriteTotalTimeoutMultiplier = 0;
lptimeouts->WriteTotalTimeoutConstant = temp ? 60000 : 0;
}
- else if(!wcsnicmp(xonW, device, 4))
+ else if(!wcsnicmp(L"xon=", device, 4))
{
if(!(device = COMM_ParseOnOff(device + 4, &temp)))
return FALSE;
@@ -354,35 +337,35 @@ static BOOL COMM_BuildNewCommDCB(LPCWSTR device, LPDCB lpdcb, LPCOMMTIMEOUTS lpt
lpdcb->fOutX = temp;
lpdcb->fInX = temp;
}
- else if(!wcsnicmp(odsrW, device, 5))
+ else if(!wcsnicmp(L"odsr=", device, 5))
{
if(!(device = COMM_ParseOnOff(device + 5, &temp)))
return FALSE;
lpdcb->fOutxDsrFlow = temp;
}
- else if(!wcsnicmp(octsW, device, 5))
+ else if(!wcsnicmp(L"octs=", device, 5))
{
if(!(device = COMM_ParseOnOff(device + 5, &temp)))
return FALSE;
lpdcb->fOutxCtsFlow = temp;
}
- else if(!wcsnicmp(dtrW, device, 4))
+ else if(!wcsnicmp(L"dtr=", device, 4))
{
if(!(device = COMM_ParseOnOff(device + 4, &temp)))
return FALSE;
lpdcb->fDtrControl = temp;
}
- else if(!wcsnicmp(rtsW, device, 4))
+ else if(!wcsnicmp(L"rts=", device, 4))
{
if(!(device = COMM_ParseOnOff(device + 4, &temp)))
return FALSE;
lpdcb->fRtsControl = temp;
}
- else if(!wcsnicmp(idsrW, device, 5))
+ else if(!wcsnicmp(L"idsr=", device, 5))
{
if(!(device = COMM_ParseOnOff(device + 5, &temp)))
return FALSE;
@@ -548,8 +531,7 @@ BOOL WINAPI BuildCommDCBW(
* The DLL should be loaded when the COMM port is opened, and closed
* when the COMM port is closed. - MJM 20 June 2000
***********************************************************************/
-static const WCHAR lpszSerialUI[] = {
- 's','e','r','i','a','l','u','i','.','d','l','l',0 };
+static const WCHAR lpszSerialUI[] = L"serialui.dll";
/***********************************************************************
diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index d55c589eaf7..3171dcd8e7a 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -45,9 +45,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(console);
-static const WCHAR coninW[] = {'C','O','N','I','N','$',0};
-static const WCHAR conoutW[] = {'C','O','N','O','U','T','$',0};
-
/******************************************************************************
* GetConsoleWindow [KERNEL32.@] Get hwnd of the console window.
*
@@ -79,7 +76,7 @@ HANDLE WINAPI OpenConsoleW(LPCWSTR name, DWORD access, BOOL inherit, DWORD creat
TRACE("(%s, 0x%08x, %d, %u)\n", debugstr_w(name), access, inherit, creation);
- if (!name || (wcsicmp( coninW, name ) && wcsicmp( conoutW, name )) || creation != OPEN_EXISTING)
+ if (!name || (wcsicmp( L"CONIN$", name ) && wcsicmp( L"CONOUT$", name )) || creation != OPEN_EXISTING)
{
SetLastError( ERROR_INVALID_PARAMETER );
return INVALID_HANDLE_VALUE;
diff --git a/dlls/kernel32/debugger.c b/dlls/kernel32/debugger.c
index d049b8bad33..b80b0f0afd1 100644
--- a/dlls/kernel32/debugger.c
+++ b/dlls/kernel32/debugger.c
@@ -73,8 +73,7 @@ void WINAPI DECLSPEC_HOTPATCH OutputDebugStringA( LPCSTR str )
if (!mutex_inited)
{
/* first call to OutputDebugString, initialize mutex handle */
- static const WCHAR mutexname[] = {'D','B','W','i','n','M','u','t','e','x',0};
- HANDLE mutex = CreateMutexExW( NULL, mutexname, 0, SYNCHRONIZE );
+ HANDLE mutex = CreateMutexExW( NULL, L"DBWinMutex", 0, SYNCHRONIZE );
if (mutex)
{
if (InterlockedCompareExchangePointer( &DBWinMutex, mutex, 0 ) != 0)
@@ -86,20 +85,17 @@ void WINAPI DECLSPEC_HOTPATCH OutputDebugStringA( LPCSTR str )
if (DBWinMutex)
{
- static const WCHAR shmname[] = {'D','B','W','I','N','_','B','U','F','F','E','R',0};
- static const WCHAR eventbuffername[] = {'D','B','W','I','N','_','B','U','F','F','E','R','_','R','E','A','D','Y',0};
- static const WCHAR eventdataname[] = {'D','B','W','I','N','_','D','A','T','A','_','R','E','A','D','Y',0};
HANDLE mapping;
- mapping = OpenFileMappingW( FILE_MAP_WRITE, FALSE, shmname );
+ mapping = OpenFileMappingW( FILE_MAP_WRITE, FALSE, L"DBWIN_BUFFER" );
if (mapping)
{
LPVOID buffer;
HANDLE eventbuffer, eventdata;
buffer = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 0 );
- eventbuffer = OpenEventW( SYNCHRONIZE, FALSE, eventbuffername );
- eventdata = OpenEventW( EVENT_MODIFY_STATE, FALSE, eventdataname );
+ eventbuffer = OpenEventW( SYNCHRONIZE, FALSE, L"DBWIN_BUFFER_READY" );
+ eventdata = OpenEventW( EVENT_MODIFY_STATE, FALSE, L"DBWIN_DATA_READY" );
if (buffer && eventbuffer && eventdata)
{
diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c
index dfedb443412..897d8abd14a 100644
--- a/dlls/kernel32/file.c
+++ b/dlls/kernel32/file.c
@@ -44,8 +44,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(file);
-static const WCHAR krnl386W[] = {'k','r','n','l','3','8','6','.','e','x','e','1','6',0};
-
/***********************************************************************
* create_file_OF
*
@@ -452,7 +450,7 @@ BOOL WINAPI DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode,
static DeviceIoProc (*vxd_get_proc)(HANDLE);
DeviceIoProc proc = NULL;
- if (!vxd_get_proc) vxd_get_proc = (void *)GetProcAddress( GetModuleHandleW(krnl386W),
+ if (!vxd_get_proc) vxd_get_proc = (void *)GetProcAddress( GetModuleHandleW(L"krnl386.exe16"),
"__wine_vxd_get_proc" );
if (vxd_get_proc) proc = vxd_get_proc( hDevice );
if (proc) return proc( dwIoControlCode, lpvInBuffer, cbInBuffer,
diff --git a/dlls/kernel32/lcformat.c b/dlls/kernel32/lcformat.c
index e02e06c2ec3..47f55b4b27d 100644
--- a/dlls/kernel32/lcformat.c
+++ b/dlls/kernel32/lcformat.c
@@ -672,9 +672,8 @@ static INT NLS_GetDateTimeFormatW(LCID lcid, DWORD dwFlags,
if (szAdd == buff && buff[0] == '\0')
{
- static const WCHAR fmtW[] = {'%','.','*','d',0};
/* We have a numeric value to add */
- swprintf(buff, ARRAY_SIZE(buff), fmtW, count, dwVal);
+ swprintf(buff, ARRAY_SIZE(buff), L"%.*d", count, dwVal);
}
dwLen = szAdd ? lstrlenW(szAdd) : 0;
diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c
index 9b3a3952307..0449bedf83f 100644
--- a/dlls/kernel32/module.c
+++ b/dlls/kernel32/module.c
@@ -165,8 +165,6 @@ BOOL WINAPI SetDllDirectoryW( LPCWSTR dir )
*/
BOOL WINAPI GetBinaryTypeW( LPCWSTR name, LPDWORD type )
{
- static const WCHAR comW[] = { '.','c','o','m',0 };
- static const WCHAR pifW[] = { '.','p','i','f',0 };
HANDLE hfile, mapping;
NTSTATUS status;
const WCHAR *ptr;
@@ -226,12 +224,12 @@ BOOL WINAPI GetBinaryTypeW( LPCWSTR name, LPDWORD type )
case STATUS_INVALID_IMAGE_NOT_MZ:
if ((ptr = wcsrchr( name, '.' )))
{
- if (!wcsicmp( ptr, comW ))
+ if (!wcsicmp( ptr, L".com" ))
{
*type = SCS_DOS_BINARY;
return TRUE;
}
- if (!wcsicmp( ptr, pifW ))
+ if (!wcsicmp( ptr, L".pif" ))
{
*type = SCS_PIF_BINARY;
return TRUE;
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 83253db4a85..c2df0ccd658 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -52,9 +52,8 @@ typedef struct
HMODULE kernel32_handle = 0;
SYSTEM_BASIC_INFORMATION system_info = { 0 };
-const WCHAR DIR_Windows[] = {'C',':','\\','w','i','n','d','o','w','s',0};
-const WCHAR DIR_System[] = {'C',':','\\','w','i','n','d','o','w','s',
- '\\','s','y','s','t','e','m','3','2',0};
+const WCHAR DIR_Windows[] = L"C:\\windows";
+const WCHAR DIR_System[] = L"C:\\windows\\system32";
/* Process flags */
#define PDB32_DEBUGGED 0x0001 /* Process is being debugged */
diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c
index cc331811821..92c163700ac 100644
--- a/dlls/kernel32/profile.c
+++ b/dlls/kernel32/profile.c
@@ -78,9 +78,6 @@ static PROFILE *MRUProfile[N_CACHED_PROFILES]={NULL};
/* Check for comments in profile */
#define IS_ENTRY_COMMENT(str) ((str)[0] == ';')
-static const WCHAR emptystringW[] = {0};
-static const WCHAR wininiW[] = { 'w','i','n','.','i','n','i',0 };
-
static CRITICAL_SECTION PROFILE_CritSect;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
@@ -725,16 +722,15 @@ static BOOL PROFILE_Open( LPCWSTR filename, BOOL write_access )
}
if (!filename)
- filename = wininiW;
+ filename = L"win.ini";
if ((RtlDetermineDosPathNameType_U(filename) == RELATIVE_PATH) &&
!wcschr(filename, '\\') && !wcschr(filename, '/'))
{
- static const WCHAR wszSeparator[] = {'\\', 0};
WCHAR windirW[MAX_PATH];
GetWindowsDirectoryW( windirW, MAX_PATH );
lstrcpyW(buffer, windirW);
- lstrcatW(buffer, wszSeparator);
+ lstrcatW(buffer, L"\\");
lstrcatW(buffer, filename);
}
else
@@ -1015,17 +1011,14 @@ static BOOL PROFILE_SetString( LPCWSTR section_name, LPCWSTR key_name,
static HKEY open_file_mapping_key( const WCHAR *filename )
{
- static const WCHAR mapping_pathW[] = {'S','o','f','t','w','a','r','e',
- '\\','M','i','c','r','o','s','o','f','t',
- '\\','W','i','n','d','o','w','s',' ','N','T',
- '\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n',
- '\\','I','n','i','F','i','l','e','M','a','p','p','i','n','g',0};
static HKEY mapping_key;
HKEY key;
EnterCriticalSection( &PROFILE_CritSect );
- if (!mapping_key && RegOpenKeyExW( HKEY_LOCAL_MACHINE, mapping_pathW, 0, KEY_WOW64_64KEY, &mapping_key ))
+ if (!mapping_key && RegOpenKeyExW( HKEY_LOCAL_MACHINE,
+ L"Software\\Microsoft\\Windows NT\\CurrentVersion\\IniFileMapping",
+ 0, KEY_WOW64_64KEY, &mapping_key ))
mapping_key = NULL;
LeaveCriticalSection( &PROFILE_CritSect );
@@ -1073,7 +1066,6 @@ static WCHAR *get_key_value( HKEY key, const WCHAR *value )
static HKEY open_mapped_key( const WCHAR *path, BOOL write )
{
- static const WCHAR softwareW[] = {'S','o','f','t','w','a','r','e','\\',0};
static const WCHAR usrW[] = {'U','S','R',':'};
static const WCHAR sysW[] = {'S','Y','S',':'};
WCHAR *combined_path;
@@ -1099,9 +1091,9 @@ static HKEY open_mapped_key( const WCHAR *path, BOOL write )
{
p += 4;
if (!(combined_path = HeapAlloc( GetProcessHeap(), 0,
- (ARRAY_SIZE( softwareW ) + lstrlenW( p )) * sizeof(WCHAR) )))
+ (ARRAY_SIZE( L"Software\\" ) + lstrlenW( p )) * sizeof(WCHAR) )))
return NULL;
- lstrcpyW( combined_path, softwareW );
+ lstrcpyW( combined_path, L"Software\\" );
lstrcatW( combined_path, p );
if (write)
res = RegCreateKeyExW( HKEY_LOCAL_MACHINE, combined_path, 0, NULL,
@@ -1120,7 +1112,6 @@ static HKEY open_mapped_key( const WCHAR *path, BOOL write )
static BOOL get_mapped_section_key( const WCHAR *filename, const WCHAR *section,
const WCHAR *name, BOOL write, HKEY *ret_key )
{
- static const WCHAR backslashW[] = {'\\',0};
WCHAR *path = NULL, *combined_path;
HKEY key, subkey = NULL;
@@ -1145,7 +1136,7 @@ static BOOL get_mapped_section_key( const WCHAR *filename, const WCHAR *section,
(lstrlenW( path ) + lstrlenW( section ) + 2) * sizeof(WCHAR) )))
{
lstrcpyW( combined_path, path );
- lstrcatW( combined_path, backslashW );
+ lstrcatW( combined_path, L"\\" );
lstrcatW( combined_path, section );
}
HeapFree( GetProcessHeap(), 0, path );
@@ -1336,7 +1327,7 @@ UINT WINAPI GetProfileIntA( LPCSTR section, LPCSTR entry, INT def_val )
*/
UINT WINAPI GetProfileIntW( LPCWSTR section, LPCWSTR entry, INT def_val )
{
- return GetPrivateProfileIntW( section, entry, def_val, wininiW );
+ return GetPrivateProfileIntW( section, entry, def_val, L"win.ini" );
}
/***********************************************************************
@@ -1346,7 +1337,6 @@ INT WINAPI GetPrivateProfileStringW( LPCWSTR section, LPCWSTR entry,
LPCWSTR def_val, LPWSTR buffer,
UINT len, LPCWSTR filename )
{
- static const WCHAR emptyW[] = {0};
int ret;
LPWSTR defval_tmp = NULL;
const WCHAR *p;
@@ -1356,7 +1346,7 @@ INT WINAPI GetPrivateProfileStringW( LPCWSTR section, LPCWSTR entry,
debugstr_w(def_val), buffer, len, debugstr_w(filename));
if (!buffer || !len) return 0;
- if (!def_val) def_val = emptyW;
+ if (!def_val) def_val = L"";
if (!section) return GetPrivateProfileSectionNamesW( buffer, len, filename );
if (!entry)
{
@@ -1491,8 +1481,7 @@ INT WINAPI GetProfileStringA( LPCSTR section, LPCSTR entry, LPCSTR def_val,
INT WINAPI GetProfileStringW( LPCWSTR section, LPCWSTR entry,
LPCWSTR def_val, LPWSTR buffer, UINT len )
{
- return GetPrivateProfileStringW( section, entry, def_val,
- buffer, len, wininiW );
+ return GetPrivateProfileStringW( section, entry, def_val, buffer, len, L"win.ini" );
}
/***********************************************************************
@@ -1510,7 +1499,7 @@ BOOL WINAPI WriteProfileStringA( LPCSTR section, LPCSTR entry,
BOOL WINAPI WriteProfileStringW( LPCWSTR section, LPCWSTR entry,
LPCWSTR string )
{
- return WritePrivateProfileStringW( section, entry, string, wininiW );
+ return WritePrivateProfileStringW( section, entry, string, L"win.ini" );
}
@@ -1524,7 +1513,7 @@ UINT WINAPI GetPrivateProfileIntW( LPCWSTR section, LPCWSTR entry,
UNICODE_STRING bufferW;
ULONG result;
- if (GetPrivateProfileStringW( section, entry, emptystringW, buffer, ARRAY_SIZE( buffer ),
+ if (GetPrivateProfileStringW( section, entry, L"", buffer, ARRAY_SIZE( buffer ),
filename ) == 0)
return def_val;
@@ -1638,7 +1627,7 @@ INT WINAPI GetProfileSectionA( LPCSTR section, LPSTR buffer, DWORD len )
*/
INT WINAPI GetProfileSectionW( LPCWSTR section, LPWSTR buffer, DWORD len )
{
- return GetPrivateProfileSectionW( section, buffer, len, wininiW );
+ return GetPrivateProfileSectionW( section, buffer, len, L"win.ini" );
}
@@ -1858,7 +1847,7 @@ BOOL WINAPI WriteProfileSectionA( LPCSTR section, LPCSTR keys_n_values)
*/
BOOL WINAPI WriteProfileSectionW( LPCWSTR section, LPCWSTR keys_n_values)
{
- return WritePrivateProfileSectionW(section, keys_n_values, wininiW);
+ return WritePrivateProfileSectionW(section, keys_n_values, L"win.ini");
}
diff --git a/dlls/kernel32/resource.c b/dlls/kernel32/resource.c
index 7e890907785..18384e7f59f 100644
--- a/dlls/kernel32/resource.c
+++ b/dlls/kernel32/resource.c
@@ -981,7 +981,6 @@ static DWORD get_init_data_size( void *base, DWORD mapping_size )
static BOOL write_raw_resources( QUEUEDUPDATES *updates )
{
- static const WCHAR prefix[] = { 'r','e','s','u',0 };
WCHAR tempdir[MAX_PATH], tempfile[MAX_PATH];
DWORD i, section_size;
BOOL ret = FALSE;
@@ -998,7 +997,7 @@ static BOOL write_raw_resources( QUEUEDUPDATES *updates )
if (!GetTempPathW( MAX_PATH, tempdir ))
return ret;
- if (!GetTempFileNameW( tempdir, prefix, 0, tempfile ))
+ if (!GetTempFileNameW( tempdir, L"resu", 0, tempfile ))
return ret;
if (!CopyFileW( updates->pFileName, tempfile, FALSE ))
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
index fdb109c5138..93f50c080ba 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -210,7 +210,7 @@ static enum fs_type VOLUME_ReadCDSuperblock( HANDLE handle, BYTE *buff )
*/
BOOL WINAPI SetVolumeLabelW( LPCWSTR root, LPCWSTR label )
{
- WCHAR device[] = {'\\','\\','.','\\','A',':',0};
+ WCHAR device[] = L"\\\\.\\A:";
HANDLE handle;
enum fs_type type = FS_UNKNOWN;
@@ -266,7 +266,7 @@ BOOL WINAPI SetVolumeLabelW( LPCWSTR root, LPCWSTR label )
case DRIVE_REMOVABLE:
case DRIVE_FIXED:
{
- WCHAR labelW[] = {'A',':','\\','.','w','i','n','d','o','w','s','-','l','a','b','e','l',0};
+ WCHAR labelW[] = L"A:\\.windows-label";
labelW[0] = device[4];
--
2.26.2
2
1
Merge some of those strings.
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
programs/oleview/typelib.c | 347 +++++++++++++------------------------
1 file changed, 117 insertions(+), 230 deletions(-)
diff --git a/programs/oleview/typelib.c b/programs/oleview/typelib.c
index 92dbebc41d5..19f902a0659 100644
--- a/programs/oleview/typelib.c
+++ b/programs/oleview/typelib.c
@@ -28,20 +28,6 @@ TYPELIB typelib;
static const WCHAR wszTypeLib[] = { 'T','Y','P','E','L','I','B','\0' };
static const WCHAR wszFailed[] = { '<','f','a','i','l','e','d','>','\0' };
-static const WCHAR wszSpace[] = { ' ','\0' };
-static const WCHAR wszAsterix[] = { '*','\0' };
-static const WCHAR wszComa[] = { ',','\0' };
-static const WCHAR wszEquals[] = { '=','\0' };
-static const WCHAR wszSemicolon[] = { ';','\0' };
-static const WCHAR wszNewLine[] = { '\n','\0' };
-static const WCHAR wszOpenBrackets1[] = { '[','\0' };
-static const WCHAR wszCloseBrackets1[] = { ']','\0' };
-static const WCHAR wszOpenBrackets2[] = { '(','\0' };
-static const WCHAR wszCloseBrackets2[] = { ')','\0' };
-static const WCHAR wszOpenBrackets3[] = { '{','\0' };
-static const WCHAR wszCloseBrackets3[] = { '}','\0' };
-static const WCHAR wszInvertedComa[] = { '"','\0' };
-static const WCHAR wszColon[] = { ':','\0' };
static const WCHAR wszUUID[] = { 'u','u','i','d','\0' };
static const WCHAR wszOdl[] = { 'o','d','l','\0' };
@@ -214,10 +200,10 @@ static void AddToTLDataStrWithTabsW(TYPELIB_DATA *pTLData, WCHAR *wszSource)
if(!lineLen) return;
while(*pSourcePos)
{
- if(*pSourcePos == *wszNewLine) newLinesNo++;
+ if(*pSourcePos == L'\n') newLinesNo++;
pSourcePos += 1;
}
- if(*(pSourcePos - 1) != *wszNewLine) newLinesNo++;
+ if(*(pSourcePos - 1) != L'\n') newLinesNo++;
pTLData->idl = HeapReAlloc(GetProcessHeap(), 0, pTLData->idl,
sizeof(WCHAR)*(pTLData->idlLen+lineLen+4*newLinesNo+1));
@@ -226,7 +212,7 @@ static void AddToTLDataStrWithTabsW(TYPELIB_DATA *pTLData, WCHAR *wszSource)
pSourceBeg = wszSource;
while(newLinesNo)
{
- if(*pSourcePos != *wszNewLine && *pSourcePos)
+ if(*pSourcePos != L'\n' && *pSourcePos)
{
pSourcePos += 1;
continue;
@@ -242,10 +228,10 @@ static void AddToTLDataStrWithTabsW(TYPELIB_DATA *pTLData, WCHAR *wszSource)
}
else lineLen = lstrlenW(pSourceBeg);
- pTLData->idl[pTLData->idlLen] = *wszSpace;
- pTLData->idl[pTLData->idlLen+1] = *wszSpace;
- pTLData->idl[pTLData->idlLen+2] = *wszSpace;
- pTLData->idl[pTLData->idlLen+3] = *wszSpace;
+ pTLData->idl[pTLData->idlLen] = L' ';
+ pTLData->idl[pTLData->idlLen+1] = L' ';
+ pTLData->idl[pTLData->idlLen+2] = L' ';
+ pTLData->idl[pTLData->idlLen+3] = L' ';
memcpy(&pTLData->idl[pTLData->idlLen+4], pSourceBeg, sizeof(WCHAR)*lineLen);
pTLData->idlLen += lineLen + 4;
pTLData->idl[pTLData->idlLen] = '\0';
@@ -269,7 +255,7 @@ static TYPELIB_DATA *InitializeTLData(void)
static void AddSpaces(TYPELIB_DATA *pTLData, int tabSize)
{
for(; tabSize>0; tabSize--)
- AddToTLDataStrW(pTLData, wszSpace);
+ AddToTLDataStrW(pTLData, L" ");
}
static void AddChildrenData(HTREEITEM hParent, TYPELIB_DATA *pData)
@@ -341,13 +327,13 @@ static void CreateTypeInfo(WCHAR *wszAddTo, WCHAR *wszAddAfter, TYPEDESC tdesc,
break;
case VT_SAFEARRAY:
AddToStrW(wszAddTo, wszVT_SAFEARRAY);
- AddToStrW(wszAddTo, wszOpenBrackets2);
+ AddToStrW(wszAddTo, L"(");
CreateTypeInfo(wszAddTo, wszAddAfter, *U(tdesc).lptdesc, pTypeInfo);
- AddToStrW(wszAddTo, wszCloseBrackets2);
+ AddToStrW(wszAddTo, L")");
break;
case VT_PTR:
CreateTypeInfo(wszAddTo, wszAddAfter, *U(tdesc).lptdesc, pTypeInfo);
- AddToStrW(wszAddTo, wszAsterix);
+ AddToStrW(wszAddTo, L"*");
break;
case VT_USERDEFINED:
hRes = ITypeInfo_GetRefTypeInfo(pTypeInfo,
@@ -396,33 +382,30 @@ static int EnumVars(ITypeInfo *pTypeInfo, int cVars, HTREEITEM hParent)
if(pVarDesc->memid < MIN_VAR_ID)
{
- AddToTLDataStrW(tld, wszOpenBrackets1);
+ AddToTLDataStrW(tld, L"[");
AddToTLDataStrW(tld, wszId);
- AddToTLDataStrW(tld, wszOpenBrackets2);
+ AddToTLDataStrW(tld, L"(");
wsprintfW(wszText, wszFormat, pVarDesc->memid);
AddToTLDataStrW(tld, wszText);
memset(wszText, 0, sizeof(wszText));
- AddToTLDataStrW(tld, wszCloseBrackets2);
+ AddToTLDataStrW(tld, L")");
if(pVarDesc->wVarFlags & VARFLAG_FREADONLY)
{
- AddToTLDataStrW(tld, wszComa);
- AddToTLDataStrW(tld, wszSpace);
+ AddToTLDataStrW(tld, L", ");
AddToTLDataStrW(tld, wszReadOnly);
}
- AddToTLDataStrW(tld, wszCloseBrackets1);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L"]\n");
}
memset(wszText, 0, sizeof(wszText));
memset(wszAfter, 0, sizeof(wszAfter));
CreateTypeInfo(wszText, wszAfter, pVarDesc->elemdescVar.tdesc, pTypeInfo);
- AddToStrW(wszText, wszSpace);
+ AddToStrW(wszText, L" ");
if (bstrName) AddToStrW(wszText, bstrName);
AddToStrW(wszText, wszAfter);
AddToTLDataStrW(tld, wszText);
- AddToTLDataStrW(tld, wszSemicolon);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L";\n");
SendMessageW(typelib.hTree, TVM_INSERTITEMW, 0, (LPARAM)&tvis);
SysFreeString(bstrName);
@@ -468,23 +451,21 @@ static int EnumEnums(ITypeInfo *pTypeInfo, int cVars, HTREEITEM hParent)
if (VariantChangeType(&var, U(*pVarDesc).lpvarValue, 0, VT_BSTR) == S_OK)
{
AddToStrW(wszText, wszConst);
- AddToStrW(wszText, wszSpace);
- AddToStrW(wszAfter, wszSpace);
- AddToStrW(wszAfter, wszEquals);
- AddToStrW(wszAfter, wszSpace);
+ AddToStrW(wszText, L" ");
+ AddToStrW(wszAfter, L" = ");
AddToStrW(wszAfter, V_BSTR(&var));
}
}
CreateTypeInfo(wszText, wszAfter, pVarDesc->elemdescVar.tdesc, pTypeInfo);
- AddToStrW(wszText, wszSpace);
+ AddToStrW(wszText, L" ");
AddToStrW(wszText, bstrName);
AddToStrW(wszText, wszAfter);
AddToTLDataStrW(tld, bstrName);
AddToTLDataStrW(tld, wszAfter);
if (i<cVars-1)
- AddToTLDataStrW(tld, wszComa);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L",");
+ AddToTLDataStrW(tld, L"\n");
SendMessageW(typelib.hTree, TVM_INSERTITEMW, 0, (LPARAM)&tvis);
SysFreeString(bstrName);
@@ -537,13 +518,13 @@ static int EnumFuncs(ITypeInfo *pTypeInfo, TYPEATTR *pTypeAttr, HTREEITEM hParen
bFirst = TRUE;
if(pFuncDesc->memid < MIN_FUNC_ID || pTypeAttr->wTypeFlags & TYPEFLAG_FDUAL)
{
- AddToTLDataStrW(tld, wszOpenBrackets1);
+ AddToTLDataStrW(tld, L"[");
bFirst = FALSE;
AddToTLDataStrW(tld, wszId);
- AddToTLDataStrW(tld, wszOpenBrackets2);
+ AddToTLDataStrW(tld, L"(");
wsprintfW(wszText, wszFormat, pFuncDesc->memid);
AddToTLDataStrW(tld, wszText);
- AddToTLDataStrW(tld, wszCloseBrackets2);
+ AddToTLDataStrW(tld, L")");
memset(wszText, 0, sizeof(wszText));
}
@@ -551,32 +532,20 @@ static int EnumFuncs(ITypeInfo *pTypeInfo, TYPEATTR *pTypeAttr, HTREEITEM hParen
switch(pFuncDesc->invkind)
{
case INVOKE_PROPERTYGET:
- if(bFirst) AddToTLDataStrW(tld, wszOpenBrackets1);
- else
- {
- AddToTLDataStrW(tld, wszComa);
- AddToTLDataStrW(tld, wszSpace);
- }
+ if(bFirst) AddToTLDataStrW(tld, L"[");
+ else AddToTLDataStrW(tld, L", ");
bFirst = FALSE;
AddToTLDataStrW(tld, wszPropGet);
break;
case INVOKE_PROPERTYPUT:
- if(bFirst) AddToTLDataStrW(tld, wszOpenBrackets1);
- else
- {
- AddToTLDataStrW(tld, wszComa);
- AddToTLDataStrW(tld, wszSpace);
- }
+ if(bFirst) AddToTLDataStrW(tld, L"[");
+ else AddToTLDataStrW(tld, L", ");
bFirst = FALSE;
AddToTLDataStrW(tld, wszPropPut);
break;
case INVOKE_PROPERTYPUTREF:
- if(bFirst) AddToTLDataStrW(tld, wszOpenBrackets1);
- else
- {
- AddToTLDataStrW(tld, wszComa);
- AddToTLDataStrW(tld, wszSpace);
- }
+ if(bFirst) AddToTLDataStrW(tld, L"[");
+ else AddToTLDataStrW(tld, L", ");
bFirst = FALSE;
AddToTLDataStrW(tld, wszPropPutRef);
break;
@@ -584,25 +553,15 @@ static int EnumFuncs(ITypeInfo *pTypeInfo, TYPEATTR *pTypeAttr, HTREEITEM hParen
}
if(SysStringLen(bstrHelpString))
{
- if(bFirst) AddToTLDataStrW(tld, wszOpenBrackets1);
- else
- {
- AddToTLDataStrW(tld, wszComa);
- AddToTLDataStrW(tld, wszSpace);
- }
+ if(bFirst) AddToTLDataStrW(tld, L"[");
+ else AddToTLDataStrW(tld, L", ");
bFirst = FALSE;
AddToTLDataStrW(tld, wszHelpstring);
- AddToTLDataStrW(tld, wszOpenBrackets2);
- AddToTLDataStrW(tld, wszInvertedComa);
+ AddToTLDataStrW(tld, L"(\"");
AddToTLDataStrW(tld, bstrHelpString);
- AddToTLDataStrW(tld, wszInvertedComa);
- AddToTLDataStrW(tld, wszCloseBrackets2);
- }
- if(!bFirst)
- {
- AddToTLDataStrW(tld, wszCloseBrackets1);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L"\")");
}
+ if(!bFirst) AddToTLDataStrW(tld, L"]\n");
if(pTypeAttr->wTypeFlags & TYPEFLAG_FOLEAUTOMATION) {
AddToTLDataStrW(tld, wszVT_HRESULT);
@@ -623,33 +582,32 @@ static int EnumFuncs(ITypeInfo *pTypeInfo, TYPEATTR *pTypeAttr, HTREEITEM hParen
}
SysFreeString(bstrParamNames[0]);
- AddToTLDataStrW(tld, wszSpace);
+ AddToTLDataStrW(tld, L" ");
if(pFuncDesc->memid >= MIN_FUNC_ID)
{
AddToTLDataStrW(tld, wszStdCall);
- AddToTLDataStrW(tld, wszSpace);
+ AddToTLDataStrW(tld, L" ");
}
if (bstrName) AddToTLDataStrW(tld, bstrName);
- AddToTLDataStrW(tld, wszOpenBrackets2);
+ AddToTLDataStrW(tld, L"(");
for(j=0; j<pFuncDesc->cParams; j++)
{
- if(j != 0) AddToTLDataStrW(tld, wszComa);
+ if(j != 0) AddToTLDataStrW(tld, L",");
if(pFuncDesc->cParams != 1)
{
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L"\n");
AddSpaces(tld, TAB_SIZE);
}
bFirst = TRUE;
#define ENUM_PARAM_FLAG(x)\
if(U(pFuncDesc->lprgelemdescParam[j]).paramdesc.wParamFlags & x) \
{\
- if(bFirst) AddToTLDataStrW(tld,\
- wszOpenBrackets1);\
+ if(bFirst)\
+ AddToTLDataStrW(tld, L"[");\
else\
{\
- AddToTLDataStrW(tld, wszComa);\
- AddToTLDataStrW(tld, wszSpace);\
+ AddToTLDataStrW(tld, L", ");\
}\
bFirst = FALSE;\
AddToTLDataStrW(tld, wsz##x);\
@@ -665,31 +623,22 @@ static int EnumFuncs(ITypeInfo *pTypeInfo, TYPEATTR *pTypeAttr, HTREEITEM hParen
{
VARIANT var, *param=&U(pFuncDesc->lprgelemdescParam[j]).paramdesc.pparamdescex->varDefaultValue;
VariantInit(&var);
- if(bFirst) AddToTLDataStrW(tld,
- wszOpenBrackets1);
- else
- {
- AddToTLDataStrW(tld, wszComa);
- AddToTLDataStrW(tld, wszSpace);
- }
+ if(bFirst) AddToTLDataStrW(tld, L"[");
+ else AddToTLDataStrW(tld, L", ");
bFirst = FALSE;
AddToTLDataStrW(tld, wszDefaultValue);
- AddToTLDataStrW(tld, wszOpenBrackets2);
+ AddToTLDataStrW(tld, L"(");
if (V_VT(param) == VT_BSTR)
{
- AddToTLDataStrW(tld, wszInvertedComa);
+ AddToTLDataStrW(tld, L"\"");
AddToTLDataStrW(tld, V_BSTR(param));
- AddToTLDataStrW(tld, wszInvertedComa);
+ AddToTLDataStrW(tld, L"\"");
} else if (VariantChangeType(&var, param, 0, VT_BSTR) == S_OK)
AddToTLDataStrW(tld, V_BSTR(&var));
- AddToTLDataStrW(tld, wszCloseBrackets2);
+ AddToTLDataStrW(tld, L")");
}
- if(!bFirst)
- {
- AddToTLDataStrW(tld, wszCloseBrackets1);
- AddToTLDataStrW(tld, wszSpace);
- }
+ if(!bFirst) AddToTLDataStrW(tld, L"] ");
memset(wszText, 0, sizeof(wszText));
memset(wszAfter, 0, sizeof(wszAfter));
@@ -697,7 +646,7 @@ static int EnumFuncs(ITypeInfo *pTypeInfo, TYPEATTR *pTypeAttr, HTREEITEM hParen
pTypeInfo);
AddToTLDataStrW(tld, wszText);
AddToTLDataStrW(tld, wszAfter);
- AddToTLDataStrW(tld, wszSpace);
+ AddToTLDataStrW(tld, L" ");
if (j+1 < namesNo) {
if (bstrParamNames[j+1])
{
@@ -708,9 +657,7 @@ static int EnumFuncs(ITypeInfo *pTypeInfo, TYPEATTR *pTypeAttr, HTREEITEM hParen
AddToTLDataStrW(tld, szRhs);
}
}
- AddToTLDataStrW(tld, wszCloseBrackets2);
- AddToTLDataStrW(tld, wszSemicolon);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L");\n");
SendMessageW(typelib.hTree, TVM_INSERTITEMW, 0, (LPARAM)&tvis);
HeapFree(GetProcessHeap(), 0, bstrParamNames);
@@ -821,12 +768,11 @@ static void EnumCoclassImplTypes(ITypeInfo *pTypeInfo,
#define ENUM_IMPLTYPEFLAG(x)\
if(flags & x) \
{\
- if(bFirst) AddToTLDataStrW(pTLData,\
- wszOpenBrackets1);\
+ if(bFirst)\
+ AddToTLDataStrW(pTLData, L"[");\
else\
{\
- AddToTLDataStrW(pTLData, wszComa);\
- AddToTLDataStrW(pTLData, wszSpace);\
+ AddToTLDataStrW(pTLData, L", ");\
}\
bFirst = FALSE;\
AddToTLDataStrW(pTLData, wsz##x);\
@@ -835,21 +781,17 @@ static void EnumCoclassImplTypes(ITypeInfo *pTypeInfo,
ENUM_IMPLTYPEFLAG(IMPLTYPEFLAG_FSOURCE);
ENUM_IMPLTYPEFLAG(IMPLTYPEFLAG_FRESTRICTED);
if(!bFirst)
- {
- AddToTLDataStrW(pTLData, wszCloseBrackets1);
- AddToTLDataStrW(pTLData, wszSpace);
- }
+ AddToTLDataStrW(pTLData, L"] ");
if(pTypeAttr->typekind == TKIND_INTERFACE ||
(pTypeAttr->wTypeFlags & TYPEFLAG_FDUAL))
AddToTLDataStrW(pTLData, wszTKIND_INTERFACE);
else if(pTypeAttr->typekind == TKIND_DISPATCH)
AddToTLDataStrW(pTLData, wszTKIND_DISPATCH);
- AddToTLDataStrW(pTLData, wszSpace);
+ AddToTLDataStrW(pTLData, L" ");
AddToTLDataStrW(pTLData, bstrName);
- AddToTLDataStrW(pTLData, wszSemicolon);
- AddToTLDataStrW(pTLData, wszNewLine);
+ AddToTLDataStrW(pTLData, L";\n");
SysFreeString(bstrName);
ITypeInfo_ReleaseTypeAttr(pRefTypeInfo, pTypeAttr);
@@ -871,7 +813,7 @@ static void AddIdlData(HTREEITEM hCur, TYPELIB_DATA *pTLData)
tvi.hItem = hCur;
SendMessageW(typelib.hTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
if(!((TYPELIB_DATA*)(tvi.lParam))->bHide) {
- AddToTLDataStrW(pTLData, wszNewLine);
+ AddToTLDataStrW(pTLData, L"\n");
AddToTLDataStrWithTabsW(pTLData, ((TYPELIB_DATA*)(tvi.lParam))->idl);
}
hCur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
@@ -893,7 +835,7 @@ static void AddPredefinitions(HTREEITEM hFirst, TYPELIB_DATA *pTLData)
TVGN_CHILD, (LPARAM)hFirst);
AddToTLDataStrWithTabsW(pTLData, wszPredefinition);
- AddToTLDataStrW(pTLData, wszNewLine);
+ AddToTLDataStrW(pTLData, L"\n");
hCur = hFirst;
memset(&tvi, 0, sizeof(TVITEMW));
@@ -907,9 +849,9 @@ static void AddPredefinitions(HTREEITEM hFirst, TYPELIB_DATA *pTLData)
if(((TYPELIB_DATA*)(tvi.lParam))->bPredefine &&
!((TYPELIB_DATA*)(tvi.lParam))->bHide)
{
- AddToStrW(wszText, wszSemicolon);
+ AddToStrW(wszText, L";");
AddToTLDataStrWithTabsW(pTLData, wszText);
- AddToTLDataStrW(pTLData, wszNewLine);
+ AddToTLDataStrW(pTLData, L"\n");
}
hCur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
TVGN_NEXT, (LPARAM)hCur);
@@ -951,51 +893,44 @@ static void CreateInterfaceInfo(ITypeInfo *pTypeInfo, int cImplTypes, WCHAR *wsz
= { 'r','e','v','e','r','s','e','b','i','n','d','\0' };
const WCHAR wszTYPEFLAG_FPROXY[] = { 'p','r','o','x','y','\0' };
- AddToTLDataStrW(pTLData, wszOpenBrackets1);
- AddToTLDataStrW(pTLData, wszNewLine);
+ AddToTLDataStrW(pTLData, L"[\n");
if(pTypeAttr->typekind != TKIND_DISPATCH)
{
AddSpaces(pTLData, TAB_SIZE);
AddToTLDataStrW(pTLData, wszOdl);
- AddToTLDataStrW(pTLData, wszComa);
- AddToTLDataStrW(pTLData, wszNewLine);
+ AddToTLDataStrW(pTLData, L",\n");
}
AddSpaces(pTLData, TAB_SIZE);
AddToTLDataStrW(pTLData, wszUUID);
- AddToTLDataStrW(pTLData, wszOpenBrackets2);
+ AddToTLDataStrW(pTLData, L"(");
StringFromGUID2(&(pTypeAttr->guid), wszGuid, MAX_LOAD_STRING);
wszGuid[lstrlenW(wszGuid)-1] = '\0';
AddToTLDataStrW(pTLData, &wszGuid[1]);
- AddToTLDataStrW(pTLData, wszCloseBrackets2);
+ AddToTLDataStrW(pTLData, L")");
if(wszHelpString)
{
- AddToTLDataStrW(pTLData, wszComa);
- AddToTLDataStrW(pTLData, wszNewLine);
+ AddToTLDataStrW(pTLData, L",\n");
AddSpaces(pTLData, TAB_SIZE);
AddToTLDataStrW(pTLData, wszHelpstring);
- AddToTLDataStrW(pTLData, wszOpenBrackets2);
- AddToTLDataStrW(pTLData, wszInvertedComa);
+ AddToTLDataStrW(pTLData, L"(\"");
AddToTLDataStrW(pTLData, wszHelpString);
- AddToTLDataStrW(pTLData, wszInvertedComa);
- AddToTLDataStrW(pTLData, wszCloseBrackets2);
+ AddToTLDataStrW(pTLData, L"\")");
}
if(ulHelpContext)
{
- AddToTLDataStrW(pTLData, wszComa);
- AddToTLDataStrW(pTLData, wszNewLine);
+ AddToTLDataStrW(pTLData, L",\n");
AddSpaces(pTLData, TAB_SIZE);
AddToTLDataStrW(pTLData, wszHelpcontext);
- AddToTLDataStrW(pTLData, wszOpenBrackets2);
+ AddToTLDataStrW(pTLData, L"(");
wsprintfW(wszHelpContext, wszFormat, ulHelpContext);
AddToTLDataStrW(pTLData, wszHelpContext);
- AddToTLDataStrW(pTLData, wszCloseBrackets2);
+ AddToTLDataStrW(pTLData, L")");
}
if(pTypeAttr->wTypeFlags)
{
#define ENUM_FLAGS(x) if(pTypeAttr->wTypeFlags & x)\
{\
- AddToTLDataStrW(pTLData, wszComa);\
- AddToTLDataStrW(pTLData, wszNewLine);\
+ AddToTLDataStrW(pTLData, L",\n");\
AddSpaces(pTLData, TAB_SIZE);\
AddToTLDataStrW(pTLData, wsz##x);\
}
@@ -1014,17 +949,14 @@ static void CreateInterfaceInfo(ITypeInfo *pTypeInfo, int cImplTypes, WCHAR *wsz
ENUM_FLAGS(TYPEFLAG_FREVERSEBIND);
ENUM_FLAGS(TYPEFLAG_FPROXY);
}
- AddToTLDataStrW(pTLData, wszNewLine);
- AddToTLDataStrW(pTLData, wszCloseBrackets1);
- AddToTLDataStrW(pTLData, wszNewLine);
+ AddToTLDataStrW(pTLData, L"\n]\n");
if(pTypeAttr->typekind != TKIND_DISPATCH) AddToTLDataStrW(pTLData, wszInterface);
else AddToTLDataStrW(pTLData, wszDispinterface);
AddToTLDataStrW(pTLData, wszName);
- AddToTLDataStrW(pTLData, wszSpace);
+ AddToTLDataStrW(pTLData, L" ");
if(cImplTypes && pTypeAttr->typekind != TKIND_DISPATCH)
{
- AddToTLDataStrW(pTLData, wszColon);
- AddToTLDataStrW(pTLData, wszSpace);
+ AddToTLDataStrW(pTLData, L": ");
ITypeInfo_GetRefTypeOfImplType(pTypeInfo, 0, &hRefType);
if (SUCCEEDED(ITypeInfo_GetRefTypeInfo(pTypeInfo, hRefType, &pRefTypeInfo)))
@@ -1032,7 +964,7 @@ static void CreateInterfaceInfo(ITypeInfo *pTypeInfo, int cImplTypes, WCHAR *wsz
ITypeInfo_GetDocumentation(pRefTypeInfo, MEMBERID_NIL, &bstrName,
NULL, NULL, NULL);
AddToTLDataStrW(pTLData, bstrName);
- AddToTLDataStrW(pTLData, wszSpace);
+ AddToTLDataStrW(pTLData, L" ");
SysFreeString(bstrName);
ITypeInfo_Release(pRefTypeInfo);
@@ -1040,12 +972,9 @@ static void CreateInterfaceInfo(ITypeInfo *pTypeInfo, int cImplTypes, WCHAR *wsz
else
AddToTLDataStrW(pTLData, wszFailed);
}
- AddToTLDataStrW(pTLData, wszOpenBrackets3);
- AddToTLDataStrW(pTLData, wszNewLine);
+ AddToTLDataStrW(pTLData, L"{\n");
- AddToStrW(pTLData->wszInsertAfter, wszCloseBrackets3);
- AddToStrW(pTLData->wszInsertAfter, wszSemicolon);
- AddToStrW(pTLData->wszInsertAfter, wszNewLine);
+ AddToStrW(pTLData->wszInsertAfter, L"};\n");
}
static void CreateTypedefHeader(ITypeInfo *pTypeInfo,
@@ -1059,31 +988,23 @@ static void CreateTypedefHeader(ITypeInfo *pTypeInfo,
AddToTLDataStrW(pTLData, wszTypedef);
if(memcmp(&pTypeAttr->guid, &GUID_NULL, sizeof(GUID)))
{
- AddToTLDataStrW(pTLData, wszOpenBrackets1);
+ AddToTLDataStrW(pTLData, L"[");
bFirst = FALSE;
AddToTLDataStrW(pTLData, wszUUID);
- AddToTLDataStrW(pTLData, wszOpenBrackets2);
+ AddToTLDataStrW(pTLData, L"(");
StringFromGUID2(&(pTypeAttr->guid), wszGuid, MAX_LOAD_STRING);
wszGuid[lstrlenW(wszGuid)-1] = '\0';
AddToTLDataStrW(pTLData, &wszGuid[1]);
- AddToTLDataStrW(pTLData, wszCloseBrackets2);
+ AddToTLDataStrW(pTLData, L")");
}
if(pTypeAttr->typekind == TKIND_ALIAS)
{
- if(bFirst) AddToTLDataStrW(pTLData, wszOpenBrackets1);
- else
- {
- AddToTLDataStrW(pTLData, wszComa);
- AddToTLDataStrW(pTLData, wszSpace);
- }
+ if(bFirst) AddToTLDataStrW(pTLData, L"[");
+ else AddToTLDataStrW(pTLData, L", ");
bFirst = FALSE;
AddToTLDataStrW(pTLData, wszPublic);
}
- if(!bFirst)
- {
- AddToTLDataStrW(pTLData, wszCloseBrackets1);
- AddToTLDataStrW(pTLData, wszNewLine);
- }
+ if(!bFirst) AddToTLDataStrW(pTLData, L"]\n");
}
static void CreateCoclassHeader(ITypeInfo *pTypeInfo,
@@ -1094,46 +1015,39 @@ static void CreateCoclassHeader(ITypeInfo *pTypeInfo,
const WCHAR wszNoncreatable[]
= { 'n','o','n','c','r','e','a','t','a','b','l','e','\0' };
- AddToTLDataStrW(pTLData, wszOpenBrackets1);
- AddToTLDataStrW(pTLData, wszNewLine);
+ AddToTLDataStrW(pTLData, L"[\n");
AddSpaces(pTLData, TAB_SIZE);
AddToTLDataStrW(pTLData, wszUUID);
- AddToTLDataStrW(pTLData, wszOpenBrackets2);
+ AddToTLDataStrW(pTLData, L"(");
StringFromGUID2(&(pTypeAttr->guid), wszGuid, MAX_LOAD_STRING);
wszGuid[lstrlenW(wszGuid)-1] = '\0';
AddToTLDataStrW(pTLData, &wszGuid[1]);
- AddToTLDataStrW(pTLData, wszCloseBrackets2);
+ AddToTLDataStrW(pTLData, L")");
if(SUCCEEDED(ITypeInfo_GetDocumentation(pTypeInfo, MEMBERID_NIL, NULL,
&bstrHelpString, NULL, NULL)))
{
if(SysStringLen(bstrHelpString))
{
- AddToTLDataStrW(pTLData, wszComa);
- AddToTLDataStrW(pTLData, wszNewLine);
+ AddToTLDataStrW(pTLData, L",\n");
AddSpaces(pTLData, TAB_SIZE);
AddToTLDataStrW(pTLData, wszHelpstring);
- AddToTLDataStrW(pTLData, wszOpenBrackets2);
- AddToTLDataStrW(pTLData, wszInvertedComa);
+ AddToTLDataStrW(pTLData, L"(\"");
AddToTLDataStrW(pTLData, bstrHelpString);
- AddToTLDataStrW(pTLData, wszInvertedComa);
- AddToTLDataStrW(pTLData, wszCloseBrackets2);
+ AddToTLDataStrW(pTLData, L"\")");
}
SysFreeString(bstrHelpString);
}
if(!(pTypeAttr->wTypeFlags & TYPEFLAG_FCANCREATE))
{
- AddToTLDataStrW(pTLData, wszComa);
- AddToTLDataStrW(pTLData, wszNewLine);
+ AddToTLDataStrW(pTLData, L",\n");
AddSpaces(pTLData, TAB_SIZE);
AddToTLDataStrW(pTLData, wszNoncreatable);
}
- AddToTLDataStrW(pTLData, wszNewLine);
- AddToTLDataStrW(pTLData, wszCloseBrackets1);
- AddToTLDataStrW(pTLData, wszNewLine);
+ AddToTLDataStrW(pTLData, L"\n]\n");
}
static int PopulateTree(void)
@@ -1215,19 +1129,14 @@ static int PopulateTree(void)
U(tvis).item.lParam = (LPARAM) tld;
AddToTLDataStrW(tld, wszGeneratedInfo);
AddToTLDataStrW(tld, typelib.wszFileName);
- AddToTLDataStrW(tld, wszNewLine);
- AddToTLDataStrW(tld, wszNewLine);
- AddToTLDataStrW(tld, wszOpenBrackets1);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L"\n\n[\n");
AddSpaces(tld, TAB_SIZE);
AddToTLDataStrW(tld, wszUUID);
- AddToTLDataStrW(tld, wszOpenBrackets2);
+ AddToTLDataStrW(tld, L"(");
StringFromGUID2(&(pTLibAttr->guid), wszText, MAX_LOAD_STRING);
wszText[lstrlenW(wszText)-1] = '\0';
AddToTLDataStrW(tld, &wszText[1]);
- AddToTLDataStrW(tld, wszCloseBrackets2);
- AddToTLDataStrW(tld, wszComa);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L"),\n");
AddSpaces(tld, TAB_SIZE);
wsprintfW(wszText, wszFormat2, pTLibAttr->wMajorVerNum, pTLibAttr->wMinorVerNum);
AddToTLDataStrW(tld, wszText);
@@ -1235,28 +1144,20 @@ static int PopulateTree(void)
if (bstrData)
{
/* helpstring is optional */
- AddToTLDataStrW(tld, wszComa);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L",\n");
AddSpaces(tld, TAB_SIZE);
AddToTLDataStrW(tld, wszHelpstring);
- AddToTLDataStrW(tld, wszOpenBrackets2);
- AddToTLDataStrW(tld, wszInvertedComa);
+ AddToTLDataStrW(tld, L"(\"");
AddToTLDataStrW(tld, bstrData);
- AddToTLDataStrW(tld, wszInvertedComa);
- AddToTLDataStrW(tld, wszCloseBrackets2);
+ AddToTLDataStrW(tld, L"\")");
}
- AddToTLDataStrW(tld, wszNewLine);
- AddToTLDataStrW(tld, wszCloseBrackets1);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L"\n]\n");
AddToTLDataStrW(tld, wszLibrary);
if (bstrName) AddToTLDataStrW(tld, bstrName);
- AddToTLDataStrW(tld, wszNewLine);
- AddToTLDataStrW(tld, wszOpenBrackets3);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L"\n{\n");
- AddToStrW(tld->wszInsertAfter, wszCloseBrackets3);
- AddToStrW(tld->wszInsertAfter, wszSemicolon);
+ AddToStrW(tld->wszInsertAfter, L"};");
wsprintfW(wszText, wszFormat, bstrName, bstrData);
SysFreeString(bstrName);
@@ -1285,13 +1186,10 @@ static int PopulateTree(void)
CreateTypedefHeader(pTypeInfo, pTypeAttr, tld);
AddToTLDataStrW(tld, &wszTKIND_ENUM[lstrlenW(wszTKIND_ALIAS)]);
- AddToTLDataStrW(tld, wszOpenBrackets3);
- AddToTLDataStrW(tld,wszNewLine);
- AddToStrW(tld->wszInsertAfter, wszCloseBrackets3);
- AddToStrW(tld->wszInsertAfter, wszSpace);
+ AddToTLDataStrW(tld, L"{\n");
+ AddToStrW(tld->wszInsertAfter, L"} ");
AddToStrW(tld->wszInsertAfter, bstrName);
- AddToStrW(tld->wszInsertAfter, wszSemicolon);
- AddToStrW(tld->wszInsertAfter, wszNewLine);
+ AddToStrW(tld->wszInsertAfter, L";\n");
bInsert = FALSE;
hParent = TreeView_InsertItemW(typelib.hTree, &tvis);
@@ -1303,15 +1201,11 @@ static int PopulateTree(void)
AddToTLDataStrW(tld, wszTKIND_RECORD);
AddToTLDataStrW(tld, wszTag);
AddToTLDataStrW(tld, bstrName);
- AddToTLDataStrW(tld, wszSpace);
- AddToTLDataStrW(tld, wszOpenBrackets3);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L" {\n");
- AddToStrW(tld->wszInsertAfter, wszCloseBrackets3);
- AddToStrW(tld->wszInsertAfter, wszSpace);
+ AddToStrW(tld->wszInsertAfter, L"} ");
AddToStrW(tld->wszInsertAfter, bstrName);
- AddToStrW(tld->wszInsertAfter, wszSemicolon);
- AddToStrW(tld->wszInsertAfter, wszNewLine);
+ AddToStrW(tld->wszInsertAfter, L";\n");
AddToStrW(wszText, wszTKIND_RECORD);
AddToStrW(wszText, bstrName);
@@ -1335,15 +1229,11 @@ static int PopulateTree(void)
CreateCoclassHeader(pTypeInfo, pTypeAttr, tld);
AddToTLDataStrW(tld, wszTKIND_COCLASS);
AddToTLDataStrW(tld, bstrName);
- AddToTLDataStrW(tld, wszSpace);
- AddToTLDataStrW(tld, wszOpenBrackets3);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L" {\n");
EnumCoclassImplTypes(pTypeInfo, pTypeAttr->cImplTypes, tld);
- AddToStrW(tld->wszInsertAfter, wszCloseBrackets3);
- AddToStrW(tld->wszInsertAfter, wszSemicolon);
- AddToStrW(tld->wszInsertAfter, wszNewLine);
+ AddToStrW(tld->wszInsertAfter, L"};\n");
bInsert = FALSE;
hParent = TreeView_InsertItemW(typelib.hTree, &tvis);
@@ -1371,8 +1261,7 @@ static int PopulateTree(void)
tld = InitializeTLData();
U(tvis).item.lParam = (LPARAM) tld;
AddToTLDataStrW(tld, wszProperties);
- AddToTLDataStrW(tld, wszColon);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L":\n");
tvis.hParent = TreeView_InsertItemW(typelib.hTree, &tvis);
EnumVars(pTypeInfo, pTypeAttr->cVars, tvis.hParent);
AddChildrenData(tvis.hParent, tld);
@@ -1382,8 +1271,7 @@ static int PopulateTree(void)
tld = InitializeTLData();
U(tvis).item.lParam = (LPARAM) tld;
AddToTLDataStrW(tld, wszMethods);
- AddToTLDataStrW(tld, wszColon);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L":\n");
tvis.hParent = TreeView_InsertItemW(typelib.hTree, &tvis);
EnumFuncs(pTypeInfo, pTypeAttr, tvis.hParent);
AddChildrenData(tvis.hParent, tld);
@@ -1424,14 +1312,13 @@ static int PopulateTree(void)
case TKIND_ALIAS:
AddToStrW(wszText, wszTKIND_ALIAS);
CreateTypeInfo(wszText, wszAfter, pTypeAttr->tdescAlias, pTypeInfo);
- AddToStrW(wszText, wszSpace);
+ AddToStrW(wszText, L" ");
AddToStrW(wszText, bstrName);
AddToStrW(wszText, wszAfter);
CreateTypedefHeader(pTypeInfo, pTypeAttr, tld);
AddToTLDataStrW(tld, &wszText[lstrlenW(wszTKIND_ALIAS)]);
- AddToTLDataStrW(tld, wszSemicolon);
- AddToTLDataStrW(tld, wszNewLine);
+ AddToTLDataStrW(tld, L";\n");
break;
default:
lstrcpyW(wszText, bstrName);
@@ -1484,7 +1371,7 @@ void UpdateData(HTREEITEM item)
SendMessageW(typelib.hTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
if(!tvi.lParam)
{
- SetWindowTextW(typelib.hEdit, wszSpace);
+ SetWindowTextW(typelib.hEdit, L" ");
return;
}
--
2.26.2
1
0
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/userenv/userenv_main.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/dlls/userenv/userenv_main.c b/dlls/userenv/userenv_main.c
index 045bac0cfe1..58e610f6c6e 100644
--- a/dlls/userenv/userenv_main.c
+++ b/dlls/userenv/userenv_main.c
@@ -418,7 +418,6 @@ BOOL WINAPI GetUserProfileDirectoryA( HANDLE hToken, LPSTR lpProfileDir,
BOOL WINAPI GetUserProfileDirectoryW( HANDLE hToken, LPWSTR lpProfileDir,
LPDWORD lpcchSize )
{
- static const WCHAR slashW[] = {'\\',0};
TOKEN_USER *t;
WCHAR *userW = NULL, *dirW = NULL;
DWORD len, dir_len, domain_len;
@@ -459,7 +458,7 @@ BOOL WINAPI GetUserProfileDirectoryW( HANDLE hToken, LPWSTR lpProfileDir,
goto done;
}
lstrcpyW( lpProfileDir, dirW );
- lstrcatW( lpProfileDir, slashW );
+ lstrcatW( lpProfileDir, L"\\" );
lstrcatW( lpProfileDir, userW );
*lpcchSize = len;
ret = TRUE;
@@ -533,11 +532,8 @@ end:
return ret;
}
-static const WCHAR ProfileListW[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s',' ','N','T','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','P','r','o','f','i','l','e','L','i','s','t',0};
-
BOOL WINAPI GetProfilesDirectoryW( LPWSTR lpProfilesDir, LPDWORD lpcchSize )
{
- static const WCHAR ProfilesDirectory[] = {'P','r','o','f','i','l','e','s','D','i','r','e','c','t','o','r','y',0};
LONG l;
HKEY key;
BOOL ret = FALSE;
@@ -552,13 +548,15 @@ BOOL WINAPI GetProfilesDirectoryW( LPWSTR lpProfilesDir, LPDWORD lpcchSize )
return FALSE;
}
- l = RegOpenKeyExW(HKEY_LOCAL_MACHINE, ProfileListW, 0, KEY_READ, &key);
+ l = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+ L"Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
+ 0, KEY_READ, &key);
if (l)
{
SetLastError(l);
return FALSE;
}
- l = RegQueryValueExW(key, ProfilesDirectory, NULL, NULL, NULL, &len);
+ l = RegQueryValueExW(key, L"ProfilesDirectory", NULL, NULL, NULL, &len);
if (l)
{
SetLastError(l);
@@ -570,7 +568,7 @@ BOOL WINAPI GetProfilesDirectoryW( LPWSTR lpProfilesDir, LPDWORD lpcchSize )
SetLastError(ERROR_OUTOFMEMORY);
goto end;
}
- l = RegQueryValueExW(key, ProfilesDirectory, NULL, NULL,
+ l = RegQueryValueExW(key, L"ProfilesDirectory", NULL, NULL,
(BYTE *)unexpanded_profiles_dir, &len);
if (l)
{
--
2.26.2
1
0
Also merge some strings.
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/taskschd/folder.c | 5 +-
dlls/taskschd/regtask.c | 3 +-
dlls/taskschd/task.c | 297 ++++++++++++++--------------------------
3 files changed, 108 insertions(+), 197 deletions(-)
diff --git a/dlls/taskschd/folder.c b/dlls/taskschd/folder.c
index eea404acd27..8b2630f4ec3 100644
--- a/dlls/taskschd/folder.c
+++ b/dlls/taskschd/folder.c
@@ -203,7 +203,6 @@ static HRESULT WINAPI TaskFolder_CreateFolder(ITaskFolder *iface, BSTR path, VAR
WCHAR *get_full_path(const WCHAR *parent, const WCHAR *path)
{
- static const WCHAR bslash[] = { '\\', 0 };
WCHAR *folder_path;
int len = 0;
@@ -224,7 +223,7 @@ WCHAR *get_full_path(const WCHAR *parent, const WCHAR *path)
{
len = lstrlenW(folder_path);
if (!len || folder_path[len - 1] != '\\')
- lstrcatW(folder_path, bslash);
+ lstrcatW(folder_path, L"\\");
while (*path == '\\') path++;
lstrcatW(folder_path, path);
@@ -232,7 +231,7 @@ WCHAR *get_full_path(const WCHAR *parent, const WCHAR *path)
len = lstrlenW(folder_path);
if (!len)
- lstrcatW(folder_path, bslash);
+ lstrcatW(folder_path, L"\\");
return folder_path;
}
diff --git a/dlls/taskschd/regtask.c b/dlls/taskschd/regtask.c
index b5d726920cf..0b4b5717657 100644
--- a/dlls/taskschd/regtask.c
+++ b/dlls/taskschd/regtask.c
@@ -357,11 +357,10 @@ HRESULT RegisteredTask_create(const WCHAR *path, const WCHAR *name, ITaskDefinit
}
else
{
- static const WCHAR languages[] = { 0 };
DWORD count = 0;
WCHAR *xml = NULL;
- hr = SchRpcRetrieveTask(full_name, languages, &count, &xml);
+ hr = SchRpcRetrieveTask(full_name, L"", &count, &xml);
if (hr != S_OK || (hr = ITaskDefinition_put_XmlText(definition, xml)) != S_OK)
{
heap_free(full_name);
diff --git a/dlls/taskschd/task.c b/dlls/taskschd/task.c
index 8d81a18b3f5..dd7380e75ac 100644
--- a/dlls/taskschd/task.c
+++ b/dlls/taskschd/task.c
@@ -1440,7 +1440,6 @@ static const ITaskSettingsVtbl TaskSettings_vtbl =
static HRESULT TaskSettings_create(ITaskSettings **obj)
{
- static const WCHAR exec_time_limit[] = { 'P','T','7','2','H',0 };
TaskSettings *taskset;
taskset = heap_alloc(sizeof(*taskset));
@@ -1450,7 +1449,7 @@ static HRESULT TaskSettings_create(ITaskSettings **obj)
taskset->ref = 1;
/* set the defaults */
taskset->restart_interval = NULL;
- taskset->execution_time_limit = heap_strdupW(exec_time_limit);
+ taskset->execution_time_limit = heap_strdupW(L"PT72H");
taskset->delete_expired_task_after = NULL;
taskset->restart_count = 0;
taskset->priority = 7;
@@ -2398,56 +2397,6 @@ static HRESULT WINAPI TaskDefinition_put_Actions(ITaskDefinition *iface, IAction
return S_OK;
}
-static const WCHAR Task[] = {'T','a','s','k',0};
-static const WCHAR version[] = {'v','e','r','s','i','o','n',0};
-static const WCHAR v1_0[] = {'1','.','0',0};
-static const WCHAR v1_1[] = {'1','.','1',0};
-static const WCHAR v1_2[] = {'1','.','2',0};
-static const WCHAR v1_3[] = {'1','.','3',0};
-static const WCHAR xmlns[] = {'x','m','l','n','s',0};
-static const WCHAR task_ns[] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','w','i','n','d','o','w','s','/','2','0','0','4','/','0','2','/','m','i','t','/','t','a','s','k',0};
-static const WCHAR RegistrationInfo[] = {'R','e','g','i','s','t','r','a','t','i','o','n','I','n','f','o',0};
-static const WCHAR Author[] = {'A','u','t','h','o','r',0};
-static const WCHAR Description[] = {'D','e','s','c','r','i','p','t','i','o','n',0};
-static const WCHAR Source[] = {'S','o','u','r','c','e',0};
-static const WCHAR Date[] = {'D','a','t','e',0};
-static const WCHAR Version[] = {'V','e','r','s','i','o','n',0};
-static const WCHAR Documentation[] = {'D','o','c','u','m','e','n','t','a','t','i','o','n',0};
-static const WCHAR URI[] = {'U','R','I',0};
-static const WCHAR SecurityDescriptor[] = {'S','e','c','u','r','i','t','y','D','e','s','c','r','i','p','t','o','r',0};
-static const WCHAR Settings[] = {'S','e','t','t','i','n','g','s',0};
-static const WCHAR Triggers[] = {'T','r','i','g','g','e','r','s',0};
-static const WCHAR Principals[] = {'P','r','i','n','c','i','p','a','l','s',0};
-static const WCHAR principalW[] = {'P','r','i','n','c','i','p','a','l',0};
-static const WCHAR id[] = {'i','d',0};
-static const WCHAR UserId[] = {'U','s','e','r','I','d',0};
-static const WCHAR LogonType[] = {'L','o','g','o','n','T','y','p','e',0};
-static const WCHAR GroupId[] = {'G','r','o','u','p','I','d',0};
-static const WCHAR DisplayName[] = {'D','i','s','p','l','a','y','N','a','m','e',0};
-static const WCHAR HighestAvailable[] = {'H','i','g','h','e','s','t','A','v','a','i','l','a','b','l','e',0};
-static const WCHAR Password[] = {'P','a','s','s','w','o','r','d',0};
-static const WCHAR S4U[] = {'S','4','U',0};
-static const WCHAR InteractiveToken[] = {'I','n','t','e','r','a','c','t','i','v','e','T','o','k','e','n',0};
-static const WCHAR RunLevel[] = {'R','u','n','L','e','v','e','l',0};
-static const WCHAR LeastPrivilege[] = {'L','e','a','s','t','P','r','i','v','i','l','e','g','e',0};
-static const WCHAR actionsW[] = {'A','c','t','i','o','n','s',0};
-static const WCHAR Exec[] = {'E','x','e','c',0};
-static const WCHAR MultipleInstancesPolicy[] = {'M','u','l','t','i','p','l','e','I','n','s','t','a','n','c','e','s','P','o','l','i','c','y',0};
-static const WCHAR IgnoreNew[] = {'I','g','n','o','r','e','N','e','w',0};
-static const WCHAR DisallowStartIfOnBatteries[] = {'D','i','s','a','l','l','o','w','S','t','a','r','t','I','f','O','n','B','a','t','t','e','r','i','e','s',0};
-static const WCHAR AllowStartOnDemand[] = {'A','l','l','o','w','S','t','a','r','t','O','n','D','e','m','a','n','d',0};
-static const WCHAR StopIfGoingOnBatteries[] = {'S','t','o','p','I','f','G','o','i','n','g','O','n','B','a','t','t','e','r','i','e','s',0};
-static const WCHAR AllowHardTerminate[] = {'A','l','l','o','w','H','a','r','d','T','e','r','m','i','n','a','t','e',0};
-static const WCHAR StartWhenAvailable[] = {'S','t','a','r','t','W','h','e','n','A','v','a','i','l','a','b','l','e',0};
-static const WCHAR RunOnlyIfNetworkAvailable[] = {'R','u','n','O','n','l','y','I','f','N','e','t','w','o','r','k','A','v','a','i','l','a','b','l','e',0};
-static const WCHAR Enabled[] = {'E','n','a','b','l','e','d',0};
-static const WCHAR Hidden[] = {'H','i','d','d','e','n',0};
-static const WCHAR RunOnlyIfIdle[] = {'R','u','n','O','n','l','y','I','f','I','d','l','e',0};
-static const WCHAR WakeToRun[] = {'W','a','k','e','T','o','R','u','n',0};
-static const WCHAR ExecutionTimeLimit[] = {'E','x','e','c','u','t','i','o','n','T','i','m','e','L','i','m','i','t',0};
-static const WCHAR Priority[] = {'P','r','i','o','r','i','t','y',0};
-static const WCHAR IdleSettings[] = {'I','d','l','e','S','e','t','t','i','n','g','s',0};
-
static int xml_indent;
static inline void push_indent(void)
@@ -2467,59 +2416,45 @@ static inline HRESULT write_stringW(IStream *stream, const WCHAR *str)
static void write_indent(IStream *stream)
{
- static const WCHAR spacesW[] = {' ',' ',0};
int i;
for (i = 0; i < xml_indent; i += 2)
- write_stringW(stream, spacesW);
+ write_stringW(stream, L" ");
}
-static const WCHAR start_element[] = {'<',0};
-static const WCHAR start_end_element[] = {'<','/',0};
-static const WCHAR close_element[] = {'>',0};
-static const WCHAR end_empty_element[] = {'/','>',0};
-static const WCHAR eol[] = {'\n',0};
-static const WCHAR spaceW[] = {' ',0};
-static const WCHAR equalW[] = {'=',0};
-static const WCHAR quoteW[] = {'"',0};
-
static inline HRESULT write_empty_element(IStream *stream, const WCHAR *name)
{
write_indent(stream);
- write_stringW(stream, start_element);
+ write_stringW(stream, L"<");
write_stringW(stream, name);
- write_stringW(stream, end_empty_element);
- return write_stringW(stream, eol);
+ return write_stringW(stream, L"/>\n");
}
static inline HRESULT write_element(IStream *stream, const WCHAR *name)
{
write_indent(stream);
- write_stringW(stream, start_element);
+ write_stringW(stream, L"<");
write_stringW(stream, name);
- write_stringW(stream, close_element);
- return write_stringW(stream, eol);
+ return write_stringW(stream, L">\n");
}
static inline HRESULT write_element_end(IStream *stream, const WCHAR *name)
{
write_indent(stream);
- write_stringW(stream, start_end_element);
+ write_stringW(stream, L"</");
write_stringW(stream, name);
- write_stringW(stream, close_element);
- return write_stringW(stream, eol);
+ return write_stringW(stream, L">\n");
}
static inline HRESULT write_text_value(IStream *stream, const WCHAR *name, const WCHAR *value)
{
write_indent(stream);
- write_stringW(stream, start_element);
+ write_stringW(stream, L"<");
write_stringW(stream, name);
- write_stringW(stream, close_element);
+ write_stringW(stream, L">");
write_stringW(stream, value);
- write_stringW(stream, start_end_element);
+ write_stringW(stream, L"</");
write_stringW(stream, name);
- write_stringW(stream, close_element);
- return write_stringW(stream, eol);
+ return write_stringW(stream, L">\n");
}
static HRESULT write_task_attributes(IStream *stream, ITaskDefinition *taskdef)
@@ -2540,35 +2475,23 @@ static HRESULT write_task_attributes(IStream *stream, ITaskDefinition *taskdef)
switch (level)
{
case TASK_COMPATIBILITY_AT:
- compatibility = v1_0;
+ compatibility = L"1.0";
break;
case TASK_COMPATIBILITY_V1:
- compatibility = v1_1;
+ compatibility = L"1.1";
break;
case TASK_COMPATIBILITY_V2:
- compatibility = v1_2;
+ compatibility = L"1.2";
break;
default:
- compatibility = v1_3;
+ compatibility = L"1.3";
break;
}
- write_stringW(stream, start_element);
- write_stringW(stream, Task);
- write_stringW(stream, spaceW);
- write_stringW(stream, version);
- write_stringW(stream, equalW);
- write_stringW(stream, quoteW);
+ write_stringW(stream, L"<Task version=\"");
write_stringW(stream, compatibility);
- write_stringW(stream, quoteW);
- write_stringW(stream, spaceW);
- write_stringW(stream, xmlns);
- write_stringW(stream, equalW);
- write_stringW(stream, quoteW);
- write_stringW(stream, task_ns);
- write_stringW(stream, quoteW);
- write_stringW(stream, close_element);
- return write_stringW(stream, eol);
+ write_stringW(stream, L"\" xmlns=\"http://schemas.microsoft.com/windows/2004/02/mit/task\">");
+ return write_stringW(stream, L"\n");
}
static HRESULT write_registration_info(IStream *stream, IRegistrationInfo *reginfo)
@@ -2578,9 +2501,9 @@ static HRESULT write_registration_info(IStream *stream, IRegistrationInfo *regin
VARIANT var;
if (!reginfo)
- return write_empty_element(stream, RegistrationInfo);
+ return write_empty_element(stream, L"RegistrationInfo");
- hr = write_element(stream, RegistrationInfo);
+ hr = write_element(stream, L"RegistrationInfo");
if (hr != S_OK) return hr;
push_indent();
@@ -2588,49 +2511,49 @@ static HRESULT write_registration_info(IStream *stream, IRegistrationInfo *regin
hr = IRegistrationInfo_get_Source(reginfo, &bstr);
if (hr == S_OK && bstr)
{
- hr = write_text_value(stream, Source, bstr);
+ hr = write_text_value(stream, L"Source", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IRegistrationInfo_get_Date(reginfo, &bstr);
if (hr == S_OK && bstr)
{
- hr = write_text_value(stream, Date, bstr);
+ hr = write_text_value(stream, L"Date", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IRegistrationInfo_get_Author(reginfo, &bstr);
if (hr == S_OK && bstr)
{
- hr = write_text_value(stream, Author, bstr);
+ hr = write_text_value(stream, L"Author", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IRegistrationInfo_get_Version(reginfo, &bstr);
if (hr == S_OK && bstr)
{
- hr = write_text_value(stream, Version, bstr);
+ hr = write_text_value(stream, L"Version", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IRegistrationInfo_get_Description(reginfo, &bstr);
if (hr == S_OK && bstr)
{
- hr = write_text_value(stream, Description, bstr);
+ hr = write_text_value(stream, L"Description", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IRegistrationInfo_get_Documentation(reginfo, &bstr);
if (hr == S_OK && bstr)
{
- hr = write_text_value(stream, Documentation, bstr);
+ hr = write_text_value(stream, L"Documentation", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IRegistrationInfo_get_URI(reginfo, &bstr);
if (hr == S_OK && bstr)
{
- hr = write_text_value(stream, URI, bstr);
+ hr = write_text_value(stream, L"URI", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
@@ -2639,7 +2562,7 @@ static HRESULT write_registration_info(IStream *stream, IRegistrationInfo *regin
{
if (V_VT(&var) == VT_BSTR)
{
- hr = write_text_value(stream, SecurityDescriptor, V_BSTR(&var));
+ hr = write_text_value(stream, L"SecurityDescriptor", V_BSTR(&var));
VariantClear(&var);
if (hr != S_OK) return hr;
}
@@ -2649,7 +2572,7 @@ static HRESULT write_registration_info(IStream *stream, IRegistrationInfo *regin
pop_indent();
- return write_element_end(stream, RegistrationInfo);
+ return write_element_end(stream, L"RegistrationInfo");
}
static HRESULT write_principal(IStream *stream, IPrincipal *principal)
@@ -2660,9 +2583,9 @@ static HRESULT write_principal(IStream *stream, IPrincipal *principal)
TASK_RUNLEVEL_TYPE level;
if (!principal)
- return write_empty_element(stream, Principals);
+ return write_empty_element(stream, L"Principals");
- hr = write_element(stream, Principals);
+ hr = write_element(stream, L"Principals");
if (hr != S_OK) return hr;
push_indent();
@@ -2671,41 +2594,34 @@ static HRESULT write_principal(IStream *stream, IPrincipal *principal)
if (hr == S_OK)
{
write_indent(stream);
- write_stringW(stream, start_element);
- write_stringW(stream, principalW);
- write_stringW(stream, spaceW);
- write_stringW(stream, id);
- write_stringW(stream, equalW);
- write_stringW(stream, quoteW);
+ write_stringW(stream, L"<Principal id=\"");
write_stringW(stream, bstr);
- write_stringW(stream, quoteW);
- write_stringW(stream, close_element);
- write_stringW(stream, eol);
+ write_stringW(stream, L"\">\n");
SysFreeString(bstr);
}
else
- write_element(stream, principalW);
+ write_element(stream, L"Principal");
push_indent();
hr = IPrincipal_get_GroupId(principal, &bstr);
if (hr == S_OK)
{
- hr = write_text_value(stream, GroupId, bstr);
+ hr = write_text_value(stream, L"GroupId", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IPrincipal_get_DisplayName(principal, &bstr);
if (hr == S_OK)
{
- hr = write_text_value(stream, DisplayName, bstr);
+ hr = write_text_value(stream, L"DisplayName", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IPrincipal_get_UserId(principal, &bstr);
if (hr == S_OK && lstrlenW(bstr))
{
- hr = write_text_value(stream, UserId, bstr);
+ hr = write_text_value(stream, L"UserId", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
@@ -2717,10 +2633,10 @@ static HRESULT write_principal(IStream *stream, IPrincipal *principal)
switch (level)
{
case TASK_RUNLEVEL_HIGHEST:
- level_str = HighestAvailable;
+ level_str = L"HighestAvailable";
break;
case TASK_RUNLEVEL_LUA:
- level_str = LeastPrivilege;
+ level_str = L"LeastPrivilege";
break;
default:
FIXME("Principal run level %d\n", level);
@@ -2729,7 +2645,7 @@ static HRESULT write_principal(IStream *stream, IPrincipal *principal)
if (level_str)
{
- hr = write_text_value(stream, RunLevel, level_str);
+ hr = write_text_value(stream, L"RunLevel", level_str);
if (hr != S_OK) return hr;
}
}
@@ -2741,13 +2657,13 @@ static HRESULT write_principal(IStream *stream, IPrincipal *principal)
switch (logon)
{
case TASK_LOGON_PASSWORD:
- logon_str = Password;
+ logon_str = L"Password";
break;
case TASK_LOGON_S4U:
- logon_str = S4U;
+ logon_str = L"S4U";
break;
case TASK_LOGON_INTERACTIVE_TOKEN:
- logon_str = InteractiveToken;
+ logon_str = L"InteractiveToken";
break;
default:
FIXME("Principal logon type %d\n", logon);
@@ -2756,22 +2672,22 @@ static HRESULT write_principal(IStream *stream, IPrincipal *principal)
if (logon_str)
{
- hr = write_text_value(stream, LogonType, logon_str);
+ hr = write_text_value(stream, L"LogonType", logon_str);
if (hr != S_OK) return hr;
}
}
pop_indent();
- write_element_end(stream, principalW);
+ write_element_end(stream, L"Principal");
pop_indent();
- return write_element_end(stream, Principals);
+ return write_element_end(stream, L"Principals");
}
static HRESULT write_settings(IStream *stream, ITaskSettings *settings)
{
if (!settings)
- return write_empty_element(stream, Settings);
+ return write_empty_element(stream, L"Settings");
FIXME("stub\n");
return S_OK;
@@ -2780,7 +2696,7 @@ static HRESULT write_settings(IStream *stream, ITaskSettings *settings)
static HRESULT write_triggers(IStream *stream, ITriggerCollection *triggers)
{
if (!triggers)
- return write_empty_element(stream, Triggers);
+ return write_empty_element(stream, L"Triggers");
FIXME("stub\n");
return S_OK;
@@ -2790,11 +2706,11 @@ static HRESULT write_actions(IStream *stream, IActionCollection *actions)
{
if (!actions)
{
- write_element(stream, actionsW);
+ write_element(stream, L"Actions");
push_indent();
- write_empty_element(stream, Exec);
+ write_empty_element(stream, L"Exec");
pop_indent();
- return write_element_end(stream, actionsW);
+ return write_element_end(stream, L"Actions");
}
FIXME("stub\n");
@@ -2843,7 +2759,7 @@ static HRESULT WINAPI TaskDefinition_get_XmlText(ITaskDefinition *iface, BSTR *x
pop_indent();
- write_element_end(stream, Task);
+ write_element_end(stream, L"Task");
IStream_Write(stream, "\0\0", 2, NULL);
p = GlobalLock(hmem);
@@ -2889,17 +2805,15 @@ static HRESULT read_text_value(IXmlReader *reader, WCHAR **value)
static HRESULT read_variantbool_value(IXmlReader *reader, VARIANT_BOOL *vbool)
{
- static const WCHAR trueW[] = {'t','r','u','e',0};
- static const WCHAR falseW[] = {'f','a','l','s','e',0};
HRESULT hr;
WCHAR *value;
hr = read_text_value(reader, &value);
if (hr != S_OK) return hr;
- if (!lstrcmpW(value, trueW))
+ if (!lstrcmpW(value, L"true"))
*vbool = VARIANT_TRUE;
- else if (!lstrcmpW(value, falseW))
+ else if (!lstrcmpW(value, L"false"))
*vbool = VARIANT_FALSE;
else
{
@@ -2947,7 +2861,7 @@ static HRESULT read_principal_attributes(IXmlReader *reader, IPrincipal *princip
TRACE("%s=%s\n", debugstr_w(name), debugstr_w(value));
- if (!lstrcmpW(name, id))
+ if (!lstrcmpW(name, L"id"))
IPrincipal_put_Id(principal, (BSTR)value);
else
FIXME("unhandled Principal attribute %s\n", debugstr_w(name));
@@ -2983,7 +2897,7 @@ static HRESULT read_principal(IXmlReader *reader, IPrincipal *principal)
TRACE("/%s\n", debugstr_w(name));
- if (!lstrcmpW(name, principalW))
+ if (!lstrcmpW(name, L"Principal"))
return S_OK;
break;
@@ -2994,20 +2908,20 @@ static HRESULT read_principal(IXmlReader *reader, IPrincipal *principal)
TRACE("Element: %s\n", debugstr_w(name));
- if (!lstrcmpW(name, UserId))
+ if (!lstrcmpW(name, L"UserId"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IPrincipal_put_UserId(principal, value);
}
- else if (!lstrcmpW(name, LogonType))
+ else if (!lstrcmpW(name, L"LogonType"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
{
TASK_LOGON_TYPE logon = TASK_LOGON_NONE;
- if (!lstrcmpW(value, InteractiveToken))
+ if (!lstrcmpW(value, L"InteractiveToken"))
logon = TASK_LOGON_INTERACTIVE_TOKEN;
else
FIXME("unhandled LogonType %s\n", debugstr_w(value));
@@ -3015,14 +2929,14 @@ static HRESULT read_principal(IXmlReader *reader, IPrincipal *principal)
IPrincipal_put_LogonType(principal, logon);
}
}
- else if (!lstrcmpW(name, RunLevel))
+ else if (!lstrcmpW(name, L"RunLevel"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
{
TASK_RUNLEVEL_TYPE level = TASK_RUNLEVEL_LUA;
- if (!lstrcmpW(value, LeastPrivilege))
+ if (!lstrcmpW(value, L"LeastPrivilege"))
level = TASK_RUNLEVEL_LUA;
else
FIXME("unhandled RunLevel %s\n", debugstr_w(value));
@@ -3071,7 +2985,7 @@ static HRESULT read_principals(IXmlReader *reader, ITaskDefinition *taskdef)
TRACE("/%s\n", debugstr_w(name));
- if (!lstrcmpW(name, Principals))
+ if (!lstrcmpW(name, L"Principals"))
return S_OK;
break;
@@ -3082,7 +2996,7 @@ static HRESULT read_principals(IXmlReader *reader, ITaskDefinition *taskdef)
TRACE("Element: %s\n", debugstr_w(name));
- if (!lstrcmpW(name, principalW))
+ if (!lstrcmpW(name, L"Principal"))
{
IPrincipal *principal;
@@ -3147,7 +3061,7 @@ static HRESULT read_settings(IXmlReader *reader, ITaskSettings *taskset)
TRACE("/%s\n", debugstr_w(name));
- if (!lstrcmpW(name, Settings))
+ if (!lstrcmpW(name, L"Settings"))
return S_OK;
break;
@@ -3158,14 +3072,14 @@ static HRESULT read_settings(IXmlReader *reader, ITaskSettings *taskset)
TRACE("Element: %s\n", debugstr_w(name));
- if (!lstrcmpW(name, MultipleInstancesPolicy))
+ if (!lstrcmpW(name, L"MultipleInstancesPolicy"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
{
int_val = TASK_INSTANCES_IGNORE_NEW;
- if (!lstrcmpW(value, IgnoreNew))
+ if (!lstrcmpW(value, L"IgnoreNew"))
int_val = TASK_INSTANCES_IGNORE_NEW;
else
FIXME("unhandled MultipleInstancesPolicy %s\n", debugstr_w(value));
@@ -3173,79 +3087,79 @@ static HRESULT read_settings(IXmlReader *reader, ITaskSettings *taskset)
ITaskSettings_put_MultipleInstances(taskset, int_val);
}
}
- else if (!lstrcmpW(name, DisallowStartIfOnBatteries))
+ else if (!lstrcmpW(name, L"DisallowStartIfOnBatteries"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_DisallowStartIfOnBatteries(taskset, bool_val);
}
- else if (!lstrcmpW(name, AllowStartOnDemand))
+ else if (!lstrcmpW(name, L"AllowStartOnDemand"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_AllowDemandStart(taskset, bool_val);
}
- else if (!lstrcmpW(name, StopIfGoingOnBatteries))
+ else if (!lstrcmpW(name, L"StopIfGoingOnBatteries"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_StopIfGoingOnBatteries(taskset, bool_val);
}
- else if (!lstrcmpW(name, AllowHardTerminate))
+ else if (!lstrcmpW(name, L"AllowHardTerminate"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_AllowHardTerminate(taskset, bool_val);
}
- else if (!lstrcmpW(name, StartWhenAvailable))
+ else if (!lstrcmpW(name, L"StartWhenAvailable"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_StartWhenAvailable(taskset, bool_val);
}
- else if (!lstrcmpW(name, RunOnlyIfNetworkAvailable))
+ else if (!lstrcmpW(name, L"RunOnlyIfNetworkAvailable"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_RunOnlyIfNetworkAvailable(taskset, bool_val);
}
- else if (!lstrcmpW(name, Enabled))
+ else if (!lstrcmpW(name, L"Enabled"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_Enabled(taskset, bool_val);
}
- else if (!lstrcmpW(name, Hidden))
+ else if (!lstrcmpW(name, L"Hidden"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_Hidden(taskset, bool_val);
}
- else if (!lstrcmpW(name, RunOnlyIfIdle))
+ else if (!lstrcmpW(name, L"RunOnlyIfIdle"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_RunOnlyIfIdle(taskset, bool_val);
}
- else if (!lstrcmpW(name, WakeToRun))
+ else if (!lstrcmpW(name, L"WakeToRun"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_WakeToRun(taskset, bool_val);
}
- else if (!lstrcmpW(name, ExecutionTimeLimit))
+ else if (!lstrcmpW(name, L"ExecutionTimeLimit"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
ITaskSettings_put_ExecutionTimeLimit(taskset, value);
}
- else if (!lstrcmpW(name, Priority))
+ else if (!lstrcmpW(name, L"Priority"))
{
hr = read_int_value(reader, &int_val);
if (hr == S_OK)
ITaskSettings_put_Priority(taskset, int_val);
}
- else if (!lstrcmpW(name, IdleSettings))
+ else if (!lstrcmpW(name, L"IdleSettings"))
{
hr = read_idle_settings(reader, taskset);
if (hr != S_OK) return hr;
@@ -3292,7 +3206,7 @@ static HRESULT read_registration_info(IXmlReader *reader, IRegistrationInfo *inf
TRACE("/%s\n", debugstr_w(name));
- if (!lstrcmpW(name, RegistrationInfo))
+ if (!lstrcmpW(name, L"RegistrationInfo"))
return S_OK;
break;
@@ -3303,43 +3217,43 @@ static HRESULT read_registration_info(IXmlReader *reader, IRegistrationInfo *inf
TRACE("Element: %s\n", debugstr_w(name));
- if (!lstrcmpW(name, Author))
+ if (!lstrcmpW(name, L"Author"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IRegistrationInfo_put_Author(info, value);
}
- else if (!lstrcmpW(name, Description))
+ else if (!lstrcmpW(name, L"Description"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IRegistrationInfo_put_Description(info, value);
}
- else if (!lstrcmpW(name, Version))
+ else if (!lstrcmpW(name, L"Version"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IRegistrationInfo_put_Version(info, value);
}
- else if (!lstrcmpW(name, Date))
+ else if (!lstrcmpW(name, L"Date"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IRegistrationInfo_put_Date(info, value);
}
- else if (!lstrcmpW(name, Documentation))
+ else if (!lstrcmpW(name, L"Documentation"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IRegistrationInfo_put_Documentation(info, value);
}
- else if (!lstrcmpW(name, URI))
+ else if (!lstrcmpW(name, L"URI"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IRegistrationInfo_put_URI(info, value);
}
- else if (!lstrcmpW(name, Source))
+ else if (!lstrcmpW(name, L"Source"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
@@ -3389,26 +3303,26 @@ static HRESULT read_task_attributes(IXmlReader *reader, ITaskDefinition *taskdef
TRACE("%s=%s\n", debugstr_w(name), debugstr_w(value));
- if (!lstrcmpW(name, version))
+ if (!lstrcmpW(name, L"version"))
{
TASK_COMPATIBILITY compatibility = TASK_COMPATIBILITY_V2;
- if (!lstrcmpW(value, v1_0))
+ if (!lstrcmpW(value, L"1.0"))
compatibility = TASK_COMPATIBILITY_AT;
- else if (!lstrcmpW(value, v1_1))
+ else if (!lstrcmpW(value, L"1.1"))
compatibility = TASK_COMPATIBILITY_V1;
- else if (!lstrcmpW(value, v1_2))
+ else if (!lstrcmpW(value, L"1.2"))
compatibility = TASK_COMPATIBILITY_V2;
- else if (!lstrcmpW(value, v1_3))
+ else if (!lstrcmpW(value, L"1.3"))
compatibility = TASK_COMPATIBILITY_V2_1;
else
FIXME("unknown version %s\n", debugstr_w(value));
ITaskSettings_put_Compatibility(taskset, compatibility);
}
- else if (!lstrcmpW(name, xmlns))
+ else if (!lstrcmpW(name, L"xmlns"))
{
- if (lstrcmpW(value, task_ns))
+ if (lstrcmpW(value, L"http://schemas.microsoft.com/windows/2004/02/mit/task"))
{
FIXME("unknown namespace %s\n", debugstr_w(value));
break;
@@ -3447,7 +3361,7 @@ static HRESULT read_task(IXmlReader *reader, ITaskDefinition *taskdef)
TRACE("/%s\n", debugstr_w(name));
- if (!lstrcmpW(name, Task))
+ if (!lstrcmpW(name, L"Task"))
return S_OK;
break;
@@ -3458,7 +3372,7 @@ static HRESULT read_task(IXmlReader *reader, ITaskDefinition *taskdef)
TRACE("Element: %s\n", debugstr_w(name));
- if (!lstrcmpW(name, RegistrationInfo))
+ if (!lstrcmpW(name, L"RegistrationInfo"))
{
IRegistrationInfo *info;
@@ -3467,7 +3381,7 @@ static HRESULT read_task(IXmlReader *reader, ITaskDefinition *taskdef)
hr = read_registration_info(reader, info);
IRegistrationInfo_Release(info);
}
- else if (!lstrcmpW(name, Settings))
+ else if (!lstrcmpW(name, L"Settings"))
{
ITaskSettings *taskset;
@@ -3476,11 +3390,11 @@ static HRESULT read_task(IXmlReader *reader, ITaskDefinition *taskdef)
hr = read_settings(reader, taskset);
ITaskSettings_Release(taskset);
}
- else if (!lstrcmpW(name, Triggers))
+ else if (!lstrcmpW(name, L"Triggers"))
hr = read_triggers(reader, taskdef);
- else if (!lstrcmpW(name, Principals))
+ else if (!lstrcmpW(name, L"Principals"))
hr = read_principals(reader, taskdef);
- else if (!lstrcmpW(name, actionsW))
+ else if (!lstrcmpW(name, L"Actions"))
hr = read_actions(reader, taskdef);
else
FIXME("unhandled Task element %s\n", debugstr_w(name));
@@ -3522,7 +3436,7 @@ static HRESULT read_xml(IXmlReader *reader, ITaskDefinition *taskdef)
TRACE("Element: %s\n", debugstr_w(name));
- if (!lstrcmpW(name, Task))
+ if (!lstrcmpW(name, L"Task"))
{
hr = read_task_attributes(reader, taskdef);
if (hr != S_OK) return hr;
@@ -3782,18 +3696,17 @@ static inline BOOL is_variant_null(const VARIANT *var)
static HRESULT start_schedsvc(void)
{
- static const WCHAR scheduleW[] = { 'S','c','h','e','d','u','l','e',0 };
SC_HANDLE scm, service;
SERVICE_STATUS_PROCESS status;
ULONGLONG start_time;
HRESULT hr = SCHED_E_SERVICE_NOT_RUNNING;
- TRACE("Trying to start %s service\n", debugstr_w(scheduleW));
+ TRACE("Trying to start Schedule service\n");
scm = OpenSCManagerW(NULL, NULL, 0);
if (!scm) return SCHED_E_SERVICE_NOT_INSTALLED;
- service = OpenServiceW(scm, scheduleW, SERVICE_START | SERVICE_QUERY_STATUS);
+ service = OpenServiceW(scm, L"Schedule", SERVICE_START | SERVICE_QUERY_STATUS);
if (service)
{
if (StartServiceW(service, 0, NULL) || GetLastError() == ERROR_SERVICE_ALREADY_RUNNING)
@@ -3837,7 +3750,7 @@ static HRESULT start_schedsvc(void)
static HRESULT WINAPI TaskService_Connect(ITaskService *iface, VARIANT server, VARIANT user, VARIANT domain, VARIANT password)
{
- static WCHAR ncalrpc[] = { 'n','c','a','l','r','p','c',0 };
+ static WCHAR ncalrpc[] = L"ncalrpc";
TaskService *task_svc = impl_from_ITaskService(iface);
WCHAR comp_name[MAX_COMPUTERNAME_LENGTH + 1];
DWORD len;
--
2.26.2
1
0
[PATCH v2] ntdll: Avoid overwriting parameters with context in call_user_apc_dispatcher() on x86.
by Paul Gofman Nov. 16, 2020
by Paul Gofman Nov. 16, 2020
Nov. 16, 2020
Fixes crash in 32 bit kernel32 file test. The crash is not always reproducible
as the issue depends on stack layout.
Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com>
---
v2:
- remove leftover debug changes.
dlls/ntdll/unix/signal_i386.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c
index 4d8eeb2072c..58b79940773 100644
--- a/dlls/ntdll/unix/signal_i386.c
+++ b/dlls/ntdll/unix/signal_i386.c
@@ -1688,15 +1688,18 @@ __ASM_GLOBAL_FUNC( call_user_apc_dispatcher,
"movl %esp,%ebx\n\t"
"cmpl %esp,%esi\n\t"
"cmovbl %esi,%esp\n\t"
+ "pushl 20(%ebx)\n\t" /* func */
+ "pushl 16(%ebx)\n\t" /* arg2 */
+ "pushl 12(%ebx)\n\t" /* arg1 */
+ "movl 8(%ebx),%ebx\n\t" /* ctx */
"movl $0x00010007,(%esi)\n\t" /* context.ContextFlags = CONTEXT_FULL */
"pushl %esi\n\t" /* context */
"pushl $0xfffffffe\n\t"
"call " __ASM_STDCALL("NtGetContextThread",8) "\n\t"
"movl $0xc0,0xb0(%esi)\n" /* context.Eax = STATUS_USER_APC */
- "movl 20(%ebx),%eax\n\t" /* func */
- "movl 16(%ebx),%ecx\n\t" /* arg2 */
- "movl 12(%ebx),%edx\n\t" /* arg1 */
- "movl 8(%ebx),%ebx\n\t" /* ctx */
+ "popl %edx\n\t"
+ "popl %ecx\n\t"
+ "popl %eax\n\t"
"leal -20(%esi),%esp\n\t"
"movl %eax,16(%esp)\n" /* func */
"2:\tmovl %ecx,12(%esp)\n\t" /* arg2 */
--
2.28.0
2
1
[PATCH] mf/session: Call session_command_complete after NotifyTopology command.
by Derek Lesho Nov. 16, 2020
by Derek Lesho Nov. 16, 2020
Nov. 16, 2020
Signed-off-by: Derek Lesho <dlesho(a)codeweavers.com>
---
dlls/mf/session.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c
index cf351c003e7..dffd5113ff9 100644
--- a/dlls/mf/session.c
+++ b/dlls/mf/session.c
@@ -2075,6 +2075,7 @@ static HRESULT WINAPI session_commands_callback_Invoke(IMFAsyncCallback *iface,
break;
case SESSION_CMD_QM_NOTIFY_TOPOLOGY:
IMFQualityManager_NotifyTopology(session->quality_manager, op->u.notify_topology.topology);
+ session_command_complete(session);
break;
case SESSION_CMD_SA_READY:
topo_node = session_get_node_by_id(session, op->u.sa_ready.node_id);
--
2.29.2
2
1