(2/2) advapi32: add some advapi32 wmi functions

Sebastian Lackner sebastian at fds-team.de
Thu May 5 21:56:49 CDT 2016


On 04.05.2016 06:47, Austin English wrote:
> -- -Austin
> 
> 
> 0002-advapi32-add-some-advapi32-wmi-functions.patch
> 
> 
> From dcdc8a38a72921f17c15c4e39ca0dd6fdb578a0f Mon Sep 17 00:00:00 2001
> From: Austin English <austinenglish at gmail.com>
> Date: Tue, 3 May 2016 02:17:15 -0500
> Subject: [PATCH 2/2] advapi32: add some advapi32 wmi functions
> 
> Signed-off-by: Austin English <austinenglish at gmail.com>
> ---
>  dlls/advapi32/Makefile.in   |   3 +-
>  dlls/advapi32/advapi32.spec |  28 +++++-----
>  dlls/advapi32/wmi.c         | 123 ++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 139 insertions(+), 15 deletions(-)
>  create mode 100644 dlls/advapi32/wmi.c
> 
> diff --git a/dlls/advapi32/Makefile.in b/dlls/advapi32/Makefile.in
> index 6b54295..ff6452a 100644
> --- a/dlls/advapi32/Makefile.in
> +++ b/dlls/advapi32/Makefile.in
> @@ -18,7 +18,8 @@ C_SRCS = \
>  	lsa.c \
>  	registry.c \
>  	security.c \
> -	service.c
> +	service.c \
> +	wmi.c

In general adding a new file for all those Wmi commands is probably fine,
but please move the existing ones there, too. (for example "WmiOpenBlock")

>  
>  IDL_SRCS = svcctl.idl
>  
> diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec
> index 3f32aa3..af5286b 100644
> --- a/dlls/advapi32/advapi32.spec
> +++ b/dlls/advapi32/advapi32.spec
> @@ -795,35 +795,35 @@
>  # @ stub WmiDevInstToInstanceNameA
>  # @ stub WmiDevInstToInstanceNameW
>  # @ stub WmiEnumerateGuids
> -# @ stub WmiExecuteMethodA
> -# @ stub WmiExecuteMethodW
> +@ stdcall WmiExecuteMethodA(ptr str  long long ptr long ptr)

Handles should still be traced as "long", not as "ptr". ;)
Also, the "outputsize" parameter is traced wrong (should be "ptr").

> +@ stdcall WmiExecuteMethodW(ptr wstr long long ptr long ptr)
>  # @ stub WmiFileHandleToInstanceNameA
>  # @ stub WmiFileHandleToInstanceNameW
> -# @ stub WmiFreeBuffer
> +@ stdcall WmiFreeBuffer(ptr)
>  # @ stub WmiGetFirstTraceOffset
>  # @ stub WmiGetNextEvent
>  # @ stub WmiGetTraceHeader
> -# @ stub WmiMofEnumerateResourcesA
> -# @ stub WmiMofEnumerateResourcesW
> -# @ stub WmiNotificationRegistrationA
> -# @ stub WmiNotificationRegistrationW
> +@ stdcall WmiMofEnumerateResourcesA(ptr ptr ptr)
> +@ stdcall WmiMofEnumerateResourcesW(ptr ptr ptr)
> +@ stdcall WmiNotificationRegistrationA(ptr long ptr ptr long)
> +@ stdcall WmiNotificationRegistrationW(ptr long ptr ptr long)
>  @ stdcall WmiOpenBlock(ptr long ptr)
>  # @ stub WmiOpenTraceWithCursor
>  # @ stub WmiParseTraceEvent
> -# @ stub WmiQueryAllDataA
> +@ stdcall WmiQueryAllDataA(ptr ptr ptr)
>  # @ stub WmiQueryAllDataMultipleA
>  # @ stub WmiQueryAllDataMultipleW
> -# @ stub WmiQueryAllDataW
> -# @ stub WmiQueryGuidInformation
> +@ stdcall WmiQueryAllDataW(ptr ptr ptr)
> +@ stdcall WmiQueryGuidInformation(ptr ptr)
>  # @ stub WmiQuerySingleInstanceA
>  # @ stub WmiQuerySingleInstanceMultipleA
>  # @ stub WmiQuerySingleInstanceMultipleW
>  @ stub WmiQuerySingleInstanceW
>  # @ stub WmiReceiveNotificationsA
>  # @ stub WmiReceiveNotificationsW
> -# @ stub WmiSetSingleInstanceA
> -@ stub WmiSetSingleInstanceW
> -# @ stub WmiSetSingleItemA
> -# @ stub WmiSetSingleItemW
> +@ stdcall WmiSetSingleInstanceA(ptr str  long long ptr)
> +@ stdcall WmiSetSingleInstanceW(ptr wstr long long ptr)
> +@ stdcall WmiSetSingleItemA(ptr str  long long long ptr)
> +@ stdcall WmiSetSingleItemW(ptr wstr long long long ptr)
>  # @ stub Wow64Win32ApiEntry
>  @ stdcall WriteEncryptedFileRaw(ptr ptr ptr)
> diff --git a/dlls/advapi32/wmi.c b/dlls/advapi32/wmi.c
> new file mode 100644
> index 0000000..de3f8fa
> --- /dev/null
> +++ b/dlls/advapi32/wmi.c
> @@ -0,0 +1,123 @@
> +/*
> + * Win32 advapi/wmi functions
> + *
> + * Copyright 2016 Austin English
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
> + */
> +
> +#include <stdarg.h>
> +
> +#include "windef.h"
> +#include "winbase.h"
> +#include "winerror.h"
> +#include "winternl.h"
> +#include "wmistr.h"
> +#include "ddk/wmium.h"
> +
> +#include "wine/unicode.h"
> +#include "wine/debug.h"
> +
> +#include "advapi32_misc.h"
> +
> +WINE_DEFAULT_DEBUG_CHANNEL(wmi);
> +
> +ULONG WMIAPI WmiExecuteMethodA(WMIHANDLE handle, const CHAR *instance, ULONG method, ULONG inputsize,

Please use lowercase 'char' instead of CHAR.

> +                               void *inputbuffer, ULONG *outputsize, void *outputbuffer)
> +{
> +    FIXME(": %p %s %u %u %p %p %p stub\n", handle, debugstr_a(instance), method, inputsize, inputbuffer,
> +                                           outputsize, outputbuffer);
> +    return ERROR_CALL_NOT_IMPLEMENTED;
> +}
> +
> +ULONG WMIAPI WmiExecuteMethodW(WMIHANDLE handle, const WCHAR *instance, ULONG method, ULONG inputsize,
> +                               void *inputbuffer, ULONG *outputsize, void *outputbuffer)
> +{
> +    FIXME(": %p %s %u %u %p %p %p stub\n", handle, debugstr_w(instance), method, inputsize, inputbuffer,
> +                                           outputsize, outputbuffer);
> +    return ERROR_CALL_NOT_IMPLEMENTED;
> +}
> +
> +VOID WMIAPI WmiFreeBuffer(void *buffer)

Lowercase 'void' is usually preferred.

> +{
> +    HeapFree(GetProcessHeap(), 0, buffer);

It doesn't really make sense to implement it unless we have at least one function which returns a buffer.

> +}
> +
> +ULONG WMIAPI WmiMofEnumerateResourcesA(MOFHANDLE handle, ULONG *count, MOFRESOURCEINFOA **resource)
> +{
> +    FIXME(": %p %p %p stub\n", handle, count, *resource);

Why do you dereference the pointer here? It looks like count and resource are output parameters here.

> +    return ERROR_CALL_NOT_IMPLEMENTED;
> +}
> +
> +ULONG WMIAPI WmiMofEnumerateResourcesW(MOFHANDLE handle, ULONG *count, MOFRESOURCEINFOW **resource)
> +{
> +    FIXME(": %p %p %p stub\n", handle, count, *resource);
> +    return ERROR_CALL_NOT_IMPLEMENTED;
> +}
> +
> +ULONG WMIAPI WmiNotificationRegistrationA(GUID *guid, BOOLEAN enable, void *info, ULONG_PTR *context, ULONG flags)
> +{
> +    FIXME(": %p %u %p %p 0x%08x stub\n", guid, enable, info, context, flags);
> +    return ERROR_CALL_NOT_IMPLEMENTED;
> +}
> +
> +ULONG WMIAPI WmiNotificationRegistrationW(GUID *guid, BOOLEAN enable, void *info, ULONG_PTR *context, ULONG flags)
> +{
> +    FIXME(": %p %u %p %p 0x%08x stub\n", guid, enable, info, context, flags);
> +    return ERROR_CALL_NOT_IMPLEMENTED;
> +}
> +
> +ULONG WMIAPI WmiQueryAllDataA(WMIHANDLE handle, ULONG *buffersize, void *buffer)
> +{
> +    FIXME(": %p %p %p stub\n", handle, buffersize, buffer);
> +    return ERROR_CALL_NOT_IMPLEMENTED;
> +}
> +
> +ULONG WMIAPI WmiQueryAllDataW(WMIHANDLE handle, ULONG *buffersize, void *buffer)
> +{
> +    FIXME(": %p %p %p stub\n", handle, buffersize, buffer);
> +    return ERROR_CALL_NOT_IMPLEMENTED;
> +}
> +
> +ULONG WMIAPI WmiQueryGuidInformation(WMIHANDLE handle, WMIGUIDINFORMATION *guidinfo)
> +{
> +    FIXME(": %p %p stub\n", handle, guidinfo);
> +    return ERROR_CALL_NOT_IMPLEMENTED;
> +}
> +
> +ULONG WMIAPI WmiSetSingleInstanceA(WMIHANDLE handle, const CHAR *name, ULONG reserved, ULONG size, void *buffer)
> +{
> +    FIXME(": %p %s %u %u %p stub\n", handle, debugstr_a(name), reserved, size, buffer);
> +    return ERROR_CALL_NOT_IMPLEMENTED;
> +}
> +
> +ULONG WMIAPI WmiSetSingleInstanceW(WMIHANDLE handle, const WCHAR *name, ULONG reserved, ULONG size, void *buffer)
> +{
> +    FIXME(": %p %s %u %u %p stub\n", handle, debugstr_w(name), reserved, size, buffer);
> +    return ERROR_CALL_NOT_IMPLEMENTED;
> +}
> +
> +ULONG WMIAPI WmiSetSingleItemA(WMIHANDLE handle, const CHAR *name, ULONG id, ULONG reserved, ULONG size, void *buffer)
> +{
> +    FIXME(": %p %s %u %u %p stub\n", handle, debugstr_a(name), reserved, size, buffer);
> +    return ERROR_CALL_NOT_IMPLEMENTED;
> +}
> +
> +ULONG WMIAPI WmiSetSingleItemW(WMIHANDLE handle, const WCHAR *name, ULONG id, ULONG reserved, ULONG size, void *buffer)
> +{
> +    FIXME(": %p %s %u %u %p stub\n", handle, debugstr_w(name), reserved, size, buffer);
> +    return ERROR_CALL_NOT_IMPLEMENTED;
> +}
> +
> -- 2.7.3
> 
> 
> 




More information about the wine-devel mailing list