[vlc-commits] [Git][videolan/vlc][master] 11 commits: package/win32: nsis: remove unused _KillProcess entry

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Oct 5 11:19:30 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
c3404fdd by Steve Lhomme at 2026-10-05T10:45:27+00:00
package/win32: nsis: remove unused _KillProcess entry

- - - - -
82c4c56a by Steve Lhomme at 2026-10-05T10:45:27+00:00
package/win32: nsis: simplify internal parameter

bTerminate is always the same as bClose in FIND_PROC_BY_NAME().

- - - - -
71ac766f by Steve Lhomme at 2026-10-05T10:45:27+00:00
package/win32: nsis: remove always TRUE parameter

- - - - -
bc53eb7b by Steve Lhomme at 2026-10-05T10:45:27+00:00
package/win32: nsis: remove empty nsProcess::Unload

- - - - -
e96ea526 by Steve Lhomme at 2026-10-05T10:45:27+00:00
package/win32: nsis: remove empty DllMain

DllMain is optional [^1]. If we don't do anything there is no reason
to provide it.

[^1]: https://learn.microsoft.com/en-us/windows/win32/dlls/dllmain

- - - - -
6bf5d21d by Steve Lhomme at 2026-10-05T10:45:27+00:00
package/win32: nsis: move SDK code into a separate folder

So it can be replaced later with the nsis-pluginapi package.

- - - - -
65f9b94e by Steve Lhomme at 2026-10-05T10:45:27+00:00
package/win32: nsis: fix compilation warnings

- unused variables
- static functions with no declaration

- - - - -
7572e7b5 by Steve Lhomme at 2026-10-05T10:45:27+00:00
package/win32: nsis: avoid using a global variable in a DLL

We do not need a global variable to get the parameter string from the stack
and pass it to FIND_PROC_BY_NAME().

- - - - -
761faf14 by Steve Lhomme at 2026-10-05T10:45:27+00:00
package/win32: nsis: pass the process name as const

- - - - -
5c18967d by Steve Lhomme at 2026-10-05T10:45:27+00:00
package/win32: nsis: do not use the process string if it wasn't read

The error codes seem arbitrary. FIND_PROC_BY_NAME returns many 6xx values
on error. We add an unused 612 value.

- - - - -
63591321 by Steve Lhomme at 2026-10-05T10:45:27+00:00
package/win32: remove name for custom meson targets

So it shows the actual file it's building in the logs.

- - - - -


10 changed files:

- extras/package/win32/NSIS/helpers/utils.nsh
- extras/package/win32/NSIS/meson.build
- extras/package/win32/NSIS/nsProcess.def
- extras/package/win32/NSIS/nsProcess.nsh
- extras/package/win32/NSIS/nsProcess/nsProcess.c
- extras/package/win32/NSIS/nsProcess/api.h → extras/package/win32/NSIS/nsProcess/nsis/api.h
- extras/package/win32/NSIS/nsProcess/nsis_tchar.h → extras/package/win32/NSIS/nsProcess/nsis/nsis_tchar.h
- extras/package/win32/NSIS/nsProcess/pluginapi.c → extras/package/win32/NSIS/nsProcess/nsis/pluginapi.c
- extras/package/win32/NSIS/nsProcess/pluginapi.h → extras/package/win32/NSIS/nsProcess/nsis/pluginapi.h
- extras/package/win32/package.mak


Changes:

=====================================
extras/package/win32/NSIS/helpers/utils.nsh
=====================================
@@ -306,10 +306,8 @@ Function CheckRunningProcesses
     goto end
 
     stop:
-    ${nsProcess::Unload}
     MessageBox MB_OK|MB_ICONEXCLAMATION "$(MessageBox_InstallAborted)"
     Quit
 
     end:
-    ${nsProcess::Unload}
 FunctionEnd


=====================================
extras/package/win32/NSIS/meson.build
=====================================
@@ -21,7 +21,7 @@ nsProcess_link_args = ['-static-libgcc']
 # TODO use nsis-pluginapi if possible to be compatible with the system makensis
 # it provides the matching pluginapi.h and a library to link with
 
-nsProcess_sources = files('nsProcess/nsProcess.c', 'nsProcess/pluginapi.c')
+nsProcess_sources = files('nsProcess/nsProcess.c', 'nsProcess/nsis/pluginapi.c')
 nsProcess_src = []
 nsProcess_obj = []
 if host_machine.cpu_family() != 'x86'
@@ -81,14 +81,14 @@ else
 endif
 
 if makensis.found()
-    spad_nsis = custom_target('spad-nsis',
+    spad_nsis = custom_target(
         command: [makensis, nsi_script_dir / 'spad.nsi'],
         input: spad_nsi,
         output: 'spad-setup.exe', # real name but located in installed folder
         build_by_default: false,
         console: true)
 
-    vlc_nsis = custom_target('vlc-nsis',
+    vlc_nsis = custom_target(
         command: [makensis, nsi_script_dir / 'vlc.win32.nsi'],
         input: vlc_nsi,
         output: 'vlc-' + vlc_version + '-' + winstaller_suffix + '.exe', # real name but root build folder


=====================================
extras/package/win32/NSIS/nsProcess.def
=====================================
@@ -1,6 +1,4 @@
 LIBRARY "nsProcess.dll"
 EXPORTS
 _FindProcess
-_KillProcess
 _CloseProcess
-_Unload


=====================================
extras/package/win32/NSIS/nsProcess.nsh
=====================================
@@ -6,23 +6,9 @@
 !macroend
 
 
-!define nsProcess::KillProcess `!insertmacro nsProcess::KillProcess`
-
-!macro nsProcess::KillProcess _FILE _ERR
-	nsProcess::_KillProcess /NOUNLOAD `${_FILE}`
-	Pop ${_ERR}
-!macroend
-
 !define nsProcess::CloseProcess `!insertmacro nsProcess::CloseProcess`
 
 !macro nsProcess::CloseProcess _FILE _ERR
 	nsProcess::_CloseProcess /NOUNLOAD `${_FILE}`
 	Pop ${_ERR}
 !macroend
-
-
-!define nsProcess::Unload `!insertmacro nsProcess::Unload`
-
-!macro nsProcess::Unload
-	nsProcess::_Unload
-!macroend


=====================================
extras/package/win32/NSIS/nsProcess/nsProcess.c
=====================================
@@ -21,42 +21,31 @@
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <psapi.h>
-#include "pluginapi.h"
+#include "nsis/pluginapi.h"
 #include <stdlib.h>
 
 /* Defines */
 #define NSIS_MAX_STRLEN 1024
 
 
-/* Global variables */
-TCHAR szBuf[NSIS_MAX_STRLEN];
-
 /* Funtions prototypes and macros */
-int FIND_PROC_BY_NAME(TCHAR *szProcessName, BOOL bTerminate, BOOL bClose);
+int FIND_PROC_BY_NAME(const TCHAR *szProcessName, BOOL bTerminate);
 
 /* NSIS functions code */
 void __declspec(dllexport) _FindProcess(HWND hwndParent, int string_size,
                                       TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
 {
+  (void)hwndParent;
+  (void)extra;
   EXDLL_INIT();
   {
     int nError;
+    TCHAR szBuf[NSIS_MAX_STRLEN];
 
-    popstringn(szBuf, NSIS_MAX_STRLEN);
-    nError=FIND_PROC_BY_NAME(szBuf, FALSE, FALSE);
-    pushint(nError);
-  }
-}
-
-void __declspec(dllexport) _KillProcess(HWND hwndParent, int string_size,
-                                      TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
-{
-  EXDLL_INIT();
-  {
-    int nError=0;
-
-    popstringn(szBuf, NSIS_MAX_STRLEN);
-    nError=FIND_PROC_BY_NAME(szBuf, TRUE, FALSE);
+    if (popstringn(szBuf, NSIS_MAX_STRLEN))
+      nError = 612;
+    else
+      nError=FIND_PROC_BY_NAME(szBuf, FALSE);
     pushint(nError);
   }
 }
@@ -64,33 +53,28 @@ void __declspec(dllexport) _KillProcess(HWND hwndParent, int string_size,
 void __declspec(dllexport) _CloseProcess(HWND hwndParent, int string_size,
                                       TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
 {
+  (void)hwndParent;
+  (void)extra;
   EXDLL_INIT();
   {
     int nError=0;
+    TCHAR szBuf[NSIS_MAX_STRLEN];
 
-    popstringn(szBuf, NSIS_MAX_STRLEN);
-    nError=FIND_PROC_BY_NAME(szBuf, TRUE, TRUE);
+    if (popstringn(szBuf, NSIS_MAX_STRLEN))
+      nError = 612;
+    else
+      nError=FIND_PROC_BY_NAME(szBuf, TRUE);
     pushint(nError);
   }
 }
 
-void __declspec(dllexport) _Unload(HWND hwndParent, int string_size,
-                                      TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
-{
-}
-
-BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
-{
-  return TRUE;
-}
-
 struct win_id
 {
     DWORD proc_id;
     HWND prev_hwnd;
 };
 
-BOOL CALLBACK EnumWindowsProc(          HWND hwnd,
+static BOOL CALLBACK EnumWindowsProc(          HWND hwnd,
     LPARAM lParam
 )
 {
@@ -105,7 +89,7 @@ BOOL CALLBACK EnumWindowsProc(          HWND hwnd,
 	return TRUE;
 }
 
-void NiceTerminate(DWORD id, BOOL bClose, BOOL *bSuccess, BOOL *bFailed)
+static void NiceTerminate(DWORD id, BOOL *bSuccess, BOOL *bFailed)
 {
   HANDLE hProc;
   DWORD ec;
@@ -114,8 +98,7 @@ void NiceTerminate(DWORD id, BOOL bClose, BOOL *bSuccess, BOOL *bFailed)
   {
 	struct win_id window = { id, NULL };
 
-	if (bClose)
-		EnumWindows(EnumWindowsProc, (LPARAM)&window);
+	EnumWindows(EnumWindowsProc, (LPARAM)&window);
 	if (window.prev_hwnd != NULL)
 	{
 	  if (GetExitCodeProcess(hProc,&ec) && ec == STILL_ACTIVE)
@@ -141,7 +124,7 @@ void NiceTerminate(DWORD id, BOOL bClose, BOOL *bSuccess, BOOL *bFailed)
   }
 }
 
-int FIND_PROC_BY_NAME(TCHAR *szProcessName, BOOL bTerminate, BOOL bClose)
+int FIND_PROC_BY_NAME(const TCHAR *szProcessName, BOOL bTerminate)
 // Find the process "szProcessName" if it is currently running.
 // This works for Win95/98/ME and also WinNT/2000/XP.
 // The process name is case-insensitive, i.e. "notepad.exe" and "NOTEPAD.EXE"
@@ -196,7 +179,6 @@ int FIND_PROC_BY_NAME(TCHAR *szProcessName, BOOL bTerminate, BOOL bClose)
   TCHAR szName[MAX_PATH];
   OSVERSIONINFO osvi;
   HANDLE hProc;
-  ULONG uError;
   BOOL bFound=FALSE;
   BOOL bSuccess=FALSE;
   BOOL bFailed=FALSE;
@@ -258,7 +240,7 @@ int FIND_PROC_BY_NAME(TCHAR *szProcessName, BOOL bTerminate, BOOL bClose)
 
             if (bTerminate == TRUE)
             {
-              NiceTerminate(processIDs[i], bClose, &bSuccess, &bFailed);
+              NiceTerminate(processIDs[i], &bSuccess, &bFailed);
             }
             else break;
           }


=====================================
extras/package/win32/NSIS/nsProcess/api.h → extras/package/win32/NSIS/nsProcess/nsis/api.h
=====================================


=====================================
extras/package/win32/NSIS/nsProcess/nsis_tchar.h → extras/package/win32/NSIS/nsProcess/nsis/nsis_tchar.h
=====================================


=====================================
extras/package/win32/NSIS/nsProcess/pluginapi.c → extras/package/win32/NSIS/nsProcess/nsis/pluginapi.c
=====================================


=====================================
extras/package/win32/NSIS/nsProcess/pluginapi.h → extras/package/win32/NSIS/nsProcess/nsis/pluginapi.h
=====================================
@@ -74,6 +74,7 @@ void NSISCALL setuservariable(const int varnum, const TCHAR *var);
 #define SetUserVariableW(x,y) setuservariable(x,y)
 
 int  NSISCALL PopStringA(char* ansiStr);
+int  NSISCALL PopStringNA(char* ansiStr, int maxlen);
 void NSISCALL PushStringA(const char* ansiStr);
 void NSISCALL GetUserVariableW(const int varnum, wchar_t* wideStr);
 void NSISCALL GetUserVariableA(const int varnum, char* ansiStr);


=====================================
extras/package/win32/package.mak
=====================================
@@ -124,7 +124,7 @@ endif
 	  fi ; \
 	done
 
-$(win32_destdir)/NSIS/nsProcess.dll: extras/package/win32/NSIS/nsProcess/nsProcess.c extras/package/win32/NSIS/nsProcess/pluginapi.c
+$(win32_destdir)/NSIS/nsProcess.dll: extras/package/win32/NSIS/nsProcess/nsProcess.c extras/package/win32/NSIS/nsProcess/nsis/pluginapi.c
 	mkdir -p "$(win32_destdir)/NSIS/"
 if HAVE_WIN64
 	i686-w64-mingw32-gcc $^ -shared -o $@ -static-libgcc -D_UNICODE=1 -DUNICODE=1



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/42916915f0b908082369bbb4718d9bca860cb686...635913218181f5c4de7e54dfd69d7b48be0aba1b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/42916915f0b908082369bbb4718d9bca860cb686...635913218181f5c4de7e54dfd69d7b48be0aba1b
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list