System::Call 'netapi32::NetUserEnum'
Hey,
I have some trouble using the System::Call 'netapi32::NetUserEnum'!
I need a way to get a list of the local users.
Some months ago "Anders" adviced me to use the System-Plugin:
http://forums.winamp.com/showthread.php?s=&threadid=304642&highlight=exec
I am using the functions written by "CancerFace". This worked fine for a while but once in a while I am running into some kind of memory-leak?!?!
I found the Thread about it:
http://forums.winamp.com/showthread.php?s=&threadid=243303&highlight=EnumerateUsers
I wrote for testing a small installer with a loop. When I set the number of iterations high the error always appears. Is there something I am doing wrong? I am really thankful for any help that you guys can give me.
This is my test-installer:
!include "Sections.nsh"
!include "LogicLib.nsh"
;--------------------------------
Name "One Section"
OutFile "one-section.exe"
;--------------------------------
Var i
Var j
!macro EnumerateUsers SERVER_NAME
messagebox mb_ok|mb_iconexclamation 'Start'
!define Index "Line${__LINE__}"
StrCpy $j 0
Loop:
IntOp $j $j + 1
System::Call 'netapi32::NetUserEnum(w "${SERVER_NAME}",i 0,i 2,*i .R0,i -1, \
*i .R1,*i .R2,*i .r1)i .r2'
StrCpy $R8 $R0
StrCpy $9 0
${Index}-loop:
StrCmp $9 $R2 ${Index}-stop +1
;messagebox mb_ok|mb_iconexclamation 'BEFORE CALL! R0:[$R0]'
System::Call "*$R0(w .R9)"
IntOp $i $9 + 1
IntOp $R0 $R0 + 4
IntOp $9 $9 + 1
Goto ${Index}-loop
${Index}-stop:
System::Call 'netapi32.dll::NetApiBufferFree(i R8)i .R1'
${If} $j < "1000"
goto Loop
${EndIf}
!undef Index
messagebox mb_ok|mb_iconexclamation 'Stop'
!macroend
;--------------------------------
; Sections
Section !Required
!insertmacro EnumerateUsers "\\127.0.0.1"
SectionEnd