다음을 통해 공유


WZCEnumInterfaces 함수

[WZCEnumInterfaces 는 Windows Vista 및 Windows Server 2008을 기준으로 더 이상 지원되지 않습니다. 대신 WlanEnumInterfaces 함수를 사용합니다. 자세한 내용은 네이티브 Wifi API 정보를 참조하세요.]

WZCEnumInterfaces 함수는 무선 제로 구성 서비스에서 관리하는 모든 무선 LAN 인터페이스를 열거합니다.

구문

DWORD WZCEnumInterfaces(
  _In_  LPWSTR           pSrvAddr,
  _Out_ PINTFS_KEY_TABLE pIntfs
);

매개 변수

pSrvAddr [in]

이 함수를 실행할 컴퓨터의 이름을 포함하는 문자열에 대한 포인터입니다. 이 매개 변수가 NULL이면 무선 제로 구성 서비스가 로컬 컴퓨터에 열거됩니다.

지정된 pSrvAddr 매개 변수가 원격 컴퓨터인 경우 원격 컴퓨터는 원격 RPC 호출을 지원해야 합니다.

pIntfs [out]

모든 인터페이스에 대한 키 정보 테이블이 포함된 INTFS_KEY_TABLE 구조체에 대한 포인터입니다.

반환 값

함수가 성공하면 반환 값이 ERROR_SUCCESS.

함수가 실패하면 반환 값은 다음 반환 코드 중 하나일 수 있습니다.

반환 코드 설명
ERROR_ARENA_TRASHED
스토리지 제어 블록이 제거되었습니다. 무선 제로 구성 서비스가 내부 개체를 초기화하지 않은 경우 이 오류가 반환됩니다.
RPC_S_UNKNOWN_IF
인터페이스를 알 수 없습니다.
무선 제로 구성 서비스가 시작되지 않은 경우 이 오류가 반환됩니다.
RPC_X_NULL_REF_POINTER
null 참조 포인터가 스텁에 전달되었습니다.
pIntfs 매개 변수가 NULL인 경우 이 오류가 반환됩니다.
ERROR_NOT_ENOUGH_MEMORY
이 요청을 처리하고 쿼리 결과에 대한 메모리를 할당하는 데 사용할 수 있는 메모리가 부족합니다.
RPC_STATUS
다양한 오류 코드.

 

설명

wZCEnumInterfaces 함수를 호출하기 전에 pIntf가 가리키는 INTFS_KEY_TABLE 구조체의 dwNumIntfs 멤버를 0으로 설정해야 합니다. 또한 pIntfs 멤버를NULL로 설정해야 합니다.

다른 무선 제로 구성 함수에 대한 후속 호출의 경우 애플리케이션은 WZCEnumInterfaces 함수에서 반환된 관련 키 정보를 제공하여 작동 중인 인터페이스를 식별해야 합니다.

WZCEnumInterfaces가 ERROR_SUCCESS 반환하는 경우 호출자는 LocalFree를 호출하여 이 정보가 더 이상 필요하지 않으면 반환된 데이터에 할당된 내부 버퍼를 해제해야 합니다.

참고

Wzcsapi.h 헤더 파일 및 Wzcsapi.lib 가져오기 라이브러리 파일은 Windows SDK에서 사용할 수 없습니다.

 

예제

다음 예제에서는 무선 제로 구성 서비스에서 관리 하는 로컬 컴퓨터에서 무선 LAN 인터페이스를 열거 하 고 각 인터페이스에 대 한 인터페이스 GUID에 대 한 값을 출력 합니다.

참고

이 예제는 Windows Vista 이상에서 실패합니다.

 

#ifndef UNICODE
#define UNICODE
#endif

#include <windows.h>
#include <objbase.h>
#include <wtypes.h>

#include <stdio.h>
#include <stdlib.h>

// Wzcsapi.h and Wsczapi.lib were never shipped
// So we need to LOadlibrary and call the WZCEnumInterfaces function 
// in Wzcsapi.dll in the 

typedef struct
{
    LPWSTR wszGuid;
} INTF_KEY_ENTRY, *PINTF_KEY_ENTRY;

typedef struct
{
    DWORD dwNumIntfs;
    PINTF_KEY_ENTRY pIntfs;
} INTFS_KEY_TABLE, *PINTFS_KEY_TABLE;

