Results 1 to 5 of 5

Thread: Getting and setting file properties eg Tags/Comments

  1. #1

    Thread Starter
    Addicted Member Witis's Avatar
    Join Date
    Jan 2011
    Location
    VB Forums Online Freedom Mode: Operational
    Posts
    213

    Getting and setting file properties eg Tags/Comments

    Hi

    Is it possible to get and set file properties such as the Tags or Comments properties
    (in file explorer browse to the folder containing the file you are looking at, then right click the folder column headers which starts with "name" and then check the properties such as tags, comments, etc)?
    Last edited by Witis; Nov 29th, 2011 at 07:28 AM.
    All men have an inherent right to life, the right to self determination including freedom from forced or compulsory labour, a right to hold opinions and the freedom of expression, and the right to a fair trial and freedom from torture. Be aware that these rights are universal and inalienable (cannot be given, taken or otherwise transferred or removed) although you do risk losing the aforementioned rights should you fail to uphold them e.g Charles Taylor; United Nations sources: http://www.un.org/en/documents/udhr/, http://www.ohchr.org/EN/Professional...ages/CCPR.aspx. Also Charles I was beheaded on the 30th of January of 1649 for trying to replace parliamentary democracy with an absolute monarchy, the same should happen to Dr Phil and Stephen Fry; source: http://www.vbforums.com/showthread.p...ute-Monarchism.

    The plural of sun is stars you Catholic turkeys.

  2. #2
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Getting and setting file properties eg Tags/Comments

    Extended properties are metadata that apply to different kinds of files. Something like a DOC file is an OLE Storage that contains multiple OLE Streams, many Streams having well-known names that the Shell knows about. An MP3 file has another way of embedding metadata, as does a JPG file, and so on.

    Shell offers several ways (Shell32 API calls, Shell32 COM objects) to read these, but not to write them. To do that your program needs to understand each file format you want to manipulate. Microsoft offers a library for handling Office binary formats. See http://support.microsoft.com/kb/224351

  3. #3

    Thread Starter
    Addicted Member Witis's Avatar
    Join Date
    Jan 2011
    Location
    VB Forums Online Freedom Mode: Operational
    Posts
    213

    Re: Getting and setting file properties eg Tags/Comments

    Thanks for the good info in the reply dilettante. I noticed that some engineers had problems using Dsofile.dll for files such as text files, presumably as these do not use the OLE Structured Storage format. I am looking at exe files, and I don't think they will use the OLE Structured Storage format either.

    The exe file format in Windows is 32-bit portable executable, and 64-bit portable executable. (http://en.wikipedia.org/wiki/EXE). I had a brief look at the PE specification (be warned it goes into a lot of detail) http://www.google.com.au/#q=executab...w=1903&bih=922 although I was not able to see an area which was designed to be read and written to for tags or comments.
    All men have an inherent right to life, the right to self determination including freedom from forced or compulsory labour, a right to hold opinions and the freedom of expression, and the right to a fair trial and freedom from torture. Be aware that these rights are universal and inalienable (cannot be given, taken or otherwise transferred or removed) although you do risk losing the aforementioned rights should you fail to uphold them e.g Charles Taylor; United Nations sources: http://www.un.org/en/documents/udhr/, http://www.ohchr.org/EN/Professional...ages/CCPR.aspx. Also Charles I was beheaded on the 30th of January of 1649 for trying to replace parliamentary democracy with an absolute monarchy, the same should happen to Dr Phil and Stephen Fry; source: http://www.vbforums.com/showthread.p...ute-Monarchism.

    The plural of sun is stars you Catholic turkeys.

  4. #4
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Getting and setting file properties eg Tags/Comments

    Yes, it can be a lot of work to manipulate these values. Windows Explorer just provides display of the values as a user service. They are really considered to be "owned" by applications that "own" each file format. For EXEs that would be compilers and linkers.

    I'm not sure it makes sense to change something for a program like the company name, version number, etc. anyway. They are not really meant for users to fiddle with.

  5. #5

    Thread Starter
    Addicted Member Witis's Avatar
    Join Date
    Jan 2011
    Location
    VB Forums Online Freedom Mode: Operational
    Posts
    213

    Re: Getting and setting file properties eg Tags/Comments

    I found this: half way down this page (http://vb.mvps.org/samples/Console/) in the section "Required Modification of Executable" there is a one liner to adjust the console bit in the PE header:

    WSHShell.Run strLINK & " /EDIT /SUBSYSTEM:CONSOLE " & strEXE

    Which means if I was just able to work out what section to update for tags/comments it might not be that much work...

    Also I tried a hack by adding a custom tag to the end of the exe i.e. write 100 characters at the end of the binary exe file, and surprisingly the exe still works.
    All men have an inherent right to life, the right to self determination including freedom from forced or compulsory labour, a right to hold opinions and the freedom of expression, and the right to a fair trial and freedom from torture. Be aware that these rights are universal and inalienable (cannot be given, taken or otherwise transferred or removed) although you do risk losing the aforementioned rights should you fail to uphold them e.g Charles Taylor; United Nations sources: http://www.un.org/en/documents/udhr/, http://www.ohchr.org/EN/Professional...ages/CCPR.aspx. Also Charles I was beheaded on the 30th of January of 1649 for trying to replace parliamentary democracy with an absolute monarchy, the same should happen to Dr Phil and Stephen Fry; source: http://www.vbforums.com/showthread.p...ute-Monarchism.

    The plural of sun is stars you Catholic turkeys.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width