Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 839 of file config.c.
{ KEY_BASIC_INFORMATION *KeyInformation; ULONG KeyInformationLength; OBJECT_ATTRIBUTES KeyAttributes; NDIS_HANDLE RegKeyHandle; PMINIPORT_CONFIGURATION_CONTEXT ConfigurationContext; *KeyHandle = NULL; *Status = ZwEnumerateKey(ConfigurationHandle, Index, KeyBasicInformation, NULL, 0, &KeyInformationLength); if(*Status != STATUS_BUFFER_TOO_SMALL && *Status != STATUS_BUFFER_OVERFLOW && *Status != STATUS_SUCCESS) { NDIS_DbgPrint(MIN_TRACE, ("ZwEnumerateKey failed (%x)\n", *Status)); *Status = NDIS_STATUS_FAILURE; return; } KeyInformation = ExAllocatePool(PagedPool, KeyInformationLength + sizeof(KEY_BASIC_INFORMATION)); if(!KeyInformation) { NDIS_DbgPrint(MIN_TRACE,("Insufficient resources.\n")); *Status = NDIS_STATUS_FAILURE; return; } *Status = ZwEnumerateKey(ConfigurationHandle, Index, KeyBasicInformation, KeyInformation, KeyInformationLength + sizeof(KEY_BASIC_INFORMATION), &KeyInformationLength); if(*Status != STATUS_SUCCESS) { NDIS_DbgPrint(MIN_TRACE, ("ZwEnumerateKey failed (%x)\n", *Status)); ExFreePool(KeyInformation); *Status = NDIS_STATUS_FAILURE; return; } /* should i fail instead if the passed-in string isn't long enough? */ wcsncpy(KeyName->Buffer, KeyInformation->Name, KeyName->MaximumLength/sizeof(WCHAR)); KeyName->Length = (USHORT)min(KeyInformation->NameLength, KeyName->MaximumLength); InitializeObjectAttributes(&KeyAttributes, KeyName, OBJ_CASE_INSENSITIVE, ConfigurationHandle, NULL); *Status = ZwOpenKey(&RegKeyHandle, KEY_ALL_ACCESS, &KeyAttributes); ExFreePool(KeyInformation); if(*Status != STATUS_SUCCESS) { NDIS_DbgPrint(MIN_TRACE, ("ZwOpenKey failed (%x)\n", *Status)); *Status = NDIS_STATUS_FAILURE; return; } ConfigurationContext = ExAllocatePool(NonPagedPool, sizeof(MINIPORT_CONFIGURATION_CONTEXT)); if(!ConfigurationContext) { NDIS_DbgPrint(MIN_TRACE,("Insufficient resources.\n")); ZwClose(RegKeyHandle); *Status = NDIS_STATUS_FAILURE; return; } KeInitializeSpinLock(&ConfigurationContext->ResourceLock); InitializeListHead(&ConfigurationContext->ResourceListHead); ConfigurationContext->Handle = RegKeyHandle; *KeyHandle = (NDIS_HANDLE)ConfigurationContext; *Status = NDIS_STATUS_SUCCESS; }