The source code for msports is already available in the DDK.
-- Best regards, Alex Ionescu
On 2011-05-17, at 3:24 PM, ekohl@svn.reactos.org wrote:
Author: ekohl Date: Tue May 17 19:24:19 2011 New Revision: 51813
URL: http://svn.reactos.org/svn/reactos?rev=51813&view=rev Log: [MSPORTS]
- Implement a simple class installer that assigns the friendly name "Serial Port (COMx)" to all serial ports.
- Enable the class installer in ports.inf.
- Add parallel port installer configuration to ports.inf (disabled).
Added: trunk/reactos/dll/win32/msports/ (with props) trunk/reactos/dll/win32/msports/CMakeLists.txt (with props) trunk/reactos/dll/win32/msports/classinst.c (with props) trunk/reactos/dll/win32/msports/msports.c (with props) trunk/reactos/dll/win32/msports/msports.rbuild (with props) trunk/reactos/dll/win32/msports/msports.rc (with props) trunk/reactos/dll/win32/msports/msports.spec (with props) Modified: trunk/reactos/baseaddress.cmake trunk/reactos/baseaddress.rbuild trunk/reactos/boot/bootdata/packages/reactos.dff trunk/reactos/dll/win32/CMakeLists.txt trunk/reactos/dll/win32/win32.rbuild trunk/reactos/media/inf/ports.inf
Modified: trunk/reactos/baseaddress.cmake URL: http://svn.reactos.org/svn/reactos/trunk/reactos/baseaddress.cmake?rev=51813... ============================================================================== --- trunk/reactos/baseaddress.cmake [iso-8859-1] (original) +++ trunk/reactos/baseaddress.cmake [iso-8859-1] Tue May 17 19:24:19 2011 @@ -49,6 +49,7 @@ set(baseaddress_netid 0x5f660000) set(baseaddress_ntprint 0x5f6a0000) set(baseaddress_mssip32 0x60430000) +set(baseaddress_msports 0x60450000) set(baseaddress_msisip 0x60b10000) set(baseaddress_inseng 0x61000000) set(baseaddress_qedit 0x611c0000)
Modified: trunk/reactos/baseaddress.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/baseaddress.rbuild?rev=5181... ============================================================================== --- trunk/reactos/baseaddress.rbuild [iso-8859-1] (original) +++ trunk/reactos/baseaddress.rbuild [iso-8859-1] Tue May 17 19:24:19 2011 @@ -52,6 +52,7 @@ <property name="BASEADDRESS_NETID" value="0x5f660000" /> <property name="BASEADDRESS_NTPRINT" value="0x5f6a0000" /> <property name="BASEADDRESS_MSSIP32" value="0x60430000" />
- <property name="BASEADDRESS_MSPORTS" value="0x60450000" /> <property name="BASEADDRESS_MSISIP" value="0x60b10000" /> <property name="BASEADDRESS_INSENG" value="0x61000000" /> <property name="BASEADDRESS_QEDIT" value="0x611c0000" />
Modified: trunk/reactos/boot/bootdata/packages/reactos.dff URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/packages/reac... ============================================================================== --- trunk/reactos/boot/bootdata/packages/reactos.dff [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/packages/reactos.dff [iso-8859-1] Tue May 17 19:24:19 2011 @@ -357,6 +357,7 @@ dll\win32\msisip\msisip.dll 1 dll\win32\msisys.ocx\msisys.ocx 1 dll\win32\msnet32\msnet32.dll 1 +dll\win32\msports\msports.dll 1 dll\win32\msrle32\msrle32.dll 1 dll\win32\mssign32\mssign32.dll 1 dll\win32\mssip32\mssip32.dll 1
Modified: trunk/reactos/dll/win32/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/CMakeLists.txt?re... ============================================================================== --- trunk/reactos/dll/win32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/CMakeLists.txt [iso-8859-1] Tue May 17 19:24:19 2011 @@ -99,6 +99,7 @@ add_subdirectory(msisip) add_subdirectory(msisys.ocx) #add_subdirectory(msnet32) #to be deleted in trunk. +add_subdirectory(msports) add_subdirectory(msrle32) add_subdirectory(mssign32) add_subdirectory(mssip32)
Propchange: trunk/reactos/dll/win32/msports/
--- bugtraq:logregex (added) +++ bugtraq:logregex Tue May 17 19:24:19 2011 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+)
Propchange: trunk/reactos/dll/win32/msports/
bugtraq:message = See issue #%BUGID% for more details.
Propchange: trunk/reactos/dll/win32/msports/
bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: trunk/reactos/dll/win32/msports/
tsvn:logminsize = 10
Added: trunk/reactos/dll/win32/msports/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msports/CMakeList... ============================================================================== --- trunk/reactos/dll/win32/msports/CMakeLists.txt (added) +++ trunk/reactos/dll/win32/msports/CMakeLists.txt [iso-8859-1] Tue May 17 19:24:19 2011 @@ -1,0 +1,24 @@
+set_unicode()
+spec2def(msports.dll msports.spec)
+list(APPEND SOURCE
- classinst.c
- msports.c
- parallel.c
- serial.c
- msports.rc
- ${CMAKE_CURRENT_BINARY_DIR}/msports_stubs.c
- ${CMAKE_CURRENT_BINARY_DIR}/msports.def)
+add_library(msports SHARED ${SOURCE})
+set_module_type(msports win32dll)
+target_link_libraries(msports wine)
+add_importlibs(msports comctl32 setupapi advapi32 user32 kernel32 ntdll)
+add_cd_file(TARGET msports DESTINATION reactos/system32 FOR all) +add_importlib_target(msports.spec)
Propchange: trunk/reactos/dll/win32/msports/CMakeLists.txt
svn:eol-style = native
Propchange: trunk/reactos/dll/win32/msports/CMakeLists.txt
svn:keywords = author date id revision
Added: trunk/reactos/dll/win32/msports/classinst.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msports/classinst... ============================================================================== --- trunk/reactos/dll/win32/msports/classinst.c (added) +++ trunk/reactos/dll/win32/msports/classinst.c [iso-8859-1] Tue May 17 19:24:19 2011 @@ -1,0 +1,250 @@ +/*
- PROJECT: ReactOS system libraries
- LICENSE: GPL - See COPYING in the top level directory
- FILE: dlls\win32\msports\classinst.c
- PURPOSE: Ports class installer
- PROGRAMMERS: Copyright 2011 Eric Kohl
- */
+#include <windows.h> +#include <setupapi.h> +#include <wine/debug.h>
+WINE_DEFAULT_DEBUG_CHANNEL(msports);
+typedef enum _PORT_TYPE +{
- UnknownPort,
- ParallelPort,
- SerialPort
+} PORT_TYPE;
+static DWORD +InstallSerialPort(IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData)+{
- LPWSTR pszFriendlyName = L"Serial Port (COMx)";
- TRACE("InstallSerialPort(%p, %p)\n",
DeviceInfoSet, DeviceInfoData);- /* Install the device */
- if (!SetupDiInstallDevice(DeviceInfoSet,
DeviceInfoData))- {
return GetLastError();- }
- /* Set the friendly name for the device */
- SetupDiSetDeviceRegistryPropertyW(DeviceInfoSet,
DeviceInfoData,SPDRP_FRIENDLYNAME,(LPBYTE)pszFriendlyName,(wcslen(pszFriendlyName) + 1) * sizeof(WCHAR));- return ERROR_SUCCESS;
+}
+static DWORD +InstallParallelPort(IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData)+{
FIXME("InstallParallelPort(%p, %p)\n",DeviceInfoSet, DeviceInfoData);return ERROR_DI_DO_DEFAULT;+}
+VOID +InstallDeviceData(IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)+{
- HKEY hKey = NULL;
- HINF hInf = INVALID_HANDLE_VALUE;
- SP_DRVINFO_DATA DriverInfoData;
- PSP_DRVINFO_DETAIL_DATA DriverInfoDetailData;
- WCHAR InfSectionWithExt[256];
- BYTE buffer[2048];
- DWORD dwRequired;
- TRACE("InstallDeviceData()\n");
- hKey = SetupDiCreateDevRegKeyW(DeviceInfoSet,
DeviceInfoData,DICS_FLAG_GLOBAL,0,DIREG_DRV,NULL,NULL);- if (hKey == NULL)
goto done;- DriverInfoData.cbSize = sizeof(SP_DRVINFO_DATA);
- if (!SetupDiGetSelectedDriverW(DeviceInfoSet,
DeviceInfoData,&DriverInfoData))- {
goto done;- }
- DriverInfoDetailData = (PSP_DRVINFO_DETAIL_DATA)buffer;
- DriverInfoDetailData->cbSize = sizeof(SP_DRVINFO_DETAIL_DATA);
- if (!SetupDiGetDriverInfoDetailW(DeviceInfoSet,
DeviceInfoData,&DriverInfoData,DriverInfoDetailData,2048,&dwRequired))- {
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)goto done;- }
- TRACE("Inf file name: %S\n", DriverInfoDetailData->InfFileName);
- hInf = SetupOpenInfFileW(DriverInfoDetailData->InfFileName,
NULL,INF_STYLE_WIN4,NULL);- if (hInf == INVALID_HANDLE_VALUE)
goto done;- TRACE("Section name: %S\n", DriverInfoDetailData->SectionName);
- SetupDiGetActualSectionToInstallW(hInf,
DriverInfoDetailData->SectionName,InfSectionWithExt,256,NULL,NULL);- TRACE("InfSectionWithExt: %S\n", InfSectionWithExt);
- SetupInstallFromInfSectionW(NULL,
hInf,InfSectionWithExt,SPINST_REGISTRY,hKey,NULL,0,NULL,NULL,NULL,NULL);- TRACE("Done\n");
+done:;
- if (hKey != NULL)
RegCloseKey(hKey);- if (hInf != INVALID_HANDLE_VALUE)
SetupCloseInfFile(hInf);+}
+PORT_TYPE +GetPortType(IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData)+{
- HKEY hKey = NULL;
- DWORD dwSize;
- DWORD dwType = 0;
- BYTE bData = 0;
- PORT_TYPE PortType = UnknownPort;
- LONG lError;
- TRACE("GetPortType()\n");
- hKey = SetupDiCreateDevRegKeyW(DeviceInfoSet,
DeviceInfoData,DICS_FLAG_GLOBAL,0,DIREG_DRV,NULL,NULL);- if (hKey == NULL)
- {
goto done;- }
- dwSize = sizeof(BYTE);
- lError = RegQueryValueExW(hKey,
L"PortSubClass",NULL,&dwType,&bData,&dwSize);- TRACE("lError: %ld\n", lError);
- TRACE("dwSize: %lu\n", dwSize);
- TRACE("dwType: %lu\n", dwType);
- if (lError == ERROR_SUCCESS &&
dwSize == sizeof(BYTE) &&dwType == REG_BINARY)- {
if (bData == 0)PortType = ParallelPort;elsePortType = SerialPort;- }
+done:;
- if (hKey != NULL)
RegCloseKey(hKey);- TRACE("GetPortType() returns %u \n", PortType);
- return PortType;
+}
+static DWORD +InstallPort(IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData)+{
- PORT_TYPE PortType;
- InstallDeviceData(DeviceInfoSet, DeviceInfoData);
- PortType = GetPortType(DeviceInfoSet, DeviceInfoData);
- switch (PortType)
- {
case ParallelPort:return InstallParallelPort(DeviceInfoSet, DeviceInfoData);case SerialPort:return InstallSerialPort(DeviceInfoSet, DeviceInfoData);default:return ERROR_DI_DO_DEFAULT;- }
+}
+DWORD +WINAPI +PortsClassInstaller(IN DI_FUNCTION InstallFunction,
IN HDEVINFO DeviceInfoSet,IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)+{
- TRACE("PortsClassInstaller(%lu, %p, %p)\n",
InstallFunction, DeviceInfoSet, DeviceInfoData);- switch (InstallFunction)
- {
case DIF_INSTALLDEVICE:return InstallPort(DeviceInfoSet, DeviceInfoData);default:TRACE("Install function %u ignored\n", InstallFunction);return ERROR_DI_DO_DEFAULT;- }
+}
+/* EOF */
Propchange: trunk/reactos/dll/win32/msports/classinst.c
svn:eol-style = native
Propchange: trunk/reactos/dll/win32/msports/classinst.c
svn:keywords = author date id revision
Added: trunk/reactos/dll/win32/msports/msports.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msports/msports.c... ============================================================================== --- trunk/reactos/dll/win32/msports/msports.c (added) +++ trunk/reactos/dll/win32/msports/msports.c [iso-8859-1] Tue May 17 19:24:19 2011 @@ -1,0 +1,33 @@ +/*
- PROJECT: Ports installer library
- LICENSE: GPL - See COPYING in the top level directory
- FILE: dll/win32/msports/msports.c
- PURPOSE: Library main function
- COPYRIGHT: Copyright 2011 Eric Kohl
- */
+#include <windows.h> +#include <wine/debug.h>
+WINE_DEFAULT_DEBUG_CHANNEL(msports);
+BOOL +WINAPI +DllMain(HINSTANCE hinstDll,
DWORD dwReason,LPVOID reserved)+{
- switch (dwReason)
- {
case DLL_PROCESS_ATTACH:TRACE("DLL_PROCESS_ATTACH\n");DisableThreadLibraryCalls(hinstDll);break;- }
- return TRUE;
+}
+/* EOF */
Propchange: trunk/reactos/dll/win32/msports/msports.c
svn:eol-style = native
Propchange: trunk/reactos/dll/win32/msports/msports.c
svn:keywords = author date id revision
Added: trunk/reactos/dll/win32/msports/msports.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msports/msports.r... ============================================================================== --- trunk/reactos/dll/win32/msports/msports.rbuild (added) +++ trunk/reactos/dll/win32/msports/msports.rbuild [iso-8859-1] Tue May 17 19:24:19 2011 @@ -1,0 +1,11 @@ +<module name="msports" type="win32dll" baseaddress="${BASEADDRESS_MSPORTS}" installbase="system32" installname="msports.dll" unicode="yes">
- <include base="msports">.</include>
<importlibrary definition="msports.spec" />
- <library>wine</library>
- <library>kernel32</library>
- <library>advapi32</library>
- <library>setupapi</library>
- <file>classinst.c</file>
- <file>msports.c</file>
- <file>msports.rc</file>
+</module>
Propchange: trunk/reactos/dll/win32/msports/msports.rbuild
svn:eol-style = native
Propchange: trunk/reactos/dll/win32/msports/msports.rbuild
svn:keywords = author date id revision
Added: trunk/reactos/dll/win32/msports/msports.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msports/msports.r... ============================================================================== --- trunk/reactos/dll/win32/msports/msports.rc (added) +++ trunk/reactos/dll/win32/msports/msports.rc [iso-8859-1] Tue May 17 19:24:19 2011 @@ -1,0 +1,7 @@ +#include <windows.h>
+#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "Ports Class Installer\0" +#define REACTOS_STR_INTERNAL_NAME "msports\0" +#define REACTOS_STR_ORIGINAL_FILENAME "msports.dll\0" +#include <reactos/version.rc>
Propchange: trunk/reactos/dll/win32/msports/msports.rc
svn:eol-style = native
Propchange: trunk/reactos/dll/win32/msports/msports.rc
svn:keywords = author date id revision
Added: trunk/reactos/dll/win32/msports/msports.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msports/msports.s... ============================================================================== --- trunk/reactos/dll/win32/msports/msports.spec (added) +++ trunk/reactos/dll/win32/msports/msports.spec [iso-8859-1] Tue May 17 19:24:19 2011 @@ -1,0 +1,12 @@ +@ stub ComDBClaimNextFreePort +@ stub ComDBClaimPort +@ stub ComDBClose +@ stub ComDBGetCurrentPortUsage +@ stub ComDBOpen +@ stub ComDBReleasePort +@ stub ComDBResizeDatabase +@ stdcall LibMain(ptr long ptr) DllMain +@ stub ParallelPortPropPageProvider +@ stdcall PortsClassInstaller(long ptr ptr) +@ stub SerialDisplayAdvancedSettings +@ stub SerialPortPropPageProvider
Propchange: trunk/reactos/dll/win32/msports/msports.spec
svn:eol-style = native
Propchange: trunk/reactos/dll/win32/msports/msports.spec
svn:keywords = author date id revision
Modified: trunk/reactos/dll/win32/win32.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/win32.rbuild?rev=... ============================================================================== --- trunk/reactos/dll/win32/win32.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/win32.rbuild [iso-8859-1] Tue May 17 19:24:19 2011 @@ -295,6 +295,9 @@
<directory name="msnet32"> <xi:include href="msnet32/msnet32.rbuild" /> </directory> +<directory name="msports"> + <xi:include href="msports/msports.rbuild" /> +</directory> <directory name="msrle32"> <xi:include href="msrle32/msrle32.rbuild" /> </directory>
Modified: trunk/reactos/media/inf/ports.inf URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/ports.inf?rev=518... ============================================================================== Binary files - no diff available.
Hello Alex!
Thank you very much for letting us all know that the source code for msports is available in the DDK!
BUT! a) I know that for several years! And I guess other developer know that too. There is absolutely no need to point us to the obvious! b) I do not like Microsoft code in the ReactOS code base. c) The DDK sample is incomplete. It uses the ComDB functions but does not implement them for an obvious reason. Finding this reason is left to the reader as an exercise. d) It is much easier to get a simple piece of code running and extend it bit by bit than getting the whole DLL running at once. My latest commits to the setupapi dll are a result of the work on msports and another class installer.
Now, take your DDK and play somehere else!
Regards, Eric
The source code for msports is already available in the DDK.
-- Best regards, Alex Ionescu
Hi!
I did not mean you should copy the DDK code, I am sorry you misunderstood me (otherwise, I'd have added "..so why are you rewriting it, idiot??").
Instead, I wanted to point out that as msports.inf/.h/.lib and pnpports are in the DDK:
1) The interfaces are known and documented, which a) Should make your job easier in case you weren't aware b) Means you need to maintain perfect compatibility even (perhaps) at the linker level, as developers would try linking with the ReactOS msports instead c) At the very least, we can share/duplicate the headers in a XDK-compatible way (Amine is good with that) d) Enums/defines, etc, can be re-used
2) There is more test code/documentation available for you to test with
3) A regression/compatibility test can be made by testing the MS implementation with yours
I agree with you on your other points, hope this cleared things up.
-- Best regards, Alex Ionescu
On 2011-05-17, at 6:04 PM, Eric Kohl wrote:
Hello Alex!
Thank you very much for letting us all know that the source code for msports is available in the DDK!
BUT! a) I know that for several years! And I guess other developer know that too. There is absolutely no need to point us to the obvious! b) I do not like Microsoft code in the ReactOS code base. c) The DDK sample is incomplete. It uses the ComDB functions but does not implement them for an obvious reason. Finding this reason is left to the reader as an exercise. d) It is much easier to get a simple piece of code running and extend it bit by bit than getting the whole DLL running at once. My latest commits to the setupapi dll are a result of the work on msports and another class installer.
Now, take your DDK and play somehere else!
Regards, Eric
The source code for msports is already available in the DDK.
Best regards, Alex Ionescu
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev