diff --git a/cmd/zed/CMakeLists.txt b/cmd/zed/CMakeLists.txt index 39d883ad020b..6350f1913952 100644 --- a/cmd/zed/CMakeLists.txt +++ b/cmd/zed/CMakeLists.txt @@ -33,3 +33,25 @@ install(FILES $ DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL ) + +add_custom_target( + zed_cat + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/cmd/zed/os/windows/zed.cat" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_BINARY_DIR}/zed.exe" "${CMAKE_CURRENT_BINARY_DIR}/cmd/zed/os/windows/zed.exe" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/cmd/zed/os/windows/zed.inf" "${CMAKE_CURRENT_BINARY_DIR}/cmd/zed/os/windows/zed.inf" + COMMAND "${STAMPINF_PROGRAM}" -d "*" -a "amd64" -v "*" -f "${CMAKE_CURRENT_BINARY_DIR}\\cmd\\zed\\os\\windows\\zed.inf" + COMMAND "${INF2CAT_PROGRAM}" /verbose "/driver:${CMAKE_CURRENT_BINARY_DIR}/cmd/zed/os/windows" /os:10_19H1_X86,10_19H1_X64,ServerRS5_X64 /uselocaltime + COMMAND "${SIGNTOOL_PROGRAM}" sign /v /as /fd sha256 /td sha256 /sha1 "${OPENZFS_SIGNTOOL_SHA1}" /tr "${OPENZFS_SIGNTOOL_TSA}" "${CMAKE_CURRENT_BINARY_DIR}/cmd/zed/os/windows/zed.cat" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cmd/zed/os/windows" + VERBATIM COMMENT "Generating and signing zed.cat file" +) + +add_dependencies(zed_cat zed) + +install(TARGETS OpenZFS RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/driver") +install(FILES + "${CMAKE_SOURCE_DIR}/cmd/zed/os/windows/zed.inf" + "${CMAKE_SOURCE_DIR}/cmd/zed/os/windows/zed.cat" + "${CMAKE_CURRENT_BINARY_DIR}/driver/zed.exe" + DESTINATION "${CMAKE_INSTALL_BINDIR}/driver" +) diff --git a/cmd/zed/os/windows/zed.inf b/cmd/zed/os/windows/zed.inf new file mode 100644 index 000000000000..324cd9a010d8 --- /dev/null +++ b/cmd/zed/os/windows/zed.inf @@ -0,0 +1,77 @@ +[Version] +Signature="$WINDOWS NT$" +Class=Application +ClassGuid={5c4c3332-344d-4f20-89c9-6800dd8809ff} +Provider=%ManufacturerName% +DriverVer = 11/21/2024,10.34.39.932 +CatalogFile=zed.cat +PnpLockdown=1 + +[SourceDisksNames] +1="OpenZFS zed media",,0 + +[SourceDisksFiles] +zed.exe=1 + +[DefaultInstall.NTx86] +CustomDestination=ProgramFilesDir +CopyFiles=CopyZedFiles + +[DefaultInstall.NTamd64] +CustomDestination=ProgramFilesDirNT +CopyFiles=CopyZedFiles + +[DefaultInstall.NTx86.Services] +AddService=OpenZFS_zed,0x00000002,ServiceInstallSection + +[DefaultInstall.NTamd64.Services] +AddService=OpenZFS_zed,0x00000002,ServiceInstallSection + +[DefaultUninstall.NTx86] +LegacyUninstall=1 +DelFiles=CopyZedFiles +UninstallServices=ServiceUninstallSection + +[DefaultUninstall.NTamd64] +LegacyUninstall=1 +DelFiles=CopyZedFiles +UninstallServices=ServiceUninstallSection + +; Change 5 to 1 below to prompt user for path. +[ProgramFilesDir] +16422=DestA,5 + +[ProgramFilesDirNT] +16422=DestB,5 + +[DestA] +HKLM,"Software\Microsoft\Windows\CurrentVersion","ProgramFilesDir",,"C:\Program Files" + +[DestB] +HKLM,"Software\Microsoft\Windows\CurrentVersion", "ProgramFilesDir",,"C:\Program Files" + +[ServiceInstallSection] +DisplayName = "OpenZFS zed" +Description = "zed monitors ZFS events." +ServiceType = 0x10 ; Own Process +StartType = 2 ; Automatic +ErrorControl= 1 ; Normal error handling +ServiceBinary = %16422%\%OpenZFSDirName%\zed.exe +LoadOrderGroup = Base + +[ServiceUninstallSection] +DelService=OpenZFS_zed,0x200 ; Removes service but not instance configuration + +[Strings] +ManufacturerName="OpenZFS on Windows" +OpenZFSDirName="OpenZFS on Windows" + +;here we tell setup where to dump our Files, dont change anything from here unless you know +; +[DestinationDirs] +CopyZedFiles=16422,%OpenZFSDirName% + +[CopyZedFiles] +zed.exe + +; ***** END OF FILE ***** diff --git a/contrib/windows/OpenZFS/OpenZFS.sln b/contrib/windows/OpenZFS/OpenZFS.sln index 4b5ec560e858..5627d57bdd44 100644 --- a/contrib/windows/OpenZFS/OpenZFS.sln +++ b/contrib/windows/OpenZFS/OpenZFS.sln @@ -1,10 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30621.155 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35327.3 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenZFS", "OpenZFS\OpenZFS.vcxproj", "{CE4D8C0F-7C0C-48EA-A286-A3FD540BA4DE}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{36A8D6D5-66DB-457F-A30B-80DB501F801C}" + ProjectSection(SolutionItems) = preProject + ..\..\..\cmd\zed\os\windows\zed.inf = ..\..\..\cmd\zed\os\windows\zed.inf + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM = Debug|ARM diff --git a/contrib/windows/OpenZFS/OpenZFS/OpenZFS.vcxproj b/contrib/windows/OpenZFS/OpenZFS/OpenZFS.vcxproj index 865858ae6a41..671ac0627e4c 100644 --- a/contrib/windows/OpenZFS/OpenZFS/OpenZFS.vcxproj +++ b/contrib/windows/OpenZFS/OpenZFS/OpenZFS.vcxproj @@ -232,13 +232,21 @@ copy /Y "$(SolutionDir)..\..\..\out\build\x64-Debug\cmd\zed\zed.exe" "$(TargetDi - + + + + + + + + + + + + - - true - diff --git a/module/os/windows/CMakeLists.txt b/module/os/windows/CMakeLists.txt index fbad6285dae6..4d1550decee2 100644 --- a/module/os/windows/CMakeLists.txt +++ b/module/os/windows/CMakeLists.txt @@ -52,6 +52,7 @@ set_target_properties(OpenZFS configure_file(OpenZFS.inf "${CMAKE_CURRENT_BINARY_DIR}/driver/OpenZFS.inf" COPYONLY) configure_file(OpenZFS.man "${CMAKE_CURRENT_BINARY_DIR}/driver/OpenZFS.man" COPYONLY) +configure_file(OpenZFS.inf "${CMAKE_CURRENT_BINARY_DIR}/driver/zed.inf" COPYONLY) add_custom_command( TARGET OpenZFS @@ -70,8 +71,10 @@ add_custom_command( COMMAND "${SIGNTOOL_PROGRAM}" sign /v /as /fd sha256 /td sha256 /sha1 "${OPENZFS_SIGNTOOL_SHA1}" /tr "${OPENZFS_SIGNTOOL_TSA}" "${CMAKE_CURRENT_BINARY_DIR}/driver/OpenZFS.cat" COMMAND "${SIGNTOOL_PROGRAM}" sign /v /as /fd sha256 /td sha256 /sha1 "${OPENZFS_SIGNTOOL_SHA1}" /tr "${OPENZFS_SIGNTOOL_TSA}" $ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/driver" - VERBATIM COMMENT "Generating and signing .cat file" + VERBATIM COMMENT "Generating and signing OpenZFS.cat file" ) + +add_dependencies(OpenZFS zed_cat) install(TARGETS OpenZFS RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/driver") install(FILES