Filename codepage conversion
Posted on 2004-04-16
Situation: a trojan has created 100 folders on the desktop (Windows 98). The problem: it used some special characters.
Neither deleting, moving or renaming works - all attempts end in Windows error 1026 (which usually means network problems or not enough disk space, but that is not the case).
The only working way I found is using a command window, copying a folder name from the 'dir' results, and using 'rmdir' with that copied folder name. While this works, in the end I need a Windows program instead of manual instructions for this.
Using Windows.FindFirstFile,FindNextFile,FindClose (or the Delphi ones FindFirst, FindNext, FindClose) returns slighty different folder names (even pasting the copied 'dir' folder name into a Windows window does return a different name). Therefore I'ld say the problem is a different codepage. So I first tried to convert codepages from 437 - 850 - 1252 in all directions (later about a dozen different to no avail), but this didn't return any useful folder name.
I also tried a bunch of different removal procedures with all filename combinations - RmDir, RemoveDir, RemoveDirectory, DeleteFile, RenameFile, ShFileOperation - to no avail.
Well, maybe my codepage conversion isn't working (I convert to Unicode with one codepage and back with another). Does anyone know how to convert filename text from a dos box to valid Windows filename text (if the text contains codepage specific characters)? A conversion that would allow me to actually access the folder with RemoveDirectory?
PS: Accidently posted this in Programming as well... whoever solves this quickly will get points from both questions.