else
RtlInitUnicodeString(&KeyString, LocalKeyName);
+ while (ParentKey->DataType == REG_LINK)
+ ParentKey = ParentKey->LinkedKey;
+
/* Check subkey in memory structure */
Ptr = ParentKey->SubKeyList.Flink;
while (Ptr != &ParentKey->SubKeyList)
ParentKey->SubKeyCount++;
nextsubkey:
- /* Follow registry links */
- while (CurrentKey->LinkedKey)
- CurrentKey = CurrentKey->LinkedKey;
ParentKey = CurrentKey;
if (End)
LocalKeyName = End + 1;
return rc;
}
-static NTSTATUS
+static LONG
RegpOpenOrCreateValue(
IN HKEY hKey,
IN LPCWSTR ValueName,
ValueCellOffset);
}
if (!NT_SUCCESS(Status))
- return Status;
- return STATUS_SUCCESS;
+ return ERROR_UNSUCCESSFUL;
+ return ERROR_SUCCESS;
}
LONG WINAPI
IN LPCWSTR lpValueName OPTIONAL,
IN ULONG Reserved,
IN ULONG dwType,
- IN const PUCHAR lpData,
+ IN const UCHAR* lpData,
IN USHORT cbData)
{
MEMKEY Key, DestKey;
DestKey = HKEY_TO_MEMKEY(*phKey);
/* Create the link in memory */
+ Key->DataType = REG_LINK;
Key->LinkedKey = DestKey;
/* Create the link in registry hive (if applicable) */
if (Key->RegistryHive != DestKey->RegistryHive)
return STATUS_SUCCESS;
- DPRINT1("Save link to registry\n");
- return STATUS_NOT_IMPLEMENTED;
+ lpData = (PUCHAR)&DestKey->KeyCellOffset;
+ cbData = sizeof(HCELL_INDEX);
}
if ((cbData & REG_DATA_SIZE_MASK) != cbData)
IN LPCSTR lpValueName OPTIONAL,
IN ULONG Reserved,
IN ULONG dwType,
- IN const PUCHAR lpData,
+ IN const UCHAR* lpData,
IN ULONG cbData)
{
LPWSTR lpValueNameW = NULL;
- PUCHAR lpDataW;
+ const UCHAR* lpDataW;
USHORT cbDataW;
LONG rc = ERROR_SUCCESS;
AnsiString.Length = (USHORT)cbData - 1;
AnsiString.MaximumLength = (USHORT)cbData;
RtlAnsiStringToUnicodeString (&Data, &AnsiString, TRUE);
- lpDataW = (const PUCHAR)Data.Buffer;
+ lpDataW = (const UCHAR*)Data.Buffer;
cbDataW = Data.MaximumLength;
}
else
if (lpValueNameW)
free(lpValueNameW);
if (lpData != lpDataW)
- free(lpDataW);
+ free((PVOID)lpDataW);
return rc;
}
//ParentKey = HKEY_TO_MEMKEY(RootKey);
PCM_KEY_VALUE ValueCell;
HCELL_INDEX ValueCellOffset;
- NTSTATUS Status;
+ LONG rc;
- Status = RegpOpenOrCreateValue(
+ rc = RegpOpenOrCreateValue(
hKey,
lpValueName,
FALSE,
&ValueCell,
&ValueCellOffset);
+ if (rc != ERROR_SUCCESS)
+ return rc;
+
+ DPRINT1("RegQueryValueExW(%S) not implemented\n", lpValueName);
+ /* ValueCell and ValueCellOffset are valid */
- //Status = CmiScanForValueKey(
- // x
return ERROR_UNSUCCESSFUL;
}
LPWSTR lpValueNameW = NULL;
LONG rc;
- DPRINT1("RegQueryValueExA(%s) not implemented\n", lpValueName);
if (lpValueName)
{
lpValueNameW = MultiByteToWideChar(lpValueName);
NULL,
L"Registry\\Machine\\SYSTEM\\CurrentControlSet",
&LinkKey);
- printf("ControlSetKey %p\n", ControlSetKey);
RegSetValueExW(LinkKey, NULL, 0, REG_LINK, (PCHAR)&ControlSetKey, sizeof(PVOID));
}