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

 

 


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


  Mostrar Mensajes
Páginas: 1 ... 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 [43] 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 ... 331
421  Programación / Programación C/C++ / Re: Get/Post en C++. en: 28 Junio 2012, 22:46 pm
Existe el protocolo HTTP con ese haces TODO... igual hay apis en las plataformas que hacen eso en windows se llaman INET si no me equivoco.

Dulces Lunas!¡.
422  Programación / Programación Visual Basic / Re: Error 3709 en tiempo de ejecucion No se encuentra el nombre del origen de datos en: 28 Junio 2012, 08:34 am
¿Ya creaste el ODBC que apunta al host y a la BDD correcta?...

Dulces Lunas...
423  Programación / Programación C/C++ / Re: [Consulta] Programa para parsear .csv en: 28 Junio 2012, 01:49 am
Ammm te cree el código ya que no tengo nada que hacer... malditas vacaciones.

crea un archivo llamado "c:\a.txt" y dentro escribe las palabras separadas con espacios...

Código
  1.  
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6.  
  7. #define PARSETHIS "[$2] [$2] [$3] [$4] [$300] [$030]"
  8.  
  9. typedef struct acumstrings
  10. {
  11.    char **ptr;
  12.    size_t count;
  13. } acumstrings;
  14.  
  15. acumstrings acum;
  16.  
  17. inline const char* getTokenIndex(const char *str, long *Index)
  18. {
  19.    if (!str) return NULL;
  20.    char *ptr = strstr(str, "[$");
  21.    char *end = NULL;
  22.  
  23.    if (ptr) {
  24.        ptr += strlen("[$");
  25.        (*Index) = strtol(ptr, &end, 10);
  26.    }
  27.  
  28.    return ptr;
  29. }
  30.  
  31. inline char* replace(const char *str, const char *find, const char *rep)
  32. {
  33.    char *ret = NULL;
  34.    size_t strOln;
  35.    size_t strFln;
  36.    size_t strRln;
  37.    const char *end[2];
  38.    size_t sizeL;
  39.    size_t sizeR;
  40.  
  41.  
  42.    if (!str) return NULL;
  43.  
  44.    strOln = strlen(str);
  45.  
  46.    if (!find || (end[0] = strstr(str, find)) == NULL) {
  47.        ret = (char*)malloc(strOln + 1);
  48.        memcpy(ret, str, strOln + 1);
  49.        return ret;
  50.    }
  51.  
  52.    strRln = strlen(rep);
  53.    strFln = strlen(find);
  54.  
  55.    end[1] = (char*)((size_t)end[0] + strFln);
  56.  
  57.    sizeL = (size_t)end[0] - (size_t)str;
  58.    sizeR = ((size_t)str + strOln) - (size_t)end[1];
  59.  
  60.    ret = (char*)malloc(sizeL + strRln + sizeR + 1);
  61.  
  62.    memcpy(ret, str, sizeL);
  63.    memcpy((void*)((int)ret + sizeL), rep, strRln);
  64.    memcpy((void*)((int)ret + sizeL + strRln), end[1], sizeR);
  65.  
  66.    ret[sizeL + strRln + sizeR] = '\0';
  67.  
  68.    return ret;
  69. }
  70.  
  71. int main ()
  72. {
  73.    FILE* file;
  74.    size_t ret;
  75.    char* strLast = NULL;
  76.    char* strNew = NULL;
  77.    char* strNewFind = NULL;
  78.    char strToken[20];
  79.    long index;
  80.  
  81.    file = fopen("C:\\a.txt", "rb+");
  82.  
  83.    //  Obtenemos cada palabra.
  84.    while (!feof(file))
  85.    {
  86.        acum.ptr = (char**)realloc(acum.ptr, (acum.count + 1) * sizeof(char**));
  87.        acum.ptr[acum.count] = (char*)calloc(256, 1);
  88.        ret = fscanf(file, "%s", acum.ptr[acum.count]);
  89.        puts(acum.ptr[acum.count]);
  90.        ++acum.count;
  91.    }
  92.  
  93.    fclose(file);
  94.  
  95.    strNew = (char*)malloc(strlen(PARSETHIS) + 1);
  96.    strcpy(strNew, PARSETHIS);
  97.    strNewFind = strNew;
  98.  
  99.    //  reemplazamos cada token por cada una de las palabras respectivas.
  100.    while(strNewFind = getTokenIndex(strNewFind, &index))
  101.    {
  102.        sprintf(strToken, "[%$%d]\0", index);
  103.        if (acum.count > index) {
  104.            strLast = strNew;
  105.            strNew = replace(strLast, strToken, acum.ptr[index - 1]);
  106.            free(strLast);
  107.            strNewFind = strNew;
  108.        } else {
  109.            ++strNewFind;
  110.        }
  111.    }
  112.  
  113.    while(acum.count--)
  114.        free(acum.ptr[acum.count]);
  115.    free(acum.ptr);
  116.  
  117.    puts(strNew);
  118.  
  119.    free(strNew);
  120.  
  121.    getchar();
  122.  
  123.    return 0;
  124. }
  125.  
  126.  

Dulces Lunas!¡.
424  Programación / Programación Visual Basic / Re: [Class] cStack (VB6) en: 27 Junio 2012, 01:20 am
Aquí te dejo mi clase Stack la acabe de hacer con el block de notas... espero funcione ya que no tengo el IDE de VB6.


(Prueben el código seguro hay varios errores ya que no la probe)

Stack.cls
Código
  1.  
  2. option explicit
  3.  
  4. private _stack   as long
  5. private _size   as long
  6. private _element as variant
  7.  
  8. Private Sub Class_Initialize()
  9.    _stack = &H0
  10.    _size = &H0
  11. End Sub
  12.  
  13. Private Sub Class_Terminate()
  14.    while (empty() = false)
  15.        pop()
  16.    loop
  17. End Sub
  18.  
  19. Public property get size() as long
  20.    size = _size
  21. End Sub
  22.  
  23. Public function top() as variant
  24.    if isobject(_element) then
  25.        set top = _element
  26.    else
  27.        top = _element
  28.    end if
  29. End property
  30.  
  31. pyblic function empty() as boolean
  32.    empty = (_size = 0)
  33. end function
  34.  
  35. Public Sub push(Byref variable As variant)
  36. dim ptr   as long
  37. dim ptrw  as long
  38.    ptr = mMemoryEx.malloc(8)
  39.    ptrw = mMemoryex.getMemData(ptr)
  40.    mMemoryEx.putdword(ptrw, _stack)
  41.  
  42.    if isobject(variable) then
  43.        set _element(0) = variable
  44.    else
  45.        _element(0) = variable
  46.    end if
  47.  
  48.    mMemoryEx.putdword((ptrw + 4), mMemoryEx.getdword(varptr(_element(0))))
  49.    _stack = ptrw
  50.    _size = (_size + 1)
  51. End Sub
  52.  
  53. Public sub pop()
  54. dim newset as variant
  55. dim ptrl   as long
  56. dim ptrw   as long
  57.  
  58.    if _size = 0 then exit sub
  59.  
  60.    ptrl = _stack
  61.    ptrw = mMemoryex.getMemData(ptrl)
  62.    mMemoryEx.putdword(varptr(_stack), mMemoryEx.getdword(ptrw))
  63.    mMemoryEx.putdword(varptr(newset), mMemoryEx.getdword(ptrw + 4))
  64.    mMemoryex.releaseMem(ptrl)
  65.  
  66.   _size = (_size - 1)
  67. End sub
  68.  
  69.  

Como esta caída mi pagina (Blog) dejo el modulo:

mMemoryEx.bas

Código:

Option Explicit

Public Const PAGE_EXECUTE_READWRITE As Long = &H40
Public Const PAGE_EXECUTE_WRITECOPY As Long = &H80
Public Const PAGE_EXECUTE_READ As Long = &H20
Public Const PAGE_EXECUTE As Long = &H10
Public Const PAGE_READONLY As Long = 2
Public Const PAGE_WRITECOPY As Long = &H8
Public Const PAGE_NOACCESS As Long = 1
Public Const PAGE_READWRITE As Long = &H4
 
