mirror of
https://github.com/reactos/reactos.git
synced 2025-07-24 13:43:42 +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
|
||||
* FILE: lib/rtl/propvar.c
|
||||
* PURPOSE: Native properties and variants API
|
||||
* PROGRAMMER:
|
||||
* PROGRAMMER: Pierre Schweitzer (pierre@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -15,66 +15,152 @@
|
|||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
UNICODE_STRING Old32Dll = RTL_CONSTANT_STRING(L"ole32.dll");
|
||||
/* 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
|
||||
NTAPI
|
||||
PropertyLengthAsVariant (
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3
|
||||
)
|
||||
typedef PVOID PPMemoryAllocator;
|
||||
typedef PVOID PSERIALIZEDPROPERTYVALUE;
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
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
|
||||
NTAPI
|
||||
RtlCompareVariants (
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2
|
||||
)
|
||||
RtlConvertPropertyToVariant(IN PSERIALIZEDPROPERTYVALUE prop,
|
||||
IN USHORT CodePage,
|
||||
OUT PROPVARIANT * pvar,
|
||||
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
|
||||
RtlConvertPropertyToVariant (
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3
|
||||
)
|
||||
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)
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
PSERIALIZEDPROPERTYVALUE Serialized = NULL;
|
||||
PVOID BaseAddress = NULL;
|
||||
PSERIALIZEDPROPERTYVALUE (*ProcedureAddress)(const PROPVARIANT*, USHORT, PSERIALIZEDPROPERTYVALUE,
|
||||
PULONG, PROPID, BOOLEAN, PULONG);
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlConvertVariantToProperty (
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5,
|
||||
DWORD Unknown6
|
||||
)
|
||||
{
|
||||
return (STATUS_NOT_IMPLEMENTED);
|
||||
_SEH2_TRY
|
||||
{
|
||||
/* Simply call the appropriate Ole32 export */
|
||||
ProcedureAddress = LoadOle32Export(&BaseAddress,
|
||||
"StgConvertVariantToProperty");
|
||||
|
||||
Serialized = ProcedureAddress(pvar, CodePage, pprop, pcb, pid, fReserved, pcIndirect);
|
||||
}
|
||||
_SEH2_FINALLY
|
||||
{
|
||||
if (BaseAddress != NULL)
|
||||
{
|
||||
LdrUnloadDll(BaseAddress);
|
||||
}
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
return Serialized;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue