Click here to learn
about this Sponsor:
Home  |  News  |  Articles  |  Polls  |  Forum  |  Directory

Keywords: Match:
What is HORM and how can you use it?
by Mike Moini (Nov. 9, 2006)

Foreword: HORM is an acronym for "Hibernate Once Resume Many," a valuable feature for quickly booting a Windows XP Embedded system. In this whitepaper, Mike Moini, a developer on the Windows XP Embedded team, reviews the basics of HORM and describes some new APIs added in Feature Pack 2007.



What is HORM and how can you use it?

by Mike Moini

The HORM feature allows a rapid reboot and return to the same hibernated image over and over again. Much different from the way you typically use hibernate mode on shut down with your desktop. With your desktop non-XP embedded operating system, you can only restore the image you hibernated last and hibernated images do not persist across reboots. If you want to return to the same image after a rapid reboot on your device, your choice is HORM.

HORM works with EWF (Enhanced Write Filter). This feature is not new to the XP Embedded operating system and was introduced in SP2. We did not change the functionality of HORM in FP2007. We changed the way HORM is activated and enabled. Previously, for HORM to work, you had to manually create a file in the root directory. To disable HORM, you had to disable EWF, reboot (for EWF disable to take effect), delete the file, reboot (for resume from hibernation to get clear), enable EWF and reboot again (for EWF enable to take effect).

Not any more. Now the interface to HORM has become more user friendly and more importantly, it requires fewer reboots when you need to deactivate HORM. "Why would you need to deactivate such a marvelous feature," you ask? When you want to service your device: upgrade the software, install a new application, apply a security patch, etc.

HORM process
(Click image to enlarge)
First of all, lets cover the basics together. You must first enable HORM in your configuration before being able to activate or deactivate it at run time. If HORM is not enabled during configuration (that is before building an embedded image), the run time commands and APIs to activate or deactivate HORM will return an error. Something like "HORM is not supported on this image." So, you have to plan ahead if you want to use HORM on a system. The process for using HORM looks like the block diagram pictured at right.

Once you have enabled HORM for your image, it defaults to being active. All subsequent activation/deactivation of HORM takes effect immediately and does not require a reboot. There are two ways to activate/deactivate HORM; one is using the EWF API and the other one is using the EWF command line interface (EWFMGR).

There 3 new APIs added to EWF; two for activation/deactivation and one for returning the state of HORM. These are: EwfMgrActivateHORM (HANDLE hDevice),EwfMgrDeactivateHORM (HANDLE hDevice), and EwfMgIsHORMActivated( HANDLE hDevice)). Sample code to use these APIs is provided at the end of this article.

There are only two new command options added to EWFMGR (-activatehorm and -deactivatehorm). The current state of HORM is added to generic command responses. This is the response that gets printed to the screen when you type "ewfmgr" with no command option.


Sample code illustrating use of HORM APIs
// EWFTestAPI.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include windows.h
#include windef.h
#include winbase.h
#include winioctl.h
#include stdio.h
#include stdlib.h
#include string.h

#define EWFIMP
#include "ewfapi.h"
#include "ewfapip.h"

// main body
int _tmain(int argc, _TCHAR* argv[])
{
HANDLE hSrcDevice = INVALID_HANDLE_VALUE;
char szSource[255];
char * psz;
int i;
BOOL ret_status;

*szSource = '\0';
strcpy_s(szSource, "\\\\.\\c:");
hSrcDevice = CreateFile((LPCWSTR)szSource, GENERIC_WRITE | GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING, NULL);

if (hSrcDevice == INVALID_HANDLE_VALUE)
{
printf("Failed opening the target device %s with error %ld\n",
szSource, GetLastError());
return 0;
}
for (i = 1; i argc; i++)
{
psz = (char *)argv[i];
if (*psz == '?')
{
goto usage;
}
else if (*psz == 'A')
{
printf("Activation...");
ret_status = EwfMgrActivateHORM(hSrcDevice);
if (ret_status)
printf("PASSED\n");
else
printf ("FAILED\n");
}
else if (*psz == 'D')
{
printf("Deactivating...");
ret_status = EwfMgrDeactivateHORM(hSrcDevice);
if (ret_status)
printf("PASSED\n");
else
printf ("FAILED\n");
}
else if (*psz == 'G')
{
printf("Geting the state...");
ret_status = EwfMgIsHORMActivated(hSrcDevice);
if (ret_status)
printf("Activated\n");
else
printf ("Deactivated\n");
}
else
goto usage;
}
return 0;
usage:
printf ("USAGE: EWFTestAPI A: Activates HORM \n");
printf (" EWFTestAPI D: Deactivates HORM\n");
printf (" EWFTestAPI G: Returns the state of HORM (NotSupported,
Active, or Deactive)\n");
return 0;
}


Copyright (c) 2006 Microsoft Corp. All rights reserved. Reproduced by WindowsForDevices.com with permission. This article was originally published on the Windows XP Embedded Team Blog, here.



About the author: Mike Moini is a software developer who joined Microsoft's Windows XP Embedded product team last summer. For the Windows XP Embedded Feature Pack 2007 product, he was part of the Embedded Enabling Features team, and was specifically responsible for EWF enhancements and HORM enhancements. Moini, who was born in Tehran, holds BS and MS degrees in Electrical Engineering and has developed embedded and real-time software, mostly for wired and wireless communication equipment.



Related stories:

(Click here for further information)


7 Advantages of D2D Backup
For decades, tape has been the backup medium of choice. But, now, disk-to-disk (D2D) backup is gaining in favor. Learn why you should make the move in this whitepaper.

4 Legal Reasons to Control Internet Access
The Internet is obviously a valuable resource for many organizations. However, many are exposed to legal liability concerns because they fail to control Internet access. Learn if you're safe in this white paper.

Rapidly Resolve J2EE Application Problems
Whether you are in the process of building J2EE applications or have J2EE applications already running in production, you must ensure that they deliver the expected ROI. Learn how in this white paper.

Load Testing 2.0 for Web 2.0
There are many unknowns in stress testing Web 2.0 applications. Find out how to test the performance of Web 2.0 in this white paper.

Build Better Games Online
For the game infrastructure providers, life is complex. Making money from games has become more complicated. Why? Find out in this white paper.

Building a Virtual Infrastructure from Servers to Storage
This white paper discusses the virtual storage solutions that reduce cost, increase storage utilization, and address the challenges of backing up and restoring Server environments.

Gaining Faster Wireless Connections with WiMAX
Welcome to what is quickly becoming the hyperconnected world where anything that would benefit from being connected to the network will be connected. Learn more in this white paper.

Is Your Desktop a Security Threat?
The new wave of sophisticated crimeware not only targets specific companies, but also targets desktops and laptops as backdoor entryways into those business’ operations and resources. Learn how to stay safe in this white paper.

Increasing SAN Reliability by 100 Percent
Storage area networks (SAN) are a strong part of storage plans. Learn how to increase your reliability and uptime by 100 percent in this case study.

 


Got a HOT tip?   please tell us!
Free weekly newsletter
Enter your email...
Click here for a profile of each sponsor:
PLATINUM SPONSORS
(Become a sponsor)

ADVERTISEMENT
(Advertise here)


Check out the latest Windows-powered...

mobile phones!

other cool
gadgets

HOT TOPICS
Microsoft targets PNDs with new embedded OS
Microsoft tips .NET MF 3.0 highlights
Microsoft previews Windows Embedded Standard
Microsoft offers free Windows CE 6.0 textbook
Microsoft renames embedded operating systems
Microsoft unveils Windows Mobile 6.1
New Atom models target low-cost PCs
REFERENCE GUIDES
Windows Device Showcase
Intro to Windows Embedded
Intro to Shared Source
Real-time Windows Embedded
Windows Embedded books
Join our Windows Embedded discussion forums:
Windows XP Embedded
Windows CE
Windows Mobile


Windows Embedded developer newsgroups
Windows CE
XP Embedded
PocketPC
Smartphone

Microsoft's Windows Embedded resources
Embedded dev center
Mobile dev center
Windows CE tutorials
XP Embedded tutorials
Windows Embedded seminars
Windows Embedded application categories
3rd-party partners


BREAKING NEWS

• Upated JVM supports Windows CE
• Windows Mobile 6.1 phone has GPS
• Windows CE thin client hides in wall sockets
• Portable spectrum analyzer runs Windows CE
• VoIP client gains add-ons, API
• Windows Mobile phone has dual active SIMs
• Access gives away Windows Mobile utilities
• Intel's Atom powers mini-ITX board
• Microsoft revamps Windows Mobile website
• Low-cost phone bundles IM client
• Pico-ITX board bears twins
• Microsoft details finalists in student competition
• Intrinsyc revs Windows CE-based software platform
• $300 mini-laptop runs Windows CE
• Microsoft releases server virtualization technology


MOST POPULAR (last 90 days)
Windows Mobile 6 SDKs available for download
Guide to HTC's Windows Mobile smartphone platforms
Microsoft unveils Windows Mobile 6.1
HTC announces unlocked Windows Mobile 6.1 phone
UMPC squeezes in optical drive
Running Windows Mobile 6.1 on your desktop computer
Microsoft releases Windows XP Service Pack 3
Mobile Firefox gets speedup, design tweaks
MOST POPULAR (Classics from the vault)
The Windows Mobile Phones Showcase
Windows XP Embedded USB boot
Troubleshooting Windows XPe's blue screen "Stop 0x0000007B" error
Asus reveals $190 mini notebook
HTC adds GPS to Windows Mobile Touch line
Windows Mobile VPN client plays with Cisco
Guide to HTC's Windows Mobile smartphone platforms
Customizing Windows XP Embedded thin clients
The Windows Mobile Pocket PCs Showcase

Also visit our sister sites:


Sign up for WindowsForDevices.com's...

news feed

Home  |  News  |  Articles  |  Polls  |  Forum  |  Directory  |  About  |  Contact
 

Ziff Davis Enterprise Home | Contact Us | Advertise | Link to Us | Reprints | Magazine Subscriptions | Newsletters
Tech RSS Feeds | White Papers | ROI Calculators | Tech Podcasts | Tech Video | VARs | Channel News

Baseline | Careers | Channel Insider | CIO Insight | DesktopLinux | DeviceForge | DevSource | eSeminars |
eWEEK | Enterprise Network Security | LinuxDevices | Linux Watch | Microsoft Watch | Mid-market | Networking | PDF Zone |
Publish | Security IT Hub | Strategic Partner | Web Buyer's Guide | Windows for Devices

Developer Shed | Dev Shed | ASP Free | Dev Articles | Dev Hardware | SEO Chat | Tutorialized | Scripts |
Code Walkers | Web Hosters | Dev Mechanic | Dev Archives | igrep

Use of this site is governed by our Terms of Service and Privacy Policy. Except where otherwise specified, the contents of this site are copyright © 1999-2008 Ziff Davis Enterprise Holdings Inc. All Rights Reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff Davis Enterprise is prohibited. Windows is a trademark or registered trademark of Microsoft Corporation in the United States and/or other countries and is used by WindowsForDevices under license from owner. All other marks are the property of their respective owners. WindowsForDevices is an independent publication not affiliated with Microsoft Corporation.