Hi!
I tried to make a list of all computers in local network under Win98. Program works improperly. Why?
Thanks,
Mike

*****************************************
.386
.model flat, stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\masm32.inc
include \masm32\include\svrapi.inc

includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\svrapi.lib

.data
MsgCaption db "Error code",0
MsgCaption1 db "Net resource name",0
Msg1 db "Net resource not found", 0
Msg2 db "Low memory for buffer", 0
Server db "\\Central", 0

.data?
retCode db 16 dup (?)
entriesRead dd ?
entriesAvail dd ?
hMem dd ?
buf db 128 dup(?)

.code
start:
invoke GlobalAlloc, GMEM_FIXED OR GMEM_ZEROINIT, 10000
mov hMem, eax

invoke NetSessionEnum,
addr Server,
0,
hMem,
10000,
addr entriesRead,
addr entriesAvail

.if eax != 0
.if eax==2392
invoke MessageBox, NULL,addr Msg1, addr MsgCaption, MB_OK
.elseif eax==2123
invoke MessageBox, NULL,addr Msg2, addr MsgCaption, MB_OK
.else
invoke dwtoa, eax, addr retCode
invoke MessageBox, NULL,addr retCode, addr MsgCaption, MB_OK
.endif

.else
invoke dwtoa, entriesRead, addr retCode
invoke MessageBox, NULL,addr retCode, addr MsgCaption, MB_OK

mov esi, hMem
mov ebx, 0
.while ebx<entriesRead
mov eax,
mov eax,
invoke MessageBox, NULL, offset buf, addr MsgCaption1, MB_OK
add esi, 4
inc ebx
.endw
.endif

invoke GlobalFree, hMem
invoke ExitProcess,NULL
end start
*************************************************
Posted on 2002-06-14 05:44:09 by Mike
NetSessionEnum does not give you a list of all local computers. It lists the current sessions(share connections) on the specified machine.
Posted on 2002-06-20 22:38:07 by rdaneel