+static inline void copy_char_to_wchar_sz(const BYTE *src, DWORD len, WCHAR *dst) +{ + const BYTE *begin; + + for (begin = src; src - begin < len; src++, dst++) + *dst = *src; + *dst = 0; +}
That looks very wrong. Is there really evidence that Unicode chars are truncated?
Until IDN is widely supported, non-ASCII characters are not valid in the DNS. There are of course several implementations of IDN, but they're not standardized. Would a FIXME be better if a wide character is encountered?
+ l = RegQueryValueExW( key, WinHttpSettings, NULL, &type, NULL, &size ); + if (!l && type == REG_BINARY && size >= 5 * sizeof(DWORD)) + { + BYTE *buf = HeapAlloc( GetProcessHeap(), 0, size ); + + if (buf) + { + DWORD *magic = (DWORD *)buf; + DWORD *unknown = magic + 1; + DWORD *flags = unknown + 1; + DWORD *len = flags + 1;
Please define an appropriate structure.
I can for the first three DWORDs, but the strings are packed. Would you like a structure for the first three DWORDs? --Juan