Skip to content
⌘ NSIS Forum Archive

LockedList plug-in

320 posts

ukreator#
IsFileLocked issue

Hi Stu

Thanks for the plugin, it is very good and helpful.

Anyway, while testing it in my installer I've found one bug. It treat file as blocked in the case when this file has non-existent directories within the full path. This can be easily fixed by replacing this piece of code at line 2050 in LockedList.cpp


if (GetLastError() != ERROR_FILE_NOT_FOUND)
fLocked = TRUE;
with


if ((err != ERROR_FILE_NOT_FOUND) && (err != ERROR_PATH_NOT_FOUND))
fLocked = TRUE;
Also it would be great to replace


#include "afxres.h"
to


#include <windows.h>
in LockedList.rc to be able to compile with MSVC Express edition.

Dmitry
TheGrudge#
LockedList plugin doesn't seem to work with x64?
I added this line in the installer script:

LockedList::AddModule "$INSTDIR\some.dll"

When compiled with w32, the dll is detected and the running program is shown. But when compiled on x64 and running it on the x64-Version of the program that is locking the dll, the file is not shown in the locked list.

Is this a known issue?
Animaether#
Originally Posted by TheGrudge View Post
LockedList plugin doesn't seem to work with x64? [...] Is this a known issue?
Yes. Because NSIS itself is not 64bit, and thus the LockedList plugin isn't 64bit, it also can't really access 64bit process information that would be required for this.

One thing you can try is testing if the file is locked, rather than the module. For this you might have to use a manual testing method, like trying to open the file for appending. If that fails - the file is locked. There's a few downsides to that method (you touch the file, and you won't know -what- is locking the file), but it's possibly all you've got 🙂
mj_blue#edited
Add Custom not working?

Hi, I am making an enhancement to our installer to change the horrible "MCI-Command Handling Window" holding open an activex control to be a more sensible message but I can't get the AddCustom work.

I have tried using the example LockedListCustom.nsi and this builds but when I say 'Yes' to the question is myapp running it never show sin the lockedlist window. I get the same behaviour in my own installer.

Details:

lockedlist V2.0
OS: XP SP3
NSIS: 2.46



Function Isocxlocked
LockedList::IsFileLocked $INSTDIR\axagp.ocx
Pop $R1
${If} $R1 == true
MessageBox MB_OK|MB_ICONINFORMATION `$INSTDIR\axagp.ocx IS locked!!??`
${Else}
MessageBox MB_OK|MB_ICONINFORMATION `$INSTDIR\axagp.ocx is not locked.`
${EndIf}
Push true

FunctionEnd

Function MyAppCallback
Pop $R0

; Message box instead of actual logical test...
${If} ${Cmd} `MessageBox MB_YESNO|MB_ICONQUESTION 'Is $R0 running?' IDYES`
Push true
${Else}
Push false
${EndIf}

FunctionEnd

Function LockedListShow
!insertmacro MUI_HEADER_TEXT `List of open Browsers with myapp in Use` ``
GetFunctionAddress $R1 Isocxlocked
LockedList::AddCustom /icon $INSTDIR\antixgpb.exe 'Internet Explorer' iexplore.exe $R1
GetFunctionAddress $R0 MyAppCallback
LockedList::AddCustom /icon $PLUGINSDIR\myapp.ico `My App v1.0` myapp.exe $R0
LockedList:😁ialog /searching "Searching for Browsers in use" /noprograms "No Browsers have Game Player in use" /autoclose
FunctionEnd
I have this running twice in the code above, once detecting if the file is in use (and currently forcing a true return) and once is extracted straight from the demo app.

Any help with how to get this working appreciated.

Thanks

Mark Jones
Animaether#
uh oh... looks like a bug - an older version of LockedList (which we use, haven't done the round of plugin updates yet) does work correctly with the example.
mj_blue#
Hi Animaether,

what version of the plugin are you using? I'll downgrade on my test setup and check that this code does actually work in principle.

Thanks

Mark
Animaether#
My version is not versioned, so I can't say... but the date on the file inside the archive is 2010/Apr/28 - which would make it version 1.5 . Actually, I should have 1.6 in the actual current build as that fixes the Next button text. There's quite a few changes since 1.5/1.6, so I'd wait and see if Afrow knows what the problem might be (I didn't spot anything standing out in the source code, but I'm not a C/C++ programmer) so it can be fixed 🙂
mj_blue#
Yes, it looks like this bug was introduced in V1.7, this works in V1.6 but when I upgrade to V1.7 then myapp never gets shown using the custom example.

A lot changed between the versions so I can't even see anything obvious to try and help sorry 🙁

I could only see that it changed from using uiFunctionAddress to iFunctionAddress

Mark
MrSpock77#
SilentSearch doesn't work as expected in Windows 2000 (SP4). I tried to run LockedListTest.nsi. The callback function is called for every running process, which is not correct. I did also notice that the Path is empty.

Testing LockedList without threading, please wait...
Id: 8
Path: 
Description: Process Id: 8
Id: 160
Path: 
Description: Process Id: 160
Id: 188
Path: 
Description: Process Id: 188
Id: 208
Path: 
Description: NetDDE Agent
Id: 236
Path: 
Description: Process Id: 236
Id: 248
Path: 
Description: Process Id: 248
Id: 436
Path: 
Description: Process Id: 436
Id: 464
Path: 
Description: Process Id: 464
Id: 500
Path: 
Description: Process Id: 500
Id: 532
Path: 
Description: Process Id: 532
Id: 580
Path: 
Description: Process Id: 580
Id: 624
Path: 
Description: SYSTEM AGENT COM WINDOW
Id: 692
Path: 
Description: Process Id: 692
Id: 712
Path: 
Description: Process Id: 712
Id: 732
Path: 
Description: Process Id: 732
Id: 744
Path: 
Description: Process Id: 744
Id: 768
Path: 
Description: Process Id: 768
Id: 1232
Path: 
Description: Process Id: 1232
Id: 1296
Path: 
Description: ModemDeviceChange
Id: 1380
Path: 
Description: Process Id: 1380
Id: 1072
Path: 
Description: Process Id: 1072
Id: 1156
Path: 
Description: Process Id: 1156
Id: 1392
Path: 
Description: Windows Task Manager
Id: 704
Path: 
Description: LockedListTest Setup 
Searching... 100%
Completed
A few of our customers still use Windows 2000, so I would appreciate if this can be fixed.
Afrow UK#
I'm quite busy at the moment with University. When I get some free time I'll take a look at both issues. I don't have a Windows 2000 machine handy though; only Windows XP.

Stu
mj_blue#
Thanks Afrow.. I am looking into getting setup so I can build plugins and will try stepping through it if I ever get setup
Afrow UK#
That would be helpful. You can use Visual Studio Express:
http://www.microsoft.com/express/Windows/
Will also need a Windows SDK suitable for Windows 2000.

Stu
Afrow UK#
Uploaded v2.2:
* Fixed AddCustom not adding items.
* No longer returns processes with no file path.
* Added /autonext to automatically go to the next page when no items are found.

Note: The Windows 2000 issue is not fixed (merely avoided). It is likely that this plug-in will not work on Windows 2000 (it may use API only available in XP and above).

Stu
mj_blue#
Custom callbacks now work a treat for me in V2.2, Thanks Afrow. I did look at if I could build this but the solution appeared to be a VS2010 solution and I am setup with VS2008 for work.

Thanks again

Mark
MrSpock77#
I would like to have another switch to LockedList:😁ialog and LockedList::InitDialog which automatically closes the dialog if no running applications were found. I just want to move on to the next page, without having to click Next.
Afrow UK#
Just noticed /autonext is missing from the readme (except under the changelog). Will fix the readme. /autonext is what you want.

Stu
Anders#
Originally Posted by Afrow UK View Post
Note: The Windows 2000 issue is not fixed (merely avoided). It is likely that this plug-in will not work on Windows 2000 (it may use API only available in XP and above).
I don't see any reason why you can't make this work on 2000 (And probably NT4), but you have some hardcoded constants that are wrong (I just looked at a small part of the source, there are probably more 🙂 )

  // Skip System Idle Process and System.
  if (file.ProcessId == 0 || file.ProcessId == 4)
    return TRUE; 
System process pid is 8 on 2k and 2 on NT4 IIRC

When getting SystemHandleInformation on <=2003 (no more service packs there) you can check the object type directly without the need for threads (Must skip pipe's IIRC)
LoRd_MuldeR#
Originally Posted by Afrow UK View Post
Just noticed /autonext is missing from the readme (except under the changelog). Will fix the readme. /autonext is what you want.

Stu
That's something I've been looking for too.

Small request: Would it be possible to proceed automatically, as soon as all conflicting programs have been closed?

Currently it only proceeds automatically if initially no conflicting program was running...
Afrow UK#
Originally Posted by LoRd_MuldeR View Post
Small request: Would it be possible to proceed automatically, as soon as all conflicting programs have been closed?
This is in for next version. Thanks Anders I will look into that. I used threads because sometimes the func calls never return. Do you mean this should not happen on <= 2003? MuldeR, is there some remoting software you can install on the 2000 VM so that I can access it? I'm not sure if LogMeIn is an option. The other option I guess is I buy and mount a drive to install 2000 on and then create a VirtualBox image from it.

Stu
LoRd_MuldeR#
Originally Posted by Afrow UK View Post
This is in for next version. Thanks Anders I will look into that. I used threads because sometimes the func calls never return. Do you mean this should not happen on <= 2003? MuldeR, is there some remoting software you can install on the 2000 VM so that I can access it? I'm not sure if LogMeIn is an option. The other option I guess is I buy and mount a drive to install 2000 on and then create a VirtualBox image from it.

Stu
Is TeamViewer okay for you? (see your PM)
Anders#
Originally Posted by Afrow UK View Post
Do you mean this should not happen on <= 2003?
Stu
No, I mean the object type constants are known, and only certain object types cause problems when getting their name, so you can filter away based on the type before getting the names of the types you are interested in...
LoRd_MuldeR#
Originally Posted by LoRd_MuldeR View Post
Is TeamViewer okay for you? (see your PM)
Afrow UK, still interested in Win2k remote access? Got my PM?

I am ready...
MrSpock77#
Originally Posted by Afrow UK View Post
Just noticed /autonext is missing from the readme (except under the changelog). Will fix the readme. /autonext is what you want.

Stu
Thank you!
mrphantuan#
Currently it grabs the first window caption for that process id by using EnumWindows. I'll look into it. Maybe I can check if the window is a child or not and if it is then skip it.

Stu







________________
Chúng tôi là một trong những công ty tu van du hoc hàng đầu Việt Nam .Chúng tôi là đại diện cho nhiều tập đoàn du hoc hàng đầu TG tại Vietnam .Hàng năm đều có các xuất hoc bong du hoc miễn phí đi vụ du hoc singapore.
LoRd_MuldeR#
Originally Posted by Afrow UK View Post
This is in for next version. Thanks Anders I will look into that. I used threads because sometimes the func calls never return. Do you mean this should not happen on <= 2003? MuldeR, is there some remoting software you can install on the 2000 VM so that I can access it? I'm not sure if LogMeIn is an option. The other option I guess is I buy and mount a drive to install 2000 on and then create a VirtualBox image from it.

Stu
Sorry for bumping this thread, but are there any news on this? 😕

(The offer still stands: If I can help by providing access to the Win2k machine, feel free to contact me at any time!)
Afrow UK#
Hi just an update on this. Sorry LoRd_MuldeR I never got to take up your offer on the Windows 2000 VM you had set up. Fortunately I was able to get a copy and use it in VirtualBox. The issue you found is now fixed. I just need to fix up the other small issues that Anders pointed out. Should have a new version out later today.

Stu
LoRd_MuldeR#
Originally Posted by Afrow UK View Post
Hi just an update on this. Sorry LoRd_MuldeR I never got to take up your offer on the Windows 2000 VM you had set up. Fortunately I was able to get a copy and use it in VirtualBox. The issue you found is now fixed. I just need to fix up the other small issues that Anders pointed out. Should have a new version out later today.

Stu
That's good news 🙂