[SETUPAPI]
authorEric Kohl <eric.kohl@reactos.org>
Sun, 20 Feb 2011 10:44:30 +0000 (10:44 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 20 Feb 2011 10:44:30 +0000 (10:44 +0000)
Implement CM_Get_Hardware_Profile_Info[_Ex]A/W.

svn path=/trunk/; revision=50829

reactos/dll/win32/setupapi/cfgmgr.c
reactos/dll/win32/setupapi/setupapi.spec

index 5b97518..f7b33e7 100644 (file)
@@ -2638,6 +2638,114 @@ CONFIGRET WINAPI CM_Get_HW_Prof_Flags_ExW(
 }
 
 
+/***********************************************************************
+ * CM_Get_Hardware_Profile_InfoA [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_Hardware_Profile_InfoA(
+    ULONG ulIndex, PHWPROFILEINFO_A pHWProfileInfo, ULONG ulFlags)
+{
+    TRACE("%lu %p %lx\n", ulIndex, pHWProfileInfo, ulFlags);
+
+    return CM_Get_Hardware_Profile_Info_ExA(ulIndex, pHWProfileInfo,
+                                            ulFlags, NULL);
+}
+
+
+/***********************************************************************
+ * CM_Get_Hardware_Profile_InfoW [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_Hardware_Profile_InfoW(
+    ULONG ulIndex, PHWPROFILEINFO_W pHWProfileInfo, ULONG ulFlags)
+{
+    TRACE("%lu %p %lx\n", ulIndex, pHWProfileInfo, ulFlags);
+
+    return CM_Get_Hardware_Profile_Info_ExW(ulIndex, pHWProfileInfo,
+                                            ulFlags, NULL);
+}
+
+
+/***********************************************************************
+ * CM_Get_Hardware_Profile_Info_ExA [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_Hardware_Profile_Info_ExA(
+    ULONG ulIndex, PHWPROFILEINFO_A pHWProfileInfo, ULONG ulFlags,
+    HMACHINE hMachine)
+{
+    HWPROFILEINFO_W LocalProfileInfo;
+    CONFIGRET ret;
+
+    TRACE("%lu %p %lx %lx\n", ulIndex, pHWProfileInfo, ulFlags, hMachine);
+
+    if (pHWProfileInfo == NULL)
+        return CR_INVALID_POINTER;
+
+    ret = CM_Get_Hardware_Profile_Info_ExW(ulIndex, &LocalProfileInfo,
+                                           ulFlags, hMachine);
+    if (ret == CR_SUCCESS)
+    {
+        pHWProfileInfo->HWPI_ulHWProfile = LocalProfileInfo.HWPI_ulHWProfile;
+        pHWProfileInfo->HWPI_dwFlags = LocalProfileInfo.HWPI_dwFlags;
+
+        if (WideCharToMultiByte(CP_ACP,
+                                0,
+                                LocalProfileInfo.HWPI_szFriendlyName,
+                                lstrlenW(LocalProfileInfo.HWPI_szFriendlyName) + 1,
+                                pHWProfileInfo->HWPI_szFriendlyName,
+                                MAX_PROFILE_LEN,
+                                NULL,
+                                NULL) == 0)
+            ret = CR_FAILURE;
+    }
+
+    return ret;
+}
+
+
+/***********************************************************************
+ * CM_Get_Hardware_Profile_Info_ExW [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_Hardware_Profile_Info_ExW(
+    ULONG ulIndex, PHWPROFILEINFO_W pHWProfileInfo, ULONG ulFlags,
+    HMACHINE hMachine)
+{
+    RPC_BINDING_HANDLE BindingHandle = NULL;
+    CONFIGRET ret;
+
+    TRACE("%lu %p %lx %lx\n", ulIndex, pHWProfileInfo, ulFlags, hMachine);
+
+    if (pHWProfileInfo == NULL)
+        return CR_INVALID_POINTER;
+
+    if (ulFlags != 0)
+        return CR_INVALID_FLAG;
+
+    if (hMachine != NULL)
+    {
+        BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+        if (BindingHandle == NULL)
+            return CR_FAILURE;
+    }
+    else
+    {
+        if (!PnpGetLocalHandles(&BindingHandle, NULL))
+            return CR_FAILURE;
+    }
+
+    RpcTryExcept
+    {
+        ret = PNP_GetHwProfInfo(BindingHandle, ulIndex, pHWProfileInfo,
+                                sizeof(HWPROFILEINFO_W), 0);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        ret = RpcStatusToCmStatus(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return ret;
+}
+
+
 /***********************************************************************
  * CM_Get_Log_Conf_Priority [SETUPAPI.@]
  */
index 4c77bf1..95965a3 100644 (file)
 @ stdcall CM_Get_HW_Prof_FlagsW(wstr long ptr long)
 @ stdcall CM_Get_HW_Prof_Flags_ExA(str long ptr long long)
 @ stdcall CM_Get_HW_Prof_Flags_ExW(wstr long ptr long long)
-@ stub CM_Get_Hardware_Profile_InfoA
-@ stub CM_Get_Hardware_Profile_InfoW
-@ stub CM_Get_Hardware_Profile_Info_ExA
-@ stub CM_Get_Hardware_Profile_Info_ExW
+@ stdcall CM_Get_Hardware_Profile_InfoA(long ptr long)
+@ stdcall CM_Get_Hardware_Profile_InfoW(long ptr long)
+@ stdcall CM_Get_Hardware_Profile_Info_ExA(long ptr long long)
+@ stdcall CM_Get_Hardware_Profile_Info_ExW(long ptr long long)
 @ stdcall CM_Get_Log_Conf_Priority(ptr ptr long)
 @ stdcall CM_Get_Log_Conf_Priority_Ex(ptr ptr long long)
 @ stdcall CM_Get_Next_Log_Conf(ptr ptr long)