CodeFragmentContainerPriv.h [plain text]
#ifndef __CODEFRAGMENTCONTAINERPRIV__
#define __CODEFRAGMENTCONTAINERPRIV__
#ifndef __MACTYPES__
#include <MacTypes.h>
#endif
#ifndef __CODEFRAGMENTS__
#include <CodeFragments.h>
#endif
#ifndef __MULTIPROCESSING__
#include <Multiprocessing.h>
#endif
#if PRAGMA_ONCE
#pragma once
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#elif PRAGMA_STRUCT_PACKPUSH
#pragma pack(push, 2)
#elif PRAGMA_STRUCT_PACK
#pragma pack(2)
#endif
typedef SInt32 CFContSignedIndex;
typedef UInt32 CFContStringHash;
#define CFContHashedStringLength(hashValue) ((hashValue) >> 16)
struct CFContHashedName {
CFContStringHash nameHash;
BytePtr nameText;
};
typedef struct CFContHashedName CFContHashedName;
enum {
kCFContContainerInfoVersion = 0x00010001
};
struct CFContContainerInfo {
CFContHashedName cfragName;
UInt32 modDate;
OSType architecture;
CFragVersionNumber currentVersion;
CFragVersionNumber oldImpVersion;
CFragVersionNumber oldDefVersion;
UInt32 reservedA;
void * reservedB;
};
typedef struct CFContContainerInfo CFContContainerInfo;
struct CFContLogicalLocation {
CFContSignedIndex section;
ByteCount offset;
};
typedef struct CFContLogicalLocation CFContLogicalLocation;
enum {
kCFContNoSectionIndex = -1,
kCFContAbsoluteSectionIndex = -2,
kCFContReexportSectionIndex = -3
};
typedef UInt8 CFContSectionSharing;
enum {
kCFContShareSectionInClosure = 0,
kCFContShareSectionInProcess = 1,
kCFContShareSectionAcrossSystem = 4,
kCFContShareSectionWithProtection = 5
};
typedef UInt8 CFContMemoryAccess;
enum {
kCFContMemReadMask = 0x01,
kCFContMemWriteMask = 0x02,
kCFContMemExecuteMask = 0x04,
kCFContReadOnlyData = kCFContMemReadMask,
kCFContWriteableData = kCFContMemReadMask | kCFContMemWriteMask,
kCFContNormalCode = kCFContMemReadMask | kCFContMemExecuteMask,
kCFContExcludedMemory = 0
};
typedef UInt32 CFContSectionOptions;
enum {
kPackedCFContSectionMask = 0x01,
kRelocatedCFContSectionMask = 0x02,
kEmptyFillCFContSectionMask = 0x04,
kResidentCFContSectionMask = 0x08,
kPrefaultCFContSectionMask = 0x10
};
enum {
kCFContSectionInfoVersion = 0x00010001
};
struct CFContSectionInfo {
CFContHashedName sectionName;
CFContMemoryAccess access;
CFContSectionSharing sharing;
UInt8 alignment;
UInt8 reservedA;
CFContSectionOptions options;
ByteCount containerOffset;
ByteCount containerLength;
ByteCount unpackedLength;
ByteCount totalLength;
LogicalAddress defaultAddress;
UInt32 reservedB;
void * reservedC;
};
typedef struct CFContSectionInfo CFContSectionInfo;
typedef UInt32 CFContExportedSymbolOptions;
enum {
kCFContExportedSymbolInfoVersion = 0x00010001
};
struct CFContExportedSymbolInfo {
CFContHashedName symbolName;
CFContLogicalLocation location;
CFContExportedSymbolOptions options;
CFragSymbolClass symbolClass;
UInt8 reservedA;
UInt16 reservedB;
UInt32 reservedC;
void * reservedD;
};
typedef struct CFContExportedSymbolInfo CFContExportedSymbolInfo;
typedef UInt32 CFContImportedLibraryOptions;
enum {
kCFContWeakLibraryMask = 0x01,
kCFContInitBeforeMask = 0x02,
kCFContDeferredBindMask = 0x04
};
enum {
kCFContImportedLibraryInfoVersion = 0x00010001
};
struct CFContImportedLibraryInfo {
CFContHashedName libraryName;
CFragVersionNumber linkedVersion;
CFragVersionNumber oldImpVersion;
CFContImportedLibraryOptions options;
};
typedef struct CFContImportedLibraryInfo CFContImportedLibraryInfo;
typedef UInt32 CFContImportedSymbolOptions;
enum {
kCFContWeakSymbolMask = 0x01
};
enum {
kCFContImportedSymbolInfoVersion = 0x00010001
};
struct CFContImportedSymbolInfo {
CFContHashedName symbolName;
ItemCount libraryIndex;
CFContImportedSymbolOptions options;
CFragSymbolClass symbolClass;
UInt8 reservedA;
UInt16 reservedB;
UInt32 reservedC;
void * reservedD;
};
typedef struct CFContImportedSymbolInfo CFContImportedSymbolInfo;
typedef UInt32 CFContOpenOptions;
enum {
kCFContPrepareInPlaceMask = 0x01,
kCFContMinimalOpenMask = 0x02
};
typedef UInt32 CFContCloseOptions;
enum {
kCFContPartialCloseMask = 0x01
};
typedef UInt8 CFContPortionTag;
enum {
kCFContTablesPortion = 0,
kCFContReadOnlyPortion = 1,
kCFContWriteablePortion = 2,
kCFContSpecifiedPortion = 3
};
typedef struct OpaqueCFContHandlerRef* CFContHandlerRef;
typedef struct CFContHandlerProcs CFContHandlerProcs;
typedef CALLBACK_API_C( LogicalAddress , CFContAllocateMem )(ByteCount size, UInt8 alignment, OptionBits options, void *refCon);
typedef CALLBACK_API_C( void , CFContReleaseMem )(LogicalAddress address, void *refCon);
typedef CALLBACK_API_C( OSStatus , CFCont_OpenContainer )(LogicalAddress address, ByteCount length, MPProcessID processID, const CFContHashedName *cfragName, CFContOpenOptions options, CFContAllocateMem AllocateMem, CFContReleaseMem ReleaseMem, void *memRefCon, CFContHandlerRef *containerRef_o, CFContHandlerProcs **handlerProcs_o);
typedef CALLBACK_API_C( OSStatus , CFCont_CloseContainer )(CFContHandlerRef containerRef, CFContCloseOptions options);
typedef CALLBACK_API_C( OSStatus , CFCont_GetContainerInfo )(CFContHandlerRef containerRef, PBVersion infoVersion, CFContContainerInfo *containerInfo_o);
typedef CALLBACK_API_C( OSStatus , CFCont_GetOldProcs )(CFContHandlerRef containerRef, UInt32 abiVersion, void **oldProcs_o);
typedef CALLBACK_API_C( OSStatus , CFCont_GetSectionCount )(CFContHandlerRef containerRef, ItemCount *sectionCount_o);
typedef CALLBACK_API_C( OSStatus , CFCont_GetSectionInfo )(CFContHandlerRef containerRef, ItemCount sectionIndex, PBVersion infoVersion, CFContSectionInfo *sectionInfo_o);
typedef CALLBACK_API_C( OSStatus , CFCont_FindSectionInfo )(CFContHandlerRef containerRef, const CFContHashedName *sectionName, PBVersion infoVersion, ItemCount *sectionIndex_o, CFContSectionInfo *sectionInfo_o);
typedef CALLBACK_API_C( OSStatus , CFCont_SetSectionAddress )(CFContHandlerRef containerRef, ItemCount sectionIndex, LogicalAddress address);
typedef CALLBACK_API_C( OSStatus , CFCont_GetAnonymousSymbolLocations )(CFContHandlerRef containerRef, CFContLogicalLocation *mainLocation_o, CFContLogicalLocation *initLocation_o, CFContLogicalLocation *termLocation_o);
typedef CALLBACK_API_C( OSStatus , CFCont_GetExportedSymbolCount )(CFContHandlerRef containerRef, ItemCount *exportCount_o);
typedef CALLBACK_API_C( OSStatus , CFCont_GetExportedSymbolInfo )(CFContHandlerRef containerRef, CFContSignedIndex exportedIndex, PBVersion infoVersion, CFContExportedSymbolInfo *exportInfo_o);
typedef CALLBACK_API_C( OSStatus , CFCont_FindExportedSymbolInfo )(CFContHandlerRef containerRef, const CFContHashedName *exportName, PBVersion infoVersion, ItemCount *exportIndex_o, CFContExportedSymbolInfo *exportInfo_o);
typedef CALLBACK_API_C( OSStatus , CFCont_GetImportCounts )(CFContHandlerRef containerRef, ItemCount *libraryCount_o, ItemCount *symbolCount_o);
typedef CALLBACK_API_C( OSStatus , CFCont_GetImportedLibraryInfo )(CFContHandlerRef containerRef, ItemCount libraryIndex, PBVersion infoVersion, CFContImportedLibraryInfo *libraryInfo_o);
typedef CALLBACK_API_C( OSStatus , CFCont_GetImportedSymbolInfo )(CFContHandlerRef containerRef, ItemCount symbolIndex, PBVersion infoVersion, CFContImportedSymbolInfo *symbolInfo_o);
typedef CALLBACK_API_C( OSStatus , CFCont_SetImportedSymbolAddress )(CFContHandlerRef containerRef, ItemCount symbolIndex, LogicalAddress symbolAddress);
typedef CALLBACK_API_C( OSStatus , CFCont_UnpackSection )(CFContHandlerRef containerRef, ItemCount sectionIndex, ByteCount sectionOffset, LogicalAddress bufferAddress, ByteCount bufferLength);
typedef CALLBACK_API_C( OSStatus , CFCont_RelocateSection )(CFContHandlerRef containerRef, ItemCount sectionIndex);
typedef CALLBACK_API_C( OSStatus , CFCont_RelocateImportsOnly )(CFContHandlerRef containerRef, ItemCount sectionIndex, ItemCount libraryIndex);
typedef CALLBACK_API_C( OSStatus , CFCont_AllocateSection )(CFContHandlerRef containerRef, ItemCount sectionIndex, LogicalAddress *address_o);
typedef CALLBACK_API_C( OSStatus , CFCont_ReleaseSection )(CFContHandlerRef containerRef, ItemCount sectionIndex);
typedef CALLBACK_API_C( void , CFCont_MakeSectionExecutable )(CFContHandlerRef containerRef, ItemCount sectionIndex);
typedef CALLBACK_API_C( void , CFCont_PrepageContainerPortion )(CFContHandlerRef containerRef, CFContPortionTag containerPortion, ItemCount sectionIndex);
typedef CALLBACK_API_C( void , CFCont_ReleaseContainerPortion )(CFContHandlerRef containerRef, CFContPortionTag containerPortion, ItemCount sectionIndex);
struct CFContHandlerProcs {
ItemCount procCount;
UInt32 abiVersion;
OSType handlerName;
CFCont_OpenContainer OpenContainer;
CFCont_CloseContainer CloseContainer;
CFCont_GetContainerInfo GetContainerInfo;
CFCont_GetSectionCount GetSectionCount;
CFCont_GetSectionInfo GetSectionInfo;
CFCont_FindSectionInfo FindSectionInfo;
CFCont_SetSectionAddress SetSectionAddress;
CFCont_GetAnonymousSymbolLocations GetAnonymousSymbolLocations;
CFCont_GetExportedSymbolCount GetExportedSymbolCount;
CFCont_GetExportedSymbolInfo GetExportedSymbolInfo;
CFCont_FindExportedSymbolInfo FindExportedSymbolInfo;
CFCont_GetImportCounts GetImportCounts;
CFCont_GetImportedLibraryInfo GetImportedLibraryInfo;
CFCont_GetImportedSymbolInfo GetImportedSymbolInfo;
CFCont_SetImportedSymbolAddress SetImportedSymbolAddress;
CFCont_UnpackSection UnpackSection;
CFCont_RelocateSection RelocateSection;
CFCont_RelocateImportsOnly RelocateImportsOnly;
CFCont_AllocateSection AllocateSection;
CFCont_ReleaseSection ReleaseSection;
CFCont_MakeSectionExecutable MakeSectionExecutable;
CFCont_PrepageContainerPortion PrepageContainerPortion;
CFCont_ReleaseContainerPortion ReleaseContainerPortion;
CFCont_GetOldProcs GetOldProcs;
};
typedef CFContHandlerProcs * CFContHandlerProcsPtr;
enum {
kCFContHandlerABIVersion = 0x00010001,
kCFContMinimumProcCount = 18,
kCFContCurrentProcCount = 24
};
#define CFContHasAllocateSection(h) ( ((h)->procCount >= 19) && ((h)->AllocateSection != NULL) )
#define CFContHasReleaseSection(h) ( ((h)->procCount >= 20) && ((h)->ReleaseSection != NULL) )
#define CFContHasMakeSectionExecutable(h) ( ((h)->procCount >= 21) && ((h)->MakeSectionExecutable != NULL) )
#define CFContHasPrepageContainerPortion(h) ( ((h)->procCount >= 22) && ((h)->PrepageContainerPortion != NULL) )
#define CFContHasReleaseContainerPortion(h) ( ((h)->procCount >= 23) && ((h)->ReleaseContainerPortion != NULL) )
#define CFContHasGetOldProcs(h) ( ((h)->procCount >= 24) && ((h)->GetOldProcs != NULL) )
enum {
kCFContHandlerInfoVersion = 0x00010001
};
struct CFContHandlerInfo {
OSType handlerName;
CFCont_OpenContainer OpenHandlerProc;
};
typedef struct CFContHandlerInfo CFContHandlerInfo;
extern CFContStringHash
CFContGetStringHash(
BytePtr nameText,
ByteCount nameLimit);
extern OSStatus
CFContOpenContainer(
LogicalAddress address,
ByteCount length,
MPProcessID processID,
const CFContHashedName * cfragName,
CFContOpenOptions options,
CFContAllocateMem Allocate,
CFContReleaseMem Release,
void * memRefCon,
CFContHandlerRef * containerRef_o,
CFContHandlerProcsPtr * handlerProcs_o);
extern OSStatus
CFContRegisterContainerHandler(
OSType handlerName,
CFCont_OpenContainer OpenHandlerProc);
extern OSStatus
CFContUnregisterContainerHandler(OSType handlerName);
extern OSStatus
CFContGetContainerHandlers(
ItemCount requestedCount,
ItemCount skipCount,
ItemCount * totalCount_o,
PBVersion infoVersion,
CFContHandlerInfo * info_o);
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#elif PRAGMA_STRUCT_PACKPUSH
#pragma pack(pop)
#elif PRAGMA_STRUCT_PACK
#pragma pack()
#endif
#ifdef __cplusplus
}
#endif
#endif