Why did I fail to enum workgroups?
I want to enum workgroups in LAN by calling Windows API WNetOpenEnum() and WNetEnumResource() under MASM V8.
But the result differed from the real.
This program is consulted MSDN demonstrates program.

I need your helps.

Thanks


; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; FileName: GrpList.asm
; Function: Call SendMessageBufferSend() to list all group in LAN
; Author: Purple Endurer
; Develop: MASM32 V8
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
.386
.model flat, stdcall
option casemap :none

include /masm32/include/windows.inc

include /masm32/include/mpr.inc
include /masm32/include/user32.inc
include /masm32/include/kernel32.inc
include /masm32/include/comctl32.inc

includelib /masm32/lib/mpr.lib
includelib /masm32/lib/user32.lib
includelib /masm32/lib/kernel32.lib
includelib /masm32/lib/comctl32.lib

IDC_gbSTATE EQU 3000

WinMain PROTO :HINSTANCE, :HINSTANCE, :LPSTR, :DWORD
DlgProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
lvResInstertColumn PROTO
AddResLine PROTO :DWORD, :DWORD

.const
conShowDbgMsg equ 0
conRES_BUFF_LEN equ 16384
con_lvResID equ 10000

.data
szDlgName db "DlgGrpList",0
szAppName db "Workgroup List", 0

szLVClassName db "SysListView32", 0
szCreateListBoxFail db "Fail to Create ListBox!", 0
szlvResHeading1 db "Remote Name", 0
szlvResHeading2 db "Local Name", 0
szlvResHeading3 db "comment", 0


g_cCount DWORD -1
g_cbBuff DWORD conRES_BUFF_LEN

szERROR_NOT_CONTAINER db "ERROR_NOT_CONTAINER", 0
szERROR_INVALID_PARAMETER db "ERROR_INVALID_PARAMETER", 0

szERROR_NO_MORE_ITEMS db "There are no more entries. The buffer contents are undefined.", 0
szERROR_MORE_DATA db "More entries are available with subsequent calls.", 0
szERROR_INVALID_HANDLE db "The handle specified by the hEnum parameter is not valid.", 0
szERROR_NO_NETWORK db "The network is unavailable.", 0
szERROR_EXTENDED_ERROR db "A network-specific error occurred!", 0

g_szFmt db "Find %d resurces!", 0

.data?
g_hInstance dd ?
g_hDlg dd ?

g_hlvRes HANDLE ?

g_hResEnum HANDLE ?
g_nrLocal DWORD conRES_BUFF_LEN dup (?)

g_szBuff db 256 dup (?)

.code

start:
invoke GetModuleHandle, NULL
mov g_hInstance, eax

invoke DialogBoxParam, g_hInstance, offset szDlgName, NULL, offset DlgProc, NULL

invoke ExitProcess, 0
invoke InitCommonControls


DlgProc proc hDlg: DWORD, uMsg: DWORD, wParam: DWORD, lParam: DWORD

.if uMsg == WM_INITDIALOG
;-- --------------------------------
; Create List Box
;----------------------------------

invoke CreateWindowEx, WS_EX_CLIENTEDGE, offset szLVClassName, NULL,\
LVS_REPORT + WS_CHILD + WS_VISIBLE + WS_EX_WINDOWEDGE + WS_TABSTOP,\
2, 15, 310, 150, hDlg, con_lvResID, g_hInstance, NULL

.IF eax == NULL
invoke MessageBox, hDlg, offset szCreateListBoxFail, offset szAppName, MB_OK + MB_ICONSTOP
invoke EndDialog, hDlg, NULL
ret
.ENDIF

mov g_hlvRes, eax


;----------------------------------
; Set List Box's column caption
;----------------------------------

invoke lvResInstertColumn

;----------------------------------
; Get the handle is need to enum resource
;----------------------------------

; DWORD WNetOpenEnum(
; DWORD dwScope,
; DWORD dwType,
; DWORD dwUsage,
; LPNETRESOURCE lpNetResource,
; LPHANDLE lphEnum
; );

invoke WNetOpenEnum, RESOURCE_GLOBALNET, RESOURCETYPE_DISK, RESOURCEUSAGE_CONTAINER,\
NULL, offset g_hResEnum

;----------------------------------
; fail and handle
;----------------------------------

.IF EAX != NO_ERROR
.if eax == ERROR_NOT_CONTAINER
;The lpNetResource parameter does not point to a container.
mov esi, offset szERROR_NOT_CONTAINER

.elseif eax == ERROR_INVALID_PARAMETER
;Either the dwScope or the dwType parameter is invalid,
;or there is an invalid combination of parameters.
mov esi, offset szERROR_INVALID_PARAMETER

.elseif eax == ERROR_NO_NETWORK
;The network is unavailable.
mov esi, offset szERROR_NO_NETWORK

.elseif eax == ERROR_EXTENDED_ERROR
;A network-specific error occurred. To obtain a description of the error,
;call the WNetGetLastError function.
mov esi, offset szERROR_EXTENDED_ERROR
.endif
invoke MessageBox, hDlg, esi, offset szAppName, MB_OK + MB_ICONSTOP
invoke EndDialog, hDlg, NULL
ret
.ENDIF


;----------------------------------
; succeed! begin to enum resource
;----------------------------------


.WHILE TRUE
invoke RtlZeroMemory, offset g_nrLocal, sizeof g_nrLocal

; DWORD WNetEnumResource(
; HANDLE hEnum,
; LPDWORD lpcCount,
; LPVOID lpBuffer,
; LPDWORD lpBufferSize
; );


invoke WNetEnumResource, g_hResEnum, offset g_cCount, offset g_nrLocal, offset g_cbBuff

.if eax == NO_ERROR

;----------------------------------
; Find the resource
;----------------------------------

;----------------------------------
;Display the resource number
;----------------------------------
pushad
invoke wsprintf, offset g_szBuff, offset g_szFmt, g_cCount
invoke MessageBox, hDlg, offset g_szBuff, offset szAppName, MB_OK
popad

;----------------------------------
; Get the information of found resource
;----------------------------------

push edx
mov edx, offset g_nrLocal
;assume edx: ptr NETRESOURCE

mov eax, g_cCount
.WHILE (eax)
push eax
push edx
invoke AddResLine, eax, edx
pop edx
;inc edx
add edx, sizeof NETRESOURCE
pop eax
dec eax
.ENDW
pop edx
;assume edx:ptr nothing

.else


;----------------------------------
; No find resource
; ----------------------------------

.IF eax == ERROR_NO_MORE_ITEMS
;There are no more entries. The buffer contents are undefined
mov edx, offset szERROR_NO_MORE_ITEMS
.ELSEIF eax == ERROR_MORE_DATA
;More entries are available with subsequent calls.
mov edx, offset szERROR_MORE_DATA
.ELSEIF eax == ERROR_INVALID_HANDLE
;The handle specified by the hEnum parameter is not valid.
mov edx, offset szERROR_INVALID_HANDLE
.ELSEIF eax == ERROR_NO_NETWORK
;The network is unavailable.
;(This condition is tested before hEnum is tested for validity.)
mov edx, offset szERROR_NO_NETWORK
.ELSEIF eax == ERROR_EXTENDED_ERROR
;A network-specific error occurred.
;To obtain a description of the error, call the WNetGetLastError function.
mov edx, offset szERROR_EXTENDED_ERROR
.ENDIF

invoke MessageBox, hDlg, edx, offset szAppName, MB_OK + MB_ICONSTOP
.break
.endif
.ENDW

.elseif uMsg == WM_CLOSE
; DWORD WNetCloseEnum(
; HANDLE hEnum
; );
invoke WNetCloseEnum, g_hResEnum

invoke EndDialog, hDlg, 0
ret
.endif

xor eax,eax
ret
DlgProc endp


;================================
; Set List Box's column caption
;================================

lvResInstertColumn proc
LOCAL lvc: LV_COLUMN

mov lvc.imask, LVCF_TEXT + LVCF_WIDTH
mov lvc.pszText, offset szlvResHeading1
mov lvc.lx, 150
invoke SendMessage, g_hlvRes, LVM_INSERTCOLUMN, 0, addr lvc

or lvc.imask, LVCF_FMT
mov lvc.fmt, LVCFMT_CENTER
mov lvc.pszText, offset szlvResHeading2
mov lvc.lx, 80
invoke SendMessage, g_hlvRes, LVM_INSERTCOLUMN, 1, addr lvc

mov lvc.pszText, offset szlvResHeading3
invoke SendMessage, g_hlvRes, LVM_INSERTCOLUMN, 2, addr lvc

ret
lvResInstertColumn endp


;===========================================
;Add the information of resource to LISTBOX
;===========================================
AddResLine proc uses edi row: DWORD, lpNetRes: DWORD
LOCAL lvi: LV_ITEM
LOCAL buffer[20]: BYTE

; typedef struct _NETRESOURCE {
; DWORD dwScope;
; DWORD dwType;
; DWORD dwDisplayType;
; DWORD dwUsage;
; LPTSTR lpLocalName;
; LPTSTR lpRemoteName;
; LPTSTR lpComment;
; LPTSTR lpProvider;
; } NETRESOURCE;

mov edi, lpNetRes
assume edi: ptr NETRESOURCE

mov lvi.imask, LVIF_TEXT
push row
pop lvi.iItem
mov lvi.iSubItem, 0
;lea eax, [edi].lpRemoteName
mov eax, [edi].lpRemoteName
mov lvi.pszText, eax
invoke SendMessage, g_hlvRes, LVM_INSERTITEM, 0, addr lvi

mov lvi.imask, LVIF_TEXT
inc lvi.iSubItem
;lea eax, [edi].lpLocalName
mov eax, [edi].lpLocalName
mov lvi.pszText, eax
invoke SendMessage, g_hlvRes, LVM_SETITEM, 0, addr lvi

inc lvi.iSubItem
;lea eax, [edi].lpComment
mov eax, [edi].lpComment
mov lvi.pszText, eax
invoke SendMessage, g_hlvRes, LVM_SETITEM, 1, addr lvi

assume edi: nothing
ret
AddResLine endp

end start






; <<<<<<<<<<<<<<
; rsrc.rc
; <<<<<<<<<<<<<<


#include "\masm32\include\resource.h"

DlgGrpList DIALOG DISCARDABLE 0, 0, 253, 120
STYLE DS_CENTER | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | DS_3DLOOK | WS_EX_TOOLWINDOW
CAPTION "Workgroup list"
{
}
Posted on 2004-03-13 04:23:29 by purpleendurer
purpleendurer,

1. Don't post in multiple forums
2. Use
 tags around your code next time

3. What have you tried yourself? Where does it go wrong? Have you debugged your program? Please try some things yourself and explain what you've tried instead of just posting a lot of code.

Thomas
Posted on 2004-03-13 08:00:10 by Thomas
To Thomas:

Sorry, I am a freshman!


This program can only find "Microsoft Windows Network" running under Windows 98 and Windows 2000 professional, but there are 3 workgroups in the LAN.

I tracked this program with OllDbg, but find nothing...
Posted on 2004-03-13 09:31:04 by purpleendurer
purpleendurer, your workgroups are subnodes of the "Microsoft Windows Network" node. If the NETRESOURCE indicates a RESOURCEUSAGE_CONTAINER, you just have to WNetOpenEnum() it and iterate through its WNetEnumResource() results.
Posted on 2004-03-14 11:06:00 by Morris
To Morris:

Thanks.

I will test according to your way.
Posted on 2004-03-16 08:43:21 by purpleendurer
I has sovlved the question!

Thanks all.


Here is the code:



; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; FileName: GrpList.asm
; Function: Call WNetOpenEnum() and WNetEnumResource()
; to enum all groups in LAN
; Author: Purple Endurer
; Develop: MASM32 V8
; 2004-03-19
; Replaced ListBox with TreeView
; 2004-03-18
; OK!
; 2004-03-10
; Created!
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

.386
.model flat, stdcall
option casemap: none

include /masm32/include/windows.inc

include /masm32/include/mpr.inc
include /masm32/include/gdi32.inc
include /masm32/include/user32.inc
include /masm32/include/comctl32.inc
include /masm32/include/kernel32.inc

includelib /masm32/lib/mpr.lib
includelib /masm32/lib/gdi32.lib
includelib /masm32/lib/user32.lib
includelib /masm32/lib/comctl32.lib
includelib /masm32/lib/kernel32.lib


WinMain PROTO :DWORD, :DWORD, :DWORD, :DWORD
GetEnumHandle PROTO :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
EnumNetResource PROTO :DWORD, :DWORD, :HANDLE, :HANDLE


.const
IDB_TREE equ 4006
conRES_BUFF_LEN equ 16384


.data
g_szClassName db "GrpListWinCls", 0
g_szAppName db "WorkGroup List", 0

g_szTreeViewClass db "SysTreeView32", 0
szCreateTreeViewFail db "Fail to create TreeView!", 0

g_cCount DWORD -1
g_cbBuff DWORD conRES_BUFF_LEN

g_szWNetOpenEnum db "WNetOpenEnum", 0
g_szWNetEnumResource db "WNetEnumResource", 0
szERROR_NOT_CONTAINER db "ERROR_NOT_CONTAINER", 0
szERROR_INVALID_PARAMETER db "ERROR_INVALID_PARAMETER", 0

szERROR_NO_MORE_ITEMS db "There are no more entries. The buffer contents are undefined.", 0
szERROR_MORE_DATA db "More entries are available with subsequent calls.", 0
szERROR_INVALID_HANDLE db "The handle specified by the hEnum parameter is not valid.", 0
szERROR_NO_NETWORK db "The network is unavailable.", 0
szERROR_EXTENDED_ERROR db "A network-specific error occurred!", 0

g_szFmt db "Find: %d", 0


.data?
hInstance HINSTANCE ?
g_hWnd HANDLE ?
g_hTreeView HANDLE ?
g_hTreeRoot HANDLE ?
g_hImageList HANDLE ?

g_hResEnum HANDLE ?
g_nrLocal db conRES_BUFF_LEN dup (?)
g_nrLocal1 db conRES_BUFF_LEN dup (?)

g_szBuff db 256 dup (?)


.code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke WinMain, hInstance, NULL, NULL, SW_SHOWDEFAULT
invoke ExitProcess, eax
invoke InitCommonControls

WinMain proc hInst:HINSTANCE, hPrevInst:HINSTANCE, CmdLine:LPSTR, CmdShow:DWORD
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
LOCAL hwnd:HWND

mov wc.cbSize, SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground, COLOR_APPWORKSPACE
mov wc.lpszMenuName, NULL
mov wc.lpszClassName, OFFSET g_szClassName
invoke LoadIcon, NULL, IDI_APPLICATION
mov wc.hIcon, eax
mov wc.hIconSm, eax
invoke LoadCursor, NULL, IDC_ARROW
mov wc.hCursor, eax
invoke RegisterClassEx, addr wc
invoke CreateWindowEx, WS_EX_CLIENTEDGE, ADDR g_szClassName, ADDR g_szAppName,\
WS_OVERLAPPED+WS_CAPTION+WS_SYSMENU+WS_MINIMIZEBOX+WS_MAXIMIZEBOX+WS_VISIBLE,\
CW_USEDEFAULT, CW_USEDEFAULT, 200, 400, NULL, NULL, hInst, NULL
mov hwnd, eax
.while TRUE
invoke GetMessage, ADDR msg, NULL, 0, 0
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.endw
mov eax, msg.wParam
ret
WinMain endp


WndProc proc uses edi hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
LOCAL hBitmap: DWORD

.if uMsg==WM_CREATE
push hWnd
pop g_hWnd

;----------------
;Create TrewView
;----------------
invoke CreateWindowEx, NULL, ADDR g_szTreeViewClass, NULL,\
WS_CHILD+WS_VISIBLE+TVS_HASLINES+TVS_HASBUTTONS+TVS_LINESATROOT, 0,\
0, 200, 400, hWnd, NULL, hInstance, NULL

.IF eax == NULL
invoke MessageBox, hWnd, offset szCreateTreeViewFail, offset g_szAppName, MB_OK + MB_ICONSTOP
invoke PostMessage, hWnd, WM_CLOSE, 0, 0
ret
.ENDIF

mov g_hTreeView, eax

;----------------
;Create ImageList
;----------------
invoke ImageList_Create, 16, 16, ILC_COLOR16, 2, 10
mov g_hImageList, eax
invoke LoadBitmap, hInstance, IDB_TREE
mov hBitmap, eax
invoke ImageList_Add, g_hImageList, hBitmap, NULL
invoke DeleteObject, hBitmap

;----------------------------------
;Set ImageList relation to TreeView
;----------------------------------
invoke SendMessage, g_hTreeView, TVM_SETIMAGELIST, 0, g_hImageList

;----------------------------------
;Enum the root of the network
;----------------------------------
invoke GetEnumHandle, RESOURCE_GLOBALNET, RESOURCETYPE_DISK, RESOURCEUSAGE_CONTAINER,\
NULL, offset g_hResEnum
.IF (eax == 1)
invoke PostMessage, hWnd, WM_CLOSE, 0, 0
ret
.ENDIF

invoke EnumNetResource, g_hResEnum, offset g_nrLocal, NULL, TVI_ROOT

;----------------------------------
;Get the handle of root of TreeView
;----------------------------------
invoke SendMessage, g_hTreeView, TVM_GETNEXTITEM, TVGN_ROOT, 0
mov g_hTreeRoot, eax

;----------------------------------
;Enum the group of the network
;----------------------------------
[color=red]
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;These two instructions below are essential
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
mov dword ptr g_cCount, -1
mov dword ptr g_cbBuff, conRES_BUFF_LEN
[/color]
invoke GetEnumHandle, RESOURCE_GLOBALNET, RESOURCETYPE_DISK, RESOURCEUSAGE_CONTAINER,\
offset g_nrLocal, offset g_hResEnum
.IF (eax == 1)
invoke PostMessage, hWnd, WM_CLOSE, 0, 0
ret
.ENDIF

invoke EnumNetResource, g_hResEnum, offset g_nrLocal1, g_hTreeRoot, TVI_LAST

.elseif uMsg==WM_DESTROY
invoke PostQuitMessage, NULL

.else
invoke DefWindowProc, hWnd, uMsg, wParam, lParam
ret
.endif
xor eax, eax
ret
WndProc endp


;//////////////////////////////////////////////////////////////////////////////////////////////////////
;Function: Get the handle to enum net resource
; Input: dwNetResScope - Scope of the enumeration
; dwResType - Resource types to be enumerated
; dwNetResUsage - Resource usage type to be enumerated
; lpNetRes - Pointer to a NETRESOURCE structure that specifies the container to enumerate.
; lphResEnum - pointer to the handle that identifies an enumeration instance
; Output: If succeeds, return 0, and lphResEnum pointer to the handle to enum net resource
; else return 1
;////////////////////////////////////////////////////////////////////////////////////////////////////////
GetEnumHandle proc dwResScope: DWORD, dwResType: DWORD,\
dwResUsage: DWORD, lpNetRes: DWORD, lphResEnum: DWORD

; DWORD WNetOpenEnum(
; DWORD dwScope,
; DWORD dwType,
; DWORD dwUsage,
; LPNETRESOURCE lpNetResource,
; LPHANDLE lphEnum
; );

invoke WNetOpenEnum, dwResScope, dwResType, dwResUsage,\
lpNetRes, lphResEnum

.IF EAX != NO_ERROR
.if eax == ERROR_NOT_CONTAINER
;The lpNetResource parameter does not point to a container.
mov esi, offset szERROR_NOT_CONTAINER

.elseif eax == ERROR_INVALID_PARAMETER
;Either the dwScope or the dwType parameter is invalid,
;or there is an invalid combination of parameters.
mov esi, offset szERROR_INVALID_PARAMETER

.elseif eax == ERROR_NO_NETWORK
;The network is unavailable.
mov esi, offset szERROR_NO_NETWORK

.elseif eax == ERROR_EXTENDED_ERROR
;A network-specific error occurred. To obtain a description of the error,
;call the WNetGetLastError function.
mov esi, offset szERROR_EXTENDED_ERROR
.endif
invoke MessageBox, g_hWnd, esi, offset g_szWNetOpenEnum, MB_OK + MB_ICONSTOP
mov eax, 1
ret
.ENDIF
xor eax, eax
ret
GetEnumHandle endp


;//////////////////////////////////////////////////////////////////////////////////////
;Function: Enum the net resources and insert it into TreeView
; Input: hEnumRes - Handle that identifies an enumeration instance
; lpNetResBuf - Pointer to the buffer that receives the enumeration results.
; (The buffer is an array of NETRESOURCE structures)
; hParent - Handle to the parent item in TreeView
; hInsertAfter - Handle to the item after which the new item is to be inserted,
; or one of the following values:
; TVI_FIRST, TVI_LAST, TVI_ROOT, TVI_SORT
;
; Output: (none)
;///////////////////////////////////////////////////////////////////////////////////////

EnumNetResource proc hEnumRes: DWORD, lpNetResBuf: DWORD, hParent: HANDLE, hInsertAfter; HANDLE
LOCAL tvinsert:TV_INSERTSTRUCT

invoke RtlZeroMemory, lpNetResBuf, sizeof g_nrLocal
.WHILE TRUE

; DWORD WNetEnumResource(
; HANDLE hEnum,
; LPDWORD lpcCount,
; LPVOID lpBuffer,
; LPDWORD lpBufferSize
; );


invoke WNetEnumResource, hEnumRes, offset g_cCount, lpNetResBuf, offset g_cbBuff

.if eax == NO_ERROR

pushad
invoke wsprintf, offset g_szBuff, offset g_szFmt, g_cCount
invoke MessageBox, g_hWnd, offset g_szBuff, offset g_szAppName, MB_OK
popad

mov eax, g_cCount
.IF (g_cCount == 0)
jmp @NoMore
.endif

; typedef struct _NETRESOURCE {
; DWORD dwScope;
; DWORD dwType;
; DWORD dwDisplayType;
; DWORD dwUsage;
; LPTSTR lpLocalName;
; LPTSTR lpRemoteName;
; LPTSTR lpComment;
; LPTSTR lpProvider;
; } NETRESOURCE;

push edi
mov edi, lpNetResBuf

.WHILE (eax > 0)
push eax
push edi

push hParent
pop tvinsert.hParent
push hInsertAfter
pop tvinsert.hInsertAfter
mov tvinsert.item._mask, TVIF_TEXT + TVIF_IMAGE + TVIF_SELECTEDIMAGE

assume edi: ptr NETRESOURCE
push [edi].lpRemoteName
assume edi: ptr nothing
pop tvinsert.item.pszText
mov tvinsert.item.iImage, 0
mov tvinsert.item.iSelectedImage, 1
invoke SendMessage, g_hTreeView, TVM_INSERTITEM, 0, addr tvinsert

pop edi
;inc edx
add edi, sizeof NETRESOURCE
pop eax
dec eax
.ENDW
pop edi

.else
.IF eax == ERROR_NO_MORE_ITEMS
@NoMore:
;There are no more entries. The buffer contents are undefined
mov edx, offset szERROR_NO_MORE_ITEMS
.ELSEIF eax == ERROR_MORE_DATA
;More entries are available with subsequent calls.
mov edx, offset szERROR_MORE_DATA
.ELSEIF eax == ERROR_INVALID_HANDLE
;The handle specified by the hEnum parameter is not valid.
mov edx, offset szERROR_INVALID_HANDLE
.ELSEIF eax == ERROR_NO_NETWORK
;The network is unavailable.
;(This condition is tested before hEnum is tested for validity.)
mov edx, offset szERROR_NO_NETWORK
.ELSEIF eax == ERROR_EXTENDED_ERROR
;A network-specific error occurred.
;To obtain a description of the error, call the WNetGetLastError function.
mov edx, offset szERROR_EXTENDED_ERROR
.ENDIF

invoke MessageBox, g_hWnd, edx, offset g_szWNetEnumResource, MB_OK + MB_ICONSTOP
.break
.endif
.ENDW

invoke WNetCloseEnum, g_hResEnum
ret
EnumNetResource endp

end start
Posted on 2004-03-19 01:25:04 by purpleendurer