Potential issue with MGTools.exe on Win 7 64 bit

Discussion in 'Malware Help - MG (A Specialist Will Reply)' started by mcse3010, Sep 16, 2010.

  1. mcse3010

    mcse3010 Private E-2

    When running the MGTools.exe under Win7 64 bit from the C:\ directory. The user name has an ampersand in it C:\users\John&Jane

    I get a lot of path not found errors for C:\users\John

    also one error message splits at the ampersand:

    ....... "C:\john"
    "jane"... rest of message


    Just an FYI.
     
  2. chaslang

    chaslang MajorGeeks Admin - Master Malware Expert Staff Member

    Welcome to Major Geeks!

    The issue is not with Win7 X64 nor is it with MGtools. It is with what you did in creating a combined user account. See this link: How to Protect yourself from malware! And scroll down to 15) Miscellaneous Tips and then see # 2 in the list under this section. The ampersand is a special character and should not be used in file names as it will mess up many programs that are DOS specific ( like batch files ) which many programs including MGtools make use of. Also you should never use one user account for two people. Each should have there own user account so that each can have there own settings, favorites,...etc. In addition, if you use a combine user account and if one of you gets infected while surfing, you are both impacted. Having a separate user account provides some isolation ( not perfect isolation since some things within Windows are common files/folders).
     
  3. mcse3010

    mcse3010 Private E-2

    I didn't create the account. I didn't come here to get in a pissing match over your bug. All I wanted to do is let you know it had a bug. You know it has a bug, and it is a "known issue" -- per your burying it in a "miscellaneous tip".

    From 1 programmer to another... I was just telling you your code has a bug. Stick your head in the sand... I really couldn't care less... Thanks for the tools, sorry it didn't work out... Have a nice life. No need to get all worked up.
     
  4. chaslang

    chaslang MajorGeeks Admin - Master Malware Expert Staff Member

    It is not a bug in MGtools. It is the way DOS in Windows works. When illegal file or folder names are created in Windows, DOS programs will have problems. If you wish to call it a bug then so be it but it is the way Windows works not MGtools. MGtools cannot fix the way Microsoft Windows works.

    A real programmer you would know this.

    Sorry to see you got so worked up over nothing.

    Try the below from a command prompt and you will see the error shown. DOS does not allow processing of an ampersand directly. This is Windows design limitation from the very days of DOS and still is. It is working as designed by Microsoft.
    You can put a ^ in front of the ampersand to tell the command interpreter to not treat the & as a special character but this does not help when you don't know that an & is going to be used in a file name or folder name ahead of time and you have to know in what position too.
     
    Last edited: Sep 17, 2010
  5. mcse3010

    mcse3010 Private E-2

    Ok... so here's #1... I am a Senior Software Engineer and an MCSE. I promise I know what is an illegal filename. Ampersand is NOT an illegal character in DOS or Windows.

    Here's the reference in MSDN:
    http://msdn.microsoft.com/en-us/library/Aa365247#naming_conventions

    And as for the example you cite, all you have to do is quote the directory name:
    C:\Users\cposey>mkdir "this&that"

    C:\Users\cposey>dir "this&that"

    Volume in drive C is OSDisk
    Volume Serial Number is 38F3-E532

    Directory of C:\Users\cposey\this&that

    09/17/2010 01:13 AM <DIR> .
    09/17/2010 01:13 AM <DIR> ..
    0 File(s) 0 bytes
    2 Dir(s) 107,760,013,312 bytes free


    Quote your directory names and it should fix your issue.

    Thanks for at least listening to reason.

    To prove my point... A short test of environment variable processing where an environment variable may contain a path with an ampersand:

    mkdir "C:\this&that"
    SET AMP_TEST=C:\this^&that

    dir %AMP_TEST% <--- this will fail trying to dir C:\this, and "that" will be unrecognized...

    dir "%AMP_TEST%" <--- this works properly


    I have not deconstructed all your batch files in MGTOOLS, but I figured you would likely be referencing %HOMEPATH%, which you'd simply need to quote to solve the issues

    I truly hope this helps.



     
    Last edited: Sep 17, 2010
  6. chaslang

    chaslang MajorGeeks Admin - Master Malware Expert Staff Member

    Yes poor choice of wording on my part. Earlier I had just said "special character" which is correct, "illegal character" is not correct nor what I really meant to say.

    Yes you are correct that quotes can be put around strings to allow processing of the ampersand. This is also how we process things like cd "C:\Documents and Settings" or dir "%programfiles%" to get around the spaces that are embedded. Sometimes there are also spaces as well as special characters to process.

    I do make use of quotes in the batch files. There were problems however at some point with various tools being used that are DOS based where I still had issues due to the use of special characters being used in file and folder names. I don't rememeber all of the issues of the top of my head but I think it was a combination of environment variable expansion along with other info in lines being processed by various DOS tools that caused a problem. I will have to check into this again to see if the problems can be avoided since over the years I have been modifying the tools being used.

    Yes thanks! At a minimum it will make me relook at this issue to see how I can make it work. There will be a lot to look at since there are quite a few batch files....some rather long.
     
  7. mcse3010

    mcse3010 Private E-2

    Thanks!
     
  8. chaslang

    chaslang MajorGeeks Admin - Master Malware Expert Staff Member

    If you are still around, download and try the below version:

    MGtools

    I have not had a chance to fully test all versions of Windows and both 32 bit and 64 bit versions on top of that but did make some changes to work around limitations in the some of the tools like grep and sed being used. Also quite a few of the previous failure messages related to the & being in the folder name were only echo message about which folder was being accessed and the actual folder being listed was accessed properly even with the ampersand. The echo messages were added at a much later time after the ampersand issue had already been addressed ( more than 2 yrs ago ) for progress reporting and some of them did not have the quotes around the paths. The limitations from grep and sed only showed up in newer features that were added to MGtools and that were never tested against path names containing quotes.
     
    Last edited: Sep 24, 2010

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds