ReactOS  0.4.13-dev-249-gcba1a2f
context.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for context.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

DNS_STATUS WINAPI DnsAcquireContextHandle_UTF8 (DWORD CredentialsFlags, PVOID Credentials, HANDLE *ContextHandle)
 
DNS_STATUS WINAPI DnsAcquireContextHandle_W (DWORD CredentialsFlags, PVOID Credentials, HANDLE *ContextHandle)
 
DNS_STATUS WINAPI DnsAcquireContextHandle_A (DWORD CredentialFlags, PVOID Credentials, HANDLE *ContextHandle)
 
void WINAPI DnsReleaseContextHandle (HANDLE ContextHandle)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file context.c.

Function Documentation

◆ DnsAcquireContextHandle_A()

DNS_STATUS WINAPI DnsAcquireContextHandle_A ( DWORD  CredentialFlags,
PVOID  Credentials,
HANDLE ContextHandle 
)

Definition at line 100 of file context.c.

103 {
104  if(CredentialFlags)
105  {
106  return DnsAcquireContextHandle_W(CredentialFlags, Credentials, ContextHandle);
107  }
108  else
109  {
110  return DnsAcquireContextHandle_UTF8(CredentialFlags, Credentials, ContextHandle);
111  }
112 }
DNS_STATUS WINAPI DnsAcquireContextHandle_W(DWORD CredentialsFlags, PVOID Credentials, HANDLE *ContextHandle)
Definition: context.c:36
DNS_STATUS WINAPI DnsAcquireContextHandle_UTF8(DWORD CredentialsFlags, PVOID Credentials, HANDLE *ContextHandle)
Definition: context.c:77

◆ DnsAcquireContextHandle_UTF8()

DNS_STATUS WINAPI DnsAcquireContextHandle_UTF8 ( DWORD  CredentialsFlags,
PVOID  Credentials,
HANDLE ContextHandle 
)

Definition at line 77 of file context.c.

80 {
81  if( CredentialsFlags )
82  {
83  return DnsAcquireContextHandle_W(CredentialsFlags, Credentials, ContextHandle);
84  }
85  else
86  {
87  /* Convert to unicode, then call the _W version
88  * For now, there is no conversion */
89  DNS_STATUS Status;
90 
91  Status = DnsAcquireContextHandle_W(TRUE, Credentials, /* XXX arty */ ContextHandle);
92 
93  /* Free the unicode credentials when they exist. */
94 
95  return Status;
96  }
97 }
#define TRUE
Definition: types.h:120
DNS_STATUS WINAPI DnsAcquireContextHandle_W(DWORD CredentialsFlags, PVOID Credentials, HANDLE *ContextHandle)
Definition: context.c:36
Status
Definition: gdiplustypes.h:24

Referenced by DnsAcquireContextHandle_A(), and DnsAcquireContextHandle_W().

◆ DnsAcquireContextHandle_W()

DNS_STATUS WINAPI DnsAcquireContextHandle_W ( DWORD  CredentialsFlags,
PVOID  Credentials,
HANDLE ContextHandle 
)

Definition at line 36 of file context.c.

39 {
40  if(CredentialsFlags)
41  {
43  int adns_status;
44 
45  /* For now, don't worry about the user's identity. */
46  Context = (PWINDNS_CONTEXT)RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(WINDNS_CONTEXT));
47 
48  if(!Context)
49  {
50  *ContextHandle = 0;
51  return ERROR_OUTOFMEMORY;
52  }
53 
54  /* The real work here is to create an adns_state that will help us
55  * do what we want to later. */
57 
58  if(adns_status != adns_s_ok)
59  {
60  *ContextHandle = 0;
61  RtlFreeHeap(RtlGetProcessHeap(), 0, Context);
63  }
64  else
65  {
66  *ContextHandle = (HANDLE)Context;
67  return ERROR_SUCCESS;
68  }
69  }
70  else
71  {
72  return DnsAcquireContextHandle_UTF8(CredentialsFlags, Credentials, ContextHandle);
73  }
74 }
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
struct WINDNS_CONTEXT * PWINDNS_CONTEXT
adns_status
Definition: adns.h:215
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
DNS_STATUS DnsIntTranslateAdnsToDNS_STATUS(int Status)
Definition: adns.c:17
PVOID HANDLE
Definition: typedefs.h:71
DNS_STATUS WINAPI DnsAcquireContextHandle_UTF8(DWORD CredentialsFlags, PVOID Credentials, HANDLE *ContextHandle)
Definition: context.c:77
ADNS_API int adns_init(adns_state *newstate_r, adns_initflags flags, FILE *diagfile)
Definition: setup.c:568
struct tagContext Context
Definition: acpixf.h:1012
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by DnsAcquireContextHandle_A(), and DnsAcquireContextHandle_UTF8().

◆ DnsReleaseContextHandle()

void WINAPI DnsReleaseContextHandle ( HANDLE  ContextHandle)

Definition at line 118 of file context.c.

119 {
120  PWINDNS_CONTEXT Context = (PWINDNS_CONTEXT)ContextHandle;
121 
122  adns_finish(Context->State);
123  RtlFreeHeap(RtlGetProcessHeap(), 0, Context);
124 }
ADNS_API void adns_finish(adns_state ads)
Definition: setup.c:650
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
struct WINDNS_CONTEXT * PWINDNS_CONTEXT