已过时端口类函数

标头文件 portcls.h 定义宏,其中包含已替换为新 PortCls 函数的过时 PortCls 函数的名称。 这些宏允许重新编译包含对已过时 PortCls 函数名称的引用的旧源代码,以使用新的 PortCls 函数,而无需对源文件进行任何编辑。

编译使用已过时名称的源代码时,定义参数名称 PC_OLD_NAMES。 如果此参数比将语句 #define PC_OLD_NAMES 引入源文件本身更方便,则可以通过编译器命令行参数“-DPC_OLD_NAMES”定义此参数。

下表的左列中列出了已过时的 PortCls 函数名称。 对于每个过时的名称,中心列包含替换它的新 PortCls 函数的名称。

已过时的函数名称 新函数名称 参数是否发生了更改?

AddAdapterDevice

PcAddAdapterDevice

CompletePendingPropertyRequest

PcCompletePendingPropertyRequest

GetTimeInterval

PcGetTimeInterval

InitializeAdapterDriver

PcInitializeAdapterDriver

NewDmaChannel

PcNewDmaChannel

NewMiniport

PcNewMiniport

NewPort

PcNewPort

NewResourceList

PcNewResourceList

NewResourceSublist

PcNewResourceSublist

NewServiceGroup

PcNewServiceGroup

RegisterPhysicalConnection

PcRegisterPhysicalConnection

RegisterPhysicalConnectionFromExternal

PcRegisterPhysicalConnectionFromExternal

RegisterPhysicalConnectionToExternal

PcRegisterPhysicalConnectionToExternal

RegisterSubdevice

PcRegisterSubdevice

在某些情况下,更改只是简单的名称更改:在名称开头插入限定符 Pc,以指示已在 PortCls 中实现函数。 但是,在其他情况下,除了函数的名称外,参数列表也发生了更改。 上表中的右列指示参数是否已更改。

在参数发生更改的情况下,portcls.h 中的宏会将已过时 PortCls 函数的参数列表转换为新 PortCls 函数的等效参数。 以下宏包含参数转换:

#define InitializeAdapterDriver(c1,c2,a) \
    PcInitializeAdapterDriver(PDRIVER_OBJECT(c1),PUNICODE_STRING(c2),PDRIVER_ADD_DEVICE(a))
#define AddAdapterDevice(c1,c2,s,m) \
    PcAddAdapterDevice(PDRIVER_OBJECT(c1),PDEVICE_OBJECT(c2),s,m,0)
#define RegisterSubdevice(c1,c2,n,u) \
    PcRegisterSubdevice(PDEVICE_OBJECT(c1),n,u)
#define RegisterPhysicalConnection(c1,c2,fs,fp,ts,tp) \
    PcRegisterPhysicalConnection(PDEVICE_OBJECT(c1),fs,fp,ts,tp)
#define RegisterPhysicalConnectionToExternal(c1,c2,fs,fp,ts,tp) \
    PcRegisterPhysicalConnectionToExternal(PDEVICE_OBJECT(c1),fs,fp,ts,tp)
#define RegisterPhysicalConnectionFromExternal(c1,c2,fs,fp,ts,tp) \
    PcRegisterPhysicalConnectionFromExternal(PDEVICE_OBJECT(c1),fs,fp,ts,tp)