VOID NbfFreeConfigurationInfo ( IN PCONFIG_DATA ConfigurationInfo ) /*++ Routine Description: This routine is called by NBF to get free any storage that was allocated by NbfConfigureTransport in producing the specified CONFIG_DATA structure. Arguments: ConfigurationInfo - A pointer to the configuration information structure. Return Value: None. --*/ { UINT i; for (i=0; i<ConfigurationInfo->NumAdapters; i++) { RemoveAdapter (ConfigurationInfo, i); RemoveDevice (ConfigurationInfo, i); } ExFreePool (ConfigurationInfo); } /* NbfFreeConfigurationInfo */
bool PhysicsNeuralModule::RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError) { std::string strType = Std_CheckString(strItemType); if(strType == "ADAPTER") { RemoveAdapter(strID); return true; } //Synapses are stored in the destination neuron. They will be removed there. //If it was not one of those above then we have a problem. if(bThrowError) THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType, "Item Type", strItemType); return false; }
VOID NbfReadLinkageInformation( IN PWSTR RegistryPathBuffer, IN PCONFIG_DATA * ConfigurationInfo ) /*++ Routine Description: This routine is called by NBF to read its linkage information from the registry. If there is none present, then ConfigData is filled with a list of all the adapters that are known to NBF. Arguments: RegistryPathBuffer - The null-terminated root of the NBF registry tree. ConfigurationInfo - Returns NBF's current configuration. Return Value: None. --*/ { UINT ConfigBindings; UINT NameCount = 0; NTSTATUS Status; RTL_QUERY_REGISTRY_TABLE QueryTable[6]; PWSTR Subkey = L"Linkage"; PWSTR Bind = L"Bind"; PWSTR Export = L"Export"; ULONG BindCount, ExportCount; UINT i; // // Set up QueryTable to do the following: // // // 1) Switch to the Linkage key below NBF // QueryTable[0].QueryRoutine = NULL; QueryTable[0].Flags = RTL_QUERY_REGISTRY_SUBKEY; QueryTable[0].Name = Subkey; // // 2) Call NbfCountEntries for the "Bind" multi-string // QueryTable[1].QueryRoutine = NbfCountEntries; QueryTable[1].Flags = RTL_QUERY_REGISTRY_REQUIRED | RTL_QUERY_REGISTRY_NOEXPAND; QueryTable[1].Name = Bind; QueryTable[1].EntryContext = (PVOID)&NameCount; QueryTable[1].DefaultType = REG_NONE; // // 3) Call NbfCountEntries for the "Export" multi-string // QueryTable[2].QueryRoutine = NbfCountEntries; QueryTable[2].Flags = RTL_QUERY_REGISTRY_REQUIRED | RTL_QUERY_REGISTRY_NOEXPAND; QueryTable[2].Name = Export; QueryTable[2].EntryContext = (PVOID)&NameCount; QueryTable[2].DefaultType = REG_NONE; // // 4) Call NbfAddBind for each string in "Bind" // QueryTable[3].QueryRoutine = NbfAddBind; QueryTable[3].Flags = 0; QueryTable[3].Name = Bind; QueryTable[3].EntryContext = (PVOID)&BindCount; QueryTable[3].DefaultType = REG_NONE; // // 5) Call NbfAddExport for each string in "Export" // QueryTable[4].QueryRoutine = NbfAddExport; QueryTable[4].Flags = 0; QueryTable[4].Name = Export; QueryTable[4].EntryContext = (PVOID)&ExportCount; QueryTable[4].DefaultType = REG_NONE; // // 6) Stop // QueryTable[5].QueryRoutine = NULL; QueryTable[5].Flags = 0; QueryTable[5].Name = NULL; BindCount = 0; ExportCount = 0; Status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, RegistryPathBuffer, QueryTable, (PVOID)ConfigurationInfo, NULL); if (Status != STATUS_SUCCESS) { return; } // // Make sure that BindCount and ExportCount match, if not // remove the extras. // if (BindCount < ExportCount) { for (i=BindCount; i<ExportCount; i++) { RemoveDevice (*ConfigurationInfo, i); } ConfigBindings = BindCount; } else if (ExportCount < BindCount) { for (i=ExportCount; i<BindCount; i++) { RemoveAdapter (*ConfigurationInfo, i); } ConfigBindings = ExportCount; } else { ConfigBindings = BindCount; // which is equal to ExportCount } (*ConfigurationInfo)->NumAdapters = ConfigBindings; } /* NbfReadLinkageInformation */