|
|
Comments and Discussions
|
|
 |
|

|
I tried installing this on 64 bit Vista.
Well it doesn't work, but I'm not sure if it should.
Is recompiling for a 64 bit target worth the try?
|
|
|
|
|
|

|
After installing your shell extension, my VS 2005 starts to crash. Even trivial application that uses generics causes C# compiler to throw compiler internal error (something like: Error 2 Internal Compiler Error (0xc0000005 at address 5A784161): likely culprit is 'COMPILE' etc.). It’s interesting that simple "Hello, World!" application works OK, but if I add any generic to code, compiler starts crashing.
static void main(string[] args)
{
// With this line it crashes, without it works fine
List<string> strings = new List<string>();
}
After uninstalling this version of your shell extension and installing previous one, everything works OK (again).
Is this version of shell extension tested against v2.0 of Framework?
If it's a girl then they're gonna call it Sigourney, after an actress. If it's a boy, then they're gonna call it Rodney, after Dave!
-- modified at 22:21 Saturday 6th May, 2006
|
|
|
|

|
The new version was written with .NET 2.0 in mind. Previous versions of .NET didn't support specific processor architectures, which support for different architectures of assembles was the focus of the new version.
I don't write any registry keys or files that would cause such behavior. I also use it aon all my machines and most of my team uses it as well.
When you install it do you pass any command-line parameters to msiexec.exe? Are you picking a non-default install location? If so, where?
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|

|
After few installs/uninstalls and few reboots it starts work well. During the first-time intallation, I've not passed any command-line parameters to msiexec.exe and have not changed default install location (it could not be changed, or I've missed something?) except that OS is installed on drive E: (it's dual-boot machine and this is second OS). Now it works OK against both OSes.
Anyway, good work!
If it's a girl then they're gonna call it Sigourney, after an actress. If it's a boy, then they're gonna call it Rodney, after Dave!
|
|
|
|

|
Just like to make a comment on how much I have found this project useful. On every box I’ve got or use, this is installed, even on non developmental boxes.
It provides an extra bit of information and can tell you some handy info which you need, primarily if it is or is not a .NET assembly.
Once again, Great work!
Daniel Brown
Enterprise Software Architect
|
|
|
|

|
Is an archive of old AsmShell installers (MSI files) available?
Here's why (more details than probably necessary b/c there's two problems here and somebody else may have the same problem in the future).
Explorer.exe has started crashing anytime I try to view a directory that contains a managed DLL. I suspect that a misconfigured or broken AsmShell might be to blame (I had been using it on this computer for a long time before this started happening, but recently had some computer problems that involved reinstalling Windows ("upgrade", not a complete reinstall) at one point). So I went to get the AsmShell installer to reinstall it to fix the broken install.
If I try to uninstall the old (possibly broken) AsmShell (via Add/Remove Programs), after a few moments it prompts me for the location of AsmShell.msi. It appears that the uninstall requires access to the installer originally used to install, but that was two years ago and that .msi file is long gone. I can't point it to a new .msi from the newer version available here -- even if I rename it to AsmShell.msi -- the installer can tell the difference and won't go.
That'd be fine if I could just run the new installer to upgrade without uninstalling the old version, but the new installer apparently kicks off the uninstall for the old version first, so eventually I get the same prompt. I'm pretty sure that's what's happening b/c when I click Cancel (b/c there's no way forward -- it won't accept anything I have on my machine as a valid AsmShell.msi), it says, "The older version of Shell Extensions for .NET Assemblies cannot be removed. Contact your technical support group."
So, is there an archive of old AsmShell.msi installers where I can try to find an .msi that the uninstaller for this old version will recognize? Or other suggestions? (I could go rip out the shell extension registry entries for the old version to see if it's really causing the crash, but that doesn't help me get the new version installed).
|
|
|
|

|
I do not have an archive, but you can remove the information for the broken product without actually having the MSI file. Download msizap.exe - part of the Windows Installer SDK at http://msdn.microsoft.com/library/en-us/msi/setup/platform_sdk_components_for_windows_installer_developers.asp[^].
Find the ProductCode for the MSI by opening regedit.exe (be careful editing the registry, yada yada yada) and go to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall. Find the ARP entry for the AsmShell. The registry key name is the ProductCode.
Now run "msizap TW! [ProductCode]" (without quotes) several times until no more errors spew out. This removes information about the package so that the new installer doesn't see the old and won't try to remove it.
As for the crash, it was an bug that has been corrected. IIRC, Explorer was expecting an empty string as opposed to a NULL string pointer. The contents would display correctly but when you sorted by that column the NULL string pointer would crash Explorer.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|

|
Thanks, that worked. Notes for anybody else with this problem below.
To make it clear, the ProductCode mentioned above is the GUID (including braces {}) that is the key name for the entry under HKLM\...\Uninstall. (I initially misread the description above to mean that there was a key named "ProductCode", which is not true). Also, the newest version of the Windows Installer SDK I could easily find at microsoft.com was v1.1 from 2000, which I assume is out of date, but it worked. It doesn't appear to have the W option mentioned above, but it worked just fine without it. So the command line, once the product key had been found, looked something like this:
msizap T {CC6EC5A8-7D88-468A-B6DC-F6F5B3C681E8}
The crash does appear to have been caused by AsmShell, so I assume it was the bug that Heath fixed. I had to restart Windows Explorer to get it to load the new DLL (or, well, actually I "restarted" by trying to view a directory and causing the crash to happen ), but after that, the crash was gone.
-- modified at 13:40 Friday 14th October, 2005
|
|
|
|

|
You have to install the Platform SDK - or at least the Core and Windows Installer SDK components - from the link I gave you. It's a bit larger than you'd need and I'm not sure why they do that (different group).
Also to "anybody else", that ProductCode that Stephen lists is only for one specific version. Since the Visual Studio Windows Installer products use major upgrades for everything, both the ProductVersion, ProductCode, and PackageCode are changed when you change the ProductVersion and click "Yes" to the following dialog. The current version uses a different product code, and the next will use yet another ProductCode, and so on. This is how MSI works for major upgrades.
For more information on Windows Installer and, more specifically how the Developer Division uses it, see my blog at http://blogs.msdn.com/heaths[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|

|
Hi,
Great little class. Does anyone know how to make this in c# or vb. I have tried but cant get it to work.
|
|
|
|

|
You have to declare all the shell interfaces in managed code with the correct attributes. It's required - since all the shell interfaces used derive from IUnknown - that you declare the methods in the correct source order, not the documentation order. See Guidelines for COM Interoperability for .NET[^] for more details.
The better question is, why would you want to? You'll force the shell to load an additional 10-20 MB of memory in the Explorer.exe process space and for what reason? The extensions are already defined in native code and the source is provided so you can change them however necessary. Managed code isn't the right choice for every situation.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|

|
Well... i dont know anything about c++. Ive looked at the code but it and cant figure it out. Could you/anybody make this so i can use the interface to return the icon I want to use as the overlay. And in that function retrive the file + path
Thanks for the answer,
//Magnus
-- modified at 5:42 Friday 30th September, 2005
|
|
|
|
|

|
Hi Heath,
What i want is to get the path of the file that the overlay icon is used and the at runtime decide which icon to use.
If u look at TortoiseCVS it uses different overlay icons to virtualize which state the file is in. This might be what you are telling me... is it?
Thanks again.
//Magnus
|
|
|
|

|
Interfaces are a contract between a client and server (a server implements the interface, the client makes call on the interface). How you implement the interface is entirely up to you. You can return different overlay icons based on some differentiating identifier in the file (Office apps do this for XML files, only using icon provider instead of overlay icons to provide a whole icon).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|

|
yes. But none of the functions in the interface makes this posible. Im looking for an extra function in the interface that has the file + path in the parameter and the posibillity to return an icon file.
eg.
string GetIcon(string fullFileame)
{
if(fullFileame == @"c:\test.xml")
return @"c:\exceloverlay.ico";
else
retrun @"c:\nooverlay.ico"
}
the 'string GetIcon' function would be in your interface.
//Magnus
|
|
|
|

|
That's what the IShellIconOverlayIdentifier.GetOverlayInfo method does. You return the icon file path in the first parameter (it's a native out parameter) - either a path to an .ico file or a PE/COFF executable (.dll, .exe, .ocx, etc.) and optionally an index in the third parameter. If you specify a .ico file you need to specify ISIOI_ICONFILE as the last parameter:string currentPath;
int IShellIconOverlayIdentifier.IsMemberOf(string path, int attributes)
{
currentPath = path;
}
void IShellIconOverlayIdentifier.GetOverlayInfo(
string path, int max, out int index, out ISIOI flags)
{
if (Path.GetExtension(currentPath).ToLower() == ".xls")
{
path = "c:\excel.ico".Substring(max - 1); }
else
{
path = "c:\other.ico".Substring(max - 1); }
index = 0;
flags = ISIOI.ISIOI_ICONFILE;
}This is just a very basic example, but it's how you can control what icon is returned based on a path. These two methods are called in order as you see them above so just save the path when IsMemberOf is called.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|

|
As i said im not a C++ shark. Amazing, thank you very much for your big help on this issue.
|
|
|
|

|
Nice job. Weldone.
I am afraid if there is a way to set the location of the icon? Like by default it is at right bottom, what if I want to put that on top left or top right or bottom left corner?
Any idea?
Best wishes,
Sameers
|
|
|
|

|
My extension is not configurable like that. You can change the overlay icon to change the position of the overlay, however. It's just a regular icon with both transparent and non-transparent bitmaps.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|

|
YEs, your extension is not. But I was trying on such extension in C# but I couldnt find anyway int the interface methods/parameters etc to set the location of overlay icon nor the MSDN documentation discuss on this. I know one method could be to have a transparent icon as per location need so we have four different icons which are transparent but icon image is on either corner. But any good solution would be better.
Also, is there anyway to load icon from the application resources and then return that as overlay icon? Currently the interface structure forces to return icon location file name and it's index. Any idea would be appreciated.
Thanks,
Sameers
|
|
|
|

|
Again, you can change your icon that you plan on using for the overlay. Look at my icon in the project. It's toward the bottom left. For your icon, move it somewhere else. Your icon dimensions must still be the same as the size of the icon you plan on overlaying, i.e. a 16x16 icon to overlay over 16x16 icons, 32x32 over 32x32 icons, etc. You might also consider different pixel depths that must match up too, including alpha channels for 32-bit icons.
I highly recommend not using managed code for shell extensions. The CLR doesn't require a large working set and when that's loaded into the Explorer process you've increased the working set by many megabytes. Since Explorer is a ubiqitous process that working set will be constant unless the CLR crashes and is unloaded by the default host (mscoree.dll) or a custom host if you're using one. Writing your extensions natively is simple in this case (most shell extensions are) and don't require you to create and deploy interop assemblies because the interfaces are already defined in headers for native compilation (or even for Managed C++, but then you're still utilizing the CLR).
If you insist on using managed code, then you'll need to do one of the following for an overlay extnesions:- Store the .ico separate from your assembly and return the path to it.
- Store the icon in a separate native resource DLL.
- Build your managed assembly, disassemble it using ildasm.exe, add your icon to the RC file, then re-assemble it using ilasm.exe with the appropriate parameters.
If you don't change the assembly attributes that constitute the default RC file you could just make that part of the build process, using the same RC file over and over again. That will embed the icon in the .rsrc section of the PE/COFF executable. You will not be able to use the icon straight from your resources because they are stored in a completely separate fashion.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|

|
Thank you very much for your information. I have written this code in C# .NET (2005) and your descriptions says that there is no way to point icon on specific location (like original icon is of 32*32 and my overlay icon is of 8*8 which I wanted to point on bottom left corner). It also looked to me the same as well as I couldnt find any hint in MSDN and other locations on the net. However, your idea looks interesting regarding getting icon from resource. Thanks again,
Sameers
|
|
|
|

