zoukankan      html  css  js  c++  java
  • 一次恢复outlook express通讯录文件*.wab的经历

    同事给领导的htc 安卓手机导通讯录,导到OE的通讯录里,不小心把OE中的记录删除了,而且同时手机上千余条通讯录也一条不剩。情急之下过来找我。我替他想办法。

    1.首先看htc手机上有没有通讯录备份。进入联系人,弹出关联菜单,选更多,找到导入导出(或备份恢复,记不清了)。看到手机是支持备份与恢复的。试图恢复,显示找不到备份文件。

    2.上网查有没有恢复htc丢失的通讯录的方法。发现不少人有类似遭遇,受害人齐声声讨htc和android2.1。

    3.下面是想办法恢复OE的通讯簿记录。上网查,找到一款软件叫Address Book Recovery,卖$30,好贵的。下载了DEMO版,只可恢复10条,试用了一下,果然能行。

    想办法找破解版。找啊找。找不到。全是DEMO版10条记录限制的。

    4.继续找其它的恢复wab数据的方法。有一条特别有创意:

    如果不小心删除了地址簿或者其中的联系人,可以打开文件夹(如果是Windows 98,则打开文件夹),先把.wab文件改为.wax,再把.wa~改为.wab即可恢复。

    我在本机上测试,是有一个wab~文件,不过改名之后似乎没有成功恢复原来的数据。到他的事发电脑上找,开始时找不到wab文件,后来在文件夹选项里设置了显示隐藏文件和文件夹,即找到wab文件和wab~文件,不过那两个文件只有一百来K,用Address Book Recovery看了一下,里面只有七八十条记录,显然不行。看来不用付费买正版了。

    5.最后打400电话给htc公司,公司员工问了十来分钟,查了些资料,最后回复说,无能为力。

    6.另外,我上网查了wab格式,想着能不能通过编程方式自己解决问题。既然wab文件没有多少内容,这个办法也就没有多少意义了。找到一篇英文的文档,就贴到这里,留作备忘吧。

    ==============================================

    http://www.cnblogs.com/xiaotaoliang/archive/2005/08/01/205124.html

    wab文件格式分析

    referred from http://www.vbcity.com/forums/topic.asp?tid=46944&highlight=read%7Cwab

    The path of the Windows Address Book (wab) file used by Outlook Express can be found in the registry at: HKEY_CURRENT_USER/Software/Microsoft/WAB/WAB4/Wab File Name.

    Here's what I've managed to figure out about the wab file format, looking at it with a hex editor (first byte of the file is byte zero).

    Byte #:
    32-35 ($20-$23) - Location (Address) in the file of the start of the table that tells where the information for each contact is located (I'll refer to it as the Contact Data Table).
    36 ($24) - Number of entries in the Contact Data Table.
    48-51 ($30-$33) - Location in the file of the list of Display Names for the persons (contacts) in the address book.
    52 ($34) - Number of Display Names in the file
    64-67 ($40-$43) - Location in the file of the list of Last Names for the contacts.
    68 ($44) - Number of Last Names in the file.
    80-83 ($50-$53) - Location in the file of the list of First Names for the contacts.
    84 ($54) - Number of First Names in the file.
    96-99 ($60-$63) - Location in the file of the list of E-Mail Addresses.
    100 ($64) - Number of E-Mail Addresses in the file.

    In you're trying to read the file in binary mode using VB, you'll need to add one each to each of the values above, since VB considers the first byte of a file to be byte one, not byte zero.

    Format of the Contact Data Table (location as specified above):
    Each entry in this table occupies 8 bytes. The first four bytes of each entry are what we'll call the Contact Index, a value that uniqely identifies each contact in the address book. The 5th through 8th bytes are the location (address) in the file where the Contact Data Record (Home Address, Home Phone, Work Phone, etc.) can be found. The exact format of the Contact Data Record is not something I've figured out yet.

    Format of the other lists above (Display Name, Last Name, First Name, and E-Mail Address):
    Each entry in one of these lists occupies 68 bytes. The bytes are stored as Unicode, meaning there are two bytes for each character, with the upper byte being zero (at least in English language versions of Windows). By reading every other byte, you can get the ASCII values that represent each character in an entry in the list. When you come to a byte pair where the lower order byte is zero, you've reached the end of the text for that entry. The 65th to 68th bytes of each entry are the Contact Index. By matching up Contact Index values between lists, you can tell which entry in one list goes with an entry in another (i.e., which Display Name belongs with which E-Mail Address). You can also match the Contact Index in these lists to the one in the Contact Data Table to determine where the rest of the contact's information is located in the file.

    Recent versions of Outlook Express allow you to store multiple address books (or the address book for multiple Outlook Express identities) in one wab file. I haven't yet figured out how to separate the data by identity. Using the information above, you'll end up getting the data for every contact that exists in the file, regardless of what address book or identity it belongs to.

    I have a VB6 project (MAPIMail) that uses what I've found out about the wab file to read the Display Names and E-Mail Addresses for each contact. It also uses the Microsoft MAPI Controls (MAPISession and MAPIMessages) to create an e-mail client that allows you to read and send e-mails, as well.

    Since I haven't yet figured out the entire format of the Contact Data Record, I can't get at information like addresses and phone numbers by reading them directly from the wab file. The only way I've figured out to get this information is using another VB6 project I've created (AddrBook.vbp) that opens Microsoft's Address Book reader (wab.exe), then uses API calls to force it to export the address book as a comma-separated-value (.csv) file. My program then reads this file and displays the information in a ListView. A hokey method of getting at the data, I'll admit, but the best I've been able to do, so far.

    My programs were tested on a computer running Windows 2000 SP4 with Outlook Express 6.

    唉。。实际上,这些数据都可以通过微软的API获取,但是其他信息,如公司、电话、家庭等等的格式就比较混乱了,基本上都是在文件尾部,但是到底从什么位置开始,还找不到规律。。。
    另外,地址本每次修改都会做一次备份操作,这个机制倒是研究出来了。。

    0x8A8处记录了文件尾部有效数据的开始地址

  • 相关阅读:
    168. Excel Sheet Column Title
    171. Excel Sheet Column Number
    264. Ugly Number II java solutions
    152. Maximum Product Subarray java solutions
    309. Best Time to Buy and Sell Stock with Cooldown java solutions
    120. Triangle java solutions
    300. Longest Increasing Subsequence java solutions
    63. Unique Paths II java solutions
    221. Maximal Square java solutions
    279. Perfect Squares java solutions
  • 原文地址:https://www.cnblogs.com/anjo/p/2279806.html
Copyright © 2011-2022 走看看