      0x00001000
#define DNS_QUERY_ADDRCONFIG                0x00002000
#define DNS_QUERY_DUAL_ADDR                 0x00004000
#define DNS_QUERY_DONT_RESET_TTL_VALUES     0x00100000
#define DNS_QUERY_DISABLE_IDN_ENCODING      0x00200000
#define DNS_QUERY_APPEND_MULTILABEL         0x00800000
#define DNS_QUERY_DNSSEC_OK                 0x01000000
#define DNS_QUERY_DNSSEC_CHECKING_DISABLED  0x02000000
#define DNS_QUERY_RESERVED                  0xf0000000


//  Backward compatibility with Win2K
//  Do not use

#define DNS_QUERY_CACHE_ONLY                DNS_QUERY_NO_WIRE_QUERY



DNS_STATUS
WINAPI
DnsQuery_A(
    _In_                PCSTR           pszName,
    _In_                WORD            wType,
    _In_                DWORD           Options,
    _Inout_opt_         PVOID           pExtra,
    _Outptr_result_maybenull_     PDNS_RECORD *   ppQueryResults,
    _Outptr_opt_result_maybenull_ PVOID *         pReserved
    );

DNS_STATUS
WINAPI
DnsQuery_UTF8(
    _In_                PCSTR           pszName,
    _In_                WORD            wType,
    _In_                DWORD           Options,
    _Inout_opt_         PVOID           pExtra,
    _Outptr_result_maybenull_     PDNS_RECORD *   ppQueryResults,
    _Outptr_opt_result_maybenull_ PVOID *         pReserved
    );

DNS_STATUS
WINAPI
DnsQuery_W(
    _In_                PCWSTR          pszName,
    _In_                WORD            wType,
    _In_                DWORD           Options,
    _Inout_opt_         PVOID           pExtra,
    _Outptr_result_maybenull_     PDNS_RECORD *   ppQueryResults,
    _Outptr_opt_result_maybenull_ PVOID *         pReserved
    );

#ifdef UNICODE
#define DnsQuery DnsQuery_W
#else
#define DnsQuery DnsQuery_A
#endif


#if !defined ( USE_PRIVATE_DNS_ADDR ) || defined (MIDL_PASS)

//
//  DnsQueryEx
//

#define DNS_QUERY_RESULTS_VERSION1  0x1

typedef struct _DNS_QUERY_RESULT
{
    _In_        ULONG           Version;
    _Out_       DNS_STATUS      QueryStatus;
    _Out_       ULONG64         QueryOptions;
    _Out_       PDNS_RECORD     pQueryRecords;
    _Inout_opt_ PVOID           Reserved;
}
DNS_QUERY_RESULT, *PDNS_QUERY_RESULT;

typedef
VOID 
WINAPI
DNS_QUERY_COMPLETION_ROUTINE(
    _In_        PVOID               pQueryContext,
    _Inout_     PDNS_QUERY_RESULT   pQueryResults
);

typedef DNS_QUERY_COMPLETION_ROUTINE *PDNS_QUERY_COMPLETION_ROUTINE;

#define DNS_QUERY_REQUEST_VERSION1  0x1

typedef struct _DNS_QUERY_REQUEST
{
    _In_        ULONG           Version;
    _In_opt_    PCWSTR          QueryName;
    _In_        WORD            QueryType;
    _In_        ULONG64         QueryOptions;
    _In_opt_    PDNS_ADDR_ARRAY pDnsServerList;
    _In_opt_    ULONG           InterfaceIndex;
    _In_opt_    PDNS_QUERY_COMPLETION_ROUTINE   pQueryCompletionCallback;
    _In_        PVOID           pQueryContext;
}
DNS_QUERY_REQUEST, *PDNS_QUERY_REQUEST;

typedef struct DECLSPEC_ALIGN(8) _DNS_QUERY_CANCEL
{
                CHAR            Reserved[32];
}
DNS_QUERY_CANCEL, *PDNS_QUERY_CANCEL;

DNS_STATUS
WINAPI
DnsQueryEx(
    _In_        PDNS_QUERY_REQUEST  pQueryRequest,
    _Inout_     PDNS_QUERY_RESULT   pQueryResults,
    _Inout_opt_ PDNS_QUERY_CANCEL   pCancelHandle
    );

DNS_STATUS
WINAPI
DnsCancelQuery(
    _In_        PDNS_QUERY_CANCEL    pCancelHandle
    );

#endif


//
//  DNS Update API
//
//      DnsAcquireContextHandle
//      DnsReleaseContextHandle
//      DnsModifyRecordsInSet
//      DnsReplaceRecordSet
//

//
//  Update flags
//

#define DNS_UPDATE_SECURITY_USE_DEFAULT     0x00000000
#define DNS_UPDATE_SECURITY_OFF             0x00000010
#define DNS_UPDATE_SECURITY_ON              0x00000020
#define DNS_UPDATE_SECURITY_ONLY            0x00000100
#define DNS_UPDATE_CACHE_SECURITY_CONTEXT   0x00000200
#define DNS_UPDATE_TEST_USE_LOCAL_SYS_ACCT  0x00000400
#define DNS_UPDATE_FORCE_SECURITY_NEGO      0x00000800
#define DNS_UPDATE_TRY_ALL_MASTER_SERVERS   0x00001000
#define DNS_UPDATE_SKIP_NO_UPDATE_ADAPTERS  0x00002000
#define DNS_UPDATE_REMOTE_SERVER            0x00004000
#define DNS_UPDATE_RESERVED                 0xffff0000


//
//  Note:  pCredentials paramater is currently respectively
//  PSEC_WINNT_AUTH_IDENTITY_W or PSEC_WINNT_AUTH_IDENTITY_A.
//  Using PVOID to obviate the need for including rpcdce.h
//  in order to include this file and to leave open the
//  possibility of alternative credential specifications in
//  the future.
//

DNS_STATUS
WINAPI
DnsAcquireContextHandle_W(
    _In_            DWORD           CredentialFlags,
    _In_opt_        PVOID           Credentials,
    _Outptr_     PHANDLE         pContext
    );

DNS_STATUS
WINAPI
DnsAcquireContextHandle_A(
    _In_            DWORD           CredentialFlags,
    _In_opt_        PVOID           Credentials,
    _Outptr_     PHANDLE         pContext
    );

#ifdef UNICODE
#define DnsAcquireContextHandle DnsAcquireContextHandle_W
#else
#define DnsAcquireContextHandle DnsAcquireContextHandle_A
#endif

VOID
WINAPI
DnsReleaseContextHandle(
    _In_        HANDLE          hContext
    );

//
//  Dynamic Update API
//

DNS_STATUS
WINAPI
DnsModifyRecordsInSet_W(
    _In_opt_        PDNS_RECORD     pAddRecords,
    _In_opt_        PDNS_RECORD     pDeleteRecords,
    _In_            DWORD           Options,
    _In_opt_        HANDLE          hCredentials,
    _Inout_opt_     PVOID           pExtraList,
    _Inout_opt_     PVOID           pReserved
    );

DNS_STATUS
WINAPI
DnsModifyRecordsInSet_A(
    _In_opt_        PDNS_RECORD     pAddRecords,
    _In_opt_        PDNS_RECORD     pDeleteRecords,
    _In_            DWORD           Options,
    _In_opt_        HANDLE          hCredentials,
    _Inout_opt_     PVOID           pExtraList,
    _Inout_opt_     PVOID           pReserved
    );

DNS_STATUS
WINAPI
DnsModifyRecordsInSet_UTF8(
    _In_opt_        PDNS_RECORD     pAddRecords,
    _In_opt_        PDNS_RECORD     pDeleteRecords,
    _In_            DWORD           Options,
    _In_opt_        HANDLE          hCredentials,
    _Inout_opt_     PVOID           pExtraList,
    _Inout_opt_     PVOID           pReserved
    );

#ifdef UNICODE
#define DnsModifyRecordsInSet  DnsModifyRecordsInSet_W
#else
#define DnsModifyRecordsInSet  DnsModifyRecordsInSet_A
#endif


DNS_STATUS
WINAPI
DnsReplaceRecordSetW(
    _In_            PDNS_RECORD     pReplaceSet,
    _In_            DWORD           Options,
    _In_opt_        HANDLE          hContext,
    _Inout_opt_     PVOID           pExtraInfo,
    _Inout_opt_     PVOID           pReserved
    );

DNS_STATUS
WINAPI
DnsReplaceRecordSetA(
    _In_            PDNS_RECORD     pReplaceSet,
    _In_            DWORD           Options,
    _In_opt_        HANDLE          hContext,
    _Inout_opt_     PVOID           pExtraInfo,
    _Inout_opt_     PVOID           pReserved
    );

DNS_STATUS
WINAPI
DnsReplaceRecordSetUTF8(
    _In_            PDNS_RECORD     pReplaceSet,
    _In_            DWORD           Options,
    _In_opt_        HANDLE          hContext,
    _Inout_opt_     PVOID           pExtraInfo,
    _Inout_opt_     PVOID           pReserved
    );

#ifdef UNICODE
#define DnsReplaceRecordSet  DnsReplaceRecordSetW
#else
#define DnsReplaceRecordSet  DnsReplaceRecordSetA
#endif


