Author: akhaldi
Date: Fri Nov 27 22:49:47 2015
New Revision: 70169
URL:
http://svn.reactos.org/svn/reactos?rev=70169&view=rev
Log:
[USER32] Partially sync resources.c with Wine Staging 1.7.55. CORE-10536
Modified:
trunk/reactos/media/doc/README.WINE
trunk/reactos/win32ss/user/user32/misc/resources.c
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Nov 27 22:49:47 2015
@@ -307,7 +307,7 @@
reactos/win32ss/user/user32/misc/ddeclient.c # Synced to WineStaging-1.7.37
reactos/win32ss/user/user32/misc/ddeserver.c # Synced to WineStaging-1.7.37
reactos/win32ss/user/user32/misc/exticon.c # Synced to Wine-1_1_22
- reactos/win32ss/user/user32/misc/resources.c # Forked?
+ reactos/win32ss/user/user32/misc/resources.c # Partially synced to
WineStaging-1.7.55
reactos/win32ss/user/user32/misc/winhelp.c # Last sync date unknown
reactos/win32ss/user/user32/misc/wsprintf.c # Synced to Wine-1_1_23
Modified: trunk/reactos/win32ss/user/user32/misc/resources.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/r…
==============================================================================
--- trunk/reactos/win32ss/user/user32/misc/resources.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/misc/resources.c [iso-8859-1] Fri Nov 27 22:49:47
2015
@@ -1,6 +1,7 @@
#include <user32.h>
#include <wine/debug.h>
+WINE_DEFAULT_DEBUG_CHANNEL(resource);
#ifndef _CFGMGR32_H_
#define CR_SUCCESS 0x00000000
@@ -20,49 +21,21 @@
static HINSTANCE hSetupApi = NULL;
-
-/*
- * @implemented (Synced with Wine 08.01.2009)
- */
-INT
-WINAPI
-LoadStringA(HINSTANCE instance, UINT resource_id, LPSTR buffer, INT buflen)
-{
- HGLOBAL hmem;
- HRSRC hrsrc;
- DWORD retval = 0;
-
- if (!buflen) return -1;
-
- /* Use loword (incremented by 1) as resourceid */
- if ((hrsrc = FindResourceW( instance, MAKEINTRESOURCEW((LOWORD(resource_id) >>
4) + 1),
- (LPWSTR)RT_STRING )) &&
- (hmem = LoadResource( instance, hrsrc )))
- {
- const WCHAR *p = LockResource(hmem);
- unsigned int id = resource_id & 0x000f;
-
- while (id--) p += *p + 1;
-
- RtlUnicodeToMultiByteN( buffer, buflen - 1, &retval, (PWSTR)(p + 1), *p *
sizeof(WCHAR) );
- }
- buffer[retval] = 0;
- return retval;
-}
-
-
-/*
- * @implemented (Synced with Wine 08.01.2009)
- */
-INT
-WINAPI
-LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
+/**********************************************************************
+ * LoadStringW (USER32.@)
+ * Synced with Wine Staging 1.7.55
+ */
+INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id,
+ LPWSTR buffer, INT buflen )
{
HGLOBAL hmem;
HRSRC hrsrc;
WCHAR *p;
int string_num;
int i;
+
+ TRACE("instance = %p, id = %04x, buffer = %p, length = %d\n",
+ instance, resource_id, buffer, buflen);
if(buffer == NULL)
return 0;
@@ -77,7 +50,9 @@
p = LockResource(hmem);
string_num = resource_id & 0x000f;
for (i = 0; i < string_num; i++)
- p += *p + 1;
+ p += *p + 1;
+
+ TRACE("strlen = %d\n", (int)*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 *) */
@@ -89,18 +64,51 @@
i = min(buflen - 1, *p);
if (i > 0) {
- memcpy(buffer, p + 1, i * sizeof (WCHAR));
+ memcpy(buffer, p + 1, i * sizeof (WCHAR));
buffer[i] = 0;
} else {
- if (buflen > 1) {
+ if (buflen > 1) {
buffer[0] = 0;
- return 0;
- }
- }
-
+ return 0;
+ }
+ }
+
+ TRACE("%s loaded !\n", debugstr_w(buffer));
return i;
}
+/**********************************************************************
+ * LoadStringA (USER32.@)
+ * Synced with Wine Staging 1.7.55
+ */
+INT WINAPI LoadStringA( HINSTANCE instance, UINT resource_id, LPSTR buffer, INT buflen )
+{
+ HGLOBAL hmem;
+ HRSRC hrsrc;
+ DWORD retval = 0;
+
+ TRACE("instance = %p, id = %04x, buffer = %p, length = %d\n",
+ instance, resource_id, buffer, buflen);
+
+ if (!buflen) return -1;
+
+ /* Use loword (incremented by 1) as resourceid */
+ if ((hrsrc = FindResourceW( instance, MAKEINTRESOURCEW((LOWORD(resource_id) >>
4) + 1),
+ (LPWSTR)RT_STRING )) &&
+ (hmem = LoadResource( instance, hrsrc )))
+ {
+ const WCHAR *p = LockResource(hmem);
+ unsigned int id = resource_id & 0x000f;
+
+ while (id--) p += *p + 1;
+
+ if (buflen != 1)
+ RtlUnicodeToMultiByteN( buffer, buflen - 1, &retval, (PWSTR)(p + 1), *p *
sizeof(WCHAR) );
+ }
+ buffer[retval] = 0;
+ TRACE("returning %s\n", debugstr_a(buffer));
+ return retval;
+}
/*
* @implemented