On Jan 17, 2008 1:31 AM, Christopher raccoonone@procyongames.com wrote:
This patch fixes LoadStringW when 0 is passed for buflen. LoadStringW should now behave as described on MSDN: http://msdn2.microsoft.com/en-us/library/ms647486.aspx
This patch also fixes bug #10932
Christopher Berner
From dfe1719df7e8cd12cc5819c647049d9f39978841 Mon Sep 17 00:00:00 2001 From: Christopher Berner raccoonone@procyongames.com Date: Wed, 16 Jan 2008 23:21:23 -0800 Subject: [PATCH] Patch to fix LoadStringW when buflen is 0
dlls/user32/resource.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/dlls/user32/resource.c b/dlls/user32/resource.c index b9a51ae..148e9d1 100644 --- a/dlls/user32/resource.c +++ b/dlls/user32/resource.c @@ -363,6 +363,7 @@ INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id, WCHAR *p; int string_num; int i;
int strlen;
TRACE("instance = %p, id = %04x, buffer = %p, length = %d\n", instance, resource_id, buffer, buflen);
@@ -379,9 +380,19 @@ INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id, for (i = 0; i < string_num; i++) p += *p + 1;
strlen = (int)*p; TRACE("strlen = %d\n", (int)*p );
if (buffer == NULL) return *p;
//if buflen == 0, then return a read-only pointer to the resource itself in buffer
//it is assumed that buffer is actually a LPWSTR *
if(buflen == 0)
{
*((LPWSTR *)buffer) = p + 1;
return strlen;
}
i = min(buflen - 1, *p); if (i > 0) { memcpy(buffer, p + 1, i * sizeof (WCHAR));
No c++ comments allowed. Also, you need to add a test case for this change.
James Hawkins wrote:
On Jan 17, 2008 1:31 AM, Christopher raccoonone@procyongames.com wrote:
This patch fixes LoadStringW when 0 is passed for buflen. LoadStringW should now behave as described on MSDN: http://msdn2.microsoft.com/en-us/library/ms647486.aspx
This patch also fixes bug #10932
Christopher Berner
From dfe1719df7e8cd12cc5819c647049d9f39978841 Mon Sep 17 00:00:00 2001 From: Christopher Berner raccoonone@procyongames.com Date: Wed, 16 Jan 2008 23:21:23 -0800 Subject: [PATCH] Patch to fix LoadStringW when buflen is 0
dlls/user32/resource.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/dlls/user32/resource.c b/dlls/user32/resource.c index b9a51ae..148e9d1 100644 --- a/dlls/user32/resource.c +++ b/dlls/user32/resource.c @@ -363,6 +363,7 @@ INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id, WCHAR *p; int string_num; int i;
int strlen;
TRACE("instance = %p, id = %04x, buffer = %p, length = %d\n", instance, resource_id, buffer, buflen);
@@ -379,9 +380,19 @@ INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id, for (i = 0; i < string_num; i++) p += *p + 1;
strlen = (int)*p; TRACE("strlen = %d\n", (int)*p );
if (buffer == NULL) return *p;
//if buflen == 0, then return a read-only pointer to the resource itself in buffer
//it is assumed that buffer is actually a LPWSTR *
if(buflen == 0)
{
*((LPWSTR *)buffer) = p + 1;
return strlen;
}
i = min(buflen - 1, *p); if (i > 0) { memcpy(buffer, p + 1, i * sizeof (WCHAR));
No c++ comments allowed. Also, you need to add a test case for this change.
Thanks for pointing that out! Am I suppose to attach a test case for all my patches to wine-patches? I had submitted a testcase under the bug report I filed, so I didn't attach it to the email.
Christopher Berner
On Jan 17, 2008 2:10 AM, Christopher raccoonone@procyongames.com wrote:
James Hawkins wrote:
On Jan 17, 2008 1:31 AM, Christopher raccoonone@procyongames.com wrote:
This patch fixes LoadStringW when 0 is passed for buflen. LoadStringW should now behave as described on MSDN: http://msdn2.microsoft.com/en-us/library/ms647486.aspx
This patch also fixes bug #10932
Christopher Berner
From dfe1719df7e8cd12cc5819c647049d9f39978841 Mon Sep 17 00:00:00 2001 From: Christopher Berner raccoonone@procyongames.com Date: Wed, 16 Jan 2008 23:21:23 -0800 Subject: [PATCH] Patch to fix LoadStringW when buflen is 0
dlls/user32/resource.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/dlls/user32/resource.c b/dlls/user32/resource.c index b9a51ae..148e9d1 100644 --- a/dlls/user32/resource.c +++ b/dlls/user32/resource.c @@ -363,6 +363,7 @@ INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id, WCHAR *p; int string_num; int i;
int strlen;
TRACE("instance = %p, id = %04x, buffer = %p, length = %d\n", instance, resource_id, buffer, buflen);
@@ -379,9 +380,19 @@ INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id, for (i = 0; i < string_num; i++) p += *p + 1;
strlen = (int)*p; TRACE("strlen = %d\n", (int)*p );
if (buffer == NULL) return *p;
//if buflen == 0, then return a read-only pointer to the resource itself in buffer
//it is assumed that buffer is actually a LPWSTR *
if(buflen == 0)
{
*((LPWSTR *)buffer) = p + 1;
return strlen;
}
i = min(buflen - 1, *p); if (i > 0) { memcpy(buffer, p + 1, i * sizeof (WCHAR));
No c++ comments allowed. Also, you need to add a test case for this change.
Thanks for pointing that out! Am I suppose to attach a test case for all my patches to wine-patches? I had submitted a testcase under the bug report I filed, so I didn't attach it to the email.
Yes, for the fixes that can be tested, which is most of them. Patches in bugzilla bit-rot.
"Christopher" raccoonone@procyongames.com wrote:
Thanks for pointing that out! Am I suppose to attach a test case for all my patches to wine-patches? I had submitted a testcase under the bug report I filed, so I didn't attach it to the email.
You have to add the test to the exiting tests in dlls/kernel32/tests not send an exe file. Also, you need to inspect and fix all places in Wine which rely on old behaviour.
"Dmitry Timoshkov" dmitry@codeweavers.com writes:
"Christopher" raccoonone@procyongames.com wrote:
Thanks for pointing that out! Am I suppose to attach a test case for all my patches to wine-patches? I had submitted a testcase under the bug report I filed, so I didn't attach it to the email.
You have to add the test to the exiting tests in dlls/kernel32/tests
Actually, there are LoadStringA tests in dlls/user32/tests/resource.c, maybe it's best to team up with those (and possibly extend for the same set of tests).
Ferenc Wagner wrote:
"Dmitry Timoshkov" dmitry@codeweavers.com writes:
"Christopher" raccoonone@procyongames.com wrote:
Thanks for pointing that out! Am I suppose to attach a test case for all my patches to wine-patches? I had submitted a testcase under the bug report I filed, so I didn't attach it to the email.
You have to add the test to the exiting tests in dlls/kernel32/tests
Actually, there are LoadStringA tests in dlls/user32/tests/resource.c, maybe it's best to team up with those (and possibly extend for the same set of tests).
I read the documentation on writing conformance tests. But is there a way for me to compile the tests under Linux to run on Windows? Having never written a conformance test before I would like to test it out on my own before I submit it. Also, once I write the test do I submit it at the same time as my patch, or do I need to submit the test first and wait for it to be accepted before sending in my patch?
Christopher
Am Saturday 19 January 2008 07:32 schrieb Christopher:
Ferenc Wagner wrote:
"Dmitry Timoshkov" dmitry@codeweavers.com writes:
"Christopher" raccoonone@procyongames.com wrote:
Thanks for pointing that out! Am I suppose to attach a test case for all my patches to wine-patches? I had submitted a testcase under the bug report I filed, so I didn't attach it to the email.
You have to add the test to the exiting tests in dlls/kernel32/tests
Actually, there are LoadStringA tests in dlls/user32/tests/resource.c, maybe it's best to team up with those (and possibly extend for the same set of tests).
I read the documentation on writing conformance tests. But is there a way for me to compile the tests under Linux to run on Windows? Having never written a conformance test before I would like to test it out on my own before I submit it. Also, once I write the test do I submit it at the same time as my patch, or do I need to submit the test first and wait for it to be accepted before sending in my patch?
Christopher
To build your tests you can use mingw as cross compiler. See http://www.winehq.org/site/docs/winedev-guide/cross-compiling-tests http://www.winehq.org/pipermail/wine-devel/2006-December/053069.html
You can send the tests and the fix for wine at the same time.
Bye Stefan