reg.exe: Add query function
Nikolay Sivov
bunglehead at gmail.com
Thu Aug 1 08:54:54 CDT 2013
On 8/1/2013 17:44, Hugh McMaster wrote:
> This patch builds significantly on the query function stub in programs/reg.exe. The patch includes recursion for subkeys.
>
> Some examples of usage:
>
> wine reg.exe query "HKCU"
> wine reg.exe query "HKCU\Console"
> wine reg.exe query "HKCU\Console" /v "ScreenSize"
> wine reg.exe query "HKCU\Software" /s
>
> ---
> programs/reg/reg.c | 232 +++++++++++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 221 insertions(+), 11 deletions(-)
>
> +static LPVOID WINAPI mem_alloc(size_t size)
> +{
> + return HeapAlloc(GetProcessHeap(), 0, size);
> +}
> +
> +static void WINAPI mem_free(LPVOID mem)
> +{
> + HeapFree(GetProcessHeap(), 0, mem);
> +}
Why WINAPI? It's better to follow naming from existing module, there's
plenty of them with similar helpers.
> + case REG_SZ:
> + case REG_MULTI_SZ:
> + case REG_EXPAND_SZ:
No tabs please.
> +static void reg_output_subkey(LPWSTR key_name, LPWSTR subkeyName)
> +{
> + reg_printfW(formatSW, key_name);
> +
> + if (subkeyName > 0)
> + {
> + reg_printfW(formatSW, slashW);
> + reg_printfW(formatSW, subkeyName);
> + reg_printfW(formatSW, newlineW);
> + }
> +}
Comparison looks a bit odd. Also why do you need to break it down to
three printf calls instead of one?
> + p = strchrW(key_name,'\\');
> + if (!p)
> + {
> + p = 0;
> + }
> + else p++;
I'm not sure what this is supposed to do.
> + case REG_BINARY:
> + case REG_NONE:
> + pValue = value;
> + for (i=0; i<valueSize; i++, pValue++)
> + reg_printfW(formatXW, *pValue);
> + break;
There's no need for separate variable here nor for incrementing pointer.
More information about the wine-devel
mailing list