Stories
Slash Boxes
Comments

SoylentNews is people

posted by Fnord666 on Friday March 24 2017, @06:49PM   Printer-friendly
from the didn't-need-those-folders-anyway dept.

in with a story on Robert Elder Software blog entitled Silently Corrupting an Eclipse Workspace: The Ultimate Prank:

Next time your co-worker asks:

"What's the best way to back up my Eclipse workspace on Windows?"

you can tell them "Just right-click on it and select 'Send to Compressed (zipped) folder' and save the zip file". Unbeknownst to them, you just pulled the ultimate prank by telling them to make a corrupted backup!

          What your friend probably doesn't realize is that the Windows 'Send to Compressed (zipped) folder' utility has a mandatory optional feature to automatically not include certain folders in the archive without telling you. This is a great feature because it demonstrates the excellent sense of humour that the authors of Microsoft Windows have. This feature was no doubt included to allow you to play a variety of hilarious pranks on others by causing them lose data, only to find out about it years later when they want to open the archive and recover it.

The blog post goes on to identify other idiosyncrasies with how Windows mishandles directories whose names start with a period and/or contain Unicode characters.

Reasons you haven't switched to Linux (cont.):

  • 3. Windows has superior development tools.

What other issues have you found with how Windows handles filenames?


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 2) by number6 on Wednesday March 29 2017, @05:12AM

    by number6 (1831) on Wednesday March 29 2017, @05:12AM (#485686) Journal
    Here is one more version of 'keepopen.c' , the comments in the code explain everything:

    /*
     * 'keepopen.c' -> version -> No console window; Close the process by pressing a hotkey.
     *
     * In the code below I am using the 'F7' key (VK_F7), but you can change it to something else
     * (see https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx).
     * Basically it will keep looping every 100 ms (0% CPU, dont worry, without that limit
     * it would go nuts with CPU). It checks for the 'F7' key press.
     *
     * Compiling this version is a bit trickier... you need to link the 'GetAsyncKeyState' function
     * with the system file 'user32.dll'. This is done in most IDEs (Visual Studio, etc) by calling
     * the file typically located here: /Lib/user32.lib
     * (more info https://msdn.microsoft.com/en-us/library/ms646293%28VS.85%29.aspx).
     *
     * However, I managed to compile this code to an executable by using 'Tiny C Compiler' by Fabrice
     * Bellard (http://www.bellard.org/tcc/) . I placed the file 'keepopen.c' at same location as the
     * compiler 'tcc.exe' , and then ran this command:
     *        tcc -luser32 -o keepopen.exe keepopen.c
     * and the executable was created ...and it worked; pressing F7 did close the process.
     *
     * Note: if you decide to use 'Tiny C Compiler' to make this, then you must also change this line:
     *        #include <windows.h>
     * to this:
     *        #include <winapi/windows.h>
     */

    #include <windows.h>

    int main(int argc, char *argv[]){
      FreeConsole(); // see https://msdn.microsoft.com/en-us/library/ms683150%28v=vs.85%29.aspx
      HANDLE h;
      if (argc == 2){
        h = CreateFile(argv[1],(GENERIC_READ | GENERIC_WRITE),FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
            while (1){
                if (GetAsyncKeyState(VK_F7)){
                    return 0;
                }
                Sleep(100);
            }
        CloseHandle(h);
      }
    }

    Starting Score:    1  point
    Karma-Bonus Modifier   +1  

    Total Score:   2