mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:43:04 +00:00
[SETUPAPI] CM_Open_DevNode_Key_Ex: Add support for remote registry access and the Disposition parameter.
This commit is contained in:
parent
95447d2fd1
commit
06f9e1220f
1 changed files with 46 additions and 12 deletions
|
@ -5002,9 +5002,10 @@ CM_Open_Class_Key_ExW(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (RegConnectRegistryW(((PMACHINE_INFO)hMachine)->szMachineName,
|
if (RegConnectRegistryW(((PMACHINE_INFO)hMachine)->szMachineName,
|
||||||
HKEY_LOCAL_MACHINE, &hKey))
|
HKEY_LOCAL_MACHINE,
|
||||||
return CR_REGISTRY_ERROR;
|
&hKey))
|
||||||
|
return CR_REGISTRY_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ulFlags & CM_OPEN_CLASS_KEY_INTERFACE)
|
if (ulFlags & CM_OPEN_CLASS_KEY_INTERFACE)
|
||||||
|
@ -5097,6 +5098,8 @@ CM_Open_DevNode_Key_Ex(
|
||||||
HSTRING_TABLE StringTable = NULL;
|
HSTRING_TABLE StringTable = NULL;
|
||||||
LPWSTR pszDevInst, pszKeyPath = NULL, pszInstancePath = NULL;
|
LPWSTR pszDevInst, pszKeyPath = NULL, pszInstancePath = NULL;
|
||||||
LONG lError;
|
LONG lError;
|
||||||
|
DWORD dwDisposition;
|
||||||
|
HKEY hRootKey = NULL;
|
||||||
CONFIGRET ret = CR_CALL_NOT_IMPLEMENTED;
|
CONFIGRET ret = CR_CALL_NOT_IMPLEMENTED;
|
||||||
|
|
||||||
FIXME("CM_Open_DevNode_Key_Ex(%lx %lx %lu %lx %p %lx %lx)\n",
|
FIXME("CM_Open_DevNode_Key_Ex(%lx %lx %lu %lx %p %lx %lx)\n",
|
||||||
|
@ -5138,14 +5141,14 @@ CM_Open_DevNode_Key_Ex(
|
||||||
|
|
||||||
TRACE("pszDevInst: %S\n", pszDevInst);
|
TRACE("pszDevInst: %S\n", pszDevInst);
|
||||||
|
|
||||||
pszKeyPath = MyMalloc(1024);
|
pszKeyPath = MyMalloc(512 * sizeof(WCHAR));
|
||||||
if (pszKeyPath == NULL)
|
if (pszKeyPath == NULL)
|
||||||
{
|
{
|
||||||
ret = CR_OUT_OF_MEMORY;
|
ret = CR_OUT_OF_MEMORY;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
pszInstancePath = MyMalloc(1024);
|
pszInstancePath = MyMalloc(512 * sizeof(WCHAR));
|
||||||
if (pszInstancePath == NULL)
|
if (pszInstancePath == NULL)
|
||||||
{
|
{
|
||||||
ret = CR_OUT_OF_MEMORY;
|
ret = CR_OUT_OF_MEMORY;
|
||||||
|
@ -5169,14 +5172,42 @@ CM_Open_DevNode_Key_Ex(
|
||||||
|
|
||||||
TRACE("pszKeyPath: %S\n", pszKeyPath);
|
TRACE("pszKeyPath: %S\n", pszKeyPath);
|
||||||
|
|
||||||
// FIXME: Disposition
|
if (hMachine == NULL)
|
||||||
// FIXME: hMachine
|
{
|
||||||
|
hRootKey = HKEY_LOCAL_MACHINE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (RegConnectRegistryW(((PMACHINE_INFO)hMachine)->szMachineName,
|
||||||
|
HKEY_LOCAL_MACHINE,
|
||||||
|
&hRootKey))
|
||||||
|
{
|
||||||
|
ret = CR_REGISTRY_ERROR;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Disposition == RegDisposition_OpenAlways)
|
||||||
|
{
|
||||||
|
lError = RegCreateKeyExW(hRootKey,
|
||||||
|
pszKeyPath,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
samDesired,
|
||||||
|
NULL,
|
||||||
|
phkDevice,
|
||||||
|
&dwDisposition);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lError = RegOpenKeyExW(hRootKey,
|
||||||
|
pszKeyPath,
|
||||||
|
0,
|
||||||
|
samDesired,
|
||||||
|
phkDevice);
|
||||||
|
}
|
||||||
|
|
||||||
lError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
|
||||||
pszKeyPath,
|
|
||||||
0,
|
|
||||||
samDesired,
|
|
||||||
phkDevice);
|
|
||||||
if (lError != ERROR_SUCCESS)
|
if (lError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
*phkDevice = NULL;
|
*phkDevice = NULL;
|
||||||
|
@ -5184,6 +5215,9 @@ CM_Open_DevNode_Key_Ex(
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
if ((hRootKey != NULL) && (hRootKey != HKEY_LOCAL_MACHINE))
|
||||||
|
RegCloseKey(hRootKey);
|
||||||
|
|
||||||
if (pszInstancePath != NULL)
|
if (pszInstancePath != NULL)
|
||||||
MyFree(pszInstancePath);
|
MyFree(pszInstancePath);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue