04
Apr 2012
22 Comments

Windows 8 Secrets: The WinX Menu and its hashing algorithm

Last week, a reader – “Windows Fan” – tipped me off to an article on Vishal Guptas blog indicating how to customize the new WinX menu in Windows 8. (You know, the menu that appears when you right-click the lower-left Start tip.) Not happy with hacking core system files and peeling back file system security, I dug a little deeper to understand what’s going on and came up with a simpler solution.

So let’s start at the top. The WinX menu is a simple context menu that appears when you right-click the Start tip that appears when you squish the mouse into the lower-left corner of the screen. The purpose of the menu is not to act as a Start Menu replacement but rather as a springboard to perform advanced system functions that are slightly out of reach. For example, if you’re trying to kill a runaway system process, you will probably need quick access to Task Manager, an elevated Command Prompt, and perhaps Programs and Features to uninstall the culprit app. Launching those applications in succession via the Start Screen would be a pain in the rump.

The entries on the menu are driven by shortcut (.lnk) files present in each Group folder located at %LocalAppData%\Microsoft\Windows\WinX. But you can’t manipulate the shortcuts within or add new ones. That’s because at first invocation (e.g. a fresh boot), the menu scans for and only adds approved shortcuts. Why? Again, Microsoft doesn’t want this becoming another Start Menu or, worse, an icon landfill for installers a la Quick Launch back in Windows Vista.

But an argument could be made for that small sliver of folks who genuinely want to lightly extend the menu, perhaps with utilities such as Process Monitor and DebugView. So let’s talk about what makes an approved shortcut.

An approved shortcut – a moniker I made up – is a .lnk file that has the appropriate markings to indicate to Windows “Hey, I’m special.” The marking is a simple 4-byte hash of several pieces of information. From the .lnk itself, two points are collected:

  • The link’s target application path/file (e.g. C:\Games\Minecraft.exe)
  • The link’s target application arguments (e.g. –windowed)

The third ingredient is simply a hard-coded chunk of text, or a salt if you will, to keep things interesting. That string is, literally, “Do not prehash links.  This should only be done by the user.”

With these three strings in hand, Windows then glues them together, lowercases everything, and runs them through the HashData function. But you’re probably wondering at this point, what does it compare to?

Let’s shift our focus to .lnk files. We know them as shortcuts to things. But they’re officially called Shell Links and can store a lot of information on other data objects in Windows. More specifically, they support storing a structure of data called a PropertyStoreDataBlock that acts as a container for arbitrary string or numeric key/value pairs. Yep, the “WinX hash” is stored in here. If you’re curious, the key can be defined as such:

DEFINE_PROPERTYKEY(PKEY_WINX_HASH,
0xFB8D2D7B, 0x90D1, 0x4E34, 0xBF, 0×60, 0x6E, 0xAC, 0×09, 0×92, 0x2B, 0xBF, 0×02);

So to tie it all together, Windows – the Shell specifically – iterates through the .lnk files in each GroupN folder; opens them up; pulls out and concatenates the target path, args, and an arbitrary string; then finally hashes the result. This hash is then compared with the one stored in the .lnk to determine if it’s approved. Rinse and repeat.

If you’re interested in stuffing items into that menu, I wrote a tool to mark your shortcuts as approved. Source code to soon follow on Github. (Please don’t link directly to the file, as I may move things around for the next revision.)

NOTE: The WinX menu doesn’t seem to handle architecture-dependent environment string expansion very well, so shortcuts to %ProgramFiles% may not work (e.g. Internet Explorer 64-bit). I suspect this is a WONTFIX given it’s not designed to work with your own shortcuts.

Update: I replaced the executable with a VS2010 compiled copy, sorry. The previous one would not execute on Windows 8 machines w/o Visual Studio 11 installed. (We don’t have a VC11 runtime redist. kit yet.)

 
31
Mar 2012
5 Comments

LoadLibrary failed with error 126, redux

Error: LoadLibrary failed with error 126: The specified module could not be found.

So I was on Skype with Paul Paliath this evening and he was having a tough time with Adobe Photoshop on Windows 8. I inquired for details and he read off the error he was seeing. “Error: LoadLibrary failed with error 126: The specified module could not be found.”

Sound familiar? Yep. I had the same problem last week with Minecraft. The error isn’t specific to Minecraft or Photoshop. It’s simply a quirk with the latest AMD preview drivers and all OpenGL applications. If you, too, are having this issue download my simple .reg file and you’ll be error free.

 
18
Mar 2012
4 Comments

Quick fix for AMD’s OpenGL on Windows 8

For whatever reason, the AMD Catalyst Drivers for Windows 8 Consumer Preview are broken when it comes to 64-bit OpenGL; they’re missing a registry entry critical to its functionality. Specifically, whenever an application (like Minecraft using Java 64-bit) requests OpenGL access, AMD’s atig6pxx.dll kicks in. It then peeks inside HKLM\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0000 and loads the OpenGL component as specified by OpenGLVendorName (64-bit) or OpenGLVendorNameWow (32-bit).

While the bits are there, the 64-bit registry entry is missing completely. But wait, you can add it yourself, though! No reboot needed.

If you have any problems, email Long Zheng and he’ll route your complaint to me.

 
16
Mar 2012
4 Comments

An introduction to Office 15 “Agaves”

Back in Feburary, I briefly hinted at extensions coming to Office “15″ aptly named Office Web Extensions (code-named Agave). To expand on that earlier post, Agaves are content-aware web apps, built with HTML and JavaScript, that can extend both desktop and web Office applications.

An Agave can appear in several forms: As a task pane (or sidebar), a block within your content, or as a popup that appears when its button is clicked.

A Task Pane Agave running in Microsoft Word “15”

Task Pane Agaves are available in Word, Excel, and Project. They live alongside your document or project and are analogous to the Metro snap feature present in Windows 8. They can default to a specific width and be floated, if desired.

Example: A thesaurus Agave that automatically suggested replacements for recently typed or highlighted words.

A Content Agave running in Microsoft Excel “15”

Content Agaves are available in both Word and Excel and integrate directly into your document or spreadsheet, similar to how OLE objects worked back in the ’90s. They can default to any width or height and be re-sized as needed.

Example: A third-party interactive charting Agave, tied to the data in the worksheet.

A Contextual Agave running in Microsoft Outlook “15″

Contextual Agaves show up in Outlook items, such as messages and appointments, and appear when the Agaves‘ conditions are met. They expand vertically as needed in the window where they’re activated.

Example: A Bing Maps Agave that displays driving directions to an upcoming meeting location.

 
04
Mar 2012
6 Comments

Working Windows 8 Consumer Preview SDK, symbol package links

I was running around looking for the Windows 8 Consumer Preview symbol package and landed on this page on MSDN. Unfortunately, the links point to internal URLs. Here are the corrected links for us non-softies: