[SETUPAPI]
authorEric Kohl <eric.kohl@reactos.org>
Sat, 5 Feb 2011 21:58:19 +0000 (21:58 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 5 Feb 2011 21:58:19 +0000 (21:58 +0000)
Implement CM_Is_Version_Available and CM_Is_Version_Available_Ex.

svn path=/trunk/; revision=50610

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

index 0ef10c4..684853f 100644 (file)
@@ -2918,6 +2918,61 @@ CONFIGRET WINAPI CM_Is_Dock_Station_Present_Ex(
 }
 
 
 }
 
 
+/***********************************************************************
+ * CM_Is_Version_Available_Ex [SETUPAPI.@]
+ */
+BOOL WINAPI CM_Is_Version_Available(
+     WORD wVersion)
+{
+    TRACE("%hu\n", wVersion);
+    return CM_Is_Version_Available_Ex(wVersion, NULL);
+}
+
+
+/***********************************************************************
+ * CM_Is_Version_Available_Ex [SETUPAPI.@]
+ */
+BOOL WINAPI CM_Is_Version_Available_Ex(
+    WORD wVersion, HMACHINE hMachine)
+{
+    RPC_BINDING_HANDLE BindingHandle = NULL;
+    WORD wServerVersion;
+    CONFIGRET ret;
+
+    TRACE("%hu %lx\n", wVersion, hMachine);
+
+    if (wVersion <= 0x400)
+        return TRUE;
+
+    if (hMachine != NULL)
+    {
+        BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+        if (BindingHandle == NULL)
+            return FALSE;
+    }
+    else
+    {
+        if (!PnpGetLocalHandles(&BindingHandle, NULL))
+            return FALSE;
+    }
+
+    RpcTryExcept
+    {
+        ret = PNP_GetVersion(BindingHandle, &wServerVersion);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        ret = RpcStatusToCmStatus(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    if (ret != CR_SUCCESS)
+        return FALSE;
+
+    return (wServerVersion >= wVersion);
+}
+
+
 /***********************************************************************
  * CM_Locate_DevNodeA [SETUPAPI.@]
  */
 /***********************************************************************
  * CM_Locate_DevNodeA [SETUPAPI.@]
  */
index 344d7f3..fb6d16a 100644 (file)
 @ stub CM_Invert_Range_List
 @ stdcall CM_Is_Dock_Station_Present(ptr)
 @ stdcall CM_Is_Dock_Station_Present_Ex(ptr long)
 @ stub CM_Invert_Range_List
 @ stdcall CM_Is_Dock_Station_Present(ptr)
 @ stdcall CM_Is_Dock_Station_Present_Ex(ptr long)
-@ stub CM_Is_Version_Available
-@ stub CM_Is_Version_Available_Ex
+@ stdcall CM_Is_Version_Available(long)
+@ stdcall CM_Is_Version_Available_Ex(long long)
 @ stdcall CM_Locate_DevNodeA(ptr str long)
 @ stdcall CM_Locate_DevNodeW(ptr wstr long)
 @ stdcall CM_Locate_DevNode_ExA(ptr str long long)
 @ stdcall CM_Locate_DevNodeA(ptr str long)
 @ stdcall CM_Locate_DevNodeW(ptr wstr long)
 @ stdcall CM_Locate_DevNode_ExA(ptr str long long)