Menú

Mostrar Mensajes

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ú

Mensajes - x64core

#401
Bueno, que puedo decir... empezando mi día bien temprano y ya un epic fail...
Como siempre el tipico haxor con sus epic fails...
-


#402
Cita de: Ikillnukes en  4 Febrero 2014, 20:53 PM
Doble click dentro del cuadro geshi y Ctrl+C mira que fácil :P
No funciona en Chrome,Firefox,IExplorer,Opera.
#403
Cita de: eferion en  4 Febrero 2014, 08:25 AM
lo que no termino de entender es qué tiene que ver DELPHI con C o C++
Que el queria saber la equivalencia de una definicion para C/C++ a Delphi.
#404
Cita de: dato000 en  4 Febrero 2014, 14:07 PM
Eso ya seria usar Visual C++, que es totalmente diferente a usar C/C++ puro. Ya teniendo las herramientas Visual Studio, yo recomendaría más C#, mucho más practico.
Usar Win32 no tiene nada que ver respecto al compilar Visual C++, esto se puede hacer en MingW,Intel,etc. :silbar:
Además ¿adonde crees que terminan llamando esas librerias que mencionaste en Windows? -> Win32
#405
De nadas suerte  ::)
#406
Hice esta traducción rapida, nota que use la estructura que creo que es la estabas buscando la vez pasada, de esta manera accedemos
a los campos directamente. pero sino, pues como dije no hay necesidad de hacer conversion a diferencia como en NET. simplemente haces
algo como esto:

variable = *((SizeOfType*)&Pointer[offset]); / SizeOfType = BYTE, WORD, etc

y obtendras el campo

Uso VC++ como compilador por si tenes problemas al compilar con directivas propias ( #pragma pack, tipos, etc ).

Código (cpp) [Seleccionar]

#pragma pack(push, 1)
typedef struct _BIOS_PARAMETERS_BLOCK
{
   USHORT    BytesPerSector;
   UCHAR     SectorsPerCluster;
   UCHAR     Unused0[7];
   UCHAR     MediaId;
   UCHAR     Unused1[2];
   USHORT    SectorsPerTrack;
   USHORT    Heads;
   UCHAR     Unused2[4];
   UCHAR     Unused3[4];
} BIOS_PARAMETERS_BLOCK, *PBIOS_PARAMETERS_BLOCK;

typedef struct _EXTENDED_BIOS_PARAMETERS_BLOCK
{
   USHORT    Unknown[2];
   ULONGLONG SectorCount;
   ULONGLONG MftLocation;
   ULONGLONG MftMirrLocation;
   CHAR      ClustersPerMftRecord;
   UCHAR     Unused4[3];
   CHAR      ClustersPerIndexRecord;
   UCHAR     Unused5[3];
   ULONGLONG SerialNumber;
   UCHAR     Checksum[4];
} EXTENDED_BIOS_PARAMETERS_BLOCK, *PEXTENDED_BIOS_PARAMETERS_BLOCK;

typedef struct _BOOT_SECTOR
{
   UCHAR     Jump[3];
   UCHAR     OEMID[8];
   BIOS_PARAMETERS_BLOCK BPB;
   EXTENDED_BIOS_PARAMETERS_BLOCK EBPB;
   UCHAR     BootStrap[426];
   USHORT    EndSector;
} BOOT_SECTOR, *PBOOT_SECTOR;
#pragma pack(pop)

VOID GetFiles(LPSTR SzDrive)
{
   if(!SzDrive)
       return;
   
   CHAR SzSymDrive[40] = "\\\\.\\";
   HANDLE hDrive;
   BYTE DriveContent[1024];
   DWORD BytesRead;
   PBOOT_SECTOR lpBootSector;
   LARGE_INTEGER MFTLcl;

   strcat(SzSymDrive,SzDrive);
   hDrive = CreateFileA(SzSymDrive,GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ | FILE_SHARE_WRITE,
               NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL, NULL);
   if(hDrive == INVALID_HANDLE_VALUE)
   {
       return;
   }

   if( (!ReadFile(hDrive,DriveContent,sizeof(DriveContent),&BytesRead,NULL)) ||
       (BytesRead != sizeof(DriveContent))
      )
   {
       goto clhandle;
   }

   lpBootSector = (PBOOT_SECTOR)DriveContent;
   MFTLcl.QuadPart = lpBootSector->BPB.BytesPerSector * lpBootSector->BPB.SectorsPerCluster * lpBootSector->EBPB.MftLocation;

   if(SetFilePointer(hDrive,MFTLcl.LowPart,&MFTLcl.HighPart,FILE_BEGIN) == INVALID_SET_FILE_POINTER)
   {
       goto clhandle;
   }

   if( (!ReadFile(hDrive,DriveContent,sizeof(DriveContent),&BytesRead,NULL)) ||
       (BytesRead != sizeof(DriveContent))
       )
   {
       goto clhandle;
   }

   // ...

clhandle:
   CloseHandle(hDrive);

}

-
llamar por ejemplo:
GetFiles("C:");
#407
Buenas, venia sugerir un boton 'copiar' para los códigos entre geshi asi es más facil para codigos que bastante lineas.
#408
Bien hoy si esta más claro.
Nota la declaración de crbig y como lo uso.


#define zwpath L"\\\\.\\C:"
     
     
long endianhextodec(BYTE *buffers, int offs)
{     
    BYTE tmp[2] = {0};
    BYTE tmp2[1] = {0};
    BYTE tmp3[3] = {0};
    BYTE tmp4[1] = {0};
     
    if(offs == 11){
    tmp[0] = buffers[11];
    tmp[1] = buffers[12];
     
    return tmp[1] << 8;
     
    }
     
    if(offs == 13){
     
    tmp2[0] = buffers[13];
     
    return tmp2[0];
     
    }
     
    if(offs == 30){
     
    tmp3[0] = buffers[48];
    tmp3[1] = buffers[49];
    tmp3[2] = buffers[50];
     
    return tmp3[2] << 16;
    }else{return 0;}

}
     
int main(int argc, char *argv[]){
{
    HANDLE hDevice;
    OVERLAPPED overlapped;
    LARGE_INTEGER crbig;
    BYTE buff[1024] = {0};
    DWORD numerobyte = 0, nbytes = 0;
    UINT32 ret;
    DWORD *d1;
    int offset1 = 11, offset2 = 13, offset3 = 30;
    long MFTCluster = 0, bytespercluster = 0, sectperclusters = 0, offet = 0;
    unsigned long mult = 0;
     
    ZeroMemory(&overlapped ,sizeof(OVERLAPPED));
     
    hDevice = CreateFileW(zwpath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,  FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
     
    if(hDevice != INVALID_HANDLE_VALUE){
     
    ret = ReadFile(hDevice, buff, 1024, &numerobyte, &overlapped);
     
    }else
    {
    return NULL;
    }
     
    if(ret == 0){
     
     
    ret = WaitForSingleObject(hDevice,INFINITE );
     
    switch (ret)
    {
    case WAIT_OBJECT_0:break;
    case WAIT_TIMEOUT:break;
    default:
    break;
    }
    }
    else
    {
    return NULL;
    }
     
     
    if((int)buff[3] == 'N' && (int)buff[4] == 'T' && (int)buff[5] == 'F' && (int)buff[6] == 'S' ){
    printf("Volumen es formato NTFS\n\n\n");
    }
     
    bytespercluster = endianhextodec(buff, offset1);
    sectperclusters = endianhextodec(buff, offset2);
    MFTCluster = endianhextodec(buff, offset3);
     
    printf("Bytes por clusters = %d\nsectores por clusters = %d\nMFTClusters = %ld\n\n", bytespercluster, sectperclusters, MFTCluster);
     

    RtlZeroMemory(&overlapped ,sizeof(OVERLAPPED));
    crbig.QuadPart = (sectperclusters * (bytespercluster * MFTCluster));
    overlapped.Offset = crbig.LowPart;
    overlapped.OffsetHigh = crbig.HighPart;
     
    ret = ReadFile(hDevice, buff, 1024, &numerobyte, &overlapped);
     
    if(ret == 0){

     
    ret = WaitForSingleObject(hDevice,INFINITE );
     
    switch (ret)
    {
    case WAIT_OBJECT_0:break;
    default:
    break;
    }
    }
    else
    {
    return NULL;
    }
     
    for (int n=0; n<sizeof(buff); n++) 
       { 
           printf("0x%02X ", buff[n]); 
       }
     
    CloseHandle(hDevice);
     
    getchar();
}




por cierto, yo no sé porqué estos tios usaron lectura asincronica, no sé si la aplicación es de multihilos de todos modos se puede
usar SetFilePointer en lugar de FILE_FLAG_OVERLAPPED y WaitForSingleObject lo veo totalmente inutil, quizas no conocian SetFilePointer...
#409
ningun extern en realidad, note que todo estaba encapsulado así que mejor decidi agregar las variables a la clase
y que sean disponibles para todas las funciones de esa clase, inicializarlas en el contructor ,el array asignarle memoria al
momento de usarlo ( recorda liberarlo ) aunque hubiera sido bueno incializarlo en el contructor así en el destructor se libera la memoria
eso depende de como diseñes tu programa.
#410
cpp


#include "cpp1.h"
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
     

Camion::Camion (int idCam, int cilindrajeCam, int puertasCam, int anioCam,
                double precioCam, string marcaCam, string modeloCam,
                string colorCam)
                {
                    idCamion = idCam;
                    cilindrajeCamion = cilindrajeCam;
                    nPuertasCamion = puertasCam;
                    anioCamion = anioCam;
                    precioCamion = precioCam;
                    marcaCamion = marcaCam;
                    modeloCamion = modeloCam;
                    colorCamion = colorCam;

                    Maximo =100;
                    cantidadDeCamiones = 0;
                }
//Funciones set
void Camion::setIdCamion(int idCam)
{
    idCamion = idCam;
}
     
void Camion::setCilindrajeCamion(int cilindrajeCam)
{
    cilindrajeCamion = cilindrajeCam;
}
     
void Camion::setNPuertasCamion(int puertasCam)
{
    nPuertasCamion = puertasCam;
}
     
void Camion::setanioCamion(int anioCam)
{
    anioCamion = anioCam;
}
     
void Camion::setPrecioCamion(double precioCam)
{
    precioCamion = precioCam;
}
     
void Camion::setMarcaCamion(string marcaCam)
{
    marcaCamion = marcaCam;
}
     
void Camion::setModeloCamion(string modeloCam)
{
    modeloCamion = modeloCam;
}
     
void Camion::setColorCamion(string colorCam)
{
    colorCamion = colorCam;
}
     
//Funciones get
int Camion::getIdCamion() const
{
    return idCamion;
}
     
int Camion::getCilindrajeCamion() const
{
    return cilindrajeCamion;
}
     
int Camion::getnPuertasCamion() const
{
    return nPuertasCamion;
}
     
int Camion::getanioCamion()const
{
    return anioCamion;
}
     
double Camion::getPrecioCamion() const
{
        return precioCamion;
}
     
string Camion::getMarcaCamion() const
{
        return marcaCamion;
}
     
string Camion::getModeloCamion() const
{
        return modeloCamion;
}
     
string Camion::getColorCamion() const
{
        return colorCamion;
}
     
void Camion::ingresarCamion()
{
    listaDeCamiones = new Camion*[Maximo];// arreglo de 100
    if (cantidadDeCamiones < Maximo)
    {
     
    system("cls");
    cout << "Ingrese los datos del camion\n";
    cout << "Ingrese el ID del camion: ";
    cin  >> idCamion;
     
    cout << "Ingrese la Marca del Camion: ";
    cin  >> marcaCamion;
     
    cout << "Ingrese el Modelo del camion: ";
    cin  >> modeloCamion;
     
    cout << "Ingrese el año del Camion: ";
    cin  >> anioCamion;
     
    cout << "Ingrese el cilindraje del camion: ";
    cin  >> cilindrajeCamion;
     
    cout << "Ingrese el numero de puertas: ";
    cin  >>  nPuertasCamion;
     
    cout << "Ingrese el color del camion: ";
    cin  >> colorCamion;
     
    cout << "Ingrese el presio del camion: ";
    cin  >> precioCamion;
     
    listaDeCamiones[cantidadDeCamiones] = new Camion(idCamion, cilindrajeCamion,
                                                        nPuertasCamion, anioCamion,
                                                        precioCamion, marcaCamion,
                                                        modeloCamion,colorCamion);
    cantidadDeCamiones++;
     
    cout << "Los datos del camion fueron ingresados correctamente\n\n";
    }
    else
    {
        system("cls");
        cout << "Ya no hay espacio disponible para mas camiones\n\n";
    }
}
     
void Camion::flistaDeCamiones()
{
    if (cantidadDeCamiones==0)
    {
        system("cls");
        cout<<"No se a registrado ninguna Camion todavía"<<endl;
        }
        else
        {
            cout<<"..:::Lista de Camiones:::.."<<endl<<endl;
            cout << setw(10)<<"Id Camion"<<setw(15)<<"Modelo"<<setw(15)<<"marca"<<endl;
            cout<<"================================================="<<endl;
     
            //Imprimmir todas las personas almacenadas en el arreglo de personas
            for (int i=0; i<cantidadDeCamiones;i++)
            {
                listaDeCamiones[i]->imprmir();
            }
            cout<<endl<<"*******Fin de la lista **********"<<endl<<endl;
            }
}

void Camion::imprmir()
{
        cout<<setw(10)<<idCamion<<setw(15)<<modeloCamion<<setw(15)<<marcaCamion<<endl;
}


h:

#ifndef CAMION_H
#define CAMION_H
#include <iostream>
using namespace std;


// Variables globales
class Camion
{
    private:
    int idCamion;
    int cilindrajeCamion;
    int nPuertasCamion;
    int anioCamion;
    double precioCamion;
    string marcaCamion, modeloCamion, colorCamion;
     
    public:
    Camion(int =0, int=0, int=0, int=0, double = 0.0, string = "", string = "", string = "");
     
    void setIdCamion(int);
    void setCilindrajeCamion(int);
    void setNPuertasCamion(int);
    void setanioCamion(int);
    void setPrecioCamion(double);
    void setMarcaCamion(string);
    void setModeloCamion(string);
    void setColorCamion(string);
     
    int getIdCamion() const;
    int getCilindrajeCamion() const;
    int getnPuertasCamion() const;
    int getanioCamion() const;
    string getMarcaCamion() const;
    string getModeloCamion() const;
    string getColorCamion() const;
    double getPrecioCamion() const;
     
    //Otros Metodos
    void ingresarCamion();
    void flistaDeCamiones();
    void imprmir();


private:
    Camion**listaDeCamiones;
    int Maximo;
    int cantidadDeCamiones;
     
};
#endif