DWORD WZCEnumInterfaces(LPWSTR pSrvAddr, PINTFS_KEY_TABLE pIntfs);

//Define the function prototype
typedef DWORD (CALLBACK* WZCEnumInterfacesType)(LPWSTR, PINTFS_KEY_TABLE);

int wmain()
{
    // Declare and initialize variables.

    DWORD dwResult = 0;
//    int iRet = 0;
    
//    WCHAR GuidString[40] = {0};
     
    int i;

    /* variables used for WZCEnumInterfaces  */
    
    PINTFS_KEY_TABLE pIfList; 
    PINTF_KEY_ENTRY pIfInfo;
    
    BOOL freeResult = FALSE;
    BOOL runTimeLinkSuccess = FALSE; 
    HINSTANCE dllHandle = NULL;              
    WZCEnumInterfacesType WZCEnumInterfacesPtr = NULL;

//    wprintf(L"Sample to test WZCEnumInterface\n");
    
    //Load the dll and keep the handle to it
    dllHandle = LoadLibrary( (LPCWSTR) L"wzcsapi.dll");

    // If the handle is valid, try to get the function address. 
    if (dllHandle == NULL) {
        dwResult = GetLastError();
        wprintf(L"LoadLibrary of wzcsapi.dll failed with error: %d\n", dwResult);
        if (dwResult ==  ERROR_MOD_NOT_FOUND)
            wprintf(L"Error: The specified module could not be found\n");
        return 1;
    }
    else  
    { 
        //Get pointer to our function using GetProcAddress:
        WZCEnumInterfacesPtr = (WZCEnumInterfacesType) GetProcAddress(dllHandle,
         "WZCEnumInterfaces");

        if (WZCEnumInterfacesPtr != NULL)
            runTimeLinkSuccess = TRUE;
        else {
            dwResult = GetLastError();   
            wprintf(L"GetProcAddress of WZCEnumInterfaces failed with error: %d\n", dwResult);
            return 1;
        }    
             
        // The function address is valid, allocate some memory for pIflist
        pIfList = (PINTFS_KEY_TABLE) LocalAlloc(LMEM_ZEROINIT,4096);
        if (pIfList == NULL) {    
            wprintf(L"Unable to allocate memory to store INTFS_KEY_TABLE\n");
            freeResult = FreeLibrary(dllHandle);
            return 1;
        }    

        // If the function address is valid, call the function. 
        if (runTimeLinkSuccess)
        {
            dwResult = WZCEnumInterfacesPtr(NULL, pIfList); 
            if (dwResult != ERROR_SUCCESS)  {
                wprintf(L"WZCEnumInterfaces failed with error: %u\n", dwResult);
                // FormatMessage can be used to find out why the function failed
                  //Free the library:
                freeResult = FreeLibrary(dllHandle);
                return 1;
            }
            else {
                wprintf(L"Num Entries: %lu\n", pIfList->dwNumIntfs);

                for (i = 0; i < (int) pIfList->dwNumIntfs; i++) {
                    pIfInfo = &pIfList->pIntfs[i];
                    if (pIfInfo->wszGuid == NULL)
                        wprintf(L"  InterfaceGUID[%d]: NULL\n",i);
                    else
                        wprintf(L"  InterfaceGUID[%d]: %ws\n",i, pIfInfo->wszGuid);
                    
                }    
            }
            wprintf(L"\n");
        }
        
        freeResult = FreeLibrary(dllHandle);
    }

    if (pIfList != NULL) {
        LocalFree(pIfList);
        pIfList = NULL;
    }
    return 0;
}

요구 사항

요구 사항
지원되는 최소 클라이언트
WINDOWS XP SP2 [데스크톱 앱만 해당]
지원되는 최소 서버
Windows Server 2003 [데스크톱 앱만 해당]
클라이언트 지원 종료
Windows XP with SP3
서버 지원 종료
Windows Server 2003
헤더
Wzcsapi.h
라이브러리
Wzcsapi.lib
DLL
Wzcsapi.dll

추가 정보

INTFS_KEY_TABLE

INTF_KEY_ENTRY

WZCEapolGetInterfaceParams

WZCQueryInterface

WZCRefreshInterface