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

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


  Mostrar Mensajes
Páginas: 1 2 3 [4] 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ... 28
31  Programación / Programación C/C++ / Re: Vector en tres dimensiones en: 30 Diciembre 2011, 05:22 am
http://pastebin.com/zNZK4Wa6

S2
32  Programación / Programación C/C++ / Re: consulta sobre Funciones de manejo de errores [c++] en: 11 Octubre 2011, 06:24 am
también puede hacer algo como esto, agregas esta función:

Código
  1. typedef enum _MINIDUMP_TYPE {
  2.  MiniDumpNormal                           = 0x00000000,
  3.  MiniDumpWithDataSegs                     = 0x00000001,
  4.  MiniDumpWithFullMemory                   = 0x00000002,
  5.  MiniDumpWithHandleData                   = 0x00000004,
  6.  MiniDumpFilterMemory                     = 0x00000008,
  7.  MiniDumpScanMemory                       = 0x00000010,
  8.  MiniDumpWithUnloadedModules              = 0x00000020,
  9.  MiniDumpWithIndirectlyReferencedMemory   = 0x00000040,
  10.  MiniDumpFilterModulePaths                = 0x00000080,
  11.  MiniDumpWithProcessThreadData            = 0x00000100,
  12.  MiniDumpWithPrivateReadWriteMemory       = 0x00000200,
  13.  MiniDumpWithoutOptionalData              = 0x00000400,
  14.  MiniDumpWithFullMemoryInfo               = 0x00000800,
  15.  MiniDumpWithThreadInfo                   = 0x00001000,
  16.  MiniDumpWithCodeSegs                     = 0x00002000,
  17.  MiniDumpWithoutAuxiliaryState            = 0x00004000,
  18.  MiniDumpWithFullAuxiliaryState           = 0x00008000,
  19.  MiniDumpWithPrivateWriteCopyMemory       = 0x00010000,
  20.  MiniDumpIgnoreInaccessibleMemory         = 0x00020000,
  21.  MiniDumpWithTokenInformation             = 0x00040000
  22. } MINIDUMP_TYPE;
  23.  
  24. typedef struct _MINIDUMP_EXCEPTION_INFORMATION {
  25.  DWORD               ThreadId;
  26.  PEXCEPTION_POINTERS ExceptionPointers;
  27.  BOOL                ClientPointers;
  28. } MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;
  29.  
  30. typedef struct _MINIDUMP_USER_STREAM {
  31.  ULONG32 Type;
  32.  ULONG   BufferSize;
  33.  PVOID   Buffer;
  34. } MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM;
  35.  
  36. typedef struct _MINIDUMP_USER_STREAM_INFORMATION {
  37.  ULONG                 UserStreamCount;
  38.  PMINIDUMP_USER_STREAM UserStreamArray;
  39. } MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;
  40.  
  41. typedef struct _MINIDUMP_CALLBACK_INFORMATION {
  42.  PVOID CallbackRoutine;
  43.  PVOID CallbackParam;
  44. } MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;
  45.  
  46. typedef BOOL (WINAPI *MiniDumpWriteDump_t)(HANDLE, DWORD, HANDLE,MINIDUMP_TYPE,
  47.  CONST PMINIDUMP_EXCEPTION_INFORMATION,
  48.  CONST PMINIDUMP_USER_STREAM_INFORMATION,
  49.  CONST PMINIDUMP_CALLBACK_INFORMATION
  50. );
  51.  
  52. LONG WINAPI MiniDumper(struct _EXCEPTION_POINTERS *pExceptionInfo){
  53.  LONG retval=EXCEPTION_CONTINUE_SEARCH;
  54.  HMODULE hDll=LoadLibrary("dbghelp.dll");
  55.  if(hDll){
  56.    MiniDumpWriteDump_t MiniDumpWriteDump=(MiniDumpWriteDump_t)
  57.    GetProcAddress(hDll,"MiniDumpWriteDump"));
  58.    if(MiniDumpWriteDump){
  59.      char szDumpPath[MAX_PATH];SYSTEMTIME sSystemTime;
  60.      if(GetModuleFileName(NULL,szDumpPath,MAX_PATH)){
  61.        char *pSlash=strrchr(szDumpPath,'\\');
  62.        if(pSlash)*++pSlash=0;
  63.      }else
  64.        GetTempPath(MAX_PATH,szDumpPath);
  65.      GetLocalTime(&sSystemTime);
  66.      sprintf(szDumpPath,"%s%s_%02i_%02i_%04i__%02i_%02i_%02i.mdmp",szDumpPath,"MyProcess",sSystemTime.wDay,sSystemTime.wMonth,sSystemTime.wYear,sSystemTime.wHour,sSystemTime.wMinute,sSystemTime.wSecond);
  67.      HANDLE hFile=CreateFile(szDumpPath,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
  68.      if(hFile!=INVALID_HANDLE_VALUE){
  69.        MINIDUMP_EXCEPTION_INFORMATION ExInfo;
  70.        ExInfo.ThreadId=GetCurrentThreadId();
  71.        ExInfo.ExceptionPointers=pExceptionInfo;
  72.        ExInfo.ClientPointers=FALSE
  73.        if(MiniDumpWriteDump(GetCurrentProcess(),GetCurrentProcessId(),hFile,MiniDumpNormal,&ExInfo,NULL,NULL))
  74.          retval=EXCEPTION_EXECUTE_HANDLER;
  75.        CloseHandle(hFile);
  76.      }
  77.    }
  78.  }
  79.  return retval;
  80. }

y luego al principio de tu programa agregas:

Código
  1. SetUnhandledExceptionFilter(MiniDumper);

de esa forma cuando ocurra un error se generará un archivo que contendrá información del mismo (el cual lo puedes analizar con Windbg)...

S2
33  Programación / Programación C/C++ / Re: API TerminateProcess function en: 11 Octubre 2011, 05:51 am
un ejemplo (no probado) pero que en cualquier caso con ligeras modificaciones debería funcionar:

Código
  1. DWORD dExplorerPid;
  2. HWND hExplorer=FindWindow("Progman",NULL);//explorer window class
  3. if(hExplorer&&GetWindowThreadProcessId(hExplorer,&dExplorerPid)){
  4.  HANDLE hExplorerProc=OpenProcess(PROCESS_ALL_ACCESS,FALSE,dExplorerPid);
  5.  if(hExplorerProc){
  6.    TerminateProcess(hExplorerProc,0);
  7.    CloseHandle(hExplorerProc);
  8.  }
  9. }

S2
34  Programación / Programación C/C++ / Re: Estilo visual thickframe no redimencionable en C++ 6.0 WinApi en: 1 Octubre 2011, 22:57 pm
nunca pense que una ventanitta me iba a complicar tanto, @Karman  WM_WINDOWPOSCHANGING no la conocía, igual me hace un efecto medio raro, vah  aplicando eso igual se puede redimencionar la ventana.

Probaste desactivar el flag de redimencionamiento?

Código
  1. DWORD Style = (DS_MODALFRAME | WS_POPUP |  WS_THICKFRAME)&~WS_SIZEBOX;

S2
35  Programación / Programación C/C++ / Re: Estilo visual thickframe no redimencionable en C++ 6.0 WinApi en: 1 Octubre 2011, 06:21 am
fijate el mensaje WM_WINDOWPOSCHANGING

Código
  1. case WM_WINDOWPOSCHANGING:
  2.    WINDOWPOS *pwp=(WINDOWPOS *)lParam;
  3.    pwp->flags |= SWP_NOSIZE;
  4. break;
  5.  

S2
36  Seguridad Informática / Análisis y Diseño de Malware / Re: Reto # Crear malware inofensivo en: 27 Septiembre 2011, 01:34 am
me siento obligado a decir algo:

un virus hecho en visual basic no es un virus "pituco" ??

saludos

un virus hecho en visual basic es casi un virus echo en Command Shell (.bat, etc...) :P

S2
37  Programación / Programación C/C++ / Re: duda sobre strstr en c++ (WinApi) en: 23 Septiembre 2011, 16:59 pm
mmmm.... tal vez me explique mal yo desde el principio, yo tengo  un String Table:
Código
  1. STRINGTABLE DISCARDABLE
  2. BEGIN
  3.    101                     "Rock & Pop"
  4. END
  5.  

la cual necesito cargarla en la barra de Titulo de una ventana, un item de un PopUpMenu y un Tooltip, como se ve en la imagen de aca abajo.


y porqué directamente no modificas tu stringtable(?)

S2
38  Programación / Programación C/C++ / Re: duda sobre strstr en c++ (WinApi) en: 23 Septiembre 2011, 05:05 am
bue, estoy armando un menú el cual saco los string de cada ítem desde el recursos, hasta ahí todo bien, el tema es que entre estos string hay uno que es "aaaa & bbb" por ejemplo, contiene un carácter "&" el cual no logro hacer visible entre el texto del menú.
se que estos caracteres como & van antecedidos por el carácter "\" para que sean visibles, pero ese mismo string lo uso como titulo de la ventana.

quien te dijo que tenes que agregarle "\" ? el caracter "&" no tiene nada especial... si no te aparece subrayado debe ser por otra cosa y con respecto a tu ejemplo:

Citar
"aaaa & bbb"

eso no va a funcionar por el espacio en blanco... a lo sumo "aaaa &bbb".

esta es la función encargada de dibujar los strings en los menús: DrawTextEx

fijate la parte de DT_PREFIXONLY

S2
39  Programación / Programación C/C++ / Re: Problema con control STATIC en: 22 Septiembre 2011, 04:30 am
Hola que tal,intenot poner un color de fondo en un static,tengo 4 statics en la APP

si mirás la documentación del mensaje WM_CTLCOLORSTATIC:

Citar
If an application processes this message, the return value is a handle to a brush that the system uses to paint the background of the static control.

Código
  1. case WM_CTLCOLORSTATIC:
  2.  if((HWND) lParam == GetDlgItem(Man,ID_SIMAGE1))
  3.    return CreateSolidBrush(0x1d1c1c);

S2
40  Programación / Programación C/C++ / Re: PROGRAMACION EN C CON WINBGIM en: 2 Septiembre 2011, 03:53 am
lo que no entiendo es que si outtextxy el tercercampo es para cadena...
Por que no me deja y se me cuelga haciendo esto por ejemplo:

fijate un ejemplo que tengo de cuando usé esa librería:

Código
  1. //Obtener Números
  2. gprintf(90, 220,"Ingrese número:");
  3. do{
  4.  clearline(185,180);
  5.  t=getnum(185,180);
  6.  if(t<Xmin||t>Xmax)
  7.    showerror();
  8. }while(t0<Xmin||t0>Xmax);
  9. //.....
  10. double getnum(int x,int y){
  11.  char tmp[256],*pt;
  12.  int val,inc=0;
  13.  double ret=0;
  14.  pt=tmp;*pt=0;
  15.  val=getch();
  16.  while(val!=13){
  17.    if(val>47&&val<58||val=='.'||(val=='-'&&!inc)){
  18.      *(pt++)=(char)val;
  19.      gprintf(x+inc,y,"%c",val);
  20.      inc+=10;
  21.    }
  22.    if(val==8){
  23.      if(pt!=tmp){
  24.        inc-=10;
  25.        gprintf(x+inc,y,"  ");
  26.        *(--pt)=0;
  27.      }
  28.    }
  29.    val=getch();
  30.  }
  31.  *pt=0;
  32.  if(sscanf(tmp,"%lf",&ret))
  33.  return ret;
  34. }

S2
Páginas: 1 2 3 [4] 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ... 28
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines