mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +00:00
- Fix MultiByteToWideChar api parameters (thanks Christoph)
- Fix bugs in EnumNameServers svn path=/trunk/; revision=36722
This commit is contained in:
parent
639ed2255f
commit
6da373e9fd
2 changed files with 6 additions and 8 deletions
|
@ -1471,14 +1471,11 @@ DWORD WINAPI GetNumberOfInterfaces(PDWORD pdwNumIf)
|
|||
* 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)
|
||||
{
|
||||
if (Context->uSizeAvailable >= Context->uSizeRequired)
|
||||
|
@ -1518,7 +1515,7 @@ DWORD WINAPI GetPerAdapterInfo(ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterIn
|
|||
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)
|
||||
|
|
|
@ -140,15 +140,16 @@ void EnumNameServers( HANDLE RegHandle, PWCHAR Interface,
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue