CChkSGFiles 函数CChkSGFiles.ErrCheckDbPages function

适用于: Exchange Server 2003 |Exchange Server 2007 |Exchange Server 2010 |Exchange Server 2013Applies to: Exchange Server 2003 | Exchange Server 2007 | Exchange Server 2010 | Exchange Server 2013

验证指定数据库中的页面范围。Validates a range of pages in a specified database.

Vitual ERRErrCheckDbPages  
    Const ULONGiDb,
    Const VOID  * const pvPageBuffer,
    Const ULONGcbPageBuffer,
    Const ULONGcPageInfo,
    Const ULONGulFlags = NO_FLAGS



输入参数。Input parameter. 指向ErrInit函数的rgwszDb [] 参数中指定的数据库数组的索引。An index into the array of databases specified in the rgwszDb[] parameter to the ErrInit function. 将检查通过此参数编制索引的数据库。The database indexed by this parameter will be checked.


输入参数。Input parameter. 指向包含要检查的一个或多个数据库页面的缓冲区的指针。A pointer to a buffer containing one or more database pages to be checked. 缓冲区的大小必须是数据库页面大小的倍数,与ErrCheckDbHeaders函数在pcbDbPageSize参数中返回的大小相同。The size of the buffer must be a multiple of the database page size, as returned in the pcbDbPageSize parameter by the ErrCheckDbHeaders function. 调用ErrCheckDbPages之前,调用应用程序必须填充数据库页面内容的缓冲区。The calling application must fill the buffer with the database page contents before calling ErrCheckDbPages.


输入参数。Input parameter. PvPageBuffer参数的大小(以字节为单位)。The size of the pvPageBuffer parameter, in bytes. 此值必须是数据库页面大小的倍数,与ErrCheckDbHeaders函数在pcbDbPageSize参数中返回的大小相同。This value must be a multiple of the database page size, as returned in the pcbDbPageSize parameter by the ErrCheckDbHeaders function.


输入/输出参数。Input/output parameter. ErrCheckDbPages使用所检查的每个数据库页面的详细结果填充的页面 _ 信息结构的数组。An array of PAGE_INFO structures that ErrCheckDbPages fills with detailed results of each database page that is checked. 对于在pvPageBuffer参数中传递的每个数据库页面,该数组必须具有一个元素,并且每个页面 _ 信息结构中的ulPgno字段必须设置为与数据库页面相对应的逻辑页面编号。The array must have one element for each database page passed in the pvPageBuffer parameter, and the ulPgno field in each PAGE_INFO structure must be set to the logical page number that corresponds to the database page. 有关详细信息,请参阅本主题后面的 "备注"。For more information, see "Remarks" later in this topic.


输入参数。Input parameter. RgPageInfo [] 数组中的条目数。The number of entries in the rgPageInfo[] array. 此值必须等于在pvPageBuffer参数中传递的数据库页面的数目。This value must be equal to the number of database pages passed in the pvPageBuffer parameter.


可选的输入参数。Optional input parameter. 保留此值以供将来使用。This value is reserved for future use. 此参数中传递的值应为0(零)。The value passed in this parameter should be 0 (zero).

返回值Return value

ERR枚举中的错误代码。An error code from the ERR enumeration.


请注意,您需要在传递给ErrInit函数的数据库数组中指定数据库。Note that you need to have specified the database in the array of databases passed to the ErrInit function. 此外,还必须在ErrCheckDbPages之前调用ErrCheckDbHeadersAlso, ErrCheckDbHeaders must be called before ErrCheckDbPages.

调用应用程序必须分配足够大的内存缓冲区,以容纳要检查的数据库页。The calling application must allocate a memory buffer that is large enough to hold the database pages to be checked. 应用程序负责使用一个或多个此类数据库页的内容填充缓冲区。The application is responsible for filling the buffer with the contents of one or more such database pages.

调用应用程序必须先调用ErrCheckDbHeaders ,然后才能调用ErrCheckDbPagesThe calling application must call ErrCheckDbHeaders before calling ErrCheckDbPages. 可以根据需要多次调用此函数,以涵盖要检查的所有数据库文件中的所有页面。This function can be called as many times as necessary to cover all the pages in all database files that are to be checked.

rgPageInfo [] 参数中,返回的每个元素都包含有关页面 _ 信息结构中的数据库页面的信息。In the rgPageInfo[] parameter, each element returned contains information about the database page in a PAGE_INFO structure. 如果ErrCheckDbPages函数返回一个错误,则应用程序应检查每个页面 _ 信息结构以确定在哪个页面上发现了错误。If the ErrCheckDbPages function returns an error, the application should check each PAGE_INFO structure to determine on which page the error was found. 例如,比较checksumActualchecksumExpected值将指示是否在该数据库页上检测到校验和错误。For example, comparing the checksumActual and checksumExpected values will indicate whether a checksum error was detected on that database page.

如果ErrCheckDbPages检测到数据库内容中的任何错误,它将创建一个 Windows 错误事件日志条目。If ErrCheckDbPages detects any errors in the database content, it will create a Windows Error event log entry.

CChkSGFiles对象确定是否实际检查了使用ErrInit函数注册的所有数据库。The CChkSGFiles object determines whether all the databases registered with the ErrInit function were actually checked. 具体来说, CChkSGFiles使用ErrCheckDbPages函数来确定是否实际验证ErrCheckDbHeaders指示的相同数量的数据库页面。Specifically, CChkSGFiles uses the ErrCheckDbPages function to determine whether the same number of database pages indicated by ErrCheckDbHeaders were actually verified. 如果未成功检查每个数据库中的正确数量的页面, ErrTerm函数将返回一个错误。If the correct number of pages in each database were not successfully checked, the ErrTerm function returns an error.

如果要在多线程应用程序中使用 CHKSGFILES,则可以在应用程序的多线程部分调用ErrCheckDbPages函数。If you're using CHKSGFILES in a multithreaded application, you can call the ErrCheckDbPages function in the multithreaded portion of the application. 请注意,对于所检查的每个数据库, ErrCheckDbPages通常被多次调用。Note that ErrCheckDbPages is typically called multiple times for each database that is checked.


Exchange 2013 仅包含64位版本的 CHKSGFILES API。Exchange 2013 only includes a 64-bit version of the CHKSGFILES API.

运行应用程序所使用的帐户必须具有对要检查的数据库和日志文件的读取权限。The account that the application is running under must have read permissions to the database and log files that are to be checked.