Declare Function VarPtrArr Lib "msvbvm60.dll" Alias "VarPtr" (ByRef Ptr() As Any) As Long
Declare Function IsBadWritePtr Lib "kernel32" (ByVal lp As Long, ByVal ucb As Long) As Long
Declare Function IsBadReadPtr Lib "kernel32" (ByVal lp As Long, ByVal ucb As Long) As Long
Declare Function VirtualProtect Lib "kernel32" (ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flNewProtect As Long, ByVal lpflOldProtect As Long) As Long

Private bvHack(0)               As Byte
Private lHackDelta              As Long
Private bInitialized            As Boolean
 
Public Function initialize() As Boolean ' By KarCrack
    On Error GoTo Error_Handle
 
    bvHack(-1) = bvHack(-1) 'Error check
    lHackDelta = VarPtr(bvHack(0))
 
    initialize = True
    bInitialized = initialize
    Exit Function
Error_Handle:
    If Err.Number = 9 Then Debug.Print "Remember to tick 'Remove array boundary check' and compile before using"
'    End
End Function
 
Public Function getByte(ByVal lptr As Long) As Byte ' By KarCrack
    If bInitialized Then getByte = bvHack(lptr - lHackDelta)
End Function
 
Public Function getWord(ByVal lptr As Long) As Integer ' By KarCrack
    If bInitialized Then getWord = makeWord(getByte(lptr + &H0), getByte(lptr + &H1))
End Function
 
Public Function getDWord(ByVal lptr As Long) As Long ' By KarCrack
    If bInitialized Then getDWord = makeDWord(getWord(lptr + &H0), getWord(lptr + &H2))
End Function
 
Public Sub putByte(ByVal lptr As Long, ByVal bByte As Byte) ' By KarCrack
    If bInitialized Then bvHack(lptr - lHackDelta) = bByte
End Sub
 
Public Sub putWord(ByVal lptr As Long, ByVal iWord As Integer) ' By KarCrack
    If bInitialized Then Call putByte(lptr + &H0, iWord And &HFF): Call putByte(lptr + &H1, (iWord And &HFF00&) / &H100)
End Sub
 
Public Sub putDWord(ByVal lptr As Long, ByVal lDWord As Long) ' By KarCrack
    If bInitialized Then Call putWord(lptr + &H0, IIf(lDWord And &H8000&, lDWord Or &HFFFF0000, lDWord And &HFFFF&)): Call putWord(lptr + &H2, (lDWord And &HFFFF0000) / &H10000)
End Sub
 
Public Function makeDWord(ByVal LoWord As Integer, ByVal HiWord As Integer) As Long '[http://www.xbeat.net/vbspeed/c_MakeDWord.htm#MakeDWord05]
    makeDWord = (HiWord * &H10000) Or (LoWord And &HFFFF&)
End Function

'   //  Funciones agregadas...

Function makeWord(ByVal lByte As Byte, ByVal hByte As Byte) As Integer ' By BlackZeroX
    makeWord = (((hByte And &H7F) * &H100&) Or lByte)
    If hByte And &H80 Then makeWord = makeWord Or &H8000
End Function

'/////////////////////
Public Function allocMem(ByVal lSize As Long) As Long
'   //  By BlackZeroX (Thanks to Karcrack).
'   //  Retorna la Dirrecion de un SafeArray.
Dim pBuff()     As Byte
    If (lSize <= &H0) Then Exit Function
    ReDim pBuff(0 To (lSize - 1))
    allocMem = getDWord(VarPtrArr(pBuff))
    putDWord VarPtrArr(pBuff), 0
End Function
 
Public Function reallocMem(ByVal lptr As Long, ByVal lSize As Long) As Long
'   //  By BlackZeroX (Thanks to Karcrack).
'   //  Retorna la Dirrecion de un SafeArray que se retorno en allocMem()/reallocMem().
Dim pBuff()     As Byte
    putDWord VarPtrArr(pBuff), lptr
    If Not (lSize = &H0) Then
        ReDim Preserve pBuff(0 To (lSize - 1))
    Else
        Erase pBuff
    End If
    reallocMem = getDWord(VarPtrArr(pBuff))
    putDWord VarPtrArr(pBuff), 0
End Function
 
Public Function getMemData(ByVal lptr As Long) As Long
'   //  By BlackZeroX (Thanks to Karcrack).
'   //  lPtr debe ser el valor (Address) que retorno en allocMem()/reallocMem().
'   //  Esta funcion retorna la Dirrecion de memoria EDITABLE de lPtr (Dirrecion de un SafeArray).
'   //  Referencias.
'   //  http://msdn.microsoft.com/en-us/library/aa908603.aspx
    If (lptr = &H0) Then Exit Function
    getMemData = getDWord(lptr + &HC)    '   //  obtenemos pvData
End Function
 
Public Sub releaseMem(ByVal lptr As Long)
'   //  By BlackZeroX (Thanks to Karcrack).
'   //  lPtr debe ser la Dirrecion que retorno en allocMem()/reallocMem().
Dim pBuff()     As Byte
    putDWord VarPtrArr(pBuff), lptr
End Sub
 
Public Sub releaseMemStr(ByVal lptr As Long)
'   //  By BlackZeroX (Thanks to Karcrack).
'   //  lPtr debe ser la Dirrecion que retorno en cloneString().
Dim sStr        As String
    putDWord VarPtr(sStr), lptr
End Sub
 
Public Sub swapVarPtr(ByVal lpVar1 As Long, ByVal lpVar2 As Long)
'   //  By BlackZeroX (Thanks to Karcrack).
Dim lAux    As Long
    lAux = getDWord(lpVar1)
    Call putDWord(lpVar1, getDWord(lpVar2))
    Call putDWord(lpVar2, lAux)
End Sub
 
Public Function cloneString(ByVal lpStrDst As Long, ByVal sStrSrc As String) As Long
'   //  By BlackZeroX (Thanks to Karcrack).
'   //  lPtr -> Puntero a una variable destino (Preferiblemente String).
'   //  sStr -> Cadena Clonada ( gracias a Byval ).
Dim lpStrSrc        As Long
    If Not (lpStrDst = &H0) And (mMemoryEx.initialize = True) Then
        Call mMemoryEx.swapVarPtr(lpStrDst, VarPtr(sStrSrc))
        Call mMemoryEx.swapVarPtr(VarPtr(cloneString), VarPtr(sStrSrc))
    End If
End Function
 
Public Function copyMemory(ByVal lpDst As Long, ByVal lpSrc As Long, ByVal lLn As Long) As Long
'   //  By BlackZeroX (Thanks to Karcrack).
Dim i       As Long
    If (lpSrc = &H0) Or (lpDst = &H0) Or (lLn = &H0) Then Exit Function
  
    i = (lLn Mod 4)
    If ((i And &H2) = &H2) Then
        Call putWord(lpDst, getWord(lpSrc))
        lpDst = (lpDst + 2)
        lpSrc = (lpSrc + 2)
        copyMemory = (copyMemory + 2)
        lLn = (lLn - 2)
    End If
    If ((i And &H1) = &H1) Then
        Call putByte(lpDst, getByte(lpSrc))
        lpDst = (lpDst + 1)
        lpSrc = (lpSrc + 1)
        copyMemory = (copyMemory + 1)
        lLn = (lLn - 1)
    End If
    For i = 0 To (lLn - 1) Step 4
        Call putDWord(lpDst + i, getDWord(lpSrc + i))
    Next
    copyMemory = (copyMemory + lLn)
  
End Function


Dulces Lunas!¡.
425  Programación / Programación C/C++ / Re: Procesamiento de imagenes PNG en: 25 Junio 2012, 05:28 am
Revisa estas especificaciones.

http://www.iso.org/iso/catalogue_detail.htm?csnumber=29581
http://www.libpng.org/pub/png/spec/1.1/           <-- recomendada.

P.D.: Google no muerde.

Dulces Lunas!¡.
426  Programación / Programación Visual Basic / Re: [SRC] Open Nod32 Keyfinder [Busca licencias del nod32] [GPL3!] en: 25 Junio 2012, 04:52 am

Si usa Internet no me funciona y a muchos tampoco, deberías meterle algunas ya por default y solo tener un botón extra para obtener las nuevas y actualizar tu BDD de seriales... así los que no tienen Internet activado tengan acceso aun que sea a algunos códigos "serial".

Muy bueno! As estudiado el algoritmo mediante Ing. Inversa o como lo as sacado?

No creo, al parecer las toma de una pagina, pero da igual que método sea lo que importa aquí realmente es que cumple su trabajo.

Nota: Crea un instalador o algo similar (Ya no uso VB6) y las personas que no tienen algunas librerias no les funciona tu App.

Dulces Lunas!¡.
427  Programación / Programación Visual Basic / Re: Problema con MoveMem - Reemplazando RtlMoveMemory. en: 22 Junio 2012, 20:50 pm

Puedes usar mi alternativa que usa el mismo método de "Ignorar limites de un array".

Alternativa a CopyMemory

solo una modificacion:

Código
  1.  
  2. Public Function copyMemory(ByVal lpDst As Long, ByVal lpSrc As Long, ByVal lLn As Long) As Long
  3. '   //  By BlackZeroX.
  4. Dim i       As Long
  5.  
  6.    If not bInitialized Then exit function
  7.  
  8.    If (lpSrc = &H0) Or (lpDst = &H0) Or (lLn = &H0) Then Exit Function
  9.  
  10.    i = (lLn Mod 4)
  11.    If ((i And &H2) = &H2) Then
  12.        Call putWord(lpDst, getWord(lpSrc))
  13.        lpDst = (lpDst + 2)
  14.        lpSrc = (lpSrc + 2)
  15.        copyMemory = (copyMemory + 2)
  16.        lLn = (lLn - 2)
  17.    End If
  18.    If ((i And &H1) = &H1) Then
  19.        Call putByte(lpDst, getByte(lpSrc))
  20.        lpDst = (lpDst + 1)
  21.        lpSrc = (lpSrc + 1)
  22.        copyMemory = (copyMemory + 1)
  23.        lLn = (lLn - 1)
  24.    End If
  25.    For i = 0 To (lLn - 1) Step 4
  26.        Call putDWord(lpDst + i, getDWord(lpSrc + i))
  27.    Next
  28.  
  29.    copyMemory = (copyMemory + lLn)
  30.  
  31. End Function
  32.  
  33.  
428  Programación / Programación Visual Basic / Re: Problema con MoveMem - Reemplazando RtlMoveMemory. en: 22 Junio 2012, 12:57 pm
Pon el código tal cual los tipos de c y de b pueden afectar en tu resultado, ya que cada tipo ocupa una longitud dada de bytes.

Dulces Lunas!¡.
429  Programación / Programación C/C++ / Re: Problema con funcion atof en: 8 Junio 2012, 16:34 pm
El usar solo elnombre de una array es decir asi como lo usas en el segundo indica un puntero al primer indice es decir  "&variable[0]" es igual a "variable"...

Dulces Lunas!¡.
430  Programación / Programación C/C++ / Re: Como seleccionar opción sin pulsar intro en: 7 Junio 2012, 04:04 am
Código
  1.  
  2. ...
  3.  
  4. switch(getchar()) {
  5.    case 'a': ... break
  6.    case 'b': ... break
  7.    case 'c': ... break
  8.    case 'd': ... break
  9.    ...
  10.    case '0': ... break
  11.    case '1': ... break
  12.    case '2': ... break;
  13.    case '3': ... break;
  14.    case '4': ... break;
  15.    case '5': ... break;
  16.    case '6': ... break;
  17.    case '7': ... break;
  18.    case '8': ... break;
  19.    case '9': ... break;
  20.    default: ... break;
  21. }
  22.  
  23. ...
  24.  
  25.  

Dulces Lunas!¡.
Páginas: 1 ... 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 [43] 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 ... 331
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines