Click here to Skip to main content
12,823,023 members (49,595 online)
Click here to Skip to main content
Add your own
alternative version

Stats

10.4K views
140 downloads
17 bookmarked
Posted 7 Oct 2014

Finding Skype's Default Account Name

, 9 Jan 2017 CPOL
Rate this:
Please Sign up or sign in to vote.
This article explains how the Skype account details are stored, how to fetch this information and in general, how to interpret XML files using Rapid XML library.

Introduction

The purpose of this article is to show you how to find the default Skype's account name.

The Problem

I needed to code a function that extracts data from the default Skype account on a given computer. To do so, I first needed to locate the default account name. I found a simple way of doing so.

The Solution

The Skype default account’s name is stored in a file named “shared.xml”. This file is stored in C:\users\username\AppData\Roaming\Skype\.

First, we need to find this location as the exact path we need to access varies based on username.

To do so, we use:

SHGetSpecialFolderPath

and pass CSIDL_APPDATA as its parameter.

According to MSDB, "The file system directory that serves as a common repository for application-specific data."

So to get that path, we call:

TCHAR szFileName[MAX_PATH + 1];
SHGetSpecialFolderPath(0, szFileName, CSIDL_APPDATA, 0);

This file is obviously an XML file. So the next step is to open "shared.xml" located in that path and extract from it the desired information.

To do so, we need an XML parser and RapidXML is the one I recommend. RapidXml is a very fast, open source XML parser which preserves its usability, is portable, is W3C compatible. It is an in-situ parser written in modern C++, with parsing speed approaching that of strlen function executed on the same data.

Alternatively, XML files can be proceed using the CString type, just by calling Find for locating the begining and the end of each XML element. In my article The Secrets of Wi-Fi Credentials, I use that method so there is no XML "helper" class included in the source code and yet, all Wi-Fi credentials are fetched (when you run the program) as the values are found using the "Find()" method.

In order to find the default account's name, we first need to find in this file the “Account” element and inside of it to find the “default” element where the account name will be found.

rapidxml::xml_node<char>* node_account = 0;
if (GetNodeByElementName(root, "Account", &node_account) == true)
{
      rapidxml::xml_node<char>* node_default = 0;
      if (GetNodeByElementName(node_account, "default", &node_default) == true)

      {
             swprintf(result, 100, L"%hs", node_default->value());
             free(xmlData);
             return true;
       }
}

So if you run the test application after compiling the source code associated with this article, you should get an output similar to that one:

Points of Interest

I have taken the opportunity to demonstrate a minimal MFC application, created by scratch and not using the Visual Studio Wizard, whilst containing only the necessary definitions and include files.

The source code which accompanies this tip was created and compiled under Visual Studio 2013 Ultimate.

Since this article was published, I was asked to add further instructions for obtaining stored Skype chat logs and other stored information and I plan to do that in future articles.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Michael Haephrati
CEO Secured Globe, Inc.
United States United States
Michael Haephrati, is an entrepreneur, inventor and a musician. Haephrati worked on many ventures starting from HarmonySoft, designing Rashumon, the first Graphical Multi-lingual word processor for Amiga computer. During 1995-1996 he worked as a Contractor with Apple at Cupertino. Worked at a research institute made the fist steps developing the credit scoring field in Israel. He founded Target Scoring and developed a credit scoring system named ThiS, based on geographical statistical data, participating VISA CAL, Isracard, Bank Leumi and Bank Discount (Target Scoring, being the VP Business Development of a large Israeli institute).

During 2000, he founded Target Eye, and developed the first remote PC surveillance and monitoring system, named Target Eye.


Other ventures included: Data Cleansing (as part of the DataTune system which was implemented in many organizations.



You may also be interested in...

Pro

Comments and Discussions

 
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170308.1 | Last Updated 9 Jan 2017
Article Copyright 2014 by Michael Haephrati
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid