Cita de: RHL - 该0在 en 6 Enero 2012, 02:29 AM
La funcion de Karcrack SI FUNCIONA, ya hasta comprobe las velocidades de todas las funciones...
Compruba la ultima mia!¡... Quien sabe por que me Crasheo el exe entonces xP...
Dulces Lunas!¡.
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCita de: RHL - 该0在 en 6 Enero 2012, 02:29 AM
La funcion de Karcrack SI FUNCIONA, ya hasta comprobe las velocidades de todas las funciones...
Private Function getNumbers2(ByRef sIn As String, ByRef sOut As String) As Long
Dim thisWord(0) As Integer ' // Un caracter = 2 bytes = integer
Dim dwOffSetGet As Long ' // Offset Get caracter...
Dim dwOffSetSet As Long ' // Offset Set caracter...
Dim wWord As Integer ' // Letra en asc...
Dim dwRet As Integer ' // Cantidad de digitos encontrados...
Dim dwLenI As Long ' // Longitud en bytes de sIn...
Dim dwLenB As Long ' // Longitud en bytes de sOut...
Dim dwOffset As Long ' // Offset del Buffer...
dwOffSetGet = (StrPtr(sIn) - VarPtr(thisWord(0))) \ 2
dwLenB = LenB(sOut)
If (dwLenB) Then
dwOffSetSet = (StrPtr(sOut) - VarPtr(thisWord(0))) \ 2
End If
dwLenI = LenB(sIn)
If (dwLenI) Then
Do
If (dwLenI And &H80000000) Then Exit Do
wWord = thisWord(dwOffSetGet)
If (wWord >= &H30) Then
If (wWord <= &H39) Then
dwRet = (dwRet + 1)
If (dwLenB) Then
thisWord(dwOffSetSet) = wWord
dwOffSetSet = (dwOffSetSet + 1)
dwLenB = (dwLenB - 2)
End If
End If
End If
dwOffSetGet = (dwOffSetGet + 1)
dwLenI = (dwLenI - 2)
Loop While (wWord > 0)
End If
thisWord(dwOffSetSet) = &H0&
getNumbers2 = dwRet
End Function
Cita de: Karcrack en 5 Enero 2012, 11:42 AM
No debería devolver un número?
Deberías poner la declaración de la función, para que BlackZeroX no empiece a usar buffers declarados fuera de esta
Cita de: ¤¤¤K@NuTöM@N¤¤¤ en 5 Enero 2012, 09:51 AM
es un sistema de cifrado? me ha llamado la atencion por que yo ando haciendo tambien algoritmos de cifrado. Un saludo!
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
typedef struct _config
{
char* szIn;
char* szOut;
size_t size;
size_t start;
unsigned int* lpPosOut;
pthread_mutex_t* lpMutex;
}
CONFIG, *LPCONFIG;
void* divideYVenceras(void* arg);
unsigned int getNumbers(char* szIn, char* szOut, size_t size);
int main()
{
char szCadena[] = {"ewiuc3dskhd8nkd62ndsnk9"};
char* szBuffer = NULL;
size_t size = getNumbers(szCadena, NULL, 0); // Cuantos numeros hay?...
if (size > 0)
{
szBuffer = (char*)malloc(size + 1);
printf("Se extrayeron: %d de %d\n", getNumbers(szCadena, szBuffer, size ), size);
printf("%s\n", szBuffer);
free(szBuffer);
}
getchar();
return EXIT_SUCCESS;
}
void*
divideYVenceras(void* arg)
{
LPCONFIG lpConfig = (LPCONFIG)arg;
unsigned int iRet = 0;
unsigned int i = lpConfig->start;
while(lpConfig->szIn[i])
{
if (i > 0 && !lpConfig->szIn[i - 1])
break;
if (lpConfig->size < (*lpConfig->lpPosOut) && lpConfig->szOut)
break;
if (lpConfig->szIn[i] >= '0' && '9' >= lpConfig->szIn[i] )
{
if (lpConfig->szOut)
{
pthread_mutex_lock(lpConfig->lpMutex);
lpConfig->szOut[(*lpConfig->lpPosOut)++] = lpConfig->szIn[i];
pthread_mutex_unlock(lpConfig->lpMutex);
}
iRet++;
}
i += 2;
}
pthread_exit((void*)iRet);
//return iRet; // No tendria caso...
}
unsigned int
getNumbers(char* szIn, char* szOut, size_t size)
{
pthread_t pthHilos[2];
CONFIG udtConfig[2];
unsigned int i = 0;
unsigned int lpiRet = 0;
unsigned int iRet = 0;
pthread_mutex_t mutex;
pthread_mutex_init(&mutex, NULL);
udtConfig[0].szIn = udtConfig[1].szIn = szIn;
udtConfig[0].size = udtConfig[1].size = size;
udtConfig[0].szOut = udtConfig[1].szOut = szOut;
udtConfig[0].start = 0;
udtConfig[1].start = 1;
udtConfig[0].lpPosOut = udtConfig[1].lpPosOut = &i;
udtConfig[0].lpMutex = udtConfig[1].lpMutex = &mutex;
pthread_create(&pthHilos[0], NULL, divideYVenceras, &udtConfig[0]);
pthread_create(&pthHilos[1], NULL, divideYVenceras, &udtConfig[1]);
pthread_join(pthHilos[0], (void**)&lpiRet);
iRet = (int)lpiRet;
pthread_join(pthHilos[1], (void**)&lpiRet);
iRet += (int)lpiRet;
pthread_mutex_destroy(&mutex);
if (szOut)
szOut[iRet + 1] = (char)0x0;
return iRet;
}
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
typedef struct _config
{
char* szIn;
size_t sizeIn;
char* szOut;
size_t sizeOut;
unsigned int* lpPosOut;
pthread_mutex_t* lpMutex;
}
CONFIG, *LPCONFIG;
void* divideYVenceras(void* arg);
unsigned int getNumbers(char* szIn, size_t sizeIn, char* szOut, size_t sizeOut);
int main()
{
char szCadena[] = {"ewiuc3dskhd8nkd62ndsnk9"};
char* szBuffer = NULL;
size_t size = getNumbers(szCadena, strlen(szCadena), NULL, 0); // Cuantos numeros hay?...
if (size > 0)
{
szBuffer = (char*)malloc(size + 1);
printf("Se extrayeron: %d de %d\n", getNumbers(szCadena, strlen(szCadena), szBuffer, size ), size);
printf("%s\n", szBuffer);
free(szBuffer);
}
getchar();
return EXIT_SUCCESS;
}
void*
divideYVenceras(void* arg)
{
LPCONFIG lpConfig = (LPCONFIG)arg;
unsigned int iRet = 0;
if (lpConfig->szIn)
{
while(lpConfig->sizeIn-- && *lpConfig->szIn)
{
if (lpConfig->sizeOut < (*lpConfig->lpPosOut) && lpConfig->szOut)
break;
if ((*lpConfig->szIn) >= '0' && '9' >= (*lpConfig->szIn) )
{
if (lpConfig->szOut)
{
pthread_mutex_lock(lpConfig->lpMutex);
lpConfig->szOut[(*lpConfig->lpPosOut)++] = *lpConfig->szIn;
pthread_mutex_unlock(lpConfig->lpMutex);
}
iRet++;
}
lpConfig->szIn++;
}
}
pthread_exit((void*)iRet);
//return iRet; // No tendria caso...
}
unsigned int
getNumbers(char* szIn, size_t sizeIn, char* szOut, size_t sizeOut)
{
pthread_t pthHilos[2];
CONFIG udtConfig[2];
unsigned int i = 0;
unsigned int iRet = 0;
unsigned int iAdd = 0;
pthread_mutex_t mutex;
pthread_mutex_init(&mutex, NULL);
udtConfig[0].szIn = szIn;
udtConfig[0].sizeIn = (sizeIn >> 1);
udtConfig[0].szOut = udtConfig[1].szOut = szOut;
udtConfig[0].sizeOut = udtConfig[1].sizeOut = sizeOut;
udtConfig[0].lpPosOut = udtConfig[1].lpPosOut = &i;
udtConfig[0].lpMutex = udtConfig[1].lpMutex = &mutex;
udtConfig[1].sizeIn = ((udtConfig[0].sizeIn) + (sizeIn & 0x1));
udtConfig[1].szIn = &szIn[(udtConfig[0].sizeIn)];
pthread_create(&pthHilos[0], NULL, divideYVenceras, &udtConfig[0]);
pthread_create(&pthHilos[1], NULL, divideYVenceras, &udtConfig[1]);
pthread_join(pthHilos[0], (void**)&iAdd);
iRet = (int)iAdd;
pthread_join(pthHilos[1], (void**)&iAdd);
iRet += (int)iAdd;
pthread_mutex_destroy(&mutex);
if (szOut)
szOut[iRet + 1] = (char)0x0;
return iRet;
}
#include <windows.h>
...
DefineDosDeviceA(0x0, "X:", "E:\\Mi música" ); // Agrega el DiscoVirtual...
getchar();
DefineDosDeviceA(DDD_REMOVE_DEFINITION, "X:", "E:\\Mi música"); // Remueve el disco virtual...
...