IOpcDigitalSignature::GetNamespaces method

Gets the prefix and namespace mapping of the Signature element of the signature markup.

Syntax


HRESULT GetNamespaces(
  [out] LPCWSTR **prefixes,
  [out] LPCWSTR **namespaces,
  [out] UINT32  *count
);

Parameters

prefixes [out]

A pointer to a buffer of XML prefix strings. If the method succeeds, call the CoTaskMemFree function to free the memory of each string in the buffer and then to free the memory of the buffer itself.

namespaces [out]

A pointer to a buffer of XML namespace strings. If the method succeeds, call the CoTaskMemFree function to free the memory of each string in the buffer and then to free the memory of the buffer itself.

count [out]

The size of the prefixes and namespaces buffers.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return codeDescription
S_OK

The method succeeded.

E_POINTER

The prefixes parameter is NULL.

E_POINTER

The namespaces parameter is NULL.

E_POINTER

The count parameter is NULL.

 

Remarks

The prefixes and namespaces buffers are mapped to each other by index.

This method allocates memory used by the buffers returned in prefixes and namespaces and the strings contained in each buffer.

Examples

The following code shows how to use CoTaskMemFree to free the memory of the buffers and the strings they contain.


// Prepare to call GetNamespaces
LPWSTR* prefixes = NULL;
LPWSTR* namespaces = NULL;
UINT32 count = 0;

// Call to GetNamespaces succeeds
if ( SUCCEEDED( signature->GetNamespaces(&prefixes, &namespaces, &count) ) )
{
    // Process strings in prefixes and namespaces as needed for the application

    // Free memory for each string
    for (UINT32 i = 0; i < count; i++)
    {
        CoTaskMemFree(prefixes[i]);
        CoTaskMemFree(namespaces[i]);
    }
    // Free memory for the buffers
    CoTaskMemFree(prefixes);
    CoTaskMemFree(namespaces);
}

Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Msopc.h

IDL

OpcDigitalSignature.idl

See also

IOpcDigitalSignature
Overviews
Digital Signatures Overview
Getting Started with the Packaging API
Packaging API Programming Guide
Reference
Core Packaging Interfaces
Packaging Digital Signature Interfaces
Packaging Interfaces
Packaging API Reference
Packaging API Samples

 

 

Community Additions

ADD
Show: