VirtualBox

vbox的更動 51770 路徑 trunk/src/VBox/Runtime/include


忽略:
時間撮記:
2014-7-1 下午06:14:02 (10 年 以前)
作者:
vboxsync
訊息:

Merged in iprt++ dev branch.

位置:
trunk
檔案:
新增 1 筆資料
修改 4 筆資料

圖例:

未更動
新增
刪除
  • trunk

  • trunk/src/VBox

  • trunk/src/VBox/Runtime/include/internal/ldr.h

    r49044 r51770  
    323323    DECLCALLBACKMEMBER(int, pfnReadDbgInfo)(PRTLDRMODINTERNAL pMod, uint32_t iDbgInfo, RTFOFF off, size_t cb, void *pvBuf);
    324324
    325 
    326 
    327325    /**
    328326     * Generic method for querying image properties.
     
    338336     * @param   cbBuf           The size of the return buffer (valid as per
    339337     *                          property).
    340      */
    341     DECLCALLBACKMEMBER(int, pfnQueryProp)(PRTLDRMODINTERNAL pMod, RTLDRPROP enmProp, void *pvBuf, size_t cbBuf);
     338     * @param   pcbRet          The number of bytes actually returned.  If
     339     *                          VERR_BUFFER_OVERFLOW is returned, this is set to the
     340     *                          required buffer size.
     341     */
     342    DECLCALLBACKMEMBER(int, pfnQueryProp)(PRTLDRMODINTERNAL pMod, RTLDRPROP enmProp, void *pvBuf, size_t cbBuf, size_t *pcbRet);
     343
     344    /**
     345     * Verify the image signature.
     346     *
     347     * This may permform additional integrity checks on the image structures that
     348     * was not done when opening the image.
     349     *
     350     * @returns IPRT status code.
     351     * @retval  VERR_LDRVI_NOT_SIGNED if not signed.
     352     *
     353     * @param   pMod            Pointer to the loader module structure.
     354     * @param   pfnCallback     Callback that does the signature and certificate
     355     *                          verficiation.
     356     * @param   pvUser          User argument for the callback.
     357     * @param   pErrInfo        Pointer to an error info buffer. Optional.
     358     */
     359    DECLCALLBACKMEMBER(int, pfnVerifySignature)(PRTLDRMODINTERNAL pMod, PFNRTLDRVALIDATESIGNEDDATA pfnCallback, void *pvUser,
     360                                                PRTERRINFO pErrInfo);
     361
     362    /**
     363     * Calculate the image hash according the image signing rules.
     364     *
     365     * @returns IPRT status code.
     366     * @param   hLdrMod         The module handle.
     367     * @param   enmDigest       Which kind of digest.
     368     * @param   pszDigest       Where to store the image digest.
     369     * @param   cbDigest        Size of the buffer @a pszDigest points at.
     370     */
     371    DECLCALLBACKMEMBER(int, pfnHashImage)(PRTLDRMODINTERNAL pMod, RTDIGESTTYPE enmDigest, char *pszDigest, size_t cbDigest);
    342372
    343373    /** Dummy entry to make sure we've initialized it all. */
     
    346376typedef RTLDROPS *PRTLDROPS;
    347377typedef const RTLDROPS *PCRTLDROPS;
    348 
    349 
    350 /** Pointer to a loader reader instance. */
    351 typedef struct RTLDRREADER *PRTLDRREADER;
    352 
    353 /**
    354  * Loader image reader instance.
    355  * The reader will have extra data members following this structure.
    356  */
    357 typedef struct RTLDRREADER
    358 {
    359     /** The name of the image provider. */
    360     const char *pszName;
    361 
    362     /**
    363      * Reads bytes at a give place in the raw image.
    364      *
    365      * @returns iprt status code.
    366      * @param   pReader     Pointer to the reader instance.
    367      * @param   pvBuf       Where to store the bits.
    368      * @param   cb          Number of bytes to read.
    369      * @param   off         Where to start reading relative to the start of the raw image.
    370      */
    371     DECLCALLBACKMEMBER(int, pfnRead)(PRTLDRREADER pReader, void *pvBuf, size_t cb, RTFOFF off);
    372 
    373     /**
    374      * Tells end position of last read.
    375      *
    376      * @returns position relative to start of the raw image.
    377      * @param   pReader     Pointer to the reader instance.
    378      */
    379     DECLCALLBACKMEMBER(RTFOFF, pfnTell)(PRTLDRREADER pReader);
    380 
    381     /**
    382      * Gets the size of the raw image bits.
    383      *
    384      * @returns size of raw image bits in bytes.
    385      * @param   pReader     Pointer to the reader instance.
    386      */
    387     DECLCALLBACKMEMBER(RTFOFF, pfnSize)(PRTLDRREADER pReader);
    388 
    389     /**
    390      * Map the bits into memory.
    391      *
    392      * The mapping will be freed upon calling pfnDestroy() if not pfnUnmap()
    393      * is called before that. The mapping is read only.
    394      *
    395      * @returns iprt status code.
    396      * @param   pReader     Pointer to the reader instance.
    397      * @param   ppvBits     Where to store the address of the memory mapping on success.
    398      *                      The size of the mapping can be obtained by calling pfnSize().
    399      */
    400     DECLCALLBACKMEMBER(int, pfnMap)(PRTLDRREADER pReader, const void **ppvBits);
    401 
    402     /**
    403      * Unmap bits.
    404      *
    405      * @returns iprt status code.
    406      * @param   pReader     Pointer to the reader instance.
    407      * @param   pvBits      Memory pointer returned by pfnMap().
    408      */
    409     DECLCALLBACKMEMBER(int, pfnUnmap)(PRTLDRREADER pReader, const void *pvBits);
    410 
    411     /**
    412      * Gets the most appropriate log name.
    413      *
    414      * @returns Pointer to readonly log name.
    415      * @param   pReader     Pointer to the reader instance.
    416      */
    417     DECLCALLBACKMEMBER(const char *, pfnLogName)(PRTLDRREADER pReader);
    418 
    419     /**
    420      * Releases all resources associated with the reader instance.
    421      * The instance is invalid after this call returns.
    422      *
    423      * @returns iprt status code.
    424      * @param   pReader     Pointer to the reader instance.
    425      */
    426     DECLCALLBACKMEMBER(int, pfnDestroy)(PRTLDRREADER pReader);
    427 
    428 } RTLDRREADER;
    429378
    430379
     
    466415}
    467416
    468 int rtldrOpenWithReader(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, PRTLDRMOD phMod);
    469 
    470417
    471418/**
     
    511458int rtldrNativeLoadSystem(const char *pszFilename, const char *pszExt, uint32_t fFlags, PRTLDRMOD phLdrMod);
    512459
    513 int rtldrPEOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offNtHdrs, PRTLDRMOD phLdrMod);
    514 int rtldrELFOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, PRTLDRMOD phLdrMod);
    515 int rtldrkLdrOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, PRTLDRMOD phLdrMod);
     460int rtldrPEOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offNtHdrs, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo);
     461int rtldrELFOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo);
     462int rtldrkLdrOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo);
    516463/*int rtldrLXOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offLX, PRTLDRMOD phLdrMod);
    517464int rtldrMachoOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offSomething, PRTLDRMOD phLdrMod);*/
  • trunk/src/VBox/Runtime/include/internal/ldrPE.h

    r46278 r51770  
    7373#define  IMAGE_SUBSYSTEM_POSIX_CUI  0x7
    7474
    75 #define  IMAGE_LIBRARY_PROCESS_INIT  0x0001
    76 #define  IMAGE_LIBRARY_PROCESS_TERM  0x0002
    77 #define  IMAGE_LIBRARY_THREAD_INIT  0x0004
    78 #define  IMAGE_LIBRARY_THREAD_TERM  0x0008
    79 #define  IMAGE_DLLCHARACTERISTICS_NO_ISOLATION  0x0200
    80 #define  IMAGE_DLLCHARACTERISTICS_NO_SEH  0x0400
    81 #define  IMAGE_DLLCHARACTERISTICS_NO_BIND  0x0800
    82 #define  IMAGE_DLLCHARACTERISTICS_WDM_DRIVER  0x2000
    83 #define  IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE  0x8000
     75#define  IMAGE_LIBRARY_PROCESS_INIT                         0x0001
     76#define  IMAGE_LIBRARY_PROCESS_TERM                         0x0002
     77#define  IMAGE_LIBRARY_THREAD_INIT                          0x0004
     78#define  IMAGE_LIBRARY_THREAD_TERM                          0x0008
     79#define  IMAGE_DLLCHARACTERISTICS_RESERVED                  0x0010
     80#define  IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA           0x0020
     81#define  IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE              0x0040
     82#define  IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY           0x0080
     83#define  IMAGE_DLLCHARACTERISTICS_NX_COMPAT                 0x0100
     84#define  IMAGE_DLLCHARACTERISTICS_NO_ISOLATION              0x0200
     85#define  IMAGE_DLLCHARACTERISTICS_NO_SEH                    0x0400
     86#define  IMAGE_DLLCHARACTERISTICS_NO_BIND                   0x0800
     87#define  IMAGE_DLLCHARACTERISTICS_APPCONTAINER              0x1000
     88#define  IMAGE_DLLCHARACTERISTICS_WDM_DRIVER                0x2000
     89#define  IMAGE_DLLCHARACTERISTICS_GUARD_CF                  0x4000
     90#define  IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE     0x8000
    8491
    8592#define  IMAGE_NUMBEROF_DIRECTORY_ENTRIES  0x10
     
    208215#define  WIN_CERT_TYPE_EFI_GUID             UINT16_C(0x0ef1)
    209216
     217/** The alignment of the certificate table.
     218 * @remarks Found thru signtool experiments.  */
     219#define  WIN_CERTIFICATE_ALIGNMENT          8
    210220
    211221/* For .DBG files. */
     
    517527
    518528
    519 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32
     529
     530/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
     531/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
     532/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
     533/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
     534/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
     535/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
     536/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
     537/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
     538/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
     539#pragma pack()
     540
     541
     542
     543typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32_V1
     544{
     545    uint32_t  Size;
     546    uint32_t  TimeDateStamp;
     547    uint16_t  MajorVersion;
     548    uint16_t  MinorVersion;
     549    uint32_t  GlobalFlagsClear;
     550    uint32_t  GlobalFlagsSet;
     551    uint32_t  CriticalSectionDefaultTimeout;
     552    uint32_t  DeCommitFreeBlockThreshold;
     553    uint32_t  DeCommitTotalFreeThreshold;
     554    uint32_t  LockPrefixTable;
     555    uint32_t  MaximumAllocationSize;
     556    uint32_t  VirtualMemoryThreshold;
     557    uint32_t  ProcessHeapFlags;
     558    uint32_t  ProcessAffinityMask;
     559    uint16_t  CSDVersion;
     560    uint16_t  Reserved1;
     561    uint32_t  EditList;
     562    uint32_t  SecurityCookie;
     563} IMAGE_LOAD_CONFIG_DIRECTORY32_V1;
     564AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V1, 0x40);
     565typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V1 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V1;
     566typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V1 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V1;
     567
     568typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32_V2
    520569{
    521570    uint32_t  Size;
     
    539588    uint32_t  SEHandlerTable;
    540589    uint32_t  SEHandlerCount;
    541 } IMAGE_LOAD_CONFIG_DIRECTORY32;
    542 typedef IMAGE_LOAD_CONFIG_DIRECTORY32 *PIMAGE_LOAD_CONFIG_DIRECTORY32;
    543 typedef IMAGE_LOAD_CONFIG_DIRECTORY32 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32;
    544 
    545 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64
     590} IMAGE_LOAD_CONFIG_DIRECTORY32_V2;
     591AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V2, 0x48);
     592typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V2 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V2;
     593typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V2 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V2;
     594
     595typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32_V3
     596{
     597    uint32_t  Size;
     598    uint32_t  TimeDateStamp;
     599    uint16_t  MajorVersion;
     600    uint16_t  MinorVersion;
     601    uint32_t  GlobalFlagsClear;
     602    uint32_t  GlobalFlagsSet;
     603    uint32_t  CriticalSectionDefaultTimeout;
     604    uint32_t  DeCommitFreeBlockThreshold;
     605    uint32_t  DeCommitTotalFreeThreshold;
     606    uint32_t  LockPrefixTable;
     607    uint32_t  MaximumAllocationSize;
     608    uint32_t  VirtualMemoryThreshold;
     609    uint32_t  ProcessHeapFlags;
     610    uint32_t  ProcessAffinityMask;
     611    uint16_t  CSDVersion;
     612    uint16_t  Reserved1;
     613    uint32_t  EditList;
     614    uint32_t  SecurityCookie;
     615    uint32_t  SEHandlerTable;
     616    uint32_t  SEHandlerCount;
     617    uint32_t  GuardCFCCheckFunctionPointer;
     618    uint32_t  Reserved2;
     619    uint32_t  GuardCFFunctionTable;
     620    uint32_t  GuardCFFunctionCount;
     621    uint32_t  GuardFlags;
     622} IMAGE_LOAD_CONFIG_DIRECTORY32_V3;
     623AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V3, 0x5c);
     624typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V3 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V3;
     625typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V3 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V3;
     626
     627typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V3   IMAGE_LOAD_CONFIG_DIRECTORY32;
     628typedef PIMAGE_LOAD_CONFIG_DIRECTORY32_V3  PIMAGE_LOAD_CONFIG_DIRECTORY32;
     629typedef PCIMAGE_LOAD_CONFIG_DIRECTORY32_V3 PCIMAGE_LOAD_CONFIG_DIRECTORY32;
     630
     631/* No _IMAGE_LOAD_CONFIG_DIRECTORY64_V1 exists. */
     632
     633typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64_V2
    546634{
    547635    uint32_t  Size;
     
    565653    uint64_t  SEHandlerTable;
    566654    uint64_t  SEHandlerCount;
    567 } IMAGE_LOAD_CONFIG_DIRECTORY64;
    568 typedef IMAGE_LOAD_CONFIG_DIRECTORY64 *PIMAGE_LOAD_CONFIG_DIRECTORY64;
    569 typedef IMAGE_LOAD_CONFIG_DIRECTORY64 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64;
    570 
     655} IMAGE_LOAD_CONFIG_DIRECTORY64_V2;
     656AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY64_V2, 0x70);
     657typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V2 *PIMAGE_LOAD_CONFIG_DIRECTORY64_V2;
     658typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V2 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64_V2;
     659
     660#pragma pack(4) /* Why not 8 byte alignment, baka microsofties?!? */
     661typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64_V3
     662{
     663    uint32_t  Size;
     664    uint32_t  TimeDateStamp;
     665    uint16_t  MajorVersion;
     666    uint16_t  MinorVersion;
     667    uint32_t  GlobalFlagsClear;
     668    uint32_t  GlobalFlagsSet;
     669    uint32_t  CriticalSectionDefaultTimeout;
     670    uint64_t  DeCommitFreeBlockThreshold;
     671    uint64_t  DeCommitTotalFreeThreshold;
     672    uint64_t  LockPrefixTable;
     673    uint64_t  MaximumAllocationSize;
     674    uint64_t  VirtualMemoryThreshold;
     675    uint64_t  ProcessAffinityMask;
     676    uint32_t  ProcessHeapFlags;
     677    uint16_t  CSDVersion;
     678    uint16_t  Reserved1;
     679    uint64_t  EditList;
     680    uint64_t  SecurityCookie;
     681    uint64_t  SEHandlerTable;
     682    uint64_t  SEHandlerCount;
     683    uint64_t  GuardCFCCheckFunctionPointer;
     684    uint64_t  Reserved2;
     685    uint64_t  GuardCFFunctionTable;
     686    uint64_t  GuardCFFunctionCount;
     687    uint32_t  GuardFlags;
     688} IMAGE_LOAD_CONFIG_DIRECTORY64_V3;
     689#pragma pack()
     690AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY64_V3, 0x94);
     691typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V3 *PIMAGE_LOAD_CONFIG_DIRECTORY64_V3;
     692typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V3 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64_V3;
     693
     694typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V3   IMAGE_LOAD_CONFIG_DIRECTORY64;
     695typedef PIMAGE_LOAD_CONFIG_DIRECTORY64_V3  PIMAGE_LOAD_CONFIG_DIRECTORY64;
     696typedef PCIMAGE_LOAD_CONFIG_DIRECTORY64_V3 PCIMAGE_LOAD_CONFIG_DIRECTORY64;
    571697
    572698typedef struct _IMAGE_DEBUG_DIRECTORY
     
    581707    uint32_t  PointerToRawData;
    582708} IMAGE_DEBUG_DIRECTORY;
     709AssertCompileSize(IMAGE_DEBUG_DIRECTORY, 28);
    583710typedef IMAGE_DEBUG_DIRECTORY *PIMAGE_DEBUG_DIRECTORY;
    584711typedef IMAGE_DEBUG_DIRECTORY const *PCIMAGE_DEBUG_DIRECTORY;
     
    592719    uint8_t    Data[1];
    593720} IMAGE_DEBUG_MISC;
     721AssertCompileSize(IMAGE_DEBUG_MISC, 16);
    594722typedef IMAGE_DEBUG_MISC *PIMAGE_DEBUG_MISC;
    595723typedef IMAGE_DEBUG_MISC const *PCIMAGE_DEBUG_MISC;
     
    603731    uint8_t     bCertificate[8];
    604732} WIN_CERTIFICATE;
     733AssertCompileSize(WIN_CERTIFICATE, 16);
    605734typedef WIN_CERTIFICATE *PWIN_CERTIFICATE;
    606735typedef WIN_CERTIFICATE const *PCWIN_CERTIFICATE;
    607 
    608 
    609 
    610 
    611 /* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
    612 /* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
    613 /* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
    614 /* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
    615 /* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
    616 /* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
    617 /* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
    618 /* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
    619 /* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */
    620 #pragma pack()
    621 
    622 
    623 
    624736
    625737
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette