WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

64-bit

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

ShortcutDir IntControl 92

 Keywords:  ShortcutDir IntControl 92 File Redirection 64 x64 64-bit

Question:

Testing ShortCutDir on my Windows 7 x64 Ultimate system:
ShortcutDir(35, 0, @TRUE)
... returns an empty string, while the command...
ShortcutDir("Common AppData", 0, @TRUE)
... returns the expected C:\ProgramData\ folder name.

The second form is a workaround, but it would be nice if the first form would work as well.

Answer:

Does your script happen to also call IntControl 92? If so, it is important to minimize the code run when the File System Redirection is disabled, especially when loading WIL Extenders, using COM, or doing anything that asks Windows to load any new DLLs. The problem is that while File System Redirection is disabled, your code will be looking at the wrong version of windows and will attempt to load wrong (64 instead of 32 bit) versions of modules, and usually fail, GPF, or otherwise not function properly."

The ShortCutDir function dynamically loads the Windows Shell DLL but the load fails because IntControl 92 forces WinBatch to attempt to load the 64-bit Shell DLL. And as we all know, you can't load a 64-bit DLL into a 32-bit process.

The only reason it appears to work at all is because ShortCutDir has some old fall-back Windows 95 code that happens to work for a few short cuts some of the time. MSFT considers the old Windows 95 technique deprecated (and a mistake) but we haven't got around to removing it for ShortCutDir yet.

Also note that this is not a Windows 7 issue but a 64-bit Windows issue.

Simply put, don't disable file redirection before calling ShortCutDir.


Article ID:   W17650
Filename:   ShortcutDir IntControl 92.txt
File Created: 2010:09:08:12:12:38
Last Updated: 2010:09:08:12:12:38