Forum
|
|
RasHangup not working
|
huntingspace |
|
Active Member
Group: Members
Posts: 49
Member No.: 49504
Joined: 11-February 12
|
see MSDN code sample code:
CODE | include masm32\include\windows.inc include \masm32\include\kernel32.inc include \MASM32\include\rasapi32.inc include \masm32\include\msvcrt.inc includelib \MASM32\lib\kernel32.lib includelib \MASM32\lib\rasapi32.lib includelib \MASM32\lib\msvcrt.lib include \masm32\macros\macros.asm
printf equ <crt_printf>
.data? lpRasConn � � dd ? dwCb � � � � �dd ? dwConnections dd ?
.code start: xor eax,eax mov dwCb,eax; mov dwConnections,eax mov lpRasConn,eax
Call RasEnumConnections with lpRasConn = NULL. dwCb is returned with the required buffer size and a return code of ERROR_BUFFER_TOO_SMALL invoke RasEnumConnections,lpRasConn, addr dwCb,addr dwConnections .if (eax== ERROR_BUFFER_TOO_SMALL)
; Allocate the memory needed for the array of RAS structure(s). invoke GetProcessHeap mov edi,eax �invoke HeapAlloc,edi,HEAP_ZERO_MEMORY,dwCb �.if !(eax & eax) � �invoke printf,CTXT("HeapAlloc failed!",13,10) � �jmp exit0 �.endif mov lpRasConn,eax
; The first RASCONN structure in the array must contain the RASCONN structure size �mov esi,lpRasConn �mov [esi].RASCONN.dwSize,sizeof RASCONN
; Call RasEnumConnections to enumerate active connections �invoke RasEnumConnections,esi,addr dwCb,addr dwConnections
; If successful, print the names of the active connections. �.if !(eax & eax) � �invoke printf,CTXT("The following RAS connections are currently active:",13,10) � �xor ebx,ebx � � �.repeat � � � �lea eax,[esi].RASCONN.szEntryName � � � �invoke printf,CTXT("%s",13,10),eax � � � �add esi,sizeof RASCONN � � � �inc ebx � � �.until (ebx>=dwConnections) � .endif
;Deallocate memory for the connection buffer �iinvoke HeapFree,edi,0,lpRasConn �jmp exit0 .endif
; There was either a problem with RAS or there are no connections to enumerate .if(dwConnections >= 1) �invoke printf,CTXT("The operation failed to acquire the buffer size.",13,10) .else �invoke printf,CTXT("There are no active RAS connections.",13,10) .endif exit0: invoke ExitProcess,0
|
i think you need fill some params in your sample before RasEnumConnections API is called:
CODE | mov l_RASCONN.RASCONN.dwSize, sizeof RASCONN mov l_Buffer_Size, sizeof l_RASCONN
|
regards, huntingspace.
|
|
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
|
|
|