processhacker / plugins-extra

These are highly unstable, buggy, incomplete plugins that are not included with Process Hacker by default.
https://processhacker.sourceforge.io/
325 stars 113 forks source link

Question - how to fix error LNK2001 then build Terminator plugin that broken in Git 4e7fb3827? #83

Closed VictorVG closed 3 years ago

VictorVG commented 3 years ago

In Git 4e7fb3827, the export of PhOsVersion was removed which broke. \Plugins-extra\TerminatorPlugin\kph2data.c where it is used on lines 58, 59, 60 and 61:

NTSTATUS Kph2InitializeDynamicPackage (
     _Out_ PKPH_DYN_PACKAGE Package
     )
{
     ULONG majorVersion, minorVersion, servicePack, buildNumber;

     majorVersion = PhOsVersion.dwMajorVersion;
     minorVersion = PhOsVersion.dwMinorVersion;
     servicePack = PhOsVersion.wServicePackMajor;
     buildNumber = PhOsVersion.dwBuildNumber;
Building ExtraPlugins

- Git 4e7fb3827 remove PhOsVersion

[ERROR]

kph2data.obj: error LNK2001: unresolved external symbol PhOsVersion. [.\plugins-extra\TerminatorPlugin\TerminatorPlugin.vcxproj]
.\plugins-extra\..\bin\Release32\plugins\TerminatorPlugin.dll: fatal error LNK1120: unresolved external items: 1 [.\plugins-extra\TerminatorPlugin\TerminatorPlugin.vcxproj]

kph2data.obj: error LNK2001: unresolved external symbol PhOsVersion. [.\plugins-extra\TerminatorPlugin\TerminatorPlugin.vcxproj]
.\plugins-extra\..\bin\Release64\plugins\TerminatorPlugin.dll: fatal error LNK1120: unresolved external items: 1 [.\plugins-extra\TerminatorPlugin\TerminatorPlugin.vcxproj]

I tried to pull export similar to kphdata.c but it didn't work. Maybe it should be described additionally in the plugin header?

skipik commented 3 years ago

Same problem here.

VictorVG commented 3 years ago

Temporary - disabled the Terminator plug-in. Test launcher (CMD):

@echo off
setlocal enableextensions
if "%~1" == "--help" (goto hlp)
if "%~1" == "-help" (goto hlp)
if "%~1" == "-h" (goto hlp)
if "%~1" == "" (goto skp)
if "%~1" == "--reset" (goto skp)
set ar=%1
set arg=%ar:~1,-1%
:skp
if "%PROCESSOR_ARCHITECTURE%"=="IA64" (goto IA64 )
if "%PROCESSOR_ARCHITECTURE%"=="ARM64" (goto ARM64)
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (set ma=x64 & goto next)
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" (set ma=x64 & goto next)
set ma=x86
:next
cd /d "%~dp0%ma%"
if "%~1" == "--reset" (del /f /q ProcessHacker.exe.settings.xml > nul)
if "%~2" == "--reset" (del /f /q ProcessHacker.exe.settings.xml > nul)
call :size ProcessHacker.exe.settings.xml
if  (%ln%) == (0) del /q/f ProcessHacker.exe.settings.xml > nul
if not exist ProcessHacker.exe.settings.xml (
echo ^<settings^> > ProcessHacker.exe.settings.xml
echo ^<setting name="AllowOnlyOneInstance"^>0^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="CloseOnEscape"^>0^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="CollapseServicesOnStart"^>0^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="DbgHelpSearchPath"^>SRV^*C^:^\Symbols^*http^:^/^/msdl.microsoft.com^/download^/symbols^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="DbgHelpUndecorate"^>1^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="DisabledPlugins"^>CommonUtil.dll^|ExtraPlugins.dll^|FirewallMonitorPlugin.dll^|ForceShutdownPlugin.dll^|HexPidPlugin.dll^|NetAdapters.dll^|LiveDumpPlugin.dll^|NetExtrasPlugin.dll^|SbieSupport.dll^|TerminatorPlugin.dll^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="ElevationLevel"^>1^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="EnableCycleCpuUsage"^>0^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="EnableInstantTooltips"^>1^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="EnableKph"^>1^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="EnableKphWarnings"^>0^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="EnableNetworkResolve"^>1^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="EnablePlugins"^>1^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="EnableSafeDefaultPlugins"^>0^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="EnableSecurityAdvancedDialog"^>1^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="EnableWarnings"^>1^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="HiddenProcessesMenuEnabled"^>1^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="ProcessHacker.NetworkTools.GeoDbPath"^>GeoLite2-Country.mmdb^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="ProcessHacker.UserNotes.DatabasePath"^>usernotesdb.xml^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<setting name="WmiProviderEnableHiddenMenu"^>1^<^/setting^> >> ProcessHacker.exe.settings.xml
echo ^<^/settings^> >> ProcessHacker.exe.settings.xml
) else (
findstr /v "IconGuids ProcessHacker.ExtendedTools.TrayIconGuids ProcessHacker.HardwareDevices.NetworkList" ProcessHacker.exe.settings.xml > out.xml
move /y out.xml ProcessHacker.exe.settings.xml > nul
)
call :size usernotesdb.xml
if  (%ln%) == (0) del /q/f usernotesdb.xml > nul
if not exist usernotesdb.xml (echo ^<objects ^/^> > usernotesdb.xml)
if "%~1" == "" (start /i /d "%~dp0%ma%" ProcessHacker.exe
     ) else (
     start /d "%~dp0%ma%" ProcessHacker.exe %arg%
     )
exit
:hlp
echo USAGE:
echo.
echo ph
echo.
echo  - Run Process Hacker w/o command line argument
echo.
echo ph "command line parameters string" or ph ^'PH command line parameters string^'
echo.
echo  - Run Process Hacker with command line parameters always escaped in to quotes
echo.
echo ph ^'PH command line parameters string^' --reset  or ph --reset
echo.
echo - If first run after placed PH in to another location always use this parameter!
echo.
echo ph -h or ph -help or ph --help
echo.
echo  - Show this help and exit
echo.
echo SYNOPSIS:
echo.
echo      Simple Process Hacker script based launcher have features run
echo   Process Hacker in to custom command line string escaped in single
echo   or double quotes as "command line parameters string" or "command
echo   line parameters string".
echo.
echo WARNING:
echo.
echo   - Quotes is required also if then used single command line parameter.
echo.
echo HISTORY:
echo.
echo    v1.0 - First public version
echo.
echo    v1.1 - Update to Process Hacker v3.0.5883.1356
echo.
echo    v1.2 - Update CPU architecture detector - added IA64 check, refactoring.
echo.
echo    v1.3 - Update CPU architecture detector - added ARM64 check, refactoring.
echo.
echo    v1.4 - User can reset all settings (see USAGE for details) if needed.
echo.
echo    v1.5 - Small improvement startup logic.
echo.
echo    v1.6 - Enable Plugins-Extra by default.
echo.
echo    v1.7 - Minor updates
echo.
echo    v1.8 - Prevent startup freeze
echo.
echo    v1.9 - Add disabled plug-ins list for v3.0.8087.3560 Git-4dfd0bcf or newer
echo.
echo    v2.0 - Add hidden menu items
echo.
echo.   v2.1 - temporary disabled Terminator Plug-in (see https://github.com/processhacker/plugins-extra/issues/83 )
echo.
echo LICENSE:
echo.
echo    GPL v3.0
echo.
echo    (c) VictorVG @ VikSoft.Ru (Russia, Moscow, 1996 - 2020). All Right Reserved.
echo.
pause
exit
:IA64
echo.
echo IA64 CPU detected, but Process Hacker compiled only for x86 and AMD64 CPU.
echo.
pause
exit
:ARM64
echo.
echo ARM64 CPU detected, but Process Hacker compiled only for x86 and AMD64 CPU.
echo.
pause
exit
:size
set ln=%~z1
goto:eof
dmex commented 3 years ago

Duplicate of #86

VictorVG commented 3 years ago

86 not include any information about this problem ....