How to Edit an xml file

Discussion in 'alt.windows7.general' started by Dave C, May 13, 2013.

  1. Dave C

    Dave C Guest

    I have been playing Win 7, Free Cell for months. I always intended to
    retry a given game until I won. On game 2710, I inadvertently accepted
    my First Loss.

    I now know that my Free Cell stats are stored in an xml file. How
    might I edit that file, to edit (delete) that one lose.

    While surely minor, compared to many the REAL problems discussed here,
    I am most annoyed at myself. I sure would appreciate any/all advice on
    how to edit that file.

    dave
     
    Dave C, May 13, 2013
    #1
    1. Advertisements

  2. Dave C

    Bert Guest

    In Dave C
    An XML file is simply an ordinary text file with a peculiar structure,
    so any ordinary text editor will do, so long as you understand and don't
    destroy the XML strucure while editing it.
     
    Bert, May 13, 2013
    #2
    1. Advertisements

  3. There are free xml editors available that structure the file display for
    you, or you can just use a text editor, as Bert suggests.

    I was gong to link you to XML Notepad, but when I try to look for a link
    in its Help-About, it crashes :)

    This is where a different part of the Help menu takes me:
    http://msdn.microsoft.com/en-US/data/bb190600.aspx

    I give up. Just Google for XML editors or use your text editor.
     
    Gene E. Bloch, May 13, 2013
    #3
  4. As I understand it, Free Cell stats are stored in:

    C:\Users\<your user name>\Appdata\Local\Microsoft Games\Freecell\Freecellsettings.xml

    To edit it, all you need is notepad or any other text editor.
    Then, find the appropriate entry and modify it, then save.
     
    Zaphod Beeblebrox, May 13, 2013
    #4
  5. I looked on the above (not very) user-friendly page and got this:
    http://www.microsoft.com/en-us/download/details.aspx?id=7973

    I also have XML Explorer, which I can't fathom, so I can't recommend it.

    The MS program works if you don't try Help-About :)
     
    Gene E. Bloch, May 13, 2013
    #5
  6. Dave C

    SC Tom Guest

    If you successfully open, edit, and save a working copy of this file, let me
    know. I've tried XML Notepad 2007, FOXE, Notepad, Notepad++, Word, etc., and
    have yet to see one recognizable character in any of the MS Games XML files.
    I've never much thought about it before, but your post piqued my curiosity,
    just to see what's in it.

    Impressive streak :) When I was working, I had a 2000+ winning streak after
    an early loss (played on break and at lunchtime only <wink wink nudge
    nudge> ), but not near what you have.
     
    SC Tom, May 14, 2013
    #6
  7. Dave C

    Paul Guest

    There's a little comedy here. While it is possible to use
    encryption on XML, apparently in one case, it was just
    BASE64 encoding.

    http://thedailywtf.com/Articles/Encrypted-XML.aspx

    Paul
     
    Paul, May 14, 2013
    #7
  8. Dave C

    SC Tom Guest

    I tried an on-line decoder and got this error:

    "The input is not a valid Base-64 string as it contains a non-base 64
    character, more than two padding characters, or a non-white space character
    among the padding characters."

    Maybe that's not it :)
     
    SC Tom, May 14, 2013
    #8
  9. Dave C

    Mike Barnes Guest

    Doncha just *love* that sort of error message? Would it be so hard to
    say which of those three problems it is?
     
    Mike Barnes, May 14, 2013
    #9
  10. OK, try ROT13 next.

    :)
     
    Gene E. Bloch, May 14, 2013
    #10
  11. One could argue that it's better than *no* list of possible errors :)
     
    Gene E. Bloch, May 14, 2013
    #11
  12. Dave C

    SC Tom Guest

    Nah, that ain't it :)

    Here's a sample of it from Notepad:

    "A¬èµ÷˱«?cWM×(Ó"f%LÔef2 á#¼LZÁ'`szãV"-L.¥²&iËåàXÑ
    FëNãrpùHV?£öf'§Þ;& ' H\Ôÿõ`ïm%
    ë.J£,Sï8ÛW#ÇÆï~¡ft¦'EWQT.ÕON<z¾¨¶6< 3C¥?¼P¡HÚÕLJs&*AT:(ZàÔj>F2ÂÛ~Fá2'?&£H+0>y¨kèt¡Ö¾ô S*êdõ?¯^CÎø£Á,G,AsQFkM!èOU$PNËÃÒY^µ^sä¦ø¼F¤ÙLzlݯq?õ,{!"3P"
    Ò~hOßT4?-¢þÄ^""!¤,dcÁÔ@fªé}É@3T<.öX-9=>Î>Ö~Ó)¬Q?#ZMÅDmò£2.É©G?BãÊ^o"d2¸¨Â9ÜÚ'enT~k¬?SC5:¤H´'Y*üp.£<_bçê´ÇÎô-sFÆ''$
    Râs"Zð¤1}OÔäÉp "Dâ":ÅNI[Ý!pës,-À¶EêÄR²£,-XOPíæÀTë=¡mPª8ñ©î9þêT"èÕ«W?¾KTo¼T*Q0
    Bkkkó .Þ@ãøÁY_õÒ\%<@\:H&ÿ´×ÙË4ÊårSF (-Ëe
    4Gt¼?«ÔÌjY÷>'/Õ0X­"Íu»YÕ?×'YÇ RàжX,R?r]]shÀÕ*5ð óÔ?àd¿oqÎ ×BQ Û
    X'\¸åI+÷Z"joo§!Ã"¥>}ú@4j:::Äm ? q ÌZ°pÜ3`),ïì+~iÛ.¤H+ºÃ$&Ð,ÎQ+T!R+cz»j?Ó¡O%lôîÝ?aºdè"quvvÒ­¸Ä6\&o^õæ]ïÏ>HĤ!tÀ\sÐS¿ÛêDäF
    Pf?ÆÑÇ,^
    ..]0LZqÉÉ,IQüîß×}Õ:ÕR"?ü]].âÃ0`?·jmmÅTÈð@[s?0>>>¡ïàôüðéG?A?¤.Mgî<ä©ðÿÉ,ßû~ÂÕÏÜÊUp
    Å"ð}ºO¸á·?gÈMC><óo<J3'ToHGrn^Øb+·y?«
    Tº¸à¨Î7B*ùà¡×zÿYQEÚ"gr"*î

    I think it's Greek. Or, at least, it's Greek to me :)
     
    SC Tom, May 14, 2013
    #12
  13. Dave C

    Paul Guest

    Well, maybe it's a heavy weight flavor.

    "How to: Encrypt XML Elements with Asymmetric Keys"

    http://msdn.microsoft.com/en-us/library/ms229746.aspx

    At least they've thought about ways to hide stuff.

    I don't think it's ASCII85. The alphabet looks too rich.

    Paul
     
    Paul, May 14, 2013
    #13
  14. Dave C

    Stan Brown Guest

    Any text editor. Even Notepad should be able to do the job.

    Don't double-click the file. Open your editor of choice, and do
    File » Open in the editor menu, or drag the file into the editor's
    client area.
     
    Stan Brown, May 15, 2013
    #14
  15. Dave C

    Dave C Guest

    First, a Sincere Thank You, to the many responders. My question is FAR
    less important than most other requests on this board.

    Certainly I followed up on the various suggestions. I D/L'ed installed
    the XML Notepad 2007, as well as another XML editor (Altova XMLSpy
    2013) I found on the net. Neither xml editor allows acces to that
    file. I have verified that the File Properties are not restricted from
    editing. Both editors give me two, most similar error messages:

    Sorry file c:\users\ ... \games \freecell \freecellsettings.xml
    cannot be opened.

    Can't load binary file c:\users\ ... \games \freecell
    \freecellsettings.xml

    Note: Above, I have truncated the the full file directory info. For
    sure I did locate the applicable Frrecell file.

    I sure would aprreciate further advice, as to how I can open and edit
    that Freecell file, in an xml editor.

    Thanks
     
    Dave C, May 15, 2013
    #15
  16. Dave C

    Dave C Guest


    Apologies!!

    I thought I had updated, to the most recent posts in this newsgroup.
    You will note that my reply today was in response to a much earlier
    post. I have now read all of the subsequent posts.

    BTW: I did open the xml file with Notepad, as well the noted other
    two xml specific editors. Notepad did NOT give me any error messages
    and it DID open the file. Alas, there were NO identifiable entries
    displayed, such that I could edit the file. A non-technical person
    might call the display gibberish?

    As others have noted, there must be some encoding, that precludes
    viewing and editing. For certain I have no idea how to proceed, and
    edit that file.
     
    Dave C, May 15, 2013
    #16
  17. Dave C

    Paul Guest

    Arrgh!

    OK, I dug out the Windows 7 laptop, played a game of Freecell
    (don't know how, quit and accepted a loss).

    OK, brought the freecellsettings.xml back to my WinXP machine
    for analysis.

    Loaded it in a hex editor. It isn't an XML file that I can see. It
    is a two part file, consisting of a binary PNG at the front,
    followed by unicode text. Didn't anyone scroll to the end
    of the file ? Unicode text in Windows, uses two bytes per character.

    Snip the file, leaving hex 89 followed by the letters PNG.
    That's the beginning of a PNG file.

    This is what is contained in the PNG file I got as a result.
    This is magnified by a factor of four, for those with poor eyesight.
    It's actually 256x192. Now, why it was important to record this, I'll
    never know.

    http://imageshack.us/a/img541/4653/test3o.png

    There is a PNG spec here, if anyone is interested.

    http://www.w3.org/TR/PNG/

    I left the text at the end of it (which is past the IEND segment
    of the PNG), as it doesn't hurt anything. In other words, with a
    hex editor, you snip until you find 137 80 78 71 13 10 26 10 decimal.
    137 decimal is 89 hex. Capital P is 80 decimal. (search for "man ascii"
    in Google.) So <splat> PNG, four characters, is the header of a PNG file.
    Depending on your image editor, you don't need to precisely snip off
    the end, to see the PNG. The image loader will ignore input past
    the IEND thing.

    We need to remove the PNG file, then analyse the rest of it. The rest
    is in unicode. And Notepad should handle it. The end of the PNG is near
    IEND, followed by four other characters.

    OK, long story short, while keeping your eye on the IEND thing
    (which is near the end of the PNG), look for

    hex 0xFF, hex 0xFE, then unicode looking like <.R.o.o.t.>

    You want to keep the 0xFF and 0xFE preamble. Snip everything before
    that. Save that as test.xml say. Load in Wordpad. You will see

    <Root>
    <Stats>
    <Version>0</Version>
    <GamesPlayed>1</GamesPlayed>
    <GamesWon>0</GamesWon>
    <MaxWinStreakLength>0</MaxWinStreakLength>
    <MaxLoseStreakLength>1</MaxLoseStreakLength>
    <CurrStreakLength>1</CurrStreakLength>
    <WonlastGame>false</WonlastGame>
    </Stats>
    <Options>
    <Version>2</Version>
    <PlaySounds>true</PlaySounds>
    <PlayAnimations>true</PlayAnimations>
    <RandomAppearance>false</RandomAppearance>
    <AutoLoad>false</AutoLoad>
    <TurnOffTips>false</TurnOffTips>
    <AutoSaveGameOnExit>false</AutoSaveGameOnExit>
    <FirstPlay>false</FirstPlay>
    <CurrDeckSkin>2</CurrDeckSkin>
    <CurrBackground>0</CurrBackground>
    </Options>
    </Root>

    This is actually unicode, so every character is represented by two bytes.

    The only question that remains, is whether the garbage between the
    end of the PNG IEND and the beginning of the 0xFF 0xFE unicode
    preamble, is a checksum or not.

    Hacking the rest of it, is left as a joyous exercise for the
    reader.

    So it's not "quantum cryptography", it's just obfuscation.
    Cut the file in two, edit the text trailer, reassemble.
    If it is protected by a checksum, there are some bytes between
    IENDxxxx and 0xFF 0xFE that I cannot account for. Make a backup
    of the file, before loading your hacked one.

    At the very end of the file, I see 0x00 0x0a 0x00 0x00 0x00,
    and you probably can't create that with a text editor. When
    reassembling the file and bolting it back together, check
    that the postamble is correct. I don't know why there is a
    Unicode zero down there. A text editor shows that character
    as a square. If saving out the file happens to remove it,
    you can put that back with the hex editor.

    Have fun,

    Paul
     
    Paul, May 15, 2013
    #17
  18. I use this hex editor:

    http://mh-nexus.de/en/

    And that was pretty good detective work, Paul!
     
    Gene E. Bloch, May 15, 2013
    #18
  19. Dave C

    Char Jackson Guest

    Ahem, didn't we collectively discuss this very same topic a few months ago
    in this group? I clearly remember pointing out that the actual xml resides
    at the end of the file. Oh well, I guess if it's worth discovering, it's
    worth discovering again. ;-)
     
    Char Jackson, May 18, 2013
    #19
  20. Dave C

    Char Jackson Guest

    Sometimes, when I need extra super security, I use *DOUBLE* ROT13! The
    average person never even notices.
     
    Char Jackson, May 18, 2013
    #20
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.