CscSearchApiGetInterface function

[This function is deprecated and might be altered or unavailable in subsequent versions.]

Creates an instance of a CCscSearchApiInterface object.

Syntax

NTSTATUS CscSearchApiGetInterface(
  _In_  ULONG                  Version,
  _In_  ULONG                  Cookie,
  _Out_ CCscSearchApiInterface **Interface
);

Parameters

Return value

Type: NTSTATUS

STATUS_SUCCESS if initialization was successful; otherwise an NTSTATUS value that specifies an error.

Remarks

This class is not included in a public header or library file in Windows versions before Windows 7. To use this function in earlier versions, call LoadLibrary with the DLL name (Cscapi.dll) to obtain a module handle, and then call GetProcAddress with that module handle and the desired function name to get the address of this function.

The following function pointer type definition can be used to call CscSearchApiGetInterface.

typedef NTSTATUS (STDMETHODCALLTYPE *PFUNC_CSC_SEARCHAPI_GET_INTERFACE)(
    __in ULONG, 
    __in ULONG, 
    __out CCscSearchApiInterface **
);

Examples

The following code example provides a function pointer prototype type definition for calling CscSearchApiGetInterface, and shows how to accomplish such a call.

class CCscSearchApiInterface;

typedef NTSTATUS (STDMETHODCALLTYPE *PFUNC_CSC_SEARCHAPI_GET_INTERFACE)(
    __in ULONG, 
    __in ULONG, 
    __out CCscSearchApiInterface **
);

#define CSC_SEARCHAPI_INTERFACE_VERSION 0x00010004
#define CSC_SEARCHAPI_INTERFACE_COOKIE 0x8fb92809

CCscSearchApiInterface* getCCscSearchApiInterface()
{
    PFUNC_CSC_SEARCHAPI_GET_INTERFACE pfnCscSearchApiGetInterface = NULL;
    CCscSearchApiInterface* pCCscSearchApiInterface = NULL;
    NTSTATUS status = 0x0;

    HMODULE dll = LoadLibraryW(L"cscapi.dll");
    
    if (dll != NULL) {
       
        pfnCscSearchApiGetInterface = (PFUNC_CSC_SEARCHAPI_GET_INTERFACE)GetProcAddress(
            dll,
            "CscSearchApiGetInterface"
        );

        if (pfnCscSearchApiGetInterface != NULL) {
            status = (pfnCscSearchApiGetInterface)(
                CSC_SEARCHAPI_INTERFACE_VERSION, 
                CSC_SEARCHAPI_INTERFACE_COOKIE, 
                &pCCscSearchApiInterface
            );
         }
    }

    FreeLibrary(dll);
    return pCCscSearchApiInterface;
}

Requirements

Minimum supported client

Windows Vista, Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Cscsearchapiif.hxx

Library

Cscapi.lib

DLL

Cscapi.dll