On Jan 17, 2008 2:10 AM, Christopher <[EMAIL PROTECTED]> wrote: > > James Hawkins wrote: > > On Jan 17, 2008 1:31 AM, Christopher <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> > >> 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. -- James Hawkins