KERNEL: improve stubs for DnsHostnameToComputerName{A,W}

Peter Berg Larsen pebl at math.ku.dk
Thu Mar 31 05:06:14 CST 2005


+BOOL WINAPI DnsHostnameToComputerNameA(LPCSTR hostname,
+    LPSTR computername, LPDWORD size)
...
+    DWORD len;
+
...
+    if (!hostname || !size) return FALSE;
+    len = lstrlenW(hostname);
+
+    if (len > MAX_COMPUTERNAME_LENGTH)
+        len = MAX_COMPUTERNAME_LENGTH;
+
+    if (*size < len)
+    {
+        *size = len;
+        return FALSE;
+    }
+    if (!computername) return FALSE;
+
+    memcpy( computername, hostname, len );
+    computername[len + 1] = 0;
+    return TRUE;
+ }

I have seen at lot of these where the \0 termination is unspecified for
the size parameter, but in this case msdn mentions it.



More information about the wine-devel mailing list