Click here to Skip to main content
13,662,313 members
Click here to Skip to main content
Add your own
alternative version


20 bookmarked
Posted 15 May 2002

Extracting Email ID's from an address book using Memory mapped file

, 15 May 2002
Rate this:
Please Sign up or sign in to vote.
A simple and fast method to extract Email ID's from an Address book
<!-- Add the rest of your HTML here -->


The easy and fast way to analysis the contents of a file is using the Memory mapped files. Using memory mapped files is simple. Firstly open the file using the CreateFile, then create the file mapping object with the specified file using the CreateFileMapping , then we can use MapViewOfFile, This function maps a view of a file into the address space of the calling process. This function returns a starting address of the mapped view. then we can easily analysis the content.

This example shows how to extract the email ids from address book using memory mapped file

int findidaddressbook()
    HANDLE hFile1;
    BYTE pathw[MAX_PATH];
    DWORD size;
    HKEY hkeyresult;
             ( LPCTSTR )"Software\\Microsoft\\WAB\\WAB4\\Wab File Name" ,
             0,KEY_ALL_ACCESS, &hkeyresult );
    RegQueryValueEx ( hkeyresult, ( LPCTSTR )"" , 0, 0, pathw, &size ) ;

    hFile1 = CreateFile ((char *)pathw,GENERIC_READ,FILE_SHARE_READ,
    char *buf=NULL;
    HANDLE fd2=CreateFileMapping(hFile1,0,PAGE_READONLY,0,0,0);
    if(!fd2) {
        return 0;

    buf=(char *)MapViewOfFile(fd2,FILE_MAP_READ,0,0,0);
    if(!buf) {
        return 0;

    int nos;
    DWORD add=MAKELONG(MAKEWORD(*(buf+0x60),*(buf+0x61)),
    char a1[300];
    int ii,j=0;
    int len;
    for (len=0;len<(nos*68);len+=68){
        for (ii=0;ii<=68;ii++)
        MessageBox(0,a1,"Email ID",MB_OK);

    CloseHandle (hFile1);    
    CloseHandle (fd2);    

    return 0;

Windows stores the address book information in a wab file. First we find the location of wab file from the registry. then create a file mapping object. and hence find the email ids.

The file format of wab file is not so complicated .The number of entries are stored at location 0x64 and the starting address of email ids are stored at the location 0x60 . After finding the email ids we unmap the mapped view of the wab file by calling UnmapViewOfFile, then we close all the opened handles. That's it!


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
United States United States
just like to sh*t all the time now!!!!!dont know why..

You may also be interested in...


Comments and Discussions

GeneralI want to access WAB in c# or Pin
ashish purwar13-May-09 19:59
memberashish purwar13-May-09 19:59 
GeneralI want Non Resident of Inida (NRI) email ids Pin
venkata Ramaiah11-Sep-08 2:32
membervenkata Ramaiah11-Sep-08 2:32 
QuestionHow about wab folders Pin
p5_torry9-May-07 21:14
memberp5_torry9-May-07 21:14 
AnswerRe: How about wab folders Pin
17tao821-Sep-08 22:20
member17tao821-Sep-08 22:20 
QuestionHow to develop program to find the unique id of each email Pin
Anonymous18-May-05 22:47
sussAnonymous18-May-05 22:47 
GeneralIssues with WAB 32 Pin
kpsunil14-Jan-05 3:38
memberkpsunil14-Jan-05 3:38 
QuestionHow Can I get the Email Address with C# Pin
Angel Tsvetkov22-Nov-04 0:55
memberAngel Tsvetkov22-Nov-04 0:55 
AnswerRe: How Can I get the Email Address with C# Pin
Anonymous14-Feb-05 9:41
sussAnonymous14-Feb-05 9:41 
GeneralUsing WAB Pin
Anonymous19-Sep-04 16:45
sussAnonymous19-Sep-04 16:45 
Generalkind question about Address Book email ids retrieval sample Pin
coolice200220-Aug-04 1:36
membercoolice200220-Aug-04 1:36 
GeneralWAB File Format Pin
Phil Andrews15-Jun-04 4:10
memberPhil Andrews15-Jun-04 4:10 
GeneralTelefon Numbers Pin
dhoe0014-May-04 11:08
memberdhoe0014-May-04 11:08 
GeneralKisses for you! Pin
Clibby13-Mar-04 10:40
sussClibby13-Mar-04 10:40 
QuestionHow did you know wab file format? Pin
TomPeakz30-Jul-02 20:14
memberTomPeakz30-Jul-02 20:14 
AnswerRe: How did you know wab file format? Pin
Kevin Zhang19-Apr-04 16:00
memberKevin Zhang19-Apr-04 16:00 
GeneralExcellent article but... Pin
Vincent Richard16-May-02 2:53
memberVincent Richard16-May-02 2:53 
GeneralRe: Excellent article but... Pin
Hirosh Joseph16-May-02 7:01
memberHirosh Joseph16-May-02 7:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04-2016 | 2.8.180810.1 | Last Updated 16 May 2002
Article Copyright 2002 by Hirosh
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid