Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 157 of file helpers.c.
Referenced by SockGetTdiName().
{ PWSTR TransportKey; HKEY KeyHandle; ULONG MappingSize; LONG Status; AFD_DbgPrint(MID_TRACE,("Called: TransportName %ws\n", TransportName)); /* Allocate a Buffer */ TransportKey = HeapAlloc(GlobalHeap, 0, (54 + wcslen(TransportName)) * sizeof(WCHAR)); /* Check for error */ if (TransportKey == NULL) { AFD_DbgPrint(MIN_TRACE, ("Buffer allocation failed\n")); return WSAEINVAL; } /* Generate the right key name */ wcscpy(TransportKey, L"System\\CurrentControlSet\\Services\\"); wcscat(TransportKey, TransportName); wcscat(TransportKey, L"\\Parameters\\Winsock"); /* Open the Key */ Status = RegOpenKeyExW(HKEY_LOCAL_MACHINE, TransportKey, 0, KEY_READ, &KeyHandle); /* We don't need the Transport Key anymore */ HeapFree(GlobalHeap, 0, TransportKey); /* Check for error */ if (Status) { AFD_DbgPrint(MIN_TRACE, ("Error reading transport mapping registry\n")); return WSAEINVAL; } /* Find out how much space we need for the Mapping */ Status = RegQueryValueExW(KeyHandle, L"Mapping", NULL, NULL, NULL, &MappingSize); /* Check for error */ if (Status) { AFD_DbgPrint(MIN_TRACE, ("Error reading transport mapping registry\n")); return WSAEINVAL; } /* Allocate Memory for the Mapping */ *Mapping = HeapAlloc(GlobalHeap, 0, MappingSize); /* Check for error */ if (*Mapping == NULL) { AFD_DbgPrint(MIN_TRACE, ("Buffer allocation failed\n")); return WSAEINVAL; } /* Read the Mapping */ Status = RegQueryValueExW(KeyHandle, L"Mapping", NULL, NULL, (LPBYTE)*Mapping, &MappingSize); /* Check for error */ if (Status) { AFD_DbgPrint(MIN_TRACE, ("Error reading transport mapping registry\n")); HeapFree(GlobalHeap, 0, *Mapping); return WSAEINVAL; } /* Close key and return */ RegCloseKey(KeyHandle); return 0; }