First step to automatically generate registry entries for network protocols (TcpIp...)
authorHervé Poussineau <hpoussin@reactos.org>
Tue, 11 Apr 2006 22:01:08 +0000 (22:01 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Tue, 11 Apr 2006 22:01:08 +0000 (22:01 +0000)
Registry settings are moved to media/inf/nettcpip.inf, which is installed for each netcard detected.

svn path=/trunk/; revision=21556

reactos/boot/bootdata/hivesys.inf
reactos/boot/bootdata/packages/reactos.dff
reactos/dll/win32/netcfgx/netcfgx.c
reactos/media/inf/inf.rbuild
reactos/media/inf/nettcpip.inf [new file with mode: 0644]

index d06bcb8..6760a76 100644 (file)
@@ -78,16 +78,6 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E974-E325-11CE-BFC1-08002BE1
 HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E974-E325-11CE-BFC1-08002BE10318}","Class",0x00000000,"NetService"
 HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}",,0x00000000,"Network Protocol"
 HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}","Class",0x00000000,"NetTrans"
-; The following entries should be generated from .inf files during installation
-; TCPIP Protocol
-HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","Characteristics",0x00010001,0x00000080
-HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","ComponentId",0x00000000,"ms_tcpip"
-HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","Description",0x00000000,"Internet Protocol (TCP/IP)"
-HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","InfPath",0x00000000,"BUGBUG_Create from Inffile.inf"
-HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","InfSection",0x00000000,"BUGBUG_Create from Inffile.inf"
-HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}\Ndi","ClsId",0x00000000,"{A907657F-6FDF-11D0-8EFB-00C04FD912B2}"
-HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}\Ndi","HelpText",0x00000000,"Transmission Control Protocol/Internet Protocol"
-HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}\Ndi","Service",0x00000000,"Tcpip"
 
 
 
@@ -708,32 +698,6 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Scsiport","ImagePath",0x00020000,"system
 HKLM,"SYSTEM\CurrentControlSet\Services\Scsiport","Start",0x00010001,0x00000000
 HKLM,"SYSTEM\CurrentControlSet\Services\Scsiport","Type",0x00010001,0x00000001
 
-; TCP/IP driver
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip","ErrorControl",0x00010001,0x00000001
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip","Group",0x00000000,"PNP_TDI"
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip","ImagePath",0x00020000,"system32\drivers\tcpip.sys"
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip","Start",0x00010001,0x00000001
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip","Type",0x00010001,0x00000001
-; NOTE: These settings should be added by the network setup
-; These bindings are of the windows 2000 type, and will probably need to be
-; twiddled to get 3rd-party network-related software to work.
-; NT4 puts additional stuff in the Bind, Export, and Route values.
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","DataBasePath",0x00010000,"DataBasePath"
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","Domain",0x00010000,""
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","Hostname",0x00010000,"ROSHost"
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","NameServer",0x00010000,"0.0.0.0"
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","ForwardBroadcasts",0x00010001,0x00000000
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","IPEnableRouter",0x00010001,0x00000000
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","SearchList",0x00010000,""
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","EnableSecurityFilters",0x00010001,0x00000000
-;HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes",,0x00000010
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\WinSock","UseDelayedAcceptance",0x00010001,0x00000000
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\WinSock","MaxSockAddrLength",0x00010001,0x00000010
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\WinSock","MinSockAddrLength",0x00010001,0x00000010
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\WinSock","HelperDllName",0x00000000,"%SystemRoot%\System32\wshtcpip.dll"
-HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\WinSock","Mapping",0x00000001,0c,00,00,00,03,00,00,00,02,00,00,00,01,00,00,00,06,00,00,00,02,00,00,00,01,00,00,00,00,00,00,00,02,00,00,00,00,00,00,00,06,00,00,00,00,00,00,00,00,00,00,00,06,00,00,00,00,00,00,00,01,00,00,00,06,00,00,00,02,00,00,00,02,00,00,00,11,00,00,00,02,00,00,00,02,00,00,00,00,00,00,00,02,00,00,00,00,00,00,00,11,00,00,00,00,00,00,00,00,00,00,00,11,00,00,00,00,00,00,00,02,00,00,00,11,00,00,00,02,00,00,00,03,00,00,00,00,00,00,00,02,00,00,00,03,00,00,00,01,00,00
-HKLM,"SYSTEM\CurrentControlSet\Services\Winsock\Parameters","Transports",0x00010000,"Tcpip"
-
 ; Simple TCP services
 HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Description",0x00000000,"Supports the following TCP/IP services: Chargen, Daytime, Discard, Echo, QOTD"
 HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","DisplayName",0x00000000,"Simple TCP/IP Services"
index b282b98..4282f71 100644 (file)
@@ -351,6 +351,7 @@ media\inf\NET_NIC.inf                               6
 media\inf\netamd.inf                                6
 media\inf\netisa.inf                                6
 media\inf\netrtpnt.inf                              6
+media\inf\nettcpip.inf                              6
 media\inf\ports.inf                                 6
 media\inf\scsi.inf                                  6
 media\inf\syssetup.inf                              6
index 22cb4e0..215d364 100644 (file)
@@ -92,6 +92,83 @@ cleanup:
        return rc;
 }
 
+/* Install a section of a .inf file
+ * Returns TRUE if success, FALSE if failure. Error code can
+ * be retrieved with GetLastError()
+ */
+static BOOL
+InstallInfSection(
+       IN HWND hWnd,
+       IN LPCWSTR InfFile,
+       IN LPCWSTR InfSection)
+{
+       WCHAR Buffer[MAX_PATH];
+       HINF hInf = INVALID_HANDLE_VALUE;
+       UINT BufferSize;
+       PVOID Context = NULL;
+       BOOL ret = FALSE;
+
+       /* Get Windows directory */
+       BufferSize = MAX_PATH - 5 - wcslen(InfFile);
+       if (GetWindowsDirectoryW(Buffer, BufferSize) > BufferSize)
+       {
+               /* Function failed */
+               SetLastError(ERROR_GEN_FAILURE);
+               goto cleanup;
+       }
+       /* We have enough space to add some information in the buffer */
+       if (Buffer[wcslen(Buffer) - 1] != '\\')
+               wcscat(Buffer, L"\\");
+       wcscat(Buffer, L"Inf\\");
+       wcscat(Buffer, InfFile);
+
+       /* Install specified section */
+       hInf = SetupOpenInfFileW(Buffer, NULL, INF_STYLE_WIN4, NULL);
+       if (hInf == INVALID_HANDLE_VALUE)
+               goto cleanup;
+
+       Context = SetupInitDefaultQueueCallback(hWnd);
+       if (Context == NULL)
+               goto cleanup;
+
+       ret = SetupInstallFromInfSectionW(
+               hWnd, hInf,
+               InfSection, SPINST_ALL,
+               NULL, NULL, SP_COPY_NEWER,
+               SetupDefaultQueueCallbackW, Context,
+               NULL, NULL);
+
+cleanup:
+       if (Context)
+               SetupTermDefaultQueueCallback(Context);
+       if (hInf != INVALID_HANDLE_VALUE)
+               SetupCloseInfFile(hInf);
+       return ret;
+}
+
+/* Add default services for network cards */
+static DWORD
+InstallAdditionalServices(
+       IN HWND hWnd)
+{
+       BOOL ret;
+
+       /* Install TCP/IP protocol */
+       ret = InstallInfSection(
+               hWnd,
+               L"nettcpip.inf",
+               L"MS_TCPIP.PrimaryInstall");
+       if (!ret && GetLastError() != ERROR_FILE_NOT_FOUND)
+       {
+               DPRINT("InstallInfSection() failed with error 0x%lx\n", GetLastError());
+               return GetLastError();
+       }
+
+       /* You can add here more clients (SMB...) and services (DHCP server...) */
+
+       return ERROR_SUCCESS;
+}
+
 DWORD WINAPI
 NetClassInstaller(
        IN DI_FUNCTION InstallFunction,
@@ -346,6 +423,15 @@ NetClassInstaller(
                goto cleanup;
        }
 
+       /* Install additionnal services */
+       /* FIXME: do it only if it is a network adapter! */
+       rc = InstallAdditionalServices(NULL);
+       if (rc != ERROR_SUCCESS)
+       {
+               DPRINT("InstallAdditionalServices() failed with error 0x%lx\n", rc);
+               goto cleanup;
+       }
+
        /* HACK: hpoussin, Dec 2005. TCP/IP driver is not able to manage devices
         * which are installed after its startup. So, we have to reboot to take
         * this new netcard into account.
index 0e8bae2..44d6306 100644 (file)
@@ -11,6 +11,7 @@
 <installfile base="inf">netamd.inf</installfile>
 <installfile base="inf">netisa.inf</installfile>
 <installfile base="inf">netrtpnt.inf</installfile>
+<installfile base="inf">nettcpip.inf</installfile>
 <installfile base="inf">ports.inf</installfile>
 <installfile base="inf">scsi.inf</installfile>
 <installfile base="inf">syssetup.inf</installfile>
diff --git a/reactos/media/inf/nettcpip.inf b/reactos/media/inf/nettcpip.inf
new file mode 100644 (file)
index 0000000..b04d460
--- /dev/null
@@ -0,0 +1,61 @@
+; NETTCPIP.INF\r
+\r
+; Installation file for TCP/IP protocol\r
+\r
+[Version]\r
+Signature  = "$Windows NT$"\r
+;Signature  = "$ReactOS$"\r
+LayoutFile = layout.inf\r
+Class      = NetTrans\r
+ClassGUID  = {4D36E975-E325-11CE-BFC1-08002BE10318}\r
+Provider   = %ReactOS%\r
+DriverVer  = 04/12/2006,1.00\r
+\r
+;----------------------------- TCP/IP DRIVER ----------------------------\r
+\r
+[MS_TCPIP.PrimaryInstall.NT]\r
+AddReg = TCPIP_AddReg.NT\r
+\r
+[TCPIP_AddReg.NT]\r
+; The following entries should be generated from .inf files during installation\r
+; TCPIP Protocol\r
+HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","Characteristics",0x00010001,0x00000080\r
+HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","ComponentId",0x00000000,"ms_tcpip"\r
+HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","Description",0x00000000,"Internet Protocol (TCP/IP)"\r
+HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","InfPath",0x00000000,"BUGBUG_Create from Inffile.inf"\r
+HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","InfSection",0x00000000,"BUGBUG_Create from Inffile.inf"\r
+HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}\Ndi","ClsId",0x00000000,"{A907657F-6FDF-11D0-8EFB-00C04FD912B2}"\r
+HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}\Ndi","HelpText",0x00000000,"Transmission Control Protocol/Internet Protocol"\r
+HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}\Ndi","Service",0x00000000,"Tcpip"\r
+\r
+; TCP/IP driver\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip","ErrorControl",0x00010001,0x00000001\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip","Group",0x00000000,"PNP_TDI"\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip","ImagePath",0x00020000,"system32\drivers\tcpip.sys"\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip","Start",0x00010001,0x00000001\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip","Type",0x00010001,0x00000001\r
+; NOTE: These settings should be added by the network setup\r
+; These bindings are of the windows 2000 type, and will probably need to be\r
+; twiddled to get 3rd-party network-related software to work.\r
+; NT4 puts additional stuff in the Bind, Export, and Route values.\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","DataBasePath",0x00010000,"DataBasePath"\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","Domain",0x00010000,""\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","Hostname",0x00010000,"ROSHost"\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","NameServer",0x00010000,"0.0.0.0"\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","ForwardBroadcasts",0x00010001,0x00000000\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","IPEnableRouter",0x00010001,0x00000000\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","SearchList",0x00010000,""\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","EnableSecurityFilters",0x00010001,0x00000000\r
+;HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes",,0x00000010\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\WinSock","UseDelayedAcceptance",0x00010001,0x00000000\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\WinSock","MaxSockAddrLength",0x00010001,0x00000010\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\WinSock","MinSockAddrLength",0x00010001,0x00000010\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\WinSock","HelperDllName",0x00000000,"%SystemRoot%\System32\wshtcpip.dll"\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\WinSock","Mapping",0x00000001,0c,00,00,00,03,00,00,00,02,00,00,00,01,00,00,00,06,00,00,00,02,00,00,00,01,00,00,00,00,00,00,00,02,00,00,00,00,00,00,00,06,00,00,00,00,00,00,00,00,00,00,00,06,00,00,00,00,00,00,00,01,00,00,00,06,00,00,00,02,00,00,00,02,00,00,00,11,00,00,00,02,00,00,00,02,00,00,00,00,00,00,00,02,00,00,00,00,00,00,00,11,00,00,00,00,00,00,00,00,00,00,00,11,00,00,00,00,00,00,00,02,00,00,00,11,00,00,00,02,00,00,00,03,00,00,00,00,00,00,00,02,00,00,00,03,00,00,00,01,00,00\r
+HKLM,"SYSTEM\CurrentControlSet\Services\Winsock\Parameters","Transports",0x00010000,"Tcpip"\r
+\r
+;-------------------------------- STRINGS -------------------------------\r
+\r
+[Strings]\r
+ReactOS = "ReactOS Team"\r
+\r