ReactOS  0.4.15-dev-1171-gab82533
proplist.c File Reference
#include <assert.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wincrypt.h"
#include "wine/debug.h"
#include "wine/list.h"
#include "crypt32_private.h"
Include dependency graph for proplist.c:

Go to the source code of this file.

Classes

struct  _CONTEXT_PROPERTY_LIST
 
struct  _CONTEXT_PROPERTY
 

Typedefs

typedef struct _CONTEXT_PROPERTY CONTEXT_PROPERTY
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (crypt)
 
CONTEXT_PROPERTY_LISTContextPropertyList_Create (void)
 
void ContextPropertyList_Free (CONTEXT_PROPERTY_LIST *list)
 
BOOL ContextPropertyList_FindProperty (CONTEXT_PROPERTY_LIST *list, DWORD id, PCRYPT_DATA_BLOB blob)
 
BOOL ContextPropertyList_SetProperty (CONTEXT_PROPERTY_LIST *list, DWORD id, const BYTE *pbData, size_t cbData)
 
void ContextPropertyList_RemoveProperty (CONTEXT_PROPERTY_LIST *list, DWORD id)
 
DWORD ContextPropertyList_EnumPropIDs (CONTEXT_PROPERTY_LIST *list, DWORD id)
 
void ContextPropertyList_Copy (CONTEXT_PROPERTY_LIST *to, CONTEXT_PROPERTY_LIST *from)
 

Typedef Documentation

◆ CONTEXT_PROPERTY

Function Documentation

◆ ContextPropertyList_Copy()

void ContextPropertyList_Copy ( CONTEXT_PROPERTY_LIST to,
CONTEXT_PROPERTY_LIST from 
)

Definition at line 207 of file proplist.c.

208 {
209  CONTEXT_PROPERTY *prop;
210 
212  LIST_FOR_EACH_ENTRY(prop, &from->properties, CONTEXT_PROPERTY, entry)
213  {
215  prop->cbData);
216  }
218 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
BOOL ContextPropertyList_SetProperty(CONTEXT_PROPERTY_LIST *list, DWORD id, const BYTE *pbData, size_t cbData)
Definition: proplist.c:95
uint32_t entry
Definition: isohybrid.c:63
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
CardRegion * from
Definition: spigame.cpp:19

Referenced by Context_CopyProperties().

◆ ContextPropertyList_Create()

CONTEXT_PROPERTY_LIST* ContextPropertyList_Create ( void  )

Context property list functions

Definition at line 43 of file proplist.c.

44 {
46 
47  if (list)
48  {
50  list->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PCONTEXT_PROPERTY_LIST->cs");
51  list_init(&list->properties);
52  }
53  return list;
54 }
#define DWORD_PTR
Definition: treelist.c:76
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
Definition: _list.h:228
#define list
Definition: rosglue.h:35
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149

Referenced by CertSetStoreProperty(), Context_CreateDataContext(), and CryptMsgOpenToDecode().

◆ ContextPropertyList_EnumPropIDs()

DWORD ContextPropertyList_EnumPropIDs ( CONTEXT_PROPERTY_LIST list,
DWORD  id 
)

Definition at line 170 of file proplist.c.

171 {
172  DWORD ret;
173 
175  if (id)
176  {
177  CONTEXT_PROPERTY *cursor = NULL, *prop;
178 
179  LIST_FOR_EACH_ENTRY(prop, &list->properties, CONTEXT_PROPERTY, entry)
180  {
181  if (prop->propID == id)
182  {
183  cursor = prop;
184  break;
185  }
186  }
187  if (cursor)
188  {
189  if (cursor->entry.next != &list->properties)
190  ret = LIST_ENTRY(cursor->entry.next, CONTEXT_PROPERTY,
191  entry)->propID;
192  else
193  ret = 0;
194  }
195  else
196  ret = 0;
197  }
198  else if (!list_empty(&list->properties))
199  ret = LIST_ENTRY(list->properties.next, CONTEXT_PROPERTY,
200  entry)->propID;
201  else
202  ret = 0;
204  return ret;
205 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
smooth NULL
Definition: ftsmooth.c:416
struct list * next
Definition: list.h:38
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
const char cursor[]
Definition: icontest.c:13
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by CertEnumCertificateContextProperties(), CertEnumCRLContextProperties(), and CertEnumCTLContextProperties().

◆ ContextPropertyList_FindProperty()

BOOL ContextPropertyList_FindProperty ( CONTEXT_PROPERTY_LIST list,
DWORD  id,
PCRYPT_DATA_BLOB  blob 
)

Definition at line 72 of file proplist.c.

74 {
75  CONTEXT_PROPERTY *prop;
76  BOOL ret = FALSE;
77 
78  TRACE("(%p, %d, %p)\n", list, id, blob);
79 
81  LIST_FOR_EACH_ENTRY(prop, &list->properties, CONTEXT_PROPERTY, entry)
82  {
83  if (prop->propID == id)
84  {
85  blob->cbData = prop->cbData;
86  blob->pbData = prop->pbData;
87  ret = TRUE;
88  break;
89  }
90  }
92  return ret;
93 }
Definition: image.c:133
#define TRUE
Definition: types.h:120
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
int ret
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by CDecodeHashMsg_GetParam(), CDecodeHashMsg_VerifyHash(), CDecodeMsg_FinalizeHashedContent(), CDecodeMsg_GetParam(), CertContext_GetProperty(), CertGetStoreProperty(), CRLContext_GetProperty(), and CTLContext_GetProperty().

◆ ContextPropertyList_Free()

void ContextPropertyList_Free ( CONTEXT_PROPERTY_LIST list)

Definition at line 56 of file proplist.c.

57 {
58  CONTEXT_PROPERTY *prop, *next;
59 
61  entry)
62  {
63  list_remove(&prop->entry);
64  CryptMemFree(prop->pbData);
65  CryptMemFree(prop);
66  }
67  list->cs.DebugInfo->Spare[0] = 0;
70 }
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
struct list entry
Definition: proplist.c:40
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
static unsigned __int64 next
Definition: rand_nt.c:6
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141

Referenced by CDecodeMsg_Close(), Context_Free(), and CRYPT_FreeStore().

◆ ContextPropertyList_RemoveProperty()

void ContextPropertyList_RemoveProperty ( CONTEXT_PROPERTY_LIST list,
DWORD  id 
)

Definition at line 149 of file proplist.c.

150 {
151  CONTEXT_PROPERTY *prop;
152 
154  LIST_FOR_EACH_ENTRY(prop, &list->properties, CONTEXT_PROPERTY, entry)
155  {
156  if (prop->propID == id)
157  {
158  list_remove(&prop->entry);
159  CryptMemFree(prop->pbData);
160  CryptMemFree(prop);
161  break;
162  }
163  }
165 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
struct list entry
Definition: proplist.c:40
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by CertContext_SetProperty(), CertSetStoreProperty(), CRLContext_SetProperty(), and CTLContext_SetProperty().

◆ ContextPropertyList_SetProperty()

BOOL ContextPropertyList_SetProperty ( CONTEXT_PROPERTY_LIST list,
DWORD  id,
const BYTE pbData,
size_t  cbData 
)

Definition at line 95 of file proplist.c.

97 {
98  LPBYTE data;
99  BOOL ret = FALSE;
100 
101  if (cbData)
102  {
103  data = CryptMemAlloc(cbData);
104  if (data)
105  memcpy(data, pbData, cbData);
106  }
107  else
108  data = NULL;
109  if (!cbData || data)
110  {
111  CONTEXT_PROPERTY *prop;
112  BOOL found = FALSE;
113 
115  LIST_FOR_EACH_ENTRY(prop, &list->properties, CONTEXT_PROPERTY, entry)
116  {
117  if (prop->propID == id)
118  {
119  found = TRUE;
120  break;
121  }
122  }
123  if (found)
124  {
125  CryptMemFree(prop->pbData);
126  prop->cbData = cbData;
127  prop->pbData = data;
128  ret = TRUE;
129  }
130  else
131  {
132  prop = CryptMemAlloc(sizeof(CONTEXT_PROPERTY));
133  if (prop)
134  {
135  prop->propID = id;
136  prop->cbData = cbData;
137  prop->pbData = data;
138  list_add_tail(&list->properties, &prop->entry);
139  ret = TRUE;
140  }
141  else
143  }
145  }
146  return ret;
147 }
#define TRUE
Definition: types.h:120
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
struct list entry
Definition: proplist.c:40
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
uint32_t entry
Definition: isohybrid.c:63
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: _list.h:228
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
GLenum GLuint id
Definition: glext.h:5579
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_updates_bytes_to_ pdwDataLen BYTE * pbData
Definition: wincrypt.h:4201

Referenced by CDecodeMsg_DecodeDataContent(), CDecodeMsg_DecodeHashedContent(), CDecodeMsg_SaveAlgorithmID(), CertContext_SetKeyProvInfoProperty(), CertContext_SetProperty(), CertSetStoreProperty(), ContextPropertyList_Copy(), CRLContext_SetProperty(), and CTLContext_SetProperty().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( crypt  )