typedef struct _INTERNAL_RANGE
{
LIST_ENTRY ListEntry;
+ struct _INTERNAL_RANGE_LIST *pRangeList;
DWORDLONG ullStart;
DWORDLONG ullEnd;
} INTERNAL_RANGE, *PINTERNAL_RANGE;
{
/* Software Key Path */
- if (ulFlags & CM_REGISTRY_CONFIG)
+ ulTransferLength = 300 * sizeof(WCHAR);
+ ulLength = 300 * sizeof(WCHAR);
+
+ RpcTryExcept
{
- SplitDeviceInstanceId(pszDeviceInst,
- pszBuffer,
- pszInstancePath);
+ ret = PNP_GetDeviceRegProp(BindingHandle,
+ pszDeviceInst,
+ CM_DRP_DRIVER,
+ &ulType,
+ (PVOID)pszBuffer,
+ &ulTransferLength,
+ &ulLength,
+ 0);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ ret = RpcStatusToCmStatus(RpcExceptionCode());
+ }
+ RpcEndExcept;
+ if (ret != CR_SUCCESS)
+ {
+ RpcTryExcept
+ {
+ ret = PNP_GetClassInstance(BindingHandle,
+ pszDeviceInst,
+ (PVOID)pszBuffer,
+ 300);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ ret = RpcStatusToCmStatus(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ if (ret != CR_SUCCESS)
+ {
+ goto done;
+ }
+ }
+
+ TRACE("szBuffer: %S\n", pszBuffer);
+
+ SplitDeviceInstanceId(pszBuffer,
+ pszBuffer,
+ pszInstancePath);
+
+ TRACE("szBuffer: %S\n", pszBuffer);
+
+ if (ulFlags & CM_REGISTRY_CONFIG)
+ {
if (ulHardwareProfile == 0)
{
wsprintfW(pszKeyPath,
L"%s\\%s\\%s\\%s",
L"System\\CurrentControlSet\\Hardware Profiles",
L"Current",
- L"System\\CurrentControlSet\\Enum",
+ L"System\\CurrentControlSet\\Control\\Class",
pszBuffer);
}
else
L"%s\\%04lu\\%s\\%s",
L"System\\CurrentControlSet\\Hardware Profiles",
ulHardwareProfile,
- L"System\\CurrentControlSet\\Enum",
+ L"System\\CurrentControlSet\\Control\\Class",
pszBuffer);
}
}
- else if (ulFlags & CM_REGISTRY_USER)
- {
- wsprintfW(pszKeyPath,
- L"%s\\%s",
- L"System\\CurrentControlSet\\Enum",
- pszDeviceInst);
-
- wcscpy(pszInstancePath,
- L"Device Parameters");
- }
else
{
- SplitDeviceInstanceId(pszDeviceInst,
- pszBuffer,
- pszInstancePath);
-
wsprintfW(pszKeyPath,
L"%s\\%s",
- L"System\\CurrentControlSet\\Enum",
+ L"System\\CurrentControlSet\\Control\\Class",
pszBuffer);
}
}
{
/* Hardware Key Path */
- ulTransferLength = 300 * sizeof(WCHAR);
- ulLength = 300 * sizeof(WCHAR);
- ret = PNP_GetDeviceRegProp(BindingHandle,
- pszDeviceInst,
- CM_DRP_DRIVER,
- &ulType,
- (PVOID)pszBuffer,
- &ulTransferLength,
- &ulLength,
- 0);
- if (ret != CR_SUCCESS)
- {
- ERR("PNP_GetDeviceRegProp() failed (Error %lu)\n", ret);
- goto done;
- }
-
- TRACE("szBuffer: %S\n", pszBuffer);
-
- SplitDeviceInstanceId(pszBuffer,
- pszBuffer,
- pszInstancePath);
-
- TRACE("szBuffer: %S\n", pszBuffer);
-
if (ulFlags & CM_REGISTRY_CONFIG)
{
+ SplitDeviceInstanceId(pszDeviceInst,
+ pszBuffer,
+ pszInstancePath);
+
if (ulHardwareProfile == 0)
{
wsprintfW(pszKeyPath,
L"%s\\%s\\%s\\%s",
L"System\\CurrentControlSet\\Hardware Profiles",
L"Current",
- L"System\\CurrentControlSet\\Control\\Class",
+ L"System\\CurrentControlSet\\Enum",
pszBuffer);
}
else
L"%s\\%04lu\\%s\\%s",
L"System\\CurrentControlSet\\Hardware Profiles",
ulHardwareProfile,
- L"System\\CurrentControlSet\\Control\\Class",
+ L"System\\CurrentControlSet\\Enum",
pszBuffer);
}
}
+ else if (ulFlags & CM_REGISTRY_USER)
+ {
+ wsprintfW(pszKeyPath,
+ L"%s\\%s",
+ L"System\\CurrentControlSet\\Enum",
+ pszDeviceInst);
+
+ wcscpy(pszInstancePath,
+ L"Device Parameters");
+ }
else
{
+ SplitDeviceInstanceId(pszDeviceInst,
+ pszBuffer,
+ pszInstancePath);
+
wsprintfW(pszKeyPath,
L"%s\\%s",
- L"System\\CurrentControlSet\\Control\\Class",
+ L"System\\CurrentControlSet\\Enum",
pszBuffer);
}
}
* CM_Add_Empty_Log_Conf_Ex [SETUPAPI.@]
*/
CONFIGRET
-WINAPI CM_Add_Empty_Log_Conf_Ex(
+WINAPI
+CM_Add_Empty_Log_Conf_Ex(
_Out_ PLOG_CONF plcLogConf,
_In_ DEVINST dnDevInst,
_In_ PRIORITY Priority,
goto done;
}
+ pRange->pRangeList = pRangeList;
pRange->ullStart = ullStartValue;
pRange->ullEnd = ullEndValue;
}
else
{
-
+ HeapFree(GetProcessHeap(), 0, pRange);
+ UNIMPLEMENTED;
}
done:
}
+/***********************************************************************
+ * CM_Detect_Resource_Conflict [SETUPAPI.@]
+ */
+CONFIGRET
+WINAPI
+CM_Detect_Resource_Conflict(
+ _In_ DEVINST dnDevInst,
+ _In_ RESOURCEID ResourceID,
+ _In_reads_bytes_(ResourceLen) PCVOID ResourceData,
+ _In_ ULONG ResourceLen,
+ _Out_ PBOOL pbConflictDetected,
+ _In_ ULONG ulFlags)
+{
+ TRACE("CM_Detect_Resource_Conflict(%p %lu %p %lu %p 0x%lx)\n",
+ dnDevInst, ResourceID, ResourceData, ResourceLen,
+ pbConflictDetected, ulFlags);
+
+ return CM_Detect_Resource_Conflict_Ex(dnDevInst,
+ ResourceID,
+ ResourceData,
+ ResourceLen,
+ pbConflictDetected,
+ ulFlags,
+ NULL);
+}
+
+
+/***********************************************************************
+ * CM_Detect_Resource_Conflict_Ex [SETUPAPI.@]
+ */
+CONFIGRET
+WINAPI
+CM_Detect_Resource_Conflict_Ex(
+ _In_ DEVINST dnDevInst,
+ _In_ RESOURCEID ResourceID,
+ _In_reads_bytes_(ResourceLen) PCVOID ResourceData,
+ _In_ ULONG ResourceLen,
+ _Out_ PBOOL pbConflictDetected,
+ _In_ ULONG ulFlags,
+ _In_opt_ HMACHINE hMachine)
+{
+ FIXME("CM_Detect_Resource_Conflict_Ex(%p %lu %p %lu %p 0x%lx %p)\n",
+ dnDevInst, ResourceID, ResourceData, ResourceLen,
+ pbConflictDetected, ulFlags, hMachine);
+
+ return CR_CALL_NOT_IMPLEMENTED;
+}
+
+
/***********************************************************************
* CM_Disable_DevNode [SETUPAPI.@]
*/
}
+/***********************************************************************
+ * CM_Get_Resource_Conflict_Count [SETUPAPI.@]
+ */
+CONFIGRET
+WINAPI
+CM_Get_Resource_Conflict_Count(
+ _In_ CONFLICT_LIST clConflictList,
+ _Out_ PULONG pulCount)
+{
+ PCONFLICT_DATA pConflictData;
+
+ FIXME("CM_Get_Resource_Conflict_Count(%p %p)\n",
+ clConflictList, pulCount);
+
+ pConflictData = (PCONFLICT_DATA)clConflictList;
+ if (!IsValidConflictData(pConflictData))
+ return CR_INVALID_CONFLICT_LIST;
+
+ if (pulCount == NULL)
+ return CR_INVALID_POINTER;
+
+ *pulCount = pConflictData->pConflictList->ConflictsListed;
+
+ return CR_SUCCESS;
+}
+
+
+/***********************************************************************
+ * CM_Get_Resource_Conflict_DetailsA [SETUPAPI.@]
+ */
+CONFIGRET
+WINAPI
+CM_Get_Resource_Conflict_DetailsA(
+ _In_ CONFLICT_LIST clConflictList,
+ _In_ ULONG ulIndex,
+ _Inout_ PCONFLICT_DETAILS_A pConflictDetails)
+{
+ FIXME("CM_Get_Resource_Conflict_CountA(%p %lu %p)\n",
+ clConflictList, ulIndex, pConflictDetails);
+
+ return CR_CALL_NOT_IMPLEMENTED;
+}
+
+
+/***********************************************************************
+ * CM_Get_Resource_Conflict_DetailsW [SETUPAPI.@]
+ */
+CONFIGRET
+WINAPI
+CM_Get_Resource_Conflict_DetailsW(
+ _In_ CONFLICT_LIST clConflictList,
+ _In_ ULONG ulIndex,
+ _Inout_ PCONFLICT_DETAILS_W pConflictDetails)
+{
+ FIXME("CM_Get_Resource_Conflict_CountW(%p %lu %p)\n",
+ clConflictList, ulIndex, pConflictDetails);
+
+ return CR_CALL_NOT_IMPLEMENTED;
+}
+
+
/***********************************************************************
* CM_Get_Sibling [SETUPAPI.@]
*/
_Out_ PDWORDLONG pullEnd,
_In_ ULONG ulFlags)
{
+ PINTERNAL_RANGE_LIST pRangeList;
+ PINTERNAL_RANGE pRange;
+ PLIST_ENTRY ListEntry;
+ CONFIGRET ret = CR_SUCCESS;
+
FIXME("CM_Next_Range(%p %p %p %lx)\n",
preElement, pullStart, pullEnd, ulFlags);
- return CR_CALL_NOT_IMPLEMENTED;
+ pRange = (PINTERNAL_RANGE)preElement;
+
+ if (pRange == NULL || pRange->pRangeList == NULL)
+ return CR_FAILURE;
+
+ if (pullStart == NULL || pullEnd == NULL)
+ return CR_INVALID_POINTER;
+
+ if (ulFlags != 0)
+ return CR_INVALID_FLAG;
+
+ pRangeList = pRange->pRangeList;
+
+ /* Lock the range list */
+ WaitForSingleObject(pRangeList->hMutex, INFINITE);
+
+ /* Fail, if we reached the end of the list */
+ if (pRange->ListEntry.Flink == &pRangeList->ListHead)
+ {
+ ret = CR_FAILURE;
+ goto done;
+ }
+
+ /* Get the next range */
+ ListEntry = pRangeList->ListHead.Flink;
+ pRange = CONTAINING_RECORD(ListEntry, INTERNAL_RANGE, ListEntry);
+
+ /* Return the range data */
+ *pullStart = pRange->ullStart;
+ *pullEnd = pRange->ullEnd;
+ *preElement = (RANGE_ELEMENT)pRange;
+
+done:
+ /* Unlock the range list */
+ ReleaseMutex(pRangeList->hMutex);
+
+ return ret;
}