microsoft / microsoft/win32metadata

WMI MI_ApplicationFT struct is hard to use

Open
#842 7 comments 0 reactions 1 assignee View on GitHub

@jterry75 is already working on this.

Since Dec 9, 2024.

help wanted usability
Dominant language
C++
Stars
1.5k
Forks
149
Avg merge
5d 16h
Merged PRs (30d)
4

Description

Related: microsoft/windows-rs#1572

WMI APIs such as MI_Application_NewSession are header-only. (Nearly all of them are.) That's not a problem per se but in this case, after calling MI_Application_InitializeV1 you get back a function table defined as such:

typedef struct _MI_ApplicationFT
{
    MI_Result (MI_CALL *Close)(
        _Inout_     MI_Application *application);

    MI_Result (MI_CALL *NewSession)(
        _In_     MI_Application *application,
        _In_opt_z_ const MI_Char *protocol,
        _In_opt_z_ const MI_Char *destination,
        _In_opt_ MI_DestinationOptions *options,
        _In_opt_ MI_SessionCallbacks *callbacks,
        _Outptr_opt_result_maybenull_ MI_Instance **extendedError,
        _Out_    MI_Session *session);

    MI_Result (MI_CALL *NewHostedProvider)(
        _In_     MI_Application *application,
        _In_z_     const MI_Char *namespaceName,
        _In_z_     const MI_Char *providerName,
        _In_     MI_MainFunction mi_Main,
        _Outptr_opt_result_maybenull_ MI_Instance **extendedError,
        _Out_    MI_HostedProvider *provider
        );

   // ...
}

Metadata currently houses a table of difficult to use bare IntPtrs.

public struct MI_ApplicationFT
{
	public IntPtr Close;
	public IntPtr NewSession;
	public IntPtr NewHostedProvider;
	public IntPtr NewInstance;
	public IntPtr NewDestinationOptions;
	public IntPtr NewOperationOptions;
	public IntPtr NewSubscriptionDeliveryOptions;
	public IntPtr NewSerializer;
	public IntPtr NewDeserializer;
	public IntPtr NewInstanceFromClass;
	public IntPtr NewClass;
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.