Copies a constant pool item. For Utf8 items, the buffer size is not the number of characters, and the copied string will be null-terminated; size includes the null-terminator. For ClassRef, FieldRef, and so on, the buffer is filled in with a struct ptr.
int __cdecl Class_CopyConstantPoolItem(ClassClass *cls, unsigned index, BYTE *pbuf, int size, DWORD flags, BYTE *ptype);
*cls | The address of the class object. |
index | The index value of the field in the class. The index must be between 0 (zero) and the field count (returned from Class_GetConstantPoolCount) minus 1, inclusive. |
*pbuf | The address of the buffer. |
size | The size of pbuf in bytes. May be NULL to obtain only the size/type. |
ptype | The type of the pool item. Returns the number of bytes copied or needed, or -1 if failed. Filled in on output with the type of the item. |
flags | A bitmask. The only flag currently defined is COPYCPITEM_RESOLVE_REFERENCES. If the constant pool item has not yet been used, this flag forces its referent to be loaded or looked up. With this flag set, the method may cause garbage collection. |
CP Type | Buffer Contents |
CP_Utf8 | Null-terminated string. |
CP_Unicode | (error) |
CP_Integer | long |
CP_Float | float |
CP_Long | __int64 |
CP_Double | double |
CP_Class | ClassClass* |
CP_String | HObject* |
CP_FieldRef | fieldblock* |
CP_MethodRef | methodblock* |
CP_IntfMethod | methodblock* |
CP_NameAndType | (error) |
This function was added as of versions 2437 through 2925 of the Microsoft virtual machine.