|
You need to make the overlay icon 32x32 and then you can position your non-transparent pixels anywhere. Open my overlay icon in VS and view the 32x32 pixel icon and you'll see the ".net" portion is in the corner. Move that to another portion of the 32x32 icon.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|

|
Yes, that is the same I got from your last reply. We need to design our icon in such way so that it displayed on the desired location (as your current icon of ".net" is displayed on bottom right, but the icon should be changed to display it on top left, no change in the code itself).
Sameers
|
|
|
|

|
And I'm not telling you to change your code, just change the position of the non-transparent pixels. Your overlay icons should match in size to the icon you're overlaying, so that if the current icon for a file type is 32x32, you'd have a 32x32 icon resource. If it's both 32x32 and 24x24, then you'd use a .ico file with both sizes. Windows will pick the correct size or default to the next smaller size if the right size is not provided. If all you're using is an 8x8 icon then you won't have control over where it's position. Make a .ico file with different sizes of icons; remember that a single .ico can contain different resolutions and pixel depths. Open my .ico up in VS or another icon editor. If in VS, use the Image -> Current Icon Image Types menu to change the size and depth of the displayed icon.
By defining different icon types that match the size of the icon on which you want to overlay your icon you can control how your overlay displays because you can control where within its bounding region the non-transparent pixels are.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|

|
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Does that fit on a standard business card? Really, your title sounds interesting, what do you really do at MS?
Regards,
-bill
|
|
|
|

|
Most developers here are called "Software Design Engineers", or simply "SDEs". DDCPX focuses on post-RTM releases (patches, services packs, etc.) as well as post-release tools for enterprise customers as well as home users. We also include the folks that bring you things like http://forums.microsoft.com/msdn[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|

|
Hi,
I would like to add an icon overlay to selected files? I was hoping I would be able to reference it such as...
1, SetIconOverlay("MyFile.txt", "myOverlay.ico") ' to set the overlay icon.
2, GetIconOverlay("MyFile.txt") ' to get the overlay icon name associated with a file.
3, RemIconOverlay("MyFile.txt") ' to remove the overlay icon associated with a file.
Can I accomplish this with your shell extention?
Any Assistance would be greatly appreciated.
Zenly,
|
|
|
|

|
This shell extension looks for PE/COFF data that determines whether the file is a managed assembly. It does not set overlay icons and is not a general purpose overlay icon.
To implement such an overlay would not be a good idea. Every file class (that is, "*" in the registry) would require registration for your overlay icon, which means Explorer would query your icon handler for EVERY SINGLE FILE on the file system that appears in Explorer for the default folder views (other view servers may not query for such information). You would have to index file paths efficiently, too, using - perhaps - a Trie (pronounced "try") data structure for efficient lookups. Using managed code for such a task would additionally be a bad idea since you have several MBs of RAM in overhead and many more instructions to process (even once JIT'd to native code).
If you want overlay icons then I suggest you implement them for your file classes (types). If you want to write a general purpose text editor than save your files as text but with a different extension. Or, save them using ".txt" and write an overlay icon handler for ".txt" but not for all file classes. Even in native code this would drag-down a system.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|

|
Thanks for that insite. I didn't realize that adding an overlay to a file could so taxing on a system.
If I did this, as you suggested, to my own file type could you give me an example or tell me where I could find an example of this?
Thanks,
Zenly
|
|
|
|
|

|
Surely your ShellExtension is being called for EVERY SINGLE FILE?
The reason I ask is that I am considering doing something like TortoiseCVS to produce Overlays on the file system based upon some additional meta-data that I will apply to them (the method or storing which is TBD). Although TortoiseCVS is very slow so I plan to build in some caching to improve performance as it does slow the file system down a lot.
If you are saying that performing this sort of operation is a bad thing then surely what you are doing is bad? Maybe just less bad as it is a quick operation. Ultimately you are querying the file everytime explore wants to draw it.
I have also noted your repeated points about not going through the CLR - I too am considering using it as my overlaying will be part of a larger system. Should a Microsoft employee really be playing down use of .NET? I can appreciate the additional memory overhead (a few megs?) but it isn't something that people usually worry about on a modern machine. As it is you aren't actually using what I would count as Native code it is still going through COM which is in itself a 'slow' technology. Ultimately COM and .NET are both built very heavily ontop of win32 which is what I would count as real native code.
That said I have been looking for a example of how to apply an overlay icon for a while, this gives me it and is EASY to follow. BUT where is the msi produced? Surely to be complete the source code download should include the setup project to allow us to recreate the msi files and also see how to do it ourselves for our own extensions - I have tried "regsvr32" and it installs but I don't get any overlays so I assume there are some additional steps that I can't see...
Thanks...
--
Phil
"No plan survive contact with the enemy"
|
|
|
|

|
I never said that parsing every single file was bad - at least when using native code. If you can avoid handling every file on the system do so, but in your case you'd have to (although try to limit checking VCS if the files' directories don't appear to be related to any CVS projects).
I saw the CLR is bad for shell extensions because of the hugely increased working set added to the explorer.exe (or any shell host, like iexplore.exe can be) process. If you open folders in separate processes (good when testing extensions so your main shell doesn't crash, although I recommend using Virtual PC if you can) your memory will quickly be exhausted.
Every process that loads the CLR incurs a larger footprint and if you managed multiple application domains every non-neutral assembly is loaded into each application domain. When managed code is more common throughout the operating system I would certainly change my recommendation. For a good book on this read Customizing the .NET Framework Common Language Runtime[^]. It's got lots of great information for hosting .NET 2.0 and much is relevant to hosting previous runtimes.
I also recommend that you don't use the CLR because of all the interop that is required. Many times certain interface method parameters or structs aren't easy to define or handle (like VARIANT) though nothing's impossible. It's easy - especially with shell programming - to spend almost as much time just defining and testing your interface and related type definitions than it is programming the meat and potatoes of your solution.
You can run regsvr32 but you will have to log off and back on (or kill your shell and restart it). The setup doesn't change that. I didn't include the source because I don't want people redistributing a setup that is not my own because of how Windows Installer handles upgrades and patches (which you can check out much more on my blog at http://blogs.msdn.com/heaths[^]). I don't mind if people redistribute my extensions but I don't want different installer packages out there (changes to the ProductCode, ProductVersion, UpgradeCode, and ProductLanguage affects everything with Windows Installer packages).
Regarding the shell problem, with my next version I plan on adding a custom action to call SHLoadNonloadedIconOverlayIdentifiers on Win2K and up which should mean you don't have to logoff or restart to see the overlay icons.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|

|
Even though this article lists Windows 9x as being supported, the installer says that it is only supported on Windows 2000 and up.
|
|
|
|

|
Thanks, I'll change that. Mostly, I didn't support non-Unicode OS's because most of the functions I have to use take Unicode strings. Honestly, I didn't feel like detecting different encodings and converting. I also didn't think it'd be an issue because I figured most people weren't developing with .NET on anything older than Win2K! Actually, I thought the .NET Framework SDK wouldn't even install on WinNT4sp(5?) or older (or Windows, for that matter).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|

|
Heath Stewart wrote:
I figured most people weren't developing with .NET on anything older than Win2K!
Yeah, well, hopefully I won't be developing on Win98 for very much longer.
Heath Stewart wrote:
I thought the .NET Framework SDK wouldn't even install on WinNT4sp(5?) or older
It's not supposed to, but you can trick it into installing on Win98 (which I did).
|
|
|
|

|
Just wanted to let you know that I've updated the code to support Windows Me. Windows 98 doesn't support IShellOverlayIdentifier or IColumnProvider shell interfaces so Windows 98 is not supported.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
Shell extensions to distinguish between .NET assemblies and Win32 applications and libraries.
| Type | Article |
| Licence | Ms-PL |
| First Posted | 18 Sep 2002 |
| Views | 128,517 |
| Bookmarked | 79 times |
|
|