ReactOS 0.4.15-dev-7924-g5949c20
propvar.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/rtl/propvar.c
5 * PURPOSE: Native properties and variants API
6 * PROGRAMMER: Pierre Schweitzer (pierre@reactos.org)
7 */
8
9/* INCLUDES *****************************************************************/
10
11#include <rtl.h>
12
13#define NDEBUG
14#include <debug.h>
15
16/* FUNCTIONS ***************************************************************/
17
19/* FIXME: (or not)
20 * Define those here to allow build. They don't need to be dereferenced
21 * so it's OK.
22 * Furthermore till Vista those Ole32 API were private so those defines
23 * should be made in a private header
24 * Finally, having those defined that way allows to write that code plain C.
25 */
28
29/*
30 * @implemented
31 */
33LoadOle32Export(PVOID * BaseAddress, const PCHAR ProcedureName)
34{
36 ANSI_STRING ExportName;
37 PVOID ProcedureAddress;
38
39 /* First load ole32.dll */
41 if (!NT_SUCCESS(Status))
42 {
44 }
45
46 RtlInitAnsiString(&ExportName, ProcedureName);
47
48 /* Look for the procedure */
50 0, &ProcedureAddress);
51 if (!NT_SUCCESS(Status))
52 {
54 }
55
56 /* Return its address */
57 return ProcedureAddress;
58}
59
60/*
61 * @implemented
62 */
66 IN ULONG cbProp,
67 IN USHORT CodePage,
68 IN BYTE bReserved)
69{
70 ULONG Length = 0;
72 ULONG (*ProcedureAddress)(PSERIALIZEDPROPERTYVALUE, ULONG, USHORT, BYTE);
73
75 {
76 /* Simply call the appropriate Ole32 export */
77 ProcedureAddress = LoadOle32Export(&BaseAddress,
78 "StgPropertyLengthAsVariant");
79
80 Length = ProcedureAddress(pProp, cbProp, CodePage, bReserved);
81 }
83 {
84 if (BaseAddress != NULL)
85 {
87 }
88 }
90
91 return Length;
92}
93
94/*
95 * @implemented
96 */
100 IN USHORT CodePage,
101 OUT PROPVARIANT * pvar,
103{
106 BOOLEAN (*ProcedureAddress)(PSERIALIZEDPROPERTYVALUE, USHORT, PROPVARIANT*, PPMemoryAllocator);
107
109 {
110 /* Simply call the appropriate Ole32 export */
111 ProcedureAddress = LoadOle32Export(&BaseAddress,
112 "StgConvertPropertyToVariant");
113
114 Success = ProcedureAddress(prop, CodePage, pvar, pma);
115 }
117 {
118 if (BaseAddress != NULL)
119 {
121 }
122 }
123 _SEH2_END;
124
125 return Success;
126}
127
128/*
129 * @implemented
130 */
132NTAPI
133RtlConvertVariantToProperty(IN const PROPVARIANT * pvar,
134 IN USHORT CodePage,
136 IN OUT PULONG pcb,
137 IN PROPID pid,
138 IN BOOLEAN fReserved,
139 IN OUT PULONG pcIndirect OPTIONAL)
140{
141 PSERIALIZEDPROPERTYVALUE Serialized = NULL;
143 PSERIALIZEDPROPERTYVALUE (*ProcedureAddress)(const PROPVARIANT*, USHORT, PSERIALIZEDPROPERTYVALUE,
145
147 {
148 /* Simply call the appropriate Ole32 export */
149 ProcedureAddress = LoadOle32Export(&BaseAddress,
150 "StgConvertVariantToProperty");
151
152 Serialized = ProcedureAddress(pvar, CodePage, pprop, pcb, pid, fReserved, pcIndirect);
153 }
155 {
156 if (BaseAddress != NULL)
157 {
159 }
160 }
161 _SEH2_END;
162
163 return Serialized;
164}
165
166
167/* EOF */
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
@ Success
Definition: eventcreate.c:712
#define _SEH2_FINALLY
Definition: filesup.c:21
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
Status
Definition: gdiplustypes.h:25
NTSTATUS NTAPI LdrUnloadDll(_In_ PVOID BaseAddress)
Definition: ldrapi.c:1331
NTSTATUS NTAPI DECLSPEC_HOTPATCH LdrLoadDll(_In_opt_ PWSTR SearchPath, _In_opt_ PULONG DllCharacteristics, _In_ PUNICODE_STRING DllName, _Out_ PVOID *BaseAddress)
Definition: ldrapi.c:312
NTSTATUS NTAPI LdrGetProcedureAddress(_In_ PVOID BaseAddress, _In_opt_ _When_(Ordinal==0, _Notnull_) PANSI_STRING Name, _In_opt_ _When_(Name==NULL, _In_range_(>, 0)) ULONG Ordinal, _Out_ PVOID *ProcedureAddress)
Definition: ldrapi.c:829
static const CLSID IPropertyStorage UINT *static const PROPSPEC PROPVARIANT *static UINT const PROPSPEC PROPVARIANT PROPID
Definition: shellole.c:78
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
DECLSPEC_NORETURN NTSYSAPI VOID NTAPI RtlRaiseStatus(_In_ NTSTATUS Status)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define L(x)
Definition: ntvdm.h:50
#define BOOLEAN
Definition: pedump.c:73
unsigned short USHORT
Definition: pedump.c:61
PVOID PPMemoryAllocator
Definition: propvar.c:26
PVOID LoadOle32Export(PVOID *BaseAddress, const PCHAR ProcedureName)
Definition: propvar.c:33
UNICODE_STRING Old32Dll
Definition: propvar.c:18
PSERIALIZEDPROPERTYVALUE NTAPI RtlConvertVariantToProperty(IN const PROPVARIANT *pvar, IN USHORT CodePage, OUT PSERIALIZEDPROPERTYVALUE pprop OPTIONAL, IN OUT PULONG pcb, IN PROPID pid, IN BOOLEAN fReserved, IN OUT PULONG pcIndirect OPTIONAL)
Definition: propvar.c:133
PVOID PSERIALIZEDPROPERTYVALUE
Definition: propvar.c:27
BOOLEAN NTAPI RtlConvertPropertyToVariant(IN PSERIALIZEDPROPERTYVALUE prop, IN USHORT CodePage, OUT PROPVARIANT *pvar, IN PPMemoryAllocator pma)
Definition: propvar.c:99
ULONG NTAPI PropertyLengthAsVariant(IN PSERIALIZEDPROPERTYVALUE pProp, IN ULONG cbProp, IN USHORT CodePage, IN BYTE bReserved)
Definition: propvar.c:65
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
unsigned char BYTE
Definition: xxhash.c:193