Re: Bug with Socket
- From: ruben.seguin@xxxxxxxxx
- Date: 19 Oct 2005 03:15:23 -0700
The code for Access Violation is:
Option Explicit
'Constantes para errores
Public Const EXCEPTION_MAXIMUM_PARAMETERS = 15
Public Const SEM_NOGPFAULTERRORBOX = &H2
Public Const FORMAT_MESSAGE_ALLOCATE_BUFFER = &H100
Public Const FORMAT_MESSAGE_FROM_SYSTEM = &H1000
Public Const EXCEPTION_EXECUTE_HANDLER = 1
'Estructura que contiene info del procesador
Type CONTEXT
FltF0 As Double
FltF1 As Double
FltF2 As Double
FltF3 As Double
FltF4 As Double
FltF5 As Double
FltF6 As Double
FltF7 As Double
FltF8 As Double
FltF9 As Double
FltF10 As Double
FltF11 As Double
FltF12 As Double
FltF13 As Double
FltF14 As Double
FltF15 As Double
FltF16 As Double
FltF17 As Double
FltF18 As Double
FltF19 As Double
FltF20 As Double
FltF21 As Double
FltF22 As Double
FltF23 As Double
FltF24 As Double
FltF25 As Double
FltF26 As Double
FltF27 As Double
FltF28 As Double
FltF29 As Double
FltF30 As Double
FltF31 As Double
IntV0 As Double
IntT0 As Double
IntT1 As Double
IntT2 As Double
IntT3 As Double
IntT4 As Double
IntT5 As Double
IntT6 As Double
IntT7 As Double
IntS0 As Double
IntS1 As Double
IntS2 As Double
IntS3 As Double
IntS4 As Double
IntS5 As Double
IntFp As Double
IntA0 As Double
IntA1 As Double
IntA2 As Double
IntA3 As Double
IntA4 As Double
IntA5 As Double
IntT8 As Double
IntT9 As Double
IntT10 As Double
IntT11 As Double
IntRa As Double
IntT12 As Double
IntAt As Double
IntGp As Double
IntSp As Double
IntZero As Double
Fpcr As Double
SoftFpcr As Double
Fir As Double
Psr As Long
ContextFlags As Long
Fill(4) As Long
End Type
Type EXCEPTION_RECORD
ExceptionCode As Long
ExceptionFlags As Long
pExceptionRecord As Long ' Puntero al registro de excepcion
ExceptionAddress As Long
NumberParameters As Long
ExceptionInformation(EXCEPTION_MAXIMUM_PARAMETERS) As Long
End Type
Type EXCEPTION_POINTERS
pExceptionRecord As EXCEPTION_RECORD
ContextRecord As CONTEXT
End Type
'Declaraciones de las API de C++ para el control de errores
Private Declare Function FormatMessage Lib "kernel32" Alias
"FormatMessageA" _
(ByVal dwFlags As Long, lpSource As Any, ByVal dwMessageId
As Long, _
ByVal dwLanguageId As Long, ByVal lpBuffer As String,
ByVal nSize As Long, _
Arguments As Long) As Long
Declare Function SetUnhandledExceptionFilter Lib "kernel32" _
(ByVal lpTopLevelExceptionFilter As Long) As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(Destination As Any, Source As Any, ByVal Length As Long)
Public Declare Function SetErrorMode Lib "kernel32" _
(ByVal wMode As Long) As Long
Public Declare Function LocalFree Lib "kernel32" (ByVal hMem As Long)
As Long
'Funcion que maneja errores en tiempo de ejecucion
'Si se produce un error en tiempo de ejecucion se lanza un nuevo error
al procedimiento que lo provoco
'de esta forma podemos saber en que procedimiento se produce el error.
Para ello todas las funciones y
'procedimientos deben tener un controlador de errores
Public Function UnhandledExceptionFilter(ExceptionInfo As
EXCEPTION_POINTERS) As Long
Dim nLastDllErr&, nBuffLen&, lpBuffer&, sErrorMessage$
nLastDllErr = Err.LastDllError
If nLastDllErr Then
nBuffLen = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER Or _
FORMAT_MESSAGE_FROM_SYSTEM, ByVal 0&,
nLastDllErr, 0&, lpBuffer, 0&, _
ByVal 0&)
If nBuffLen Then
sErrorMessage = String$(nBuffLen, vbNullChar)
CopyMemory sErrorMessage, lpBuffer, nBuffLen
Call LocalFree(lpBuffer)
sErrorMessage = StrConv(sErrorMessage, vbUnicode)
End If
Else
nLastDllErr = vbObjectError + 1
End If
If Len(sErrorMessage) = 0 Then
sErrorMessage = " Error en tiempo de ejecución. "
End If
UnhandledExceptionFilter = EXCEPTION_EXECUTE_HANDLER
Err.Raise 500, "¡¡Error en tiempo de ejecucion!!", sErrorMessage
End Function
.
- Follow-Ups:
- Re: Bug with Socket
- From: Someone
- Re: Bug with Socket
- From: Nospam
- Re: Bug with Socket
- References:
- Bug with Socket
- From: ruben . seguin
- Re: Bug with Socket
- From: Sinna
- Re: Bug with Socket
- From: ruben . seguin
- Re: Bug with Socket
- From: Nospam
- Re: Bug with Socket
- From: ruben . seguin
- Re: Bug with Socket
- From: Nospam
- Re: Bug with Socket
- From: ruben . seguin
- Bug with Socket
- Prev by Date: Re: Bug with Socket
- Next by Date: Re: Bug with Socket
- Previous by thread: Re: Bug with Socket
- Next by thread: Re: Bug with Socket
- Index(es):