mirror of
https://github.com/reactos/reactos.git
synced 2025-06-06 09:50:43 +00:00
[UMPNPMGR] Implement first part of PNP_FreeLogConf
This commit is contained in:
parent
208dfd22c6
commit
2ec3a199af
2 changed files with 85 additions and 4 deletions
|
@ -33,6 +33,8 @@
|
||||||
#include <pnp_s.h>
|
#include <pnp_s.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define LOGCONF_NAME_BUFFER_SIZE 32
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
LIST_ENTRY ListEntry;
|
LIST_ENTRY ListEntry;
|
||||||
|
|
|
@ -4179,7 +4179,7 @@ PNP_AddEmptyLogConf(
|
||||||
DWORD RegDataType = 0;
|
DWORD RegDataType = 0;
|
||||||
ULONG ulDataSize = 0;
|
ULONG ulDataSize = 0;
|
||||||
LPBYTE pDataBuffer = NULL;
|
LPBYTE pDataBuffer = NULL;
|
||||||
WCHAR szValueNameBuffer[64];
|
WCHAR szValueNameBuffer[LOGCONF_NAME_BUFFER_SIZE];
|
||||||
CONFIGRET ret = CR_SUCCESS;
|
CONFIGRET ret = CR_SUCCESS;
|
||||||
|
|
||||||
DPRINT("PNP_AddEmptyLogConf(%p %S %lu %p 0x%08lx)\n",
|
DPRINT("PNP_AddEmptyLogConf(%p %S %lu %p 0x%08lx)\n",
|
||||||
|
@ -4211,7 +4211,7 @@ PNP_AddEmptyLogConf(
|
||||||
&RegDataType,
|
&RegDataType,
|
||||||
&ulDataSize,
|
&ulDataSize,
|
||||||
&pDataBuffer,
|
&pDataBuffer,
|
||||||
64,
|
LOGCONF_NAME_BUFFER_SIZE,
|
||||||
szValueNameBuffer);
|
szValueNameBuffer);
|
||||||
|
|
||||||
if (ret != CR_SUCCESS || ulDataSize == 0)
|
if (ret != CR_SUCCESS || ulDataSize == 0)
|
||||||
|
@ -4324,8 +4324,87 @@ PNP_FreeLogConf(
|
||||||
DWORD ulLogConfTag,
|
DWORD ulLogConfTag,
|
||||||
DWORD ulFlags)
|
DWORD ulFlags)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
HKEY hConfigKey = NULL;
|
||||||
return CR_CALL_NOT_IMPLEMENTED;
|
DWORD RegDataType = 0;
|
||||||
|
ULONG ulDataSize = 0;
|
||||||
|
LPBYTE pDataBuffer = NULL;
|
||||||
|
WCHAR szValueNameBuffer[LOGCONF_NAME_BUFFER_SIZE];
|
||||||
|
CONFIGRET ret = CR_SUCCESS;
|
||||||
|
|
||||||
|
DPRINT("PNP_FreeLogConf(%p %S %lu %lu 0x%08lx)\n",
|
||||||
|
hBinding, pDeviceID, ulLogConfType, ulLogConfTag, ulFlags);
|
||||||
|
|
||||||
|
if (ulFlags != 0)
|
||||||
|
return CR_INVALID_FLAG;
|
||||||
|
|
||||||
|
if (!IsValidDeviceInstanceID(pDeviceID))
|
||||||
|
return CR_INVALID_DEVNODE;
|
||||||
|
|
||||||
|
ret = OpenConfigurationKey(pDeviceID,
|
||||||
|
ulLogConfType,
|
||||||
|
&hConfigKey);
|
||||||
|
if (ret != CR_SUCCESS)
|
||||||
|
{
|
||||||
|
DPRINT1("OpenConfigurationKey() failed (Error %lu)\n", ret);
|
||||||
|
ret = CR_NO_MORE_LOG_CONF;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = GetConfigurationData(hConfigKey,
|
||||||
|
ulLogConfType,
|
||||||
|
&RegDataType,
|
||||||
|
&ulDataSize,
|
||||||
|
&pDataBuffer,
|
||||||
|
LOGCONF_NAME_BUFFER_SIZE,
|
||||||
|
szValueNameBuffer);
|
||||||
|
if (ret != CR_SUCCESS)
|
||||||
|
{
|
||||||
|
ret = CR_INVALID_LOG_CONF;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RegDataType == REG_RESOURCE_LIST)
|
||||||
|
{
|
||||||
|
if (((PCM_RESOURCE_LIST)pDataBuffer)->Count <= 1)
|
||||||
|
{
|
||||||
|
/* Delete the key if there is only one or no configuration in the key */
|
||||||
|
DPRINT("Delete value %S\n", szValueNameBuffer);
|
||||||
|
RegDeleteValue(hConfigKey, szValueNameBuffer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* FIXME */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST)
|
||||||
|
{
|
||||||
|
if (((PIO_RESOURCE_REQUIREMENTS_LIST)pDataBuffer)->AlternativeLists <= 1)
|
||||||
|
{
|
||||||
|
/* Delete the key if there is only one or no configuration in the key */
|
||||||
|
DPRINT("Delete value %S\n", szValueNameBuffer);
|
||||||
|
RegDeleteValue(hConfigKey, szValueNameBuffer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* FIXME */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = CR_FAILURE;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (pDataBuffer != NULL)
|
||||||
|
HeapFree(GetProcessHeap(), 0, pDataBuffer);
|
||||||
|
|
||||||
|
if (hConfigKey != NULL)
|
||||||
|
RegCloseKey(hConfigKey);
|
||||||
|
|
||||||
|
DPRINT("PNP_FreeLogConf() returns %lu\n", ret);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue