⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getguid.cpp

📁  读取Notebook 1394 Guid
💻 CPP
字号:
#include <dos.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <process.h>

void ver(void);

#define MAX_INFO 500
#define Max 100
#define Nax

#define TRUE  0
#define FALSE 1

typedef unsigned char   BYTE;
typedef unsigned int    WORD;
typedef unsigned long   DWORD;


unsigned long GDT_Table[]={0,0,0x0000FFFF,0x00CF9A00,0x0000FFFF,0x00CF9200};
unsigned char OldIDT[6] = {0};
unsigned char pdescr_tmp[6] = {0};

#define  KeyWait() {while(inportb(0x64)&2);}

typedef unsigned char BYTE;

void showHelp(void)
{
   printf("\n\n");
   printf("  /?        -Display help information\n");
   printf("  /t        -guid.log file\n");
}

void version(void)
{

}


void A20Enable(void)
{
    KeyWait();
    outportb(0x64,0xD1);
    KeyWait();
    outportb(0x60,0xDF);
    KeyWait();
    outportb(0x64,0xFF);
    KeyWait();
}

void LoadFSLimit4G(void)
{
    A20Enable();
    asm{
       cli
       sidt OldIDT
       LIDT pdescr_tmp
    }
    asm{
       db 0x66
       MOV CX,DS
       db 0x66
       SHL CX,4
       MOV word ptr pdescr_tmp[0],(3*8-1)
       db 0x66
       XOR AX,AX
       MOV AX,offset GDT_Table
       db 0x66
       ADD AX,CX
       MOV word ptr pdescr_tmp[2],AX
       db 0x66
       SHR AX,16
       MOV word ptr pdescr_tmp[4],AX
       LGDT pdescr_tmp
    }

    asm{
       MOV DX,0x10
       db 0x66,0x0F,0x20,0xC0
       db 0x66
       MOV BX,AX
       OR AX,1
       db 0x66,0x0F,0x22,0xC0
       JMP flush
    }

    flush:
    asm{
       db 0x66
       MOV AX,BX
       db 0x8E,0xE2
       db 0x66,0x0F,0x22,0xC0
       LIDT OldIDT
       STI
    }
}

unsigned char ReadByte (unsigned long Address)
{
    unsigned char AL;
    asm db 0x66
    asm mov di,word ptr Address
    asm db 0x67
    asm db 0x64
    asm mov al, byte ptr [BX]
    return _AL;
}

unsigned char WriteByte(unsigned long Address)
{
    BYTE AL;
    asm db 0x66
    asm mov di,word ptr Address
    asm db 0x67
    asm db 0x64
    asm mov byte ptr [Bx],al
    asm mov AL,byte ptr [Bx]
    return _AL;
}

void Dump4G(unsigned long Address)
{
    int i,j;

    for(i=0;i<20;i++)
    {
      printf("%08lX:",(Address+(i*16)) );

      for(j=0;j<16;j++)
     {
       printf("%02x",ReadByte(Address+i*16+j));
     }
     printf(" ");
     for(j=0;j<16;j++)
     {
       if(ReadByte(Address+i*16+j)<0x20)
	printf(".");
       else
	printf("%c",ReadByte(Address+i*16+j));
    }
    printf("\n");
  }
}

int main(int argc,char *argv[])
{
    unsigned long Address = 0x34002024;
    unsigned long tmp;
    unsigned char GUID[Max];
    unsigned char UUID[Max];
    unsigned char head[8];
    unsigned char string[Max],dsting[Max];
    unsigned far char *pSmbiosBegin,far *pSmbiosIndex;
    unsigned far char *pBiosStart;

    int SmbiosSeg,SmbiosOff;
    int hiSmbiosSeg,loSmbiosSeg,hiSmbiosOff,loSmbiosOff;
    int i = 0, j = 0;

    FILE *fp;
    fp = fopen("guid.log","w+");
    if(fp==NULL)
    {
	printf("Can't not guid.log\n");
	exit(1);
    }
    if(argc!=2)
    {
	version();
	printf("\n\nForgot to input parameter!!!\n");
	exit(1);
    }
    else
    {
      if( (!stricmp(argv[1],"/h"))||(!stricmp(argv[1],"-h"))||
	  (!stricmp(argv[1],"/?"))||(!stricmp(argv[1],"-?")) )
      {
	  version();
	  showHelp();
	  exit(1);
      }

      if( (!stricmp(argv[1],"/t"))||(!stricmp(argv[1],"-t")) )
      {
	  memset(&UUID,0,sizeof(UUID));
	  memset(&GUID,0,sizeof(GUID));

	  LoadFSLimit4G();

	  for(i=0;i<=7;i++)
	  {
	      GUID[i] = ReadByte(Address+i);
	  }

	  sprintf(string,"%02x%02x%02x%02x%02x%02x%02x%02x\0",GUID[7],GUID[6],GUID[5],GUID[4],GUID[3],GUID[2],GUID[1],GUID[0]);
	  delay(1);

	  ver();

	  if(!strncmpi(dsting,"00061b",6))
	  {
	      printf("\n");
	      printf("Guid is %s\n",dsting);
	      fprintf(fp,"%s\n",string);
              return 0;
	  }
	  else
	  {
	      printf("\nGUID is %s\n",string);
	      fprintf(fp,"%s\n",string);
	      return 1;
	  }
      }
    }
}

void ver(void)
{
}



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -