Author: janderwald
Date: Sat Oct 11 14:30:45 2008
New Revision: 36722
URL:
http://svn.reactos.org/svn/reactos?rev=36722&view=rev
Log:
- Fix MultiByteToWideChar api parameters (thanks Christoph)
- Fix bugs in EnumNameServers
Modified:
trunk/reactos/dll/win32/iphlpapi/iphlpapi_main.c
trunk/reactos/dll/win32/iphlpapi/resinfo_reactos.c
Modified: trunk/reactos/dll/win32/iphlpapi/iphlpapi_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/iphlpapi/iphlpap…
==============================================================================
--- trunk/reactos/dll/win32/iphlpapi/iphlpapi_main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/iphlpapi/iphlpapi_main.c [iso-8859-1] Sat Oct 11 14:30:45
2008
@@ -1471,13 +1471,10 @@
* DWORD
*
*/
-static void CreateNameServerListEnumNamesFunc( PWCHAR Interface,
- PWCHAR Server,
- PVOID Data )
+static void CreateNameServerListEnumNamesFunc( PWCHAR Interface, PWCHAR Server, PVOID
Data)
{
IP_ADDR_STRING *pNext;
PNAME_SERVER_LIST_CONTEXT Context = (PNAME_SERVER_LIST_CONTEXT)Data;
-
if (!Context->NumServers)
{
@@ -1518,7 +1515,7 @@
if (!ifName)
return ERROR_INVALID_PARAMETER;
- MultiByteToWideChar(CP_ACP, 0, ifName, -1, &keyname[62], sizeof(keyname) - (63 *
sizeof(WCHAR)));
+ MultiByteToWideChar(CP_ACP, 0, ifName, -1, &keyname[62],
sizeof(keyname)/sizeof(WCHAR) - 63);
HeapFree(GetProcessHeap(), 0, (LPVOID)ifName);
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, keyname, 0, KEY_READ, &hkey) !=
ERROR_SUCCESS)
Modified: trunk/reactos/dll/win32/iphlpapi/resinfo_reactos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/iphlpapi/resinfo…
==============================================================================
--- trunk/reactos/dll/win32/iphlpapi/resinfo_reactos.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/iphlpapi/resinfo_reactos.c [iso-8859-1] Sat Oct 11 14:30:45
2008
@@ -136,19 +136,20 @@
malloc(((ch - LastNameStart) + 1) * sizeof(WCHAR));
if (NameServer) {
memcpy(NameServer,NameServerString + LastNameStart,
- (ch - LastNameStart) * sizeof(WCHAR));
+ (ch - LastNameStart) * sizeof(WCHAR));
NameServer[ch - LastNameStart] = 0;
cb( Interface, NameServer, Data );
free(NameServer);
+ LastNameStart = ch +1;
}
}
LastNameStart = ch + 1; /* The first one after the comma */
}
}
if (ch - LastNameStart > 0) { /* A last name? */
- PWCHAR NameServer = malloc(ch - LastNameStart + 1);
+ PWCHAR NameServer = malloc(((ch - LastNameStart) + 1) * sizeof(WCHAR));
memcpy(NameServer,NameServerString + LastNameStart,
- (ch - LastNameStart));
+ (ch - LastNameStart) * sizeof(WCHAR));
NameServer[ch - LastNameStart] = 0;
cb( Interface, NameServer, Data );
free(NameServer);