MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2QueryVolumeParams

Function Ext2QueryVolumeParams

Ext4Fsd/memory.c:1941–2013  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1939}
1940
1941NTSTATUS
1942Ext2QueryVolumeParams(IN PEXT2_VCB Vcb, IN PUNICODE_STRING Params)
1943{
1944 NTSTATUS Status;
1945 RTL_QUERY_REGISTRY_TABLE QueryTable[2];
1946
1947 UNICODE_STRING UniName;
1948 PUSHORT UniBuffer = NULL;
1949
1950 USHORT UUID[50];
1951
1952 int i;
1953 int len = 0;
1954
1955 /* zero params */
1956 RtlZeroMemory(Params, sizeof(UNICODE_STRING));
1957
1958 /* constructing volume UUID name */
1959 memset(UUID, 0, sizeof(USHORT) * 50);
1960 for (i=0; i < 16; i++) {
1961 if (i == 0) {
1962 swprintf((wchar_t *)&UUID[len], L"{%2.2X",Vcb->SuperBlock->s_uuid[i]);
1963 len += 3;
1964 } else if (i == 15) {
1965 swprintf((wchar_t *)&UUID[len], L"-%2.2X}", Vcb->SuperBlock->s_uuid[i]);
1966 len +=4;
1967 } else {
1968 swprintf((wchar_t *)&UUID[len], L"-%2.2X", Vcb->SuperBlock->s_uuid[i]);
1969 len += 3;
1970 }
1971 }
1972
1973 /* allocating memory for UniBuffer */
1974 UniBuffer = Ext2AllocatePool(PagedPool, 1024, EXT2_PARAM_MAGIC);
1975 if (NULL == UniBuffer) {
1976 Status = STATUS_INSUFFICIENT_RESOURCES;
1977 goto errorout;
1978 }
1979 RtlZeroMemory(UniBuffer, 1024);
1980
1981 /* querying volume parameter string */
1982 RtlZeroMemory(&QueryTable[0], sizeof(RTL_QUERY_REGISTRY_TABLE) * 2);
1983 QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_REQUIRED;
1984 QueryTable[0].Name = UUID;
1985 QueryTable[0].EntryContext = &(UniName);
1986 UniName.MaximumLength = 1024;
1987 UniName.Length = 0;
1988 UniName.Buffer = UniBuffer;
1989
1990 Status = RtlQueryRegistryValues(
1991 RTL_REGISTRY_ABSOLUTE,
1992 Ext2Global->RegistryPath.Buffer,
1993 &QueryTable[0],
1994 NULL,
1995 NULL
1996 );
1997
1998 if (!NT_SUCCESS(Status)) {

Callers 1

Calls 2

Ext2AllocatePoolFunction · 0.85
Ext2FreePoolFunction · 0.85

Tested by

no test coverage detected