...um, how to do that (please some example code)?
Posted on 2002-08-07 11:17:47 by Christopher
ScanNetwork PROC
LOCAL hdc:HDC

invoke GetDC, hWnd
mov eax, hdc
invoke EnumerateFunc, hWnd, hdc, NULL
invoke ReleaseDC, hWnd, hdc

RET
ScanNetwork ENDP

EnumerateFunc PROC hwnd:DWORD, hdc:DWORD, lpnr:DWORD
LOCAL dwResult:DWORD
LOCAL dwResultEnum:DWORD
LOCAL hEnum:DWORD
LOCAL lpnrLocal:DWORD ;pointer to enumerated structures
LOCAL i:DWORD
LOCAL cEntries:DWORD

mov cEntries, 0FFFFFFFFh ;enumerate all possible entries
mov dword ptr dwResult, 0
invoke WNetOpenEnum, RESOURCE_GLOBALNET, RESOURCETYPE_DISK, 0, lpnr, addr hEnum
.if EAX != NO_ERROR
xor eax,eax ;?????? FALSE
RET
.endif

.repeat

;Allocate memory for NETRESOURCE structures.
invoke GlobalAlloc, GPTR, cbBuffer
mov lpnrLocal, eax

invoke WNetEnumResource, hEnum, addr cEntries, lpnrLocal, addr cbBuffer
mov dwResultEnum, eax

.if dwResultEnum == NO_ERROR
mov ecx, cEntries
lab1739:
push ecx

; If this NETRESOURCE is a container, call the function
; recursively.

shl ecx, 5 ;????????? ?? 32 (??????? ?? ???????????)
mov ebx, dword ptr
add ebx, ecx

push ecx
push ebx
add ebx, 20
mov eax, dword ptr ;.lpRemoteName
INVOKE MessageBox, NULL, eax, ADDR AppName, MB_OK
pop ebx
pop ecx

add ebx, 12
mov eax, dword ptr ;.dwUsage
and eax, RESOURCEUSAGE_CONTAINER
cmp eax, RESOURCEUSAGE_CONTAINER
jne lab1765
mov ebx, dword ptr
add ebx, ecx
invoke EnumerateFunc, hWnd, hdc, ebx
pop ecx
loop lab1739

.elseif (dwResultEnum != ERROR_NO_MORE_ITEMS)
szText szWNetEnumResource,"WNetEnumResource"
INVOKE MessageBox, NULL, szWNetEnumResource, ADDR AppName, MB_OK
.endif

.until dwResultEnum != ERROR_NO_MORE_ITEMS

invoke GlobalFree, lpnrLocal


invoke WNetCloseEnum, hEnum
mov dwResult, eax

.if dwResult != NO_ERROR
xor eax,eax ;?????? FALSE
RET
.endif

mov eax,1 ;?????? TRUE
RET
EnumerateFunc ENDP
Posted on 2002-08-07 18:55:31 by martidim
martidim, moi Bolgarskiy tovarish!
Posted on 2002-08-07 19:44:28 by comrade
...
Posted on 2002-08-09 12:52:02 by Christopher