programmers resources
  http://www.intel-assembler.it/  (c)2017 intel-assembler.it   info@intel-assembler.it
 
Search :  
Lingua Italiana    English Language   
Index
 
just an empty assembly space
just an arrow Intel Platform
just an arrow Article & Guides
just an arrow Download Software


23/01/2009 Featured Article: How to remove Buzus Virus (permalink)




:::3348718:::
Bottone Scambio Directory Pubblicitaonline.it
Home Page | Articles & Guides | Download | Intel Platform | Contacts

Google
 


Bookmark and Share
Download 
Tell a friend



Simple BIOS save

A CPP source to save BIOS in a file

(by unknown)

A very simple CPP code which downloads the BIOS code and saves it in a file. For eg. my BIOS was saved in 64KB.
This article is online from 2438 days and has been seen 9505 times




// biossave.cpp
//
#include "stdafx.h"
#include "biossave.h"
#define MAX_LOADSTRING 100

typedef struct _UNICODE_STRING {
  USHORT  Length;
  USHORT  MaximumLength;
  PWSTR  Buffer;
} UNICODE_STRING,*PUNICODE_STRING;


typedef struct _OBJECT_ATTRIBUTES {
    ULONG Length;// 18h
    HANDLE RootDirectory;//  00000000
    PUNICODE_STRING ObjectName;
    ULONG Attributes;//00000040h
    PVOID SecurityDescriptor;       //Points to type SECURITY_DESCRIPTOR
    PVOID SecurityQualityOfService; //Points to type SECURITY_QUALITY_OF_SERVICE
} OBJECT_ATTRIBUTES;
typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES;

typedef DWORD  (__stdcall *ZWOS)(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
typedef DWORD  (__stdcall *ZWMV)(HANDLE,HANDLE,PVOID,ULONG,ULONG,PLARGE_INTEGER,
                                  PSIZE_T,DWORD,ULONG,ULONG);
typedef DWORD  (__stdcall *ZWUMV)(HANDLE,PVOID);


HINSTANCE hInst;
TCHAR szTitle[MAX_LOADSTRING];
TCHAR szWindowClass[MAX_LOADSTRING];


int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
  MSG msg;
HACCEL hAccelTable;
UNICODE_STRING struniph;
OBJECT_ATTRIBUTES obj_ar;
ZWOS ZWopenS;
ZWMV ZWmapV;
ZWUMV ZWunmapV;
HANDLE hSection;
HMODULE hinstLib;
DWORD ba;
LARGE_INTEGER so;
SIZE_T ssize;
so.LowPart=0x000f0000;
so.HighPart=0x00000000;
ssize=0xffff;
wchar_t strPH[30]=L"\\device\\physicalmemory";
FILE *f1;


     ba=0;
     struniph.Buffer=strPH;
struniph.Length=0x2c;
struniph.MaximumLength =0x2e;
     obj_ar.Attributes =64;
obj_ar.Length =24;//OBJECT_ATTRIBUTES
obj_ar.ObjectName=&struniph;
obj_ar.RootDirectory=0;
obj_ar.SecurityDescriptor=0;
     obj_ar.SecurityQualityOfService =0;

     hinstLib = LoadLibrary("ntdll.dll");
ZWopenS=(ZWOS)GetProcAddress(hinstLib,"ZwOpenSection");
     ZWmapV=(ZWMV)GetProcAddress(hinstLib,"ZwMapViewOfSection");
ZWunmapV=(ZWUMV)GetProcAddress(hinstLib,"ZwUnmapViewOfSection");

     ZWopenS(&hSection,4,&obj_ar);
ZWmapV((HANDLE)hSection,(HANDLE)0xffffffff,&ba,0,0xffff,&so,
        &ssize,1,0,2);
     f1=fopen("bios.mem","wb+");
fwrite((void*)ba,65536,1,f1);
fclose(f1);
MessageBox(NULL,"Bios saved to bios.mem!","Save OK",MB_OK);
return 0;
}



Top
Download 
Tell a friend
Bookmark and Share



Similar Articles

BIOS Boot Specification Version 1.01
A 46 page PDF BIOS specification
(by Compaq - Phoenix - Intel)

BIOS Information Leakage
A nice doc about cmos programming in asm
(by Endrazine)

BIOS Masm 4.0 source 8088
A complete 8088 source code
(by BITNET@CUNYVM.CUNY.EDU)

Bootable CD-ROM Format Specification
Bootable CD and int 13 BIOS extensions
(by Phoenix Technologies / IBM)

IBM AT 80286 BIOS SOURCE CODE
Very detailed BIOS commented code from IBM
(by IBM)

LinuxBIOS 2.0 UEFI Compliant BIOS
An open source replacement for PC BIOS
(by various)

TinyBios (tm) 1.3
An open source x86 assembly bios code
(by PC Engines GmbH)

 Tags: bios, cpp


webmaster jes
writers rguru, tech-g, aiguru, drAx

site optimized for IE/Firefox/Chrome with 1024x768 resolution

Valid HTML 4.01 Transitional


ALL TRADEMARKS ® ARE PROPERTY OF LEGITTIMATE OWNERS.
© ALL RIGHTS RESERVED.

hosting&web - www.accademia3.it

grossocactus
find rguru on
http://www.twitter.com/sicurezza3/
... send an email ...
Your name

Destination email

Message

captcha! Code