PermaLink 64-bit DSOFile and Windows File Metadata12/04/2007 08:19 PM
Some of you may be familiar w/ MS' many failed attempts at getting metadata onto the filesystem...what is surprising is that you can do this today on any NTFS filesystem.  MS provides DSOFile and the source code for a DLL that lets you do this.  While it was intended to be used for OLE documents, it'll also work for plain text files that are not using OLE Structured Storage.

The DLL is relatively easy to use in ASP.Net via the imported Interop, however, this ties your ASP.Net app to be 32-bit.  I've compiled for 64-bit Windows w/ the following caveats:
- it can't read Date properties on 64-bit systems
- if you use it to write a bunch of times, it sometimes causes IIS to crash

Even with these problems, it's still useful if you want to use it only for reading OLE document properties or file metadata. If anyone finds fixes to the two problems above, please let me know so I can update this code. This code also includes my fix for the "access denied" error when accessing empty summary properties.

One warning for those of you thinking of using file metadata for code you put on customer sites: you *cannot* just zip up the files because zip doesn't know that there is weird NTFS metadata associated with the file. You have to use a Windows share to copy the files w/ metadata.

Comments :v

1. Mike09/29/2014 14:45:02


Please can you sign this DLL with a strong name? I can't add this DLL to an MSI to be registered on install without a strong name...




2. Stephen03/20/2013 13:50:53


"if you use it to write a bunch of times, it sometimes causes IIS to crash"

Just wondering if this is still a concern, or if anybody else is reporting this kind of problem.. Is it an AppPool crash, or something that brings down all of IIS?

I'm trying to decide how to get custom document properties for Excel files in my web app. I have methods written for the OpenXML formats, but the only 2 ways I have seen to get custom properties for 2003 format files is with DSOFile or with Office Automation.

I know (and have experience with) automation being unstable and causing server reboots - so I dont want to implement that on a webserver, but if DSOFile is unstable as well, I'm at a loss of how to get those properties for 2003 format files?

Has anyone else experienced IIS crashes using DSOFile? Are there other alternatives for getting custom document properties?




3. Zdenek M.01/29/2013 18:54:14


Hi everybody,

how can I load and use this compiled 64bit Interop.DSOFile.dl and DSOFile.dl from Powershell script in 64bit environmnet?
Thanks for any help you can provide.

Regards
Zdenek M.




4. cooltan05/03/2012 08:06:50


Installing Office 2007 SP3 will update "msoshext.dll" which solved the problem for me.




5. Cliff10/19/2011 15:56:57


I'm having an issue writing a custom propery to a file from a console application on Server 2003 64bit. Everything works fine but when I try to close the file with true I get an invalid attribute error. I am thus unable to save the custom property I am setting. Can anyone help with this issue?




6. Chris05/19/2011 18:45:42


Hi all.. After using DSO file for a couple years, I have just completely moved away from DSO and started using the APICodePack which works well with both Windows Vista, 7 and 2008. The IShellObject provides the same information. You may have to change the propery names you are referencing but they all match up pretty well.

API Code Pack on MSDN
{ Link }




7. Yvonne04/13/2011 05:29:20


Hi,
Thanks to you and your great explanations, I was able to find the solution - there is a hotfix out now - the msoshext.dll is fixed! { Link }




8. Samir03/28/2011 08:05:21


Got it, its msoshext.dll! I should have been reading your comment carefully!




9. Samir03/28/2011 06:40:05


Rohan Salt

Hi have a scenario just same as you described in below quoted text. However I am unable to find out Office Property Hander. Can you please tell me what is the physical file name of the dll and where can I find it on a 32-bit machine?

"If you MUST (like me) have 32 bit app on 64 bit OS, Use 32 bit version of DSOFIle and obtain the 32 bit Office Property Hander from a 32 bit OS and copy it to:
c:\program files (x86)\common files\Microsoft shared\office12
register it with c:\windows\sysWOW64\regsvr32.exe AND
change the registry setting for the Office Property handler (ie HKEY_CLASSES_ROOT\CLSID\{993BE281-6695-4BA5-8A2A-7AACBFAAB69E}\InprocServer32) to point to c:\program files (x86)\common files\Microsoft shared\office12 "




10. ken02/04/2011 22:37:41


Good job w/ hacking Rohan. It is pretty convoluted. There's nothing in the code that really ties it to 32 or 64-bit, but it does have that dependency...




11. Rohan Salt02/04/2011 08:14:24


I have just had the same issue with a 32bit application/ 32bit dsofile 2.1 and getting properties on windows 2008 R2 64 bit platform. After much messing around I can add some clarity( I hope!) to this issue!!

DSOFile uses the default windows property handler for the specific file type to get and set its properties. In order for DSOFile to support Office 2007/2010 formats a property handler must be associated with those file types in order to obtain its properties.

One of the “quirks” of DSOFile 2.1 was that if you did not have Office installed on the machine you where trying to get/set properties from (like a web server), you needed to install the Office Capability package on the machine.

By doing this, msoshext.dll ( the Office Property handler) get installed and configured for the 2007/2010 file types It is usually located in c:\program files\common files\Microsoft shared\office12.

The problem with 32bit DSOFile on a 64 bit OS is that the compatibility pack loads the 64 version of the Office Property Handlers and the 32 bit DSO can’t talk to it!!

So: if you have a 64 bit app on a 64 bit OS.. use the 64 versions of DSOFILE from Ken and for office support on machines that don’t have office, install the compatibility pack.

If you have a 32bit application on 32bit OS use the 32 versions of DSOFILE from MS and for office support on machines that don’t have office, install the compatibility pack.

If you MUST (like me) have 32 bit app on 64 bit OS, Use 32 bit version of DSOFIle and obtain the 32 bit Office Property Hander from a 32 bit OS and copy it to:
c:\program files (x86)\common files\Microsoft shared\office12
register it with c:\windows\sysWOW64\regsvr32.exe AND
change the registry setting for the Office Property handler (ie HKEY_CLASSES_ROOT\CLSID\{993BE281-6695-4BA5-8A2A-7AACBFAAB69E}\InprocServer32) to point to c:\program files (x86)\common files\Microsoft shared\office12

If you have other non-office related issue with DSOfile working on some machine and no others – check the property handler to make sure its the same.

The only down side of the above is that DSOFile with work, but you can no longer see the properties from the explorer via right click properties

Hope this helps!!!




12. Bruce Morgan01/02/2011 05:16:59


I have been using DSOFile.dll for some time now, and it works very well on Windows XP with Office 2003 (XL). It recently stopped working on one of the PCs (it worked OK for months). It still works fine on 3 other PC. I have tried copying the various files into the System32 folder, and registering the dll as per comments on this blog. No luck....
When I debug the VBA code in XL, the properties are all empty. Debugging the exact same XL, using the exact same .jpg file (all located on a shared folder, on a different PC does show the parameters correctly. Any Ideas? Thanks in advance..




13. nidhi10/26/2010 12:49:20


Hi Ken,

I am using Windows 7 64-bit machine.

I first tried to register and then use the dll compiled by you, and I am not getting error but am not getting the properties i.e. all the values are null (which works perfectly in XP).

Then I also compiled the source code on my machine and registered and then used the dlls in my code, but in vain as still the properties values are null.

Please let me know where am I going wrong. Thanks.




14. Bill Brunt08/25/2010 19:31:40


Hi folks,

Running Windows 7, 64 bit.

I've been trying to use Ken's DSOfile.dll without success. I unzipped and took the files DSOFile.dll and Interop.DSOFile.dll from the 64-bit directory and copied these into c:\windows\system32. From there I ran as Administrator

regsvr32 DSOFile.dll

RegAsm Interop.DSOFile.dll

If I have the file open, calls to DSOFile work and produce the correct results. If I call DSOFile for files which are closed, I'm getting "The document is not an OLE file, and does not support extended document properties. I am able to view these extended document properties.

Any ideas?




15. Tim01/22/2010 15:42:15


Hi all,
For a while, i'm looking for the 64-bit version of dsofile.dll or a way to make it works on a 64 bits platform. Do you know where is the solution?
cheers, Tim




16. Jeff12/29/2009 19:09:10


Anyone tried this on Windows 7? Having a hard time to get these to register without errors. works great on XP.




17. ken10/28/2009 00:16:04
Homepage: http://www.keysolutions.com/blogs/kenyee.nsf


Only thing I can think of is make sure you register the DLL by hand...you might be missing some runtime DLLs.




18. james10/23/2009 20:59:08


My app uses the dsofile.dll to modify doc properties works on my 32-bit machine for both 2003 and 2007, but works for 2003 only on my 64-bit machine.

I have registered the 64-bit version of dsofile.dll, copied over the iterop dll, and had the server people install the office compatibility pack.

The office compat pack, was supposed to resolve the 2007 functioning, but it has not.

Any ideas?




19. Pete06/24/2009 08:47:35
Homepage: http://www.lonerobot.net


Hi Ken,

I've been asked if there is a x64 version of the v2.1.2841 release of DSOfile.
{ Link }
Do you think you could compile this for x64 like you did the last one? cheers, pete




20. Dan10/01/2008 18:54:31


Thanks, this helped me a lot! I had an app with a reference to DSOfile.dll (x86) in a web service that worked fine until I upgraded my web server from Server 2003 x86 to Server 2008 x64. Registering your file on the server and using the included interop assembly has fixed everything. Thanks again!




21. Pete02/12/2008 22:01:16


Hi Ken, thanks so much for fixing the link. I really appreciate it. kindest regards, Peter




22. Ken02/12/2008 18:32:36
Homepage: http://www.keysolutions.com/blogs/kenyee.nsf


Pete: yes, since the DLL is written in C++, it has to be rebuilt for Windows 64-bit. I fixed the link in case you want to download it.




23. Pete02/12/2008 10:46:49


Hi Ken,

Ive been having some problems with DSOfile on a 64 bit platform. do you need to recompile the dll? the link you give is down, thanks, peter




Start Pages
RSS News Feed RSS Comments Feed CoComment Integrated
The BlogRoll
Calendar
November 2018
Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Search
Contact Me
About Ken
Full-stack developer (consultant) working with .Net, Java, Android, Javascript (jQuery, Meteor.js, AngularJS), Lotus Domino