elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  [HELP] Type Declares
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [HELP] Type Declares  (Leído 1,364 veces)
Swellow

Desconectado Desconectado

Mensajes: 77


Ver Perfil
[HELP] Type Declares
« en: 24 Junio 2012, 18:34 pm »

Hey guys, I'm trying to remove type declares on that code but I didn't success.

Here is the code:

Código:
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function Process32First Lib "kernel32" (ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal dwFlags As Long, th32ProcessID As Long) As Long

Public Type PROCESSENTRY32
    dwSize As Long
    cntUseage As Long
    th32ProcessID As Long
    th32DefaultHeapID As Long
    th32ModuleID As Long
    cntThreads As Long
    th32ParentProcessID As Long
    pcPriClassBase As Long
    swFlags As Long
    szExeFile As String * 1024
End Type

Public Function Running(ByVal sFileName As String) As Boolean
    Dim hSnapshot As Long
    Dim pe32 As PROCESSENTRY32
   
    hSnapshot = CreateToolhelp32Snapshot(2, 0)
    pe32.dwSize = Len(pe32)
    Process32First hSnapshot, pe32
   
    Do While Process32Next(hSnapshot, pe32) <> 0
        If InStr(1, LCase(pe32.szExeFile), LCase(sFileName)) > 0 Then
            Running = True
        End If
    Loop
   
    CloseHandle (hSnapshot)
End Function

Would be really appreciated if anyone could remove the type declare and let me know how you did it.

Thanks!


En línea

Swellow

Desconectado Desconectado

Mensajes: 77


Ver Perfil
Re: [HELP] Type Declares
« Respuesta #1 en: 24 Junio 2012, 21:24 pm »

I've tried:

Código:
Public Function IsProcessRunning(ByVal sFileName As String) As Boolean
    Dim hSnapshot As Long
    Dim bPE32(1024 + 36 - 1) As Byte
    Dim bExe(1023) As Byte
   
    hSnapshot = CreateToolhelp32Snapshot(2, 0)
    sMoveMem VarPtr(bPE32(0)), VarPtr(CLng(UBound(bPE32))), 4
    Process32First hSnapshot, VarPtr(bPE32(0))
   
    Do While Process32Next(hSnapshot, VarPtr(bPE32(0))) <> 0
        sMoveMem VarPtr(bExe(0)), VarPtr(bPE32(36)), 1024
        If InStr(1, LCase(StrConv(bExe, vbUnicode)), LCase(sFileName)) > 0 Then
            IsProcessRunning = True
        End If
    Loop
   
    CloseHandle (hSnapshot)
End Function

But this is buggy, it doesnt work correctly...


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
input type « 1 2 »
PHP
JJely 16 7,236 Último mensaje 8 Febrero 2010, 18:59 pm
por KrossPock
Problema co DOC TYPE
Desarrollo Web
Riki_89D 1 2,408 Último mensaje 19 Diciembre 2010, 05:25 am
por bomba1990
De type a %var%
Scripting
electrodev 1 2,017 Último mensaje 15 Octubre 2011, 13:28 pm
por electrodev
type mismatch
Java
m@o_614 1 2,011 Último mensaje 11 Junio 2012, 21:34 pm
por 1mpuls0
(Python) TypeError: can't multiply sequence by non-int of type 'str'
Scripting
Linton 9 6,806 Último mensaje 17 Febrero 2013, 09:36 am
por Linton
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines