diff --git a/reactos/include/idl/pnp.idl b/reactos/include/idl/pnp.idl index 417880257d3..f42d2a6cfc6 100644 --- a/reactos/include/idl/pnp.idl +++ b/reactos/include/idl/pnp.idl @@ -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 @@ interface pnp [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 @@ interface pnp [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 @@ interface pnp [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 @@ interface pnp [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); } diff --git a/reactos/include/wine/cfgmgr32.h b/reactos/include/wine/cfgmgr32.h index 50dfcb15a1b..f9cd9bd0edf 100644 --- a/reactos/include/wine/cfgmgr32.h +++ b/reactos/include/wine/cfgmgr32.h @@ -207,6 +207,8 @@ CONFIGRET WINAPI CM_Get_Sibling_Ex( PDEVINST, DEVINST, ULONG, HMACHINE ); 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) diff --git a/reactos/lib/setupapi/cfgmgr.c b/reactos/lib/setupapi/cfgmgr.c index a7befef3457..75d9055e998 100644 --- a/reactos/lib/setupapi/cfgmgr.c +++ b/reactos/lib/setupapi/cfgmgr.c @@ -1520,6 +1520,49 @@ WORD WINAPI CM_Get_Version_Ex(HMACHINE hMachine) } +/*********************************************************************** + * 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.@] */ diff --git a/reactos/lib/setupapi/setupapi.spec b/reactos/lib/setupapi/setupapi.spec index eea0d8fc0b0..cfb6b566235 100644 --- a/reactos/lib/setupapi/setupapi.spec +++ b/reactos/lib/setupapi/setupapi.spec @@ -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) diff --git a/reactos/services/umpnpmgr/umpnpmgr.c b/reactos/services/umpnpmgr/umpnpmgr.c index 8fecf2e3c78..48ca7315f59 100644 --- a/reactos/services/umpnpmgr/umpnpmgr.c +++ b/reactos/services/umpnpmgr/umpnpmgr.c @@ -794,6 +794,56 @@ PNP_SetDeviceProblem(handle_t BindingHandle, } +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) { diff --git a/reactos/w32api/include/ddk/cfgmgr32.h b/reactos/w32api/include/ddk/cfgmgr32.h index 2ba4126e50b..b030d1b6a77 100644 --- a/reactos/w32api/include/ddk/cfgmgr32.h +++ b/reactos/w32api/include/ddk/cfgmgr32.h @@ -587,6 +587,13 @@ typedef PCONFLICT_DETAILS_A PCONFLICT_DETAILS; +/* 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 @@ CM_Get_Version_Ex( /* 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