- Turn the user-mode PnP Manager into a dll, as it is in Windows. However, on Windows 2k/XP/2k3, the dll is managed by services.exe (the SC Manager) (and its entry point name hardcoded in it), whereas on Vista/7+ it is managed by svchost.exe . Since we do not support external dll hardcoded services management in services.exe, make it svchost-compatible instead.
- In the .spec file, we mention that a few API set is exported (in stdcall), but we use it also for RPC, and therefore one has to fix somewhere the calling conventions.
- Add/modify the registry entries accordingly.
svn path=/trunk/; revision=64292
add_rpc_files(server ${REACTOS_SOURCE_DIR}/include/reactos/idl/pnp.idl)
+spec2def(umpnpmgr.dll umpnpmgr.spec ADD_IMPORTLIB)
-add_executable(umpnpmgr
+add_library(umpnpmgr SHARED
umpnpmgr.c
umpnpmgr.rc
- ${CMAKE_CURRENT_BINARY_DIR}/pnp_s.c)
+ ${CMAKE_CURRENT_BINARY_DIR}/pnp_s.c
+ ${CMAKE_CURRENT_BINARY_DIR}/umpnpmgr_stubs.c
+ ${CMAKE_CURRENT_BINARY_DIR}/umpnpmgr.def)
target_link_libraries(umpnpmgr
wdmguid
${PSEH_LIB})
-set_module_type(umpnpmgr win32cui UNICODE)
+set_module_type(umpnpmgr win32dll UNICODE)
add_importlibs(umpnpmgr advapi32 rpcrt4 userenv shlwapi msvcrt kernel32 ntdll)
add_cd_file(TARGET umpnpmgr DESTINATION reactos/system32 FOR all)
*/
/* INCLUDES *****************************************************************/
+
//#define HAVE_SLIST_ENTRY_IMPLEMENTED
#define WIN32_NO_STATUS
#define _INC_WINDOWS
/* GLOBALS ******************************************************************/
-static VOID CALLBACK ServiceMain(DWORD argc, LPWSTR *argv);
static WCHAR ServiceName[] = L"PlugPlay";
-static SERVICE_TABLE_ENTRYW ServiceTable[] =
-{
- {ServiceName, ServiceMain},
- {NULL, NULL}
-};
static SERVICE_STATUS_HANDLE ServiceStatusHandle;
static SERVICE_STATUS ServiceStatus;
DPRINT("RpcServerThread() called\n");
#if 0
- /* XP-compatible protocol sequence/endpoint */
+ /* 2k/XP/2k3-compatible protocol sequence/endpoint */
Status = RpcServerUseProtseqEpW(L"ncacn_np",
20,
L"\\pipe\\ntsvcs",
DPRINT1("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status);
#endif
- /* Vista-compatible protocol sequence/endpoint */
+ /* Vista/7-compatible protocol sequence/endpoint */
Status = RpcServerUseProtseqEpW(L"ncacn_np",
20,
L"\\pipe\\plugplay",
}
}
-done:;
+done:
if (ret == CR_SUCCESS)
*pulTransferLen = *pulLength;
ret = CR_REGISTRY_ERROR;
}
-done:;
+done:
if (hPropKey != NULL)
RegCloseKey(hPropKey);
}
}
-done:;
+done:
if (ret == CR_SUCCESS)
*pulTransferLen = *pulLength;
/* Function 73 */
DWORD PNP_SetActiveService(
- handle_t hBinding)
+ handle_t hBinding,
+ LPWSTR pszFilter,
+ DWORD ulFlags)
{
UNIMPLEMENTED;
return CR_CALL_NOT_IMPLEMENTED;
}
-static VOID CALLBACK
+VOID WINAPI
ServiceMain(DWORD argc, LPTSTR *argv)
{
HANDLE hThread;
DPRINT("ServiceMain() done\n");
}
-
-int
-wmain(int argc, WCHAR *argv[])
+static DWORD
+InitializePnPManager(VOID)
{
BOOLEAN OldValue;
DWORD dwError;
- UNREFERENCED_PARAMETER(argc);
- UNREFERENCED_PARAMETER(argv);
-
- DPRINT("Umpnpmgr: main() started\n");
+ DPRINT("UMPNPMGR: InitializePnPManager() started\n");
/* We need this privilege for using CreateProcessAsUserW */
RtlAdjustPrivilege(SE_ASSIGNPRIMARYTOKEN_PRIVILEGE, TRUE, FALSE, &OldValue);
- hInstallEvent = CreateEvent(NULL, TRUE, SetupIsActive()/*FALSE*/, NULL);
+ hInstallEvent = CreateEventW(NULL, TRUE, SetupIsActive()/*FALSE*/, NULL);
if (hInstallEvent == NULL)
{
dwError = GetLastError();
return dwError;
}
- hDeviceInstallListNotEmpty = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hDeviceInstallListNotEmpty = CreateEventW(NULL, FALSE, FALSE, NULL);
if (hDeviceInstallListNotEmpty == NULL)
{
dwError = GetLastError();
return dwError;
}
- StartServiceCtrlDispatcher(ServiceTable);
+ DPRINT("UMPNPMGR: InitializePnPManager() done\n");
- DPRINT("Umpnpmgr: main() done\n");
+ return 0;
+}
- ExitThread(0);
+BOOL WINAPI
+DllMain(HINSTANCE hinstDLL,
+ DWORD fdwReason,
+ LPVOID lpvReserved)
+{
+ switch (fdwReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ DisableThreadLibraryCalls(hinstDLL);
+ InitializePnPManager();
+ break;
- return 0;
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+
+ return TRUE;
}
/* EOF */
-#define REACTOS_STR_FILE_DESCRIPTION "User-Mode Plug and Play manager"
+#define REACTOS_VERSION_DLL
+#define REACTOS_STR_FILE_DESCRIPTION "User-Mode Plug and Play Manager"
#define REACTOS_STR_INTERNAL_NAME "Umpnpmgr"
-#define REACTOS_STR_ORIGINAL_FILENAME "Umpnpmgr.exe"
+#define REACTOS_STR_ORIGINAL_FILENAME "umpnpmgr.dll"
#include <reactos/version.rc>
--- /dev/null
+@ stub DeleteServicePlugPlayRegKeys
+
+;;; FIXME: Windows UMPNPMGR exports those APIs.
+;;; Fix their calling convention before enabling these exports!!
+
+;@ stdcall PNP_GetDeviceList(long ptr ptr ptr long)
+;@ stdcall PNP_GetDeviceListSize(long ptr ptr long)
+;@ stdcall PNP_GetDeviceRegProp(long ptr long ptr ptr ptr ptr long)
+;@ stdcall PNP_HwProfFlags(long long ptr long ptr ptr ptr long long)
+;@ stdcall PNP_SetActiveService(long ptr long)
+
+@ stub RegisterScmCallback
+@ stub RegisterServiceNotification
+@ stdcall ServiceMain(long ptr) ;; If using SvcHost.exe (Vista+)
+;@ stdcall SvcEntry_PlugPlay(long long long long) ;; If using services.exe (<= 2k3)
; SvcHost services
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost",,0x00000012
-HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost", "netsvcs",0x00010000,"DHCP","BITS"
+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost","DcomLaunch",0x00010000,"PlugPlay"
+HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost","netsvcs",0x00010000,"DHCP","BITS"
; Win32 config
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows",,0x00000012
; Plug and Play manager
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","DisplayName",0x00000000,"Plug and Play"
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Description",0x00000000,"Detects hardware changes and installs needed software if possible"
-HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ErrorControl",0x00010001,0x00000000
+HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ErrorControl",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Group",0x00000000,"PlugPlay"
-HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ImagePath",0x00020000,"%SystemRoot%\system32\umpnpmgr.exe"
+HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ImagePath",0x00020000,"%SystemRoot%\system32\svchost.exe -k DcomLaunch"
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ObjectName",0x00000000,"LocalSystem"
-HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Start",0x00010001,0x00000004
-HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Type",0x00010001,0x00000010
+HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Start",0x00010001,0x00000002
+HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Type",0x00010001,0x00000020
+HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay\Parameters","ServiceDll",0x00020000,"%SystemRoot%\system32\umpnpmgr.dll"
; RPC service
HKLM,"SYSTEM\CurrentControlSet\Services\Rpcss","DisplayName",0x00000000,"Remote Procedure Call"