-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 2014-11-06 22:17, schrieb Jonathan Vollebregt:
+static LSTATUS wchar_get_data( const WCHAR *input, const DWORD type,
const WCHAR separator, DWORD *size_out, BYTE **out)
This whitespace use is a bit weird. Is there a precedent for it?
** (DWORD **) out = i;
The space between ** and ( is a bit odd too.
/* If it's the first character or the previous one was a separator */
if (!p || temp[p - 1] == 0)
{
HeapFree(GetProcessHeap(), 0, temp);
return ERROR_BAD_COMMAND;
}
What does advapi32 do if you have empty substrings? (I.e., the same question as with the trailing backslashes: Does this code belong into reg.exe or advapi32.dll?) If advapi32 returns an error you can probably use it instead of the internal ERROR_NOT_INT_OR_NEG.
*out = HeapReAlloc(GetProcessHeap(), 0, temp, p * sizeof(WCHAR));
Technically this could fail. But I don't think it is necessary - the compiled code for the HeapReAlloc invocation takes probably more space than the few bytes you're freeing a little bit earlier.
return ERROR_SUCCESS;
}
case REG_BINARY:
{
BYTE * temp = HeapAlloc(GetProcessHeap(), 0, strlenW(input));
Inconsistent style.
case REG_BINARY:
...
return ERROR_BAD_COMMAND;
Does native write different error messages for a negative DWORD, improperly separated REG_MULTI_SZ and invalid REG_BINARY?
*out = HeapReAlloc(GetProcessHeap(), 0, temp-odd, p);
MSDN says the third parameter has to be a pointer returned by HeapAlloc or HeapReAlloc.