- Forgot to commit these for MSVC build...
[reactos.git] / reactos / drivers / net / tcpip / tcpip / proto.c
1 #include "precomp.h"
2
3 NTSTATUS TiGetProtocolNumber(
4 PUNICODE_STRING FileName,
5 PULONG Protocol)
6 /*
7 * FUNCTION: Returns the protocol number from a file name
8 * ARGUMENTS:
9 * FileName = Pointer to string with file name
10 * Protocol = Pointer to buffer to put protocol number in
11 * RETURNS:
12 * Status of operation
13 */
14 {
15 UNICODE_STRING us;
16 NTSTATUS Status;
17 ULONG Value;
18 PWSTR Name;
19
20 TI_DbgPrint(MAX_TRACE, ("Called. FileName (%wZ).\n", FileName));
21
22 Name = FileName->Buffer;
23
24 if (*Name++ != (WCHAR)L'\\')
25 return STATUS_UNSUCCESSFUL;
26
27 if (*Name == (WCHAR)NULL)
28 return STATUS_UNSUCCESSFUL;
29
30 RtlInitUnicodeString(&us, Name);
31
32 Status = RtlUnicodeStringToInteger(&us, 10, &Value);
33 if (!NT_SUCCESS(Status) || ((Value > 255)))
34 return STATUS_UNSUCCESSFUL;
35
36 *Protocol = Value;
37
38 return STATUS_SUCCESS;
39 }
40