Author: ekohl
Date: Sat Feb  5 21:58:19 2011
New Revision: 50610

URL: http://svn.reactos.org/svn/reactos?rev=50610&view=rev
Log:
[SETUPAPI]
Implement CM_Is_Version_Available and CM_Is_Version_Available_Ex.

Modified:
    trunk/reactos/dll/win32/setupapi/cfgmgr.c
    trunk/reactos/dll/win32/setupapi/setupapi.spec

Modified: trunk/reactos/dll/win32/setupapi/cfgmgr.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/cfgmgr.c?rev=50610&r1=50609&r2=50610&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/cfgmgr.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/cfgmgr.c [iso-8859-1] Sat Feb  5 21:58:19 
2011
@@ -2915,6 +2915,61 @@
     RpcEndExcept;
 
     return ret;
+}
+
+
+/***********************************************************************
+ * 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);
 }
 
 

Modified: trunk/reactos/dll/win32/setupapi/setupapi.spec
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupapi.spec?rev=50610&r1=50609&r2=50610&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/setupapi.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/setupapi.spec [iso-8859-1] Sat Feb  5 
21:58:19 2011
@@ -137,8 +137,8 @@
 @ 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)


Reply via email to