- Implement CM_Is_Dock_Station_Present[_Ex]
Modified: trunk/reactos/include/idl/pnp.idl
Modified: trunk/reactos/include/wine/cfgmgr32.h
Modified: trunk/reactos/lib/setupapi/cfgmgr.c
Modified: trunk/reactos/lib/setupapi/setupapi.spec
Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c
Modified: trunk/reactos/w32api/include/ddk/cfgmgr32.h

Modified: trunk/reactos/include/idl/pnp.idl
--- trunk/reactos/include/idl/pnp.idl	2005-09-25 20:56:58 UTC (rev 18071)
+++ trunk/reactos/include/idl/pnp.idl	2005-09-25 21:02:43 UTC (rev 18072)
@@ -5,6 +5,7 @@
 #define WORD unsigned short
 #define DWORD unsigned long
 #define CONFIGRET unsigned long
+#define PBOOL unsigned long *
 
 [
   uuid (809F4e40-A03D-11CE-8F69-08003E30051B),
@@ -14,21 +15,32 @@
 ]
 interface pnp
 {
+  /* Function 0 */
+//  CONFIGRET PNP_Unknown0(handle_t BindingHandle);
+
+  /* Function 1 */
+//  CONFIGRET PNP_Unknown1(handle_t BindingHandle);
+
+  /* Function 2 */
   CONFIGRET PNP_GetVersion(handle_t BindingHandle,
                            [out] WORD *Version);
 
+  /* Function 3 */
   CONFIGRET PNP_GetGlobalState(handle_t BindingHandle,
                                [out] unsigned long *State,
                                [in] unsigned long Flags);
 
+  /* Function 6 */
   CONFIGRET PNP_ValidateDeviceInstance(handle_t BindingHandle,
                                        [in, string] wchar_t *DeviceInstance,
                                        [in] DWORD Flags);
 
+  /* Function 7 */
   CONFIGRET PNP_GetRootDeviceInstance(handle_t BindingHandle,
                                       [out, string, size_is(Length)] wchar_t *DeviceInstance,
                                       [in] DWORD Length);
 
+  /* Function 8 */
   cpp_quote("#define PNP_DEVICE_PARENT  1")
   cpp_quote("#define PNP_DEVICE_CHILD   2")
   cpp_quote("#define PNP_DEVICE_SIBLING 3")
@@ -39,6 +51,7 @@
                                          [in] DWORD Length,
                                          [in] DWORD Flags);
 
+  /* Function 9 */
   cpp_quote("#define PNP_BRANCH_ENUM  1")
   cpp_quote("#define PNP_BRANCH_CLASS 2")
   CONFIGRET PNP_EnumerateSubKeys(handle_t BindingHandle,
@@ -49,22 +62,26 @@
                                  [out] unsigned long *RequiredLength,
                                  [in] DWORD Flags);
 
+  /* Function 10 */
 //  CONFIGRET PNP_GetDeviceList(handle_t BindingHandle,
 //                              [in, unique, string] wchar_t *Filter,
 //                              [out, string, size_is(*Length)] unsigned char *Buffer
 //                              [in, out] unsigned long *Length,
 //                              [in] DWORD Flags);
 
+  /* Function 11 */
   CONFIGRET PNP_GetDeviceListSize(handle_t BindingHandle,
                                   [in, unique, string] wchar_t *Filter,
                                   [out] unsigned long *Length,
                                   [in] DWORD Flags);
 
+  /* Function 12 */
   CONFIGRET PNP_GetDepth(handle_t BindingHandle,
                          [in, string] wchar_t *DeviceInstance,
                          [out] unsigned long *Depth,
                          [in] DWORD Flags);
 
+  /* Function 13 */
   CONFIGRET PNP_GetDeviceRegProp(handle_t BindingHandle,
                                  [in, string] wchar_t *DeviceInstance,
                                  [in] unsigned long Property,
@@ -74,6 +91,7 @@
                                  [in, out] unsigned long *Length,
                                  [in] DWORD Flags);
 
+  /* Function 14 */
   CONFIGRET PNP_SetDeviceRegProp(handle_t BindingHandle,
                                  [in, string] wchar_t *DeviceId,
                                  [in] unsigned long Property,
@@ -82,24 +100,38 @@
                                  [in] unsigned long Length,
                                  [in] unsigned long Flags);
 
+  /* Function 16 */
+  CONFIGRET PNP_CreateKey(handle_t BindingHandle,
+                          [in, string] wchar_t *SubKey,
+                          [in] unsigned long DesiredAccess,
+                          [in] unsigned long Flags);
+
+  /* Function 19 */
   CONFIGRET PNP_GetClassName(handle_t BindingHandle,
                              [in, string] wchar_t *ClassGuid,
                              [out, string, size_is(*Length)] wchar_t *Buffer,
                              [in, out] unsigned long *Length,
                              [in] unsigned long Flags);
 
+  /* Function 20 */
   CONFIGRET PNP_DeleteClassKey(handle_t BindingHandle,
                                [in, string] wchar_t *ClassGuid,
                                [in] unsigned long Flags);
 
+  /* Function 30 */
   CONFIGRET PNP_GetDeviceStatus(handle_t BindingHandle,
                                 [in, string] wchar_t *DeviceInstance,
                                 [out] unsigned long *Status,
                                 [out] unsigned long *Problem,
                                 [in] DWORD Flags);
 
+  /* Function 31 */
   CONFIGRET PNP_SetDeviceProblem(handle_t BindingHandle,
                                  [in, string] wchar_t *DeviceInstance,
                                  [in] unsigned long Problem,
                                  [in] DWORD Flags);
+
+  /* Function 38 */
+  CONFIGRET PNP_IsDockStationPresent(handle_t BindingHandle,
+                                     [out]PBOOL Present);
 }

Modified: trunk/reactos/include/wine/cfgmgr32.h
--- trunk/reactos/include/wine/cfgmgr32.h	2005-09-25 20:56:58 UTC (rev 18071)
+++ trunk/reactos/include/wine/cfgmgr32.h	2005-09-25 21:02:43 UTC (rev 18072)
@@ -207,6 +207,8 @@
 WORD WINAPI CM_Get_Version( VOID );
 WORD WINAPI CM_Get_Version_Ex( HMACHINE );
 
+CONFIGRET WINAPI CM_Is_Dock_Station_Present( PBOOL );
+CONFIGRET WINAPI CM_Is_Dock_Station_Present_Ex( PBOOL, HMACHINE );
 CONFIGRET WINAPI CM_Locate_DevNodeA(PDEVINST, DEVINSTID_A, ULONG);
 CONFIGRET WINAPI CM_Locate_DevNodeW(PDEVINST, DEVINSTID_W, ULONG);
 #define     CM_Locate_DevNode WINELIB_NAME_AW(CM_Locate_DevNode)

Modified: trunk/reactos/lib/setupapi/cfgmgr.c
--- trunk/reactos/lib/setupapi/cfgmgr.c	2005-09-25 20:56:58 UTC (rev 18071)
+++ trunk/reactos/lib/setupapi/cfgmgr.c	2005-09-25 21:02:43 UTC (rev 18072)
@@ -1521,6 +1521,49 @@
 
 
 /***********************************************************************
+ * CM_Is_Dock_Station_Present [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Is_Dock_Station_Present(
+    PBOOL pbPresent)
+{
+    TRACE("%p\n", pbPresent);
+    return CM_Is_Dock_Station_Present_Ex(pbPresent, NULL);
+}
+
+
+/***********************************************************************
+ * CM_Is_Dock_Station_Present_Ex [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Is_Dock_Station_Present_Ex(
+    PBOOL pbPresent, HMACHINE hMachine)
+{
+    RPC_BINDING_HANDLE BindingHandle = NULL;
+
+    FIXME("%p %lx\n", pbPresent, hMachine);
+
+    if (pbPresent == NULL)
+        return CR_INVALID_POINTER;
+
+    *pbPresent = FALSE;
+
+    if (hMachine != NULL)
+    {
+        BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+        if (BindingHandle == NULL)
+            return CR_FAILURE;
+    }
+    else
+    {
+        if (!PnpGetLocalHandles(&BindingHandle, NULL))
+            return CR_FAILURE;
+    }
+
+    return PNP_IsDockStationPresent(BindingHandle,
+                                    (unsigned long *)pbPresent);
+}
+
+
+/***********************************************************************
  * CM_Locate_DevNodeA [SETUPAPI.@]
  */
 CONFIGRET WINAPI CM_Locate_DevNodeA(

Modified: trunk/reactos/lib/setupapi/setupapi.spec
--- trunk/reactos/lib/setupapi/setupapi.spec	2005-09-25 20:56:58 UTC (rev 18071)
+++ trunk/reactos/lib/setupapi/setupapi.spec	2005-09-25 21:02:43 UTC (rev 18072)
@@ -127,8 +127,8 @@
 @ stdcall CM_Get_Version_Ex(long)
 @ stub CM_Intersect_Range_List
 @ stub CM_Invert_Range_List
-@ stub CM_Is_Dock_Station_Present
-@ stub CM_Is_Dock_Station_Present_Ex
+@ stdcall CM_Is_Dock_Station_Present(ptr)
+@ stdcall CM_Is_Dock_Station_Present_Ex(ptr long)
 @ stdcall CM_Locate_DevNodeA(ptr str long)
 @ stdcall CM_Locate_DevNodeW(ptr wstr long)
 @ stdcall CM_Locate_DevNode_ExA(ptr str long long)

Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c
--- trunk/reactos/services/umpnpmgr/umpnpmgr.c	2005-09-25 20:56:58 UTC (rev 18071)
+++ trunk/reactos/services/umpnpmgr/umpnpmgr.c	2005-09-25 21:02:43 UTC (rev 18072)
@@ -794,6 +794,56 @@
 }
 
 
+CONFIGRET
+PNP_IsDockStationPresent(handle_t BindingHandle,
+                         unsigned long *Present)
+{
+    HKEY hKey;
+    DWORD dwType;
+    DWORD dwValue;
+    DWORD dwSize;
+    CONFIGRET ret = CR_SUCCESS;
+
+    DPRINT1("PNP_IsDockStationPresent() called\n");
+
+    *Present = FALSE;
+
+    if (RegOpenKeyExW(HKEY_CURRENT_CONFIG,
+                      L"CurrentDockInfo",
+                      0,
+                      KEY_READ,
+                      &hKey) != ERROR_SUCCESS)
+        return CR_REGISTRY_ERROR;
+
+    dwSize = sizeof(DWORD);
+    if (RegQueryValueExW(hKey,
+                         L"DockingState",
+                         NULL,
+                         &dwType,
+                         (LPBYTE)&dwValue,
+                         &dwSize) != ERROR_SUCCESS)
+        ret = CR_REGISTRY_ERROR;
+
+    RegCloseKey(hKey);
+
+    if (ret == CR_SUCCESS)
+    {
+        if (dwType != REG_DWORD || dwSize != sizeof(DWORD))
+        {
+            ret = CR_REGISTRY_ERROR;
+        }
+        else if (dwValue != 0)
+        {
+            *Present = TRUE;
+        }
+    }
+
+    DPRINT1("PNP_IsDockStationPresent() done (returns %lx)\n", ret);
+
+    return ret;
+}
+
+
 static DWORD WINAPI
 PnpEventThread(LPVOID lpParameter)
 {

Modified: trunk/reactos/w32api/include/ddk/cfgmgr32.h
--- trunk/reactos/w32api/include/ddk/cfgmgr32.h	2005-09-25 20:56:58 UTC (rev 18071)
+++ trunk/reactos/w32api/include/ddk/cfgmgr32.h	2005-09-25 21:02:43 UTC (rev 18072)
@@ -587,6 +587,13 @@
 
 
 
+/* FIXME: Missing CMP_Init_Detection */
+/* FIXME: Missing CMP_RegisterNotification */
+/* FIXME: Missing CMP_Report_LogOn */
+/* FIXME: Missing CMP_UnregisterNotification */
+/* FIXME: Missing CMP_WaitNoPendingInstallEvents */
+/* FIXME: Missing CMP_WaitServicesAvailable */
+
 /* CM_Add_Empty_Log_Conf.ulFlags constants */
 #define PRIORITY_EQUAL_FIRST              0x00000008
 #define PRIORITY_EQUAL_LAST               0x00000000
@@ -1452,21 +1459,32 @@
 
 /* FIXME: Obsolete CM_Intersect_Range_List */
 /* FIXME: Obsolete CM_Invert_Range_List */
-/* FIXME: Obsolete CM_Is_Dock_Station_Present */
-/* FIXME: Obsolete CM_Is_Dock_Station_Present_Ex */
 
+CMAPI
+CONFIGRET
+WINAPI
+CM_Is_Dock_Station_Present(
+  OUT PBOOL  pbPresent);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Is_Dock_Station_Present_Ex(
+  OUT PBOOL  pbPresent,
+  IN HMACHINE  hMachine);
+
 /* CM_Locate_DevNode.ulFlags constants */
-#define CM_LOCATE_DEVNODE_NORMAL       		0x00000000
-#define CM_LOCATE_DEVNODE_PHANTOM      		0x00000001
-#define CM_LOCATE_DEVNODE_CANCELREMOVE 		0x00000002
-#define CM_LOCATE_DEVNODE_NOVALIDATION 		0x00000004
-#define CM_LOCATE_DEVNODE_BITS         		0x00000007
+#define CM_LOCATE_DEVNODE_NORMAL         0x00000000
+#define CM_LOCATE_DEVNODE_PHANTOM        0x00000001
+#define CM_LOCATE_DEVNODE_CANCELREMOVE   0x00000002
+#define CM_LOCATE_DEVNODE_NOVALIDATION   0x00000004
+#define CM_LOCATE_DEVNODE_BITS           0x00000007
 
-#define CM_LOCATE_DEVINST_NORMAL       		CM_LOCATE_DEVNODE_NORMAL
-#define CM_LOCATE_DEVINST_PHANTOM      		CM_LOCATE_DEVNODE_PHANTOM
-#define CM_LOCATE_DEVINST_CANCELREMOVE 		CM_LOCATE_DEVNODE_CANCELREMOVE
-#define CM_LOCATE_DEVINST_NOVALIDATION 		CM_LOCATE_DEVNODE_NOVALIDATION
-#define CM_LOCATE_DEVINST_BITS         		CM_LOCATE_DEVNODE_BITS
+#define CM_LOCATE_DEVINST_NORMAL         CM_LOCATE_DEVNODE_NORMAL
+#define CM_LOCATE_DEVINST_PHANTOM        CM_LOCATE_DEVNODE_PHANTOM
+#define CM_LOCATE_DEVINST_CANCELREMOVE   CM_LOCATE_DEVNODE_CANCELREMOVE
+#define CM_LOCATE_DEVINST_NOVALIDATION   CM_LOCATE_DEVNODE_NOVALIDATION
+#define CM_LOCATE_DEVINST_BITS           CM_LOCATE_DEVNODE_BITS
 
 CMAPI
 CONFIGRET