mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 01:52:06 +00:00
[RTL]
Implement RtlConvertVariantToProperty, RtlConvertPropertyToVariant, PropertyLengthAsVariant Those are just wrappers around Ole32 functions. svn path=/trunk/; revision=56795
This commit is contained in:
parent
d58e76d5dc
commit
07f3561057
1 changed files with 131 additions and 45 deletions
|
@ -3,7 +3,7 @@
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/rtl/propvar.c
|
* FILE: lib/rtl/propvar.c
|
||||||
* PURPOSE: Native properties and variants API
|
* PURPOSE: Native properties and variants API
|
||||||
* PROGRAMMER:
|
* PROGRAMMER: Pierre Schweitzer (pierre@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES *****************************************************************/
|
||||||
|
@ -15,66 +15,152 @@
|
||||||
|
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
/*
|
UNICODE_STRING Old32Dll = RTL_CONSTANT_STRING(L"ole32.dll");
|
||||||
* @unimplemented
|
/* FIXME: (or not)
|
||||||
|
* Define those here to allow build. They don't need to be dereferenced
|
||||||
|
* so it's OK.
|
||||||
|
* Furthermore till Vista those Ole32 API were private so those defines
|
||||||
|
* should be made in a private header
|
||||||
|
* Finally, having those defined that way allows to write that code plain C.
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
typedef PVOID PPMemoryAllocator;
|
||||||
NTAPI
|
typedef PVOID PSERIALIZEDPROPERTYVALUE;
|
||||||
PropertyLengthAsVariant (
|
|
||||||
DWORD Unknown0,
|
/*
|
||||||
DWORD Unknown1,
|
* @implemented
|
||||||
DWORD Unknown2,
|
*/
|
||||||
DWORD Unknown3
|
PVOID
|
||||||
)
|
LoadOle32Export(PVOID * BaseAddress, const PCHAR ProcedureName)
|
||||||
{
|
{
|
||||||
return (STATUS_NOT_IMPLEMENTED);
|
NTSTATUS Status;
|
||||||
|
ANSI_STRING ExportName;
|
||||||
|
PVOID ProcedureAddress;
|
||||||
|
|
||||||
|
/* First load ole32.dll */
|
||||||
|
Status = LdrLoadDll(NULL, NULL, &Old32Dll, BaseAddress);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
RtlRaiseStatus(Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlInitAnsiString(&ExportName, ProcedureName);
|
||||||
|
|
||||||
|
/* Look for the procedure */
|
||||||
|
Status = LdrGetProcedureAddress(*BaseAddress, &ExportName,
|
||||||
|
0, &ProcedureAddress);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
RtlRaiseStatus(Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return its address */
|
||||||
|
return ProcedureAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
|
*/
|
||||||
|
ULONG
|
||||||
|
NTAPI
|
||||||
|
PropertyLengthAsVariant(IN PSERIALIZEDPROPERTYVALUE pProp,
|
||||||
|
IN ULONG cbProp,
|
||||||
|
IN USHORT CodePage,
|
||||||
|
IN BYTE bReserved)
|
||||||
|
{
|
||||||
|
BOOLEAN Success = FALSE;
|
||||||
|
PVOID BaseAddress = NULL;
|
||||||
|
ULONG (*ProcedureAddress)(PSERIALIZEDPROPERTYVALUE, ULONG, USHORT, BYTE);
|
||||||
|
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
/* Simply call the appropriate Ole32 export */
|
||||||
|
ProcedureAddress = LoadOle32Export(&BaseAddress,
|
||||||
|
"StgPropertyLengthAsVariant");
|
||||||
|
|
||||||
|
Success = ProcedureAddress(pProp, cbProp, CodePage, bReserved);
|
||||||
|
}
|
||||||
|
_SEH2_FINALLY
|
||||||
|
{
|
||||||
|
if (BaseAddress != NULL)
|
||||||
|
{
|
||||||
|
LdrUnloadDll(BaseAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
*/
|
*/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlCompareVariants (
|
RtlConvertPropertyToVariant(IN PSERIALIZEDPROPERTYVALUE prop,
|
||||||
DWORD Unknown0,
|
IN USHORT CodePage,
|
||||||
DWORD Unknown1,
|
OUT PROPVARIANT * pvar,
|
||||||
DWORD Unknown2
|
IN PPMemoryAllocator pma)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return (FALSE);
|
BOOLEAN Success = FALSE;
|
||||||
|
PVOID BaseAddress = NULL;
|
||||||
|
BOOLEAN (*ProcedureAddress)(PSERIALIZEDPROPERTYVALUE, USHORT, PROPVARIANT*, PPMemoryAllocator);
|
||||||
|
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
/* Simply call the appropriate Ole32 export */
|
||||||
|
ProcedureAddress = LoadOle32Export(&BaseAddress,
|
||||||
|
"StgConvertPropertyToVariant");
|
||||||
|
|
||||||
|
Success = ProcedureAddress(prop, CodePage, pvar, pma);
|
||||||
|
}
|
||||||
|
_SEH2_FINALLY
|
||||||
|
{
|
||||||
|
if (BaseAddress != NULL)
|
||||||
|
{
|
||||||
|
LdrUnloadDll(BaseAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
BOOLEAN
|
PSERIALIZEDPROPERTYVALUE
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlConvertPropertyToVariant (
|
RtlConvertVariantToProperty(IN const PROPVARIANT * pvar,
|
||||||
DWORD Unknown0,
|
IN USHORT CodePage,
|
||||||
DWORD Unknown1,
|
OUT PSERIALIZEDPROPERTYVALUE pprop OPTIONAL,
|
||||||
DWORD Unknown2,
|
IN OUT PULONG pcb,
|
||||||
DWORD Unknown3
|
IN PROPID pid,
|
||||||
)
|
IN BOOLEAN fReserved,
|
||||||
|
IN OUT PULONG pcIndirect OPTIONAL)
|
||||||
{
|
{
|
||||||
return (FALSE);
|
PSERIALIZEDPROPERTYVALUE Serialized = NULL;
|
||||||
}
|
PVOID BaseAddress = NULL;
|
||||||
|
PSERIALIZEDPROPERTYVALUE (*ProcedureAddress)(const PROPVARIANT*, USHORT, PSERIALIZEDPROPERTYVALUE,
|
||||||
|
PULONG, PROPID, BOOLEAN, PULONG);
|
||||||
|
|
||||||
/*
|
_SEH2_TRY
|
||||||
* @unimplemented
|
{
|
||||||
*/
|
/* Simply call the appropriate Ole32 export */
|
||||||
NTSTATUS
|
ProcedureAddress = LoadOle32Export(&BaseAddress,
|
||||||
NTAPI
|
"StgConvertVariantToProperty");
|
||||||
RtlConvertVariantToProperty (
|
|
||||||
DWORD Unknown0,
|
Serialized = ProcedureAddress(pvar, CodePage, pprop, pcb, pid, fReserved, pcIndirect);
|
||||||
DWORD Unknown1,
|
}
|
||||||
DWORD Unknown2,
|
_SEH2_FINALLY
|
||||||
DWORD Unknown3,
|
{
|
||||||
DWORD Unknown4,
|
if (BaseAddress != NULL)
|
||||||
DWORD Unknown5,
|
{
|
||||||
DWORD Unknown6
|
LdrUnloadDll(BaseAddress);
|
||||||
)
|
}
|
||||||
{
|
}
|
||||||
return (STATUS_NOT_IMPLEMENTED);
|
_SEH2_END;
|
||||||
|
|
||||||
|
return Serialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue