Old 30th January 2006, 15:15   #1
JoeAcunzo
Junior Member
 
Join Date: Feb 2004
Posts: 29
Question How to Detect Other Windows Logons

During an install, is there a way to detect if there are other Window users logged into the machine? I want to prevent installation if there are other users logged on.
JoeAcunzo is offline   Reply With Quote
Old 31st January 2006, 17:43   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You can write a plug-in that'd use WTSEnumerateSessions or call it using the System plug-in.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 31st January 2006, 21:05   #3
JoeAcunzo
Junior Member
 
Join Date: Feb 2004
Posts: 29
Yep, I've started down that path already. I wrote a small C++ program to experiment with WTSEnumerateSessions, which works nicely.

Unfortunately, it will be a bit of a pain in NSIS due to the memory pointer it returns to an array of structures. Can you point me to any sample NSIS code that does something similar (use a pointer to walk an array of structs)?
JoeAcunzo is offline   Reply With Quote
Old 31st January 2006, 22:44   #4
goldy1064
Senior Member
 
Join Date: Jun 2005
Posts: 211
In the plugin you already wrote, just add another function that can return the appropriate data you need to the installer via the NSIS stack.
goldy1064 is offline   Reply With Quote
Old 3rd February 2006, 09:44   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You said you wanted to find out if another user is logged on, there's no need to return an array to the script for that. Have the plug-in check if there's more than one session and return a simple string.

If you want to return an array anyway, check out:

http://nsis.sourceforge.net/Enumerate_CD-ROM_Drives

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 12th November 2007, 17:33   #6
M-Force
Junior Member
 
Join Date: Mar 2006
Posts: 28
Logged on more than one user detection

Hi JoeAcunzo,

I try to figure out as well if other users are logged on to the system at install time.

Could you please post your solution how to detect if multiple users are logged on.

Thank you very much for your help.

M.
M-Force is offline   Reply With Quote
Old 22nd November 2007, 14:16   #7
mazdakam
Junior Member
 
mazdakam's Avatar
 
Join Date: Nov 2007
Posts: 35
Hello

I try to figure out as well if other users are logged on to the system at install time.

Could you please post your solution how to detect if multiple users are logged on.
i need it thanks
mazdakam is offline   Reply With Quote
Old 23rd November 2007, 08:09   #8
mazdakam
Junior Member
 
mazdakam's Avatar
 
Join Date: Nov 2007
Posts: 35
BUMP
mazdakam is offline   Reply With Quote
Old 26th November 2007, 19:53   #9
mazdakam
Junior Member
 
mazdakam's Avatar
 
Join Date: Nov 2007
Posts: 35
Ok i try my best to fine solution and as my little knowledge in scripting i was not successes man in this case

i read whole of forum
and wiki and read me and hep file

as i don't want to create new topic with the same tile so decide to pop up this old topic the only one that discuss about detecting multiuser login in one system

what i need exactly?

i need a solution to detect if another user except current user are log in to the system or not and if it is force them to log off

i know all of you are busy but i will wait for your answer because i can;t down anything else i am newbie in everything

any help...
any little suggestion...
Thanks
mazdakam is offline   Reply With Quote
Old 26th November 2007, 22:23   #10
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
I supplied the answer in my first reply.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 5th December 2007, 20:44   #11
mazdakam
Junior Member
 
mazdakam's Avatar
 
Join Date: Nov 2007
Posts: 35
please explain more how can i call WTSEnumerateSessions with system?

is there more simple way to detect if a user is log in or not?
mazdakam is offline   Reply With Quote
Old 5th December 2007, 20:54   #12
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
code:
!include LogicLib.nsh
#...
System::Call 'wtsapi32::WTSEnumerateSessions(i 0, i 0, i 1, *i .r0, *i .r1) i .r2'
${If} $2 != 0
${If} $1 != 1
MessageBox MB_OK "more than one user logged in"
${EndIf}
System::Call 'wtsapi32::WTSFreeMemory(i r0)'
${EndIf}


NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 5th December 2007, 21:30   #13
mazdakam
Junior Member
 
mazdakam's Avatar
 
Join Date: Nov 2007
Posts: 35
thank you very much
and worked for me
but how can i forced the other users log of after detecting other users are log in?
mazdakam is offline   Reply With Quote
Old 5th December 2007, 21:59   #14
mazdakam
Junior Member
 
mazdakam's Avatar
 
Join Date: Nov 2007
Posts: 35
sorry i try it vut dowsent work correctly
in your cod wht is $2?
mazdakam is offline   Reply With Quote
Old 6th December 2007, 22:24   #15
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
$2 is zero for me as it should always be.

WTSLogoffSession can be used to logoff sessions.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 8th December 2007, 15:22   #16
mazdakam
Junior Member
 
mazdakam's Avatar
 
Join Date: Nov 2007
Posts: 35
you said:
WTSLogoffSession can be used to log off sessions.

I used a shutdown plug in for force current user to log off
but if i understand right i can use WTSLogoffSession for forcing other user to log off. am i in true way?
mazdakam is offline   Reply With Quote
Old 8th December 2007, 15:25   #17
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Yes.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 9th December 2007, 09:37   #18
mazdakam
Junior Member
 
mazdakam's Avatar
 
Join Date: Nov 2007
Posts: 35
i c. so which parameter do i need to work on it?
hServer
ppSessionInfo
pCount

adn how tell this function to log off other user?
mazdakam is offline   Reply With Quote
Old 9th December 2007, 12:33   #19
CancerFace
Senior Member
 
Join Date: Apr 2006
Posts: 289
Send a message via ICQ to CancerFace
WTSEnumerateSessions will give you an array of WTS_SESSION_INFO structures and each one contains a SessionId for a given active session. Use kichik's code for the WTSEnumerateSessions function but do not call the WTSFreeMemory function before you extract the info you need from the structures that reside in $0.
Then call the WTSLogoffSession with one of the extracted SessionIds in order to logoff that session ...
Hope this helps ...
CF
CancerFace is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump