diff --git a/rosapps/fraginator/Defragment.cpp b/rosapps/fraginator/Defragment.cpp index 2b989e05a94..e78161f97d6 100644 --- a/rosapps/fraginator/Defragment.cpp +++ b/rosapps/fraginator/Defragment.cpp @@ -6,16 +6,16 @@ // and fits it to a given length. If it has to truncate it will first truncate from the path, // substituting in periods. So you might end up with something like: // C:\Program Files\Micro...\Register.exe -int FitName (char *destination, const char *path, const char *filename, uint32 totalWidth) +int FitName (wchar_t *destination, const wchar_t *path, const wchar_t *filename, uint32 totalWidth) { uint32 pathLen=0; uint32 fnLen=0; uint32 halfTotLen=0; uint32 len4fn=0; /* number of chars remaining for filename after path is applied */ uint32 len4path=0; /* number of chars for path before filename is applied */ - char fmtStrPath[20]=""; - char fmtStrFile[20]=""; - char fmtString[40]=""; + wchar_t fmtStrPath[20]=L""; + wchar_t fmtStrFile[20]=L""; + wchar_t fmtString[40]=L""; /* assert (destination != NULL); @@ -24,8 +24,8 @@ int FitName (char *destination, const char *path, const char *filename, uint32 t assert (totalWidth != 0); */ - pathLen = strlen(path); - fnLen = strlen(filename); + pathLen = wcslen(path); + fnLen = wcslen(filename); if (!(totalWidth % 2)) halfTotLen=totalWidth / 2; else @@ -58,28 +58,28 @@ int FitName (char *destination, const char *path, const char *filename, uint32 t } /* if halfTotLen was adjusted above to avoid a rounding error, give the - extra char to the filename + extra wchar_t to the filename */ if (halfTotLen < (totalWidth/2)) len4path++; - if (pathLen > len4path) sprintf (fmtStrPath, "%%.%ds...\\", len4path-4); + if (pathLen > len4path) swprintf (fmtStrPath, L"%%.%ds...\\", len4path-4); else - sprintf (fmtStrPath, "%%s"); + swprintf (fmtStrPath, L"%%s"); - if (fnLen > len4fn) sprintf (fmtStrFile, "%%.%ds...", len4fn-3); + if (fnLen > len4fn) swprintf (fmtStrFile, L"%%.%ds...", len4fn-3); else - sprintf (fmtStrFile, "%%s"); + swprintf (fmtStrFile, L"%%s"); - strcpy (fmtString, fmtStrPath); - strcat (fmtString, fmtStrFile); - /*sprintf (fmtString, "%s%s", fmtStrPath, fmtStrFile);*/ - sprintf (destination, fmtString, path,filename); + wcscpy (fmtString, fmtStrPath); + wcscat (fmtString, fmtStrFile); + /*swprintf (fmtString, L"%s%s", fmtStrPath, fmtStrFile);*/ + swprintf (destination, fmtString, path,filename); return (1); } -Defragment::Defragment (string Name, DefragType DefragMethod) +Defragment::Defragment (wstring Name, DefragType DefragMethod) { Method = DefragMethod; DoLimitLength = true; @@ -91,10 +91,10 @@ Defragment::Defragment (string Name, DefragType DefragMethod) StatusPercent = 0.0f; LastBMPUpdate = GetTickCount (); - SetStatusString ("Opening volume " + Name); + SetStatusString (L"Opening volume " + Name); if (!Volume.Open (Name)) { - SetStatusString ("Error opening volume " + Name); + SetStatusString (L"Error opening volume " + Name); Error = true; Done = true; StatusPercent = 100.0f; @@ -111,7 +111,7 @@ Defragment::~Defragment () Stop (); while (!IsDoneYet() && !HasError()) { - SetStatusString ("Waiting for thread to stop ..."); + SetStatusString (L"Waiting for thread to stop ..."); Sleep (150); } } @@ -121,7 +121,7 @@ Defragment::~Defragment () } -void Defragment::SetStatusString (string NewStatus) +void Defragment::SetStatusString (wstring NewStatus) { Lock (); StatusString = NewStatus; @@ -131,9 +131,9 @@ void Defragment::SetStatusString (string NewStatus) } -string Defragment::GetStatusString (void) +wstring Defragment::GetStatusString (void) { - string ReturnVal; + wstring ReturnVal; Lock (); ReturnVal = StatusString; @@ -161,17 +161,17 @@ void Defragment::Start (void) uint64 FirstFreeLCN; uint64 TotalClusters; uint64 ClustersProgress; - char PrintName[80]; + wchar_t PrintName[80]; int Width = 70; if (Error) goto DoneDefrag; // First thing: build a file list. - SetStatusString ("Getting volume bitmap"); + SetStatusString (L"Getting volume bitmap"); if (!Volume.GetBitmap()) { - SetStatusString ("Could not get volume " + DriveName + " bitmap"); + SetStatusString (L"Could not get volume " + DriveName + L" bitmap"); Error = true; goto DoneDefrag; } @@ -181,10 +181,10 @@ void Defragment::Start (void) if (PleaseStop) goto DoneDefrag; - SetStatusString ("Obtaining volume geometry"); + SetStatusString (L"Obtaining volume geometry"); if (!Volume.ObtainInfo ()) { - SetStatusString ("Could not obtain volume " + DriveName + " geometry"); + SetStatusString (L"Could not obtain volume " + DriveName + L" geometry"); Error = true; goto DoneDefrag; } @@ -192,10 +192,10 @@ void Defragment::Start (void) if (PleaseStop) goto DoneDefrag; - SetStatusString ("Building file database for volume " + DriveName); + SetStatusString (L"Building file database for volume " + DriveName); if (!Volume.BuildFileList (PleaseStop, StatusPercent)) { - SetStatusString ("Could not build file database for volume " + DriveName); + SetStatusString (L"Could not build file database for volume " + DriveName); Error = true; goto DoneDefrag; } @@ -203,7 +203,7 @@ void Defragment::Start (void) if (PleaseStop) goto DoneDefrag; - SetStatusString ("Analyzing database for " + DriveName); + SetStatusString (L"Analyzing database for " + DriveName); TotalClusters = 0; for (i = 0; i < Volume.GetDBFileCount(); i++) { @@ -287,7 +287,7 @@ void Defragment::Start (void) // What? They want us to pause? Oh ok. if (PleasePause) { - SetStatusString ("Paused"); + SetStatusString (L"Paused"); PleasePause = false; while (PleasePause == false) @@ -300,7 +300,7 @@ void Defragment::Start (void) if (PleaseStop) { - SetStatusString ("Stopping"); + SetStatusString (L"Stopping"); break; } @@ -374,11 +374,11 @@ void Defragment::Start (void) else if (!Result || Retry != 1) { // hmm. Wait for a moment, then update the drive bitmap - //SetStatusString ("(Reobtaining volume " + DriveName + " bitmap)"); + //SetStatusString (L"(Reobtaining volume " + DriveName + L" bitmap)"); if (!DoLimitLength) { - SetStatusString (GetStatusString() + string (" .")); + SetStatusString (GetStatusString() + wstring (L" .")); } if (Volume.GetBitmap ()) @@ -394,7 +394,7 @@ void Defragment::Start (void) } else { - SetStatusString ("Could not re-obtain volume " + DriveName + " bitmap"); + SetStatusString (L"Could not re-obtain volume " + DriveName + L" bitmap"); Error = true; } } @@ -407,22 +407,22 @@ void Defragment::Start (void) } DoneDefrag: - string OldStatus; + wstring OldStatus; OldStatus = GetStatusString (); StatusPercent = 99.999999f; - SetStatusString ("Closing volume " + DriveName); + SetStatusString (L"Closing volume " + DriveName); Volume.Close (); StatusPercent = 100.0f; - // If there was an error then the string has already been set + // If there was an error then the wstring has already been set if (Error) SetStatusString (OldStatus); else if (PleaseStop) - SetStatusString ("Volume " + DriveName + " defragmentation was stopped"); + SetStatusString (L"Volume " + DriveName + L" defragmentation was stopped"); else - SetStatusString ("Finished defragmenting " + DriveName); + SetStatusString (L"Finished defragmenting " + DriveName); Done = true; @@ -433,7 +433,7 @@ DoneDefrag: void Defragment::TogglePause (void) { Lock (); - SetStatusString ("Pausing ..."); + SetStatusString (L"Pausing ..."); PleasePause = true; Unlock (); @@ -444,7 +444,7 @@ void Defragment::TogglePause (void) void Defragment::Stop (void) { Lock (); - SetStatusString ("Stopping ..."); + SetStatusString (L"Stopping ..."); PleaseStop = true; Unlock (); diff --git a/rosapps/fraginator/Defragment.h b/rosapps/fraginator/Defragment.h index f814234391f..4706f2856f5 100644 --- a/rosapps/fraginator/Defragment.h +++ b/rosapps/fraginator/Defragment.h @@ -14,12 +14,12 @@ #include "Mutex.h" -extern int FitName (char *destination, const char *path, const char *filename, uint32 totalWidth); +extern int FitName (wchar_t *destination, const wchar_t *path, const wchar_t *filename, uint32 totalWidth); typedef struct DefragReport { - string RootPath; + wstring RootPath; uint64 DiskSizeBytes; uint64 DirsCount; uint64 FilesCount; @@ -41,7 +41,7 @@ typedef struct DefragReport class Defragment { public: - Defragment (string Name, DefragType DefragMethod); + Defragment (wstring Name, DefragType DefragMethod); ~Defragment (); // Commands @@ -52,7 +52,7 @@ public: // Info bool IsDoneYet (void); bool HasError (void); - string GetStatusString (void); + wstring GetStatusString (void); double GetStatusPercent (void); DefragType GetDefragType (void) { return (Method); } DefragReport &GetDefragReport (void) { return (Report); } @@ -69,16 +69,16 @@ public: private: void FastDefrag (void); void ExtensiveDefrag (void); - void SetStatusString (string NewStatus); + void SetStatusString (wstring NewStatus); DWORD LastBMPUpdate; // Last time volume bitmap was updated DefragReport Report; bool DoLimitLength; DefragType Method; - string DriveName; + wstring DriveName; DriveVolume Volume; - string StatusString; - string ErrorString; + wstring StatusString; + wstring ErrorString; double StatusPercent; Mutex DefragMutex; bool Error; diff --git a/rosapps/fraginator/DriveVolume.cpp b/rosapps/fraginator/DriveVolume.cpp index 6845ef4ba5c..0d9c18a5993 100644 --- a/rosapps/fraginator/DriveVolume.cpp +++ b/rosapps/fraginator/DriveVolume.cpp @@ -39,14 +39,14 @@ void DriveVolume::Close (void) // "Name" should be the drive letter followed by a colon. ie, "c:" // It's a string to allow for further expansion (ie, defragging over the network?) // or some other baloney reason -bool DriveVolume::Open (string Name) +bool DriveVolume::Open (wstring Name) { - char FileName[100]; + wchar_t FileName[100]; bool ReturnVal; - sprintf (FileName, "\\\\.\\%s", Name.c_str()); + swprintf (FileName, L"\\\\.\\%s", Name.c_str()); RootPath = Name.c_str(); - RootPath += "\\"; + RootPath += L"\\"; Handle = CreateFile ( @@ -63,11 +63,11 @@ bool DriveVolume::Open (string Name) ReturnVal = false; else { - char VolName[64]; + wchar_t VolName[64]; DWORD VolSN; DWORD VolMaxFileLen; DWORD FSFlags; - char FSName[64]; + wchar_t FSName[64]; BOOL Result; ReturnVal = true; @@ -85,24 +85,24 @@ bool DriveVolume::Open (string Name) if (Result) { - char SerialText[10]; + wchar_t SerialText[10]; VolInfo.FileSystem = FSName; VolInfo.MaxNameLen = VolMaxFileLen; VolInfo.Name = VolName; - sprintf (SerialText, "%x-%x", (VolSN & 0xffff0000) >> 16, + swprintf (SerialText, L"%x-%x", (VolSN & 0xffff0000) >> 16, VolSN & 0x0000ffff); - strupr (SerialText); + wcsupr (SerialText); VolInfo.Serial = SerialText; } else { - VolInfo.FileSystem = "(Unknown)"; + VolInfo.FileSystem = L"(Unknown)"; VolInfo.MaxNameLen = 255; - VolInfo.Name = "(Unknown)"; - VolInfo.Serial = "(Unknown)"; + VolInfo.Name = L"(Unknown)"; + VolInfo.Serial = L"(Unknown)"; } } @@ -202,7 +202,7 @@ bool DriveVolume::GetBitmap (void) // Bad result? if (Result == FALSE && GetLastError () != ERROR_MORE_DATA) { - //printf ("\nDeviceIoControl returned false, GetLastError() was not ERROR_MORE_DATA\n"); + //wprintf ("\nDeviceIoControl returned false, GetLastError() was not ERROR_MORE_DATA\n"); free (Bitmap); return (false); } @@ -226,12 +226,12 @@ bool DriveVolume::GetBitmap (void) if (Result == FALSE) { - printf ("\nCouldn't properly read volume bitmap\n"); + wprintf (L"\nCouldn't properly read volume bitmap\n"); free (Bitmap); return (false); } - // Convert to a 'quick use' bitmap + // Convert to a L'quick use' bitmap //const int BitShift[] = { 1, 2, 4, 8, 16, 32, 64, 128 }; VolInfo.ClusterCount = Bitmap->BitmapSize.QuadPart; @@ -331,7 +331,7 @@ bool BuildDBCallback (FileInfo &Info, HANDLE &FileHandle, void *UserData) } -string &DriveVolume::GetDBDir (uint32 Indice) +wstring &DriveVolume::GetDBDir (uint32 Indice) { return (Directories[Indice]); } @@ -365,17 +365,17 @@ uint32 DriveVolume::RemoveDBFile (uint32 Indice) } -bool DriveVolume::ScanDirectory (string DirPrefix, ScanCallback Callback, void *UserData) +bool DriveVolume::ScanDirectory (wstring DirPrefix, ScanCallback Callback, void *UserData) { WIN32_FIND_DATA FindData; HANDLE FindHandle; - string SearchString; + wstring SearchString; uint32 DirIndice; DirIndice = Directories.size() - 1; SearchString = DirPrefix; - SearchString += "*.*"; + SearchString += L"*.*"; ZeroMemory (&FindData, sizeof (FindData)); FindHandle = FindFirstFile (SearchString.c_str(), &FindData); @@ -393,8 +393,8 @@ bool DriveVolume::ScanDirectory (string DirPrefix, ScanCallback Callback, void * // First copy over the easy stuff. Info.Name = FindData.cFileName; - // Don't ever include '.' and '..' - if (Info.Name == "." || Info.Name == "..") + // DonLL't ever include '.L' and '..' + if (Info.Name == L"." || Info.Name == L"..") continue; //Info.FullName = DirPrefix + Info.Name; @@ -450,11 +450,11 @@ bool DriveVolume::ScanDirectory (string DirPrefix, ScanCallback Callback, void * // If directory, perform recursion if (Info.Attributes.Directory == 1) { - string Dir; + wstring Dir; Dir = GetDBDir (Info.DirIndice); Dir += Info.Name; - Dir += "\\"; + Dir += L"\\"; Directories.push_back (Dir); ScanDirectory (Dir, Callback, UserData); @@ -485,7 +485,7 @@ bool DriveVolume::GetClusterInfo (FileInfo &Info, HANDLE &HandleResult) { BOOL Result; HANDLE Handle; - string FullName; + wstring FullName; BY_HANDLE_FILE_INFORMATION FileInfo; Info.Fragments.resize (0); @@ -529,7 +529,7 @@ bool DriveVolume::GetClusterInfo (FileInfo &Info, HANDLE &HandleResult) if (Result == FALSE) { Info.Attributes.AccessDenied = 1; - printf ("GetFileInformationByHandle ('%s%s') failed\n", GetDBDir (Info.DirIndice).c_str(), + wprintf (L"GetFileInformationByHandle ('%s%s') failed\n", GetDBDir (Info.DirIndice).c_str(), Info.Name.c_str()); CloseHandle (Handle); @@ -544,7 +544,7 @@ bool DriveVolume::GetClusterInfo (FileInfo &Info, HANDLE &HandleResult) DWORD BytesReturned; // Grab info one extent at a time, until it's done grabbing all the extent data - // Yeah, well it doesn't give us a way to ask "how many extents?" that I know of ... + // Yeah, well it doesn't give us a way to ask L"how many extents?" that I know of ... // btw, the Extents variable tends to only reflect memory usage, so when we have // all the extents we look at the structure Win32 gives us for the REAL count! Extents = 10; @@ -668,7 +668,7 @@ bool DriveVolume::MoveFileDumb (uint32 FileIndice, uint64 NewLCN) bool ReturnVal = false; FileInfo Info; HANDLE FileHandle; - string FullName; + wstring FullName; MOVE_FILE_DATA MoveData; uint64 CurrentLCN; uint64 CurrentVCN; @@ -724,7 +724,7 @@ bool DriveVolume::MoveFileDumb (uint32 FileIndice, uint64 NewLCN) BOOL Result; DWORD BytesReturned; - //printf ("%3u", i); + //wprintf (L"%3u", i); MoveData.ClusterCount = Info.Fragments[i].Length; MoveData.StartingLcn.QuadPart = CurrentLCN; @@ -733,15 +733,15 @@ bool DriveVolume::MoveFileDumb (uint32 FileIndice, uint64 NewLCN) MoveData.FileHandle = FileHandle; /* - printf ("\n"); - printf ("StartLCN: %I64u\n", MoveData.StartingLcn.QuadPart); - printf ("StartVCN: %I64u\n", MoveData.StartingVcn.QuadPart); - printf ("Clusters: %u (%I64u-%I64u --> %I64u-%I64u)\n", MoveData.ClusterCount, + wprintf (L"\n"); + wprintf (L"StartLCN: %I64u\n", MoveData.StartingLcn.QuadPart); + wprintf (L"StartVCN: %I64u\n", MoveData.StartingVcn.QuadPart); + wprintf (L"Clusters: %u (%I64u-%I64u --> %I64u-%I64u)\n", MoveData.ClusterCount, Info.Fragments[i].StartLCN, Info.Fragments[i].StartLCN + MoveData.ClusterCount, MoveData.StartingLcn.QuadPart, MoveData.StartingLcn.QuadPart + MoveData.ClusterCount - 1); - printf ("\n"); + wprintf (L"\n"); */ Result = DeviceIoControl @@ -756,7 +756,7 @@ bool DriveVolume::MoveFileDumb (uint32 FileIndice, uint64 NewLCN) NULL ); - //printf ("\b\b\b"); + //wprintf (L"\b\b\b"); if (Result == FALSE) { diff --git a/rosapps/fraginator/DriveVolume.h b/rosapps/fraginator/DriveVolume.h index ea9fad0e6e8..cb43dda376b 100644 --- a/rosapps/fraginator/DriveVolume.h +++ b/rosapps/fraginator/DriveVolume.h @@ -51,7 +51,7 @@ typedef struct typedef struct { - string Name; + wstring Name; uint32 DirIndice; // indice into directory list uint64 Size; uint64 Clusters; @@ -65,10 +65,10 @@ typedef vector FileList; typedef struct { - string Name; - string Serial; + wstring Name; + wstring Serial; DWORD MaxNameLen; - string FileSystem; + wstring FileSystem; uint64 ClusterCount; uint32 ClusterSize; uint64 TotalBytes; @@ -92,7 +92,7 @@ public: DriveVolume (); ~DriveVolume (); - bool Open (string Name); // opens the volume + bool Open (wstring Name); // opens the volume void Close (void); bool ObtainInfo (void); // retrieves drive geometry bool GetBitmap (void); // gets drive bitmap @@ -108,7 +108,7 @@ public: DISK_GEOMETRY GetGeometry (void) { return (Geometry); } VolumeInfo GetVolumeInfo (void) { return (VolInfo); } - string GetRootPath (void) { return (RootPath); } + wstring GetRootPath (void) { return (RootPath); } // Scans drive starting from the root dir and calls a user defined function // for each file/directory encountered. void* UserData is passed to this @@ -116,7 +116,7 @@ public: bool Scan (ScanCallback Callback, void *UserData); // Retrieve a directory string from the file database - string &GetDBDir (uint32 Indice); + wstring &GetDBDir (uint32 Indice); uint32 GetDBDirCount (void); // Retrieve file strings/info from the file database FileInfo &GetDBFile (uint32 Indice); @@ -137,7 +137,7 @@ private: friend bool BuildDBCallback (FileInfo &Info, HANDLE &FileHandle, void *UserData); // DirPrefix should be in the form "drive:\\path\\" ie, C:\CRAP\ . - bool ScanDirectory (string DirPrefix, ScanCallback Callback, void *UserData); + bool ScanDirectory (wstring DirPrefix, ScanCallback Callback, void *UserData); // given a file's attributes, should it be processed or not? bool ShouldProcess (FileAttr Attr); @@ -146,8 +146,8 @@ private: VolumeInfo VolInfo; FileList Files; - vector Directories; // Directories[Files[x].DirIndice] - string RootPath; // ie, C:\ . + vector Directories; // Directories[Files[x].DirIndice] + wstring RootPath; // ie, C:\ . HANDLE Handle; DISK_GEOMETRY Geometry; uint32 *BitmapDetail; diff --git a/rosapps/fraginator/Fraginator.cpp b/rosapps/fraginator/Fraginator.cpp index e80bb06a16e..f3096e5f889 100644 --- a/rosapps/fraginator/Fraginator.cpp +++ b/rosapps/fraginator/Fraginator.cpp @@ -42,7 +42,7 @@ int WINAPI WinMain (HINSTANCE HInstance, HINSTANCE HPrevInstance, LPSTR CmdLine, if (!CheckWinVer()) { - MessageBox (GetDesktopWindow(), "Sorry, this program requires Windows 2000.", "Error", MB_OK); + MessageBox (GetDesktopWindow(), L"Sorry, this program requires Windows 2000.", L"Error", MB_OK); return (0); } @@ -51,7 +51,7 @@ int WINAPI WinMain (HINSTANCE HInstance, HINSTANCE HPrevInstance, LPSTR CmdLine, #if 0 AllocConsole (); if (_CrtDumpMemoryLeaks ()) - MessageBox (NULL, "Click OK to quit", "Leaks", MB_OK); + MessageBox (NULL, L"Click OK to quit", L"Leaks", MB_OK); #endif return (0); diff --git a/rosapps/fraginator/Fraginator.exe b/rosapps/fraginator/Fraginator.exe deleted file mode 100644 index 2ef93897ce3..00000000000 Binary files a/rosapps/fraginator/Fraginator.exe and /dev/null differ diff --git a/rosapps/fraginator/Fraginator.h b/rosapps/fraginator/Fraginator.h index 7008ca8856b..ac26abfdceb 100644 --- a/rosapps/fraginator/Fraginator.h +++ b/rosapps/fraginator/Fraginator.h @@ -14,7 +14,7 @@ int WINAPI WinMain (HINSTANCE HInstance, HINSTANCE HPrevInstance, LPSTR CmdLine, int ShowCmd); -Defragment *StartDefragBox (string Drive, DefragType Method); +Defragment *StartDefragBox (wstring Drive, DefragType Method); extern HINSTANCE GlobalHInstance; diff --git a/rosapps/fraginator/Fraginator.mak b/rosapps/fraginator/Fraginator.mak deleted file mode 100644 index 30cfd628dc5..00000000000 --- a/rosapps/fraginator/Fraginator.mak +++ /dev/null @@ -1,224 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on Fraginator.dsp -!IF "$(CFG)" == "" -CFG=Fraginator - Win32 Debug -!MESSAGE No configuration specified. Defaulting to Fraginator - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "Fraginator - Win32 Release" && "$(CFG)" != "Fraginator - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Fraginator.mak" CFG="Fraginator - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Fraginator - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "Fraginator - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -CPP=xicl6.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Fraginator - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -ALL : "$(OUTDIR)\Fraginator.exe" - - -CLEAN : - -@erase "$(INTDIR)\Defragment.obj" - -@erase "$(INTDIR)\DriveVolume.obj" - -@erase "$(INTDIR)\Fraginator.obj" - -@erase "$(INTDIR)\Fraginator.res" - -@erase "$(INTDIR)\MainDialog.obj" - -@erase "$(INTDIR)\ReportDialog.obj" - -@erase "$(INTDIR)\Unfrag.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(OUTDIR)\Fraginator.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /G6 /Gr /MT /W3 /GX /Ox /Ot /Og /Oi /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\Fraginator.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\Fraginator.res" /d "NDEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\Fraginator.bsc" -BSC32_SBRS= \ - -LINK32=xilink6.exe -LINK32_FLAGS=comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /profile /machine:I386 /out:"$(OUTDIR)\Fraginator.exe" -LINK32_OBJS= \ - "$(INTDIR)\Defragment.obj" \ - "$(INTDIR)\DriveVolume.obj" \ - "$(INTDIR)\Fraginator.obj" \ - "$(INTDIR)\MainDialog.obj" \ - "$(INTDIR)\ReportDialog.obj" \ - "$(INTDIR)\Unfrag.obj" \ - "$(INTDIR)\Fraginator.res" - -"$(OUTDIR)\Fraginator.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -SOURCE="$(InputPath)" -PostBuild_Desc=Copying to Program Files ... -DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep - -ALL : $(DS_POSTBUILD_DEP) - -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -$(DS_POSTBUILD_DEP) : "$(OUTDIR)\Fraginator.exe" - copy Release\Fraginator.exe "c:\Program Files\Fraginator\Fraginator.exe" - echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)" - -!ELSEIF "$(CFG)" == "Fraginator - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -ALL : "$(OUTDIR)\Fraginator.exe" - - -CLEAN : - -@erase "$(INTDIR)\Defragment.obj" - -@erase "$(INTDIR)\DriveVolume.obj" - -@erase "$(INTDIR)\Fraginator.obj" - -@erase "$(INTDIR)\Fraginator.res" - -@erase "$(INTDIR)\MainDialog.obj" - -@erase "$(INTDIR)\ReportDialog.obj" - -@erase "$(INTDIR)\Unfrag.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\Fraginator.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\Fraginator.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\Fraginator.res" /d "_DEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\Fraginator.bsc" -BSC32_SBRS= \ - -LINK32=xilink6.exe -LINK32_FLAGS=comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /profile /debug /machine:I386 /out:"$(OUTDIR)\Fraginator.exe" -LINK32_OBJS= \ - "$(INTDIR)\Defragment.obj" \ - "$(INTDIR)\DriveVolume.obj" \ - "$(INTDIR)\Fraginator.obj" \ - "$(INTDIR)\MainDialog.obj" \ - "$(INTDIR)\ReportDialog.obj" \ - "$(INTDIR)\Unfrag.obj" \ - "$(INTDIR)\Fraginator.res" - -"$(OUTDIR)\Fraginator.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("Fraginator.dep") -!INCLUDE "Fraginator.dep" -!ELSE -!MESSAGE Warning: cannot find "Fraginator.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "Fraginator - Win32 Release" || "$(CFG)" == "Fraginator - Win32 Debug" -SOURCE=.\Defragment.cpp - -"$(INTDIR)\Defragment.obj" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\DriveVolume.cpp - -"$(INTDIR)\DriveVolume.obj" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\Fraginator.cpp - -"$(INTDIR)\Fraginator.obj" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\MainDialog.cpp - -"$(INTDIR)\MainDialog.obj" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\ReportDialog.cpp - -"$(INTDIR)\ReportDialog.obj" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\Unfrag.cpp - -"$(INTDIR)\Unfrag.obj" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\Fraginator.rc - -"$(INTDIR)\Fraginator.res" : $(SOURCE) "$(INTDIR)" - $(RSC) $(RSC_PROJ) $(SOURCE) - - - -!ENDIF - diff --git a/rosapps/fraginator/Fraginator.rc b/rosapps/fraginator/Fraginator.rc index c243fabd2a1..c36ebee107f 100644 --- a/rosapps/fraginator/Fraginator.rc +++ b/rosapps/fraginator/Fraginator.rc @@ -7,7 +7,7 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxres.h" +#include "windows.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -40,17 +40,17 @@ BEGIN PUSHBUTTON "Start",IDC_STARTSTOP,294,7,45,15 PUSHBUTTON "Help",ID_MAIN_HELP,294,28,45,15 PUSHBUTTON "Exit",IDC_QUIT,294,49,45,15 - CONTROL 110,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN | + CONTROL 110,-1,"Static",SS_BITMAP | SS_SUNKEN | WS_BORDER,7,7,63,58 - LTEXT "Choose a drive:",IDC_STATIC,78,40,50,8 - LTEXT "Choose an action:",IDC_STATIC,135,40,58,8 + LTEXT "Choose a drive:",-1,78,40,50,8 + LTEXT "Choose an action:",-1,135,40,58,8 CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER | 0x1,7,71,299,10 CONTROL "Static",IDC_STATUS,"Static",SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP,7,86,332,10 LTEXT "I am a monkey, hear me eeK",IDC_WISECRACKS,78,15,91,8 LTEXT "100.00%",IDC_PERCENT,311,71,28,8,0,WS_EX_RIGHT - LTEXT "Process Priority:",IDC_STATIC,223,40,51,8 + LTEXT "Process Priority:",-1,223,40,51,8 END IDD_REPORT DIALOG 0, 0, 391, 169 @@ -63,50 +63,50 @@ BEGIN DEFPUSHBUTTON "Megabytes",IDC_MEGABYTES,115,148,50,14 DEFPUSHBUTTON "Gigabytes",IDC_GIGABYTES,169,148,50,14 DEFPUSHBUTTON "OK",IDC_REPORTOK,334,148,50,14 - RTEXT "Volume",IDC_STATIC,7,7,24,8 - LTEXT "Capacity",IDC_STATIC,7,51,28,8 + RTEXT "Volume",-1,7,7,24,8 + LTEXT "Capacity",-1,7,51,28,8 RTEXT "(Drive Letter)",IDC_DRIVELETTER,63,7,117,10,SS_SUNKEN RTEXT "(Disk Size, Bytes)",IDC_DISKSIZEBYTES,63,51,117,10, SS_SUNKEN RTEXT "(Disk Size, Clusters)",IDC_DISKSIZECLUSTERS,63,73,117, 10,SS_SUNKEN - LTEXT "Total clusters",IDC_STATIC,7,73,43,8 + LTEXT "Total clusters",-1,7,73,43,8 RTEXT "(Cluster size)",IDC_DISKCLUSTERSIZE,63,84,117,10, SS_SUNKEN - LTEXT "Cluster size",IDC_STATIC,7,84,36,8 + LTEXT "Cluster size",-1,7,84,36,8 RTEXT "(Files count)",IDC_FILESCOUNT,267,18,117,10,SS_SUNKEN RTEXT "(Files size, bytes)",IDC_FILESSIZEBYTES,267,29,117,10, SS_SUNKEN - LTEXT "# of files",IDC_STATIC,194,18,28,8 - LTEXT "Total size",IDC_STATIC,194,29,31,8 - LTEXT "Size on disk",IDC_STATIC,194,40,39,8 + LTEXT "# of files",-1,194,18,28,8 + LTEXT "Total size",-1,194,29,31,8 + LTEXT "Size on disk",-1,194,40,39,8 RTEXT "(Total size, bytes)",IDC_FILESSIZEONDISK,267,40,117,10, SS_SUNKEN RTEXT "(Files slack bytes)",IDC_FILESSLACKBYTES,267,51,117,10, SS_SUNKEN - LTEXT "Wasted slack",IDC_STATIC,194,51,44,8 + LTEXT "Wasted slack",-1,194,51,44,8 RTEXT "(Disk Free, Bytes)",IDC_DISKFREEBYTES,63,62,117,10, SS_SUNKEN - LTEXT "Free space",IDC_STATIC,7,62,36,8 + LTEXT "Free space",-1,7,62,36,8 RTEXT "(Files fragmented, count)",IDC_FILESFRAGGED,267,62,117, 10,SS_SUNKEN - LTEXT "Fragmented files",IDC_STATIC,194,62,52,8 + LTEXT "Fragmented files",-1,194,62,52,8 RTEXT "(Dirs count)",IDC_DIRSCOUNT,267,7,117,10,SS_SUNKEN - LTEXT "# of directories",IDC_STATIC,194,7,48,8 - RTEXT "File System",IDC_STATIC,7,40,36,8 + LTEXT "# of directories",-1,194,7,48,8 + RTEXT "File System",-1,7,40,36,8 RTEXT "(File System Name)",IDC_FILESYSTEM,63,40,117,10, SS_SUNKEN - RTEXT "Volume Label",IDC_STATIC,7,18,44,8 + RTEXT "Volume Label",-1,7,18,44,8 RTEXT "(Volume Name)",IDC_VOLUMELABEL,63,18,117,10,SS_SUNKEN - RTEXT "Serial",IDC_STATIC,7,29,18,8 + RTEXT "Serial",-1,7,29,18,8 RTEXT "(Volume Serial)",IDC_VOLUMESERIAL,63,29,117,10, SS_SUNKEN RTEXT "(Average Frags Per File)",IDC_AVERAGEFRAGS,267,73,117, 10,SS_SUNKEN - LTEXT "Average fragments per file",IDC_STATIC,194,73,60,20 + LTEXT "Average fragments per file",-1,194,73,60,20 LTEXT "XX.X% of the files on this drive are fragmented. It is recommended that you perform a SSSSSSS defragmentation.", IDC_RECOMMEND,7,106,377,38,SS_SUNKEN - LTEXT "Recommendations:",IDC_STATIC,7,96,62,8 + LTEXT "Recommendations:",-1,7,96,62,8 END @@ -150,7 +150,7 @@ END 2 TEXTINCLUDE BEGIN - "#include ""afxres.h""\r\n" + "#include ""windows.h""\r\n" "\0" END diff --git a/rosapps/fraginator/Fraginator.sln b/rosapps/fraginator/Fraginator.sln index 8996ce9b5a3..06348278065 100644 --- a/rosapps/fraginator/Fraginator.sln +++ b/rosapps/fraginator/Fraginator.sln @@ -1,27 +1,25 @@ -Microsoft Visual Studio Solution File, Format Version 7.00 +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual C++ Express 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Fraginator", "Fraginator.vcproj", "{7CB0DB3F-D4AB-4A99-807F-C56CC9F0B19C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unfrag", "unfrag.vcproj", "{8E7E76C1-739B-46E5-99C2-A0504558164B}" EndProject Global - GlobalSection(SolutionConfiguration) = preSolution - ConfigName.0 = Debug - ConfigName.1 = Release + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7CB0DB3F-D4AB-4A99-807F-C56CC9F0B19C}.Debug|Win32.ActiveCfg = Debug|Win32 + {7CB0DB3F-D4AB-4A99-807F-C56CC9F0B19C}.Debug|Win32.Build.0 = Debug|Win32 + {7CB0DB3F-D4AB-4A99-807F-C56CC9F0B19C}.Release|Win32.ActiveCfg = Release|Win32 + {7CB0DB3F-D4AB-4A99-807F-C56CC9F0B19C}.Release|Win32.Build.0 = Release|Win32 + {8E7E76C1-739B-46E5-99C2-A0504558164B}.Debug|Win32.ActiveCfg = Debug|Win32 + {8E7E76C1-739B-46E5-99C2-A0504558164B}.Debug|Win32.Build.0 = Debug|Win32 + {8E7E76C1-739B-46E5-99C2-A0504558164B}.Release|Win32.ActiveCfg = Release|Win32 + {8E7E76C1-739B-46E5-99C2-A0504558164B}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {7CB0DB3F-D4AB-4A99-807F-C56CC9F0B19C}.Debug.ActiveCfg = Debug|Win32 - {7CB0DB3F-D4AB-4A99-807F-C56CC9F0B19C}.Debug.Build.0 = Debug|Win32 - {7CB0DB3F-D4AB-4A99-807F-C56CC9F0B19C}.Release.ActiveCfg = Release|Win32 - {7CB0DB3F-D4AB-4A99-807F-C56CC9F0B19C}.Release.Build.0 = Release|Win32 - {8E7E76C1-739B-46E5-99C2-A0504558164B}.Debug.ActiveCfg = Debug|Win32 - {8E7E76C1-739B-46E5-99C2-A0504558164B}.Debug.Build.0 = Debug|Win32 - {8E7E76C1-739B-46E5-99C2-A0504558164B}.Release.ActiveCfg = Release|Win32 - {8E7E76C1-739B-46E5-99C2-A0504558164B}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection EndGlobal diff --git a/rosapps/fraginator/Fraginator.suo b/rosapps/fraginator/Fraginator.suo deleted file mode 100644 index c674481aaf8..00000000000 Binary files a/rosapps/fraginator/Fraginator.suo and /dev/null differ diff --git a/rosapps/fraginator/Fraginator.vcproj b/rosapps/fraginator/Fraginator.vcproj index 5d17321bb50..344061c6729 100644 --- a/rosapps/fraginator/Fraginator.vcproj +++ b/rosapps/fraginator/Fraginator.vcproj @@ -1,200 +1,292 @@ - + + ProjectGUID="{7CB0DB3F-D4AB-4A99-807F-C56CC9F0B19C}" + > + Name="Win32" + /> + + + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="1" + ManagedExtensions="0" + > + Name="VCPreBuildEventTool" + /> + Name="VCCustomBuildTool" + /> + Name="VCXMLDataGeneratorTool" + /> + + TypeLibraryName=".\Release/Fraginator.tlb" + /> + Name="VCCLCompilerTool" + Optimization="3" + InlineFunctionExpansion="2" + EnableIntrinsicFunctions="true" + FavorSizeOrSpeed="1" + PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS" + ExceptionHandling="1" + RuntimeLibrary="0" + StructMemberAlignment="5" + BufferSecurityCheck="false" + PrecompiledHeaderFile=".\Release/Fraginator.pch" + WarningLevel="3" + SuppressStartupBanner="true" + CallingConvention="1" + /> - + Name="VCManagedResourceCompilerTool" + /> + Culture="1033" + /> + Name="VCPreLinkEventTool" + /> + Name="VCLinkerTool" + AdditionalOptions="/MACHINE:I386" + AdditionalDependencies="user32.lib advapi32.lib shell32.lib comctl32.lib" + LinkIncremental="1" + SuppressStartupBanner="true" + GenerateManifest="false" + GenerateDebugInformation="true" + SubSystem="2" + /> + + + + + + + + + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="1" + > + + + + + + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> - - - - - + Name="VCManagedResourceCompilerTool" + /> + Culture="1033" + /> + Name="VCPreLinkEventTool" + /> + Name="VCLinkerTool" + AdditionalOptions="/MACHINE:I386" + AdditionalDependencies="user32.lib advapi32.lib shell32.lib comctl32.lib" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateManifest="false" + GenerateDebugInformation="true" + SubSystem="2" + /> + + + + + + + + + + + Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" + > + RelativePath=".\Defragment.cpp" + > + RelativePath=".\DriveVolume.cpp" + > + RelativePath=".\Fraginator.cpp" + > + RelativePath=".\MainDialog.cpp" + > + RelativePath=".\ReportDialog.cpp" + > + RelativePath="Unfrag.cpp" + > + Filter="h;hpp;hxx;hm;inl" + > + RelativePath=".\Defragment.h" + > + RelativePath=".\DriveVolume.h" + > + RelativePath=".\Fraginator.h" + > + RelativePath=".\MainDialog.h" + > + RelativePath=".\Mutex.h" + > + RelativePath=".\ReportDialog.h" + > + RelativePath=".\resource.h" + > + RelativePath=".\Unfrag.h" + > + Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" + > + RelativePath=".\default1.bin" + > + RelativePath=".\Fraginator Help - Fraginator Icon.bmp" + > + RelativePath=".\Fraginator Motif Icon.bmp" + > + RelativePath=".\Fraginator.rc" + > + RelativePath=".\icon1.ico" + > diff --git a/rosapps/fraginator/MainDialog.cpp b/rosapps/fraginator/MainDialog.cpp index 51dc8724b95..efb3578a857 100644 --- a/rosapps/fraginator/MainDialog.cpp +++ b/rosapps/fraginator/MainDialog.cpp @@ -6,7 +6,7 @@ #include "ReportDialog.h" -vector DrivesList; +vector DrivesList; LRESULT AnalyzeID; LRESULT FastID; LRESULT ExtensiveID; @@ -24,8 +24,8 @@ LRESULT PriIdleID; void InitDialog (HWND Dlg); void UpdateDefragInfo (HWND Dlg); void UpdatePriority (HWND Dlg); -string GetDefaultTitle (void); -string GetDefragTitle (void); +wstring GetDefaultTitle (void); +wstring GetDefragTitle (void); void SetDisables (HWND Dlg); INT_PTR CALLBACK MainDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LParam); @@ -38,7 +38,7 @@ static void InitDialog (HWND Dlg) int d; // Clear out wisecracks line for now - SetDlgItemText (Dlg, IDC_WISECRACKS, "\"Defrag, baby!\""); + SetDlgItemText (Dlg, IDC_WISECRACKS, L"\"Defrag, baby!\""); // Make list of logical drives DrivesList.resize (0); @@ -48,10 +48,10 @@ static void InitDialog (HWND Dlg) { if (DriveMask & (1 << d)) { - string Name; + wstring Name; - Name = (char)('A' + d); - Name += ':'; + Name = (wchar_t)(L'A' + d); + Name += L':'; DrivesList.push_back (Name); } } @@ -67,23 +67,23 @@ static void InitDialog (HWND Dlg) // Put in defrag methods DlgItem = GetDlgItem (Dlg, IDC_METHODS_LIST); SendMessage (DlgItem, CB_RESETCONTENT, 0, 0); - AnalyzeID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) "Analyze Only"); - FastID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) "Fast Defrag"); - ExtensiveID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) "Extensive Defrag"); + AnalyzeID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) L"Analyze Only"); + FastID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) L"Fast Defrag"); + ExtensiveID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) L"Extensive Defrag"); // Set up process priorities DlgItem = GetDlgItem (Dlg, IDC_PRIORITY_LIST); SendMessage (Dlg, CB_RESETCONTENT, 0, 0); - PriHighID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) "High"); - PriAboveNormID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) "Above Normal"); - PriNormalID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) "Normal"); - PriBelowNormID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) "Below Normal"); - PriIdleID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) "Idle"); + PriHighID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) L"High"); + PriAboveNormID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) L"Above Normal"); + PriNormalID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) L"Normal"); + PriBelowNormID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) L"Below Normal"); + PriIdleID = SendMessage (DlgItem, CB_ADDSTRING, 0, (LPARAM) L"Idle"); UpdatePriority (Dlg); // Reset texts and progress meters - SendDlgItemMessage (Dlg, IDC_STATUS, WM_SETTEXT, 0, (LPARAM) ""); - SendDlgItemMessage (Dlg, IDC_PERCENT, WM_SETTEXT, 0, (LPARAM) ""); + SendDlgItemMessage (Dlg, IDC_STATUS, WM_SETTEXT, 0, (LPARAM) L""); + SendDlgItemMessage (Dlg, IDC_PERCENT, WM_SETTEXT, 0, (LPARAM) L""); SendDlgItemMessage (Dlg, IDC_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM (0, 10000)); SendDlgItemMessage (Dlg, IDC_PROGRESS, PBM_SETPOS, 0, 0); @@ -93,10 +93,10 @@ static void InitDialog (HWND Dlg) void UpdateDefragInfo (HWND Dlg) { - char PercentText[100]; + wchar_t PercentText[100]; static double OldPercent = 200.0f; - static string OldStatus = "Non"; - string NewStatus; + static wstring OldStatus = L"Non"; + wstring NewStatus; double NewPercent; if (Defrag == NULL) @@ -109,7 +109,7 @@ void UpdateDefragInfo (HWND Dlg) NewPercent = 0.0f; if (NewPercent != OldPercent) { - sprintf (PercentText, "%6.2f%%", NewPercent); + swprintf (PercentText, L"%6.2f%%", NewPercent); SendDlgItemMessage (Dlg, IDC_PERCENT, WM_SETTEXT, 0, (LPARAM) PercentText); SendDlgItemMessage (Dlg, IDC_PROGRESS, PBM_SETPOS, (WPARAM) (int)(NewPercent * 100.0f), 0); @@ -119,16 +119,16 @@ void UpdateDefragInfo (HWND Dlg) NewStatus = Defrag->GetStatusString (); if (NewStatus != OldStatus) { // Change & characters to && to avoid underlining - string Status; - string::iterator it; + wstring Status; + wstring::iterator it; Status = NewStatus; it = Status.begin (); while (it < Status.end()) { - if (*it == '&') + if (*it == L'&') { - Status.insert (it, 1, '&'); + Status.insert (it, 1, L'&'); it++; } @@ -145,29 +145,29 @@ void UpdateDefragInfo (HWND Dlg) } -string GetDefaultTitle (void) +wstring GetDefaultTitle (void) { - string DefaultText; + wstring DefaultText; - DefaultText = string(string(APPNAME_GUI) + string(" v") + string(APPVER_STR) + - string(" (C) 2000 by Rick Brewster")); + DefaultText = wstring(wstring(APPNAME_GUI) + wstring(L" v") + wstring(APPVER_STR) + + wstring(L" (C) 2000 by Rick Brewster")); return (DefaultText); } -string GetDefragTitle (void) +wstring GetDefragTitle (void) { - string DefragText; - char Percent[10]; + wstring DefragText; + wchar_t Percent[10]; - sprintf (Percent, "%.2f%%", Defrag->GetStatusPercent()); + swprintf (Percent, L"%.2f%%", Defrag->GetStatusPercent()); DefragText = GetDefaultTitle (); if (Defrag != NULL) { - DefragText = string(Percent) + string (" - ") + Defrag->GetVolume().GetRootPath() + - string (" - ") + DefragText; + DefragText = wstring(Percent) + wstring (L" - ") + Defrag->GetVolume().GetRootPath() + + wstring (L" - ") + DefragText; } return (DefragText); @@ -176,17 +176,17 @@ string GetDefragTitle (void) void SetDisables (HWND Dlg) { - // If a defrag is in process, set 'Start' button to say 'Stop' and disable + // If a defrag is in process, set L'Start' button to say L'Stop' and disable // the Select Drive and Select Action controls if (Defrag != NULL && !Defrag->IsDoneYet() && !Defrag->HasError()) { - SendMessage (GetDlgItem (Dlg, IDC_STARTSTOP), WM_SETTEXT, 0, (LPARAM) "Stop"); + SendMessage (GetDlgItem (Dlg, IDC_STARTSTOP), WM_SETTEXT, 0, (LPARAM) L"Stop"); EnableWindow (GetDlgItem (Dlg, IDC_DRIVES_LIST), FALSE); EnableWindow (GetDlgItem (Dlg, IDC_METHODS_LIST), FALSE); } else { - SendMessage (GetDlgItem (Dlg, IDC_STARTSTOP), WM_SETTEXT, 0, (LPARAM) "Start"); + SendMessage (GetDlgItem (Dlg, IDC_STARTSTOP), WM_SETTEXT, 0, (LPARAM) L"Start"); EnableWindow (GetDlgItem (Dlg, IDC_STARTSTOP), TRUE); EnableWindow (GetDlgItem (Dlg, IDC_QUIT), TRUE); EnableWindow (GetDlgItem (Dlg, IDC_DRIVES_LIST), TRUE); @@ -235,7 +235,7 @@ bool GetRegKeys (HKEY *RegKeyResult) Error = RegCreateKeyEx ( HKEY_CURRENT_USER, - "Software\\Fraginator", + L"Software\\Fraginator", 0, NULL, REG_OPTION_NON_VOLATILE, @@ -303,7 +303,7 @@ void SaveSettings (HWND Dlg) RegSetValueEx ( RegKey, - "Default Action", + L"Default Action", 0, REG_DWORD, (CONST BYTE *)&DefragVal, @@ -313,7 +313,7 @@ void SaveSettings (HWND Dlg) RegSetValueEx ( RegKey, - "Process Priority", + L"Process Priority", 0, REG_DWORD, (CONST BYTE *)&PriVal, @@ -346,7 +346,7 @@ void LoadSettings (HWND Dlg) Error = RegQueryValueEx ( RegKey, - "Default Action", + L"Default Action", 0, &RegType, (BYTE *)&DTypeVal, @@ -359,7 +359,7 @@ void LoadSettings (HWND Dlg) Error = RegQueryValueEx ( RegKey, - "Process Priority", + L"Process Priority", 0, &RegType, (BYTE *)&PriVal, @@ -419,7 +419,7 @@ void LoadSettings (HWND Dlg) #define IDLETIME 25 -string OldWindowText = ""; +wstring OldWindowText = L""; INT_PTR CALLBACK MainDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LParam) { @@ -443,7 +443,7 @@ INT_PTR CALLBACK MainDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LPara case WM_TIMER: if (Defrag != NULL && !ReEntrance) { - string NewTitle; + wstring NewTitle; SendMessage (Dlg, WM_UPDATEINFO, 0, 0); @@ -503,7 +503,7 @@ INT_PTR CALLBACK MainDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LPara case ID_MAIN_HELP: - ShellExecute (Dlg, "open", "Fraginator.chm", "", ".", SW_SHOW); + ShellExecute (Dlg, L"open", L"Fraginator.chm", L"", L".", SW_SHOW); return (1); @@ -524,8 +524,8 @@ INT_PTR CALLBACK MainDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LPara case IDC_STARTSTOP: if (Defrag == NULL) - { // "Start" - char Drive[10]; + { // L"Start" + wchar_t Drive[10]; LRESULT ID; DefragType Method; HANDLE H; @@ -536,7 +536,7 @@ INT_PTR CALLBACK MainDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LPara SendMessage (GetDlgItem (Dlg, IDC_DRIVES_LIST), WM_GETTEXT, sizeof (Drive) - 1, (LPARAM) Drive); - if (strlen(Drive) != 2 || Drive[1] != ':') + if (wcslen(Drive) != 2 || Drive[1] != L':') return (1); ID = SendMessage (GetDlgItem (Dlg, IDC_METHODS_LIST), CB_GETCURSEL, 0, 0); @@ -559,7 +559,7 @@ INT_PTR CALLBACK MainDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LPara } } else - { // "Stop" + { // L"Stop" Stopping = true; Defrag->Stop (); EnableWindow (GetDlgItem (Dlg, IDC_STARTSTOP), FALSE); diff --git a/rosapps/fraginator/ReportDialog.cpp b/rosapps/fraginator/ReportDialog.cpp index 4ddad62847a..157325bbf7f 100644 --- a/rosapps/fraginator/ReportDialog.cpp +++ b/rosapps/fraginator/ReportDialog.cpp @@ -6,11 +6,11 @@ #include "resource.h" -void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, char *BytesUnits, bool Fractional) +void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, wchar_t *BytesUnits, bool Fractional) { - char Text[1000]; - char Text2[1000]; - char Text3[1000]; + wchar_t Text[1000]; + wchar_t Text2[1000]; + wchar_t Text3[1000]; memset (Text, 0, sizeof (Text)); @@ -29,14 +29,14 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, char *B // DiskSizeBytes if (Fractional) { - sprintf (Text, "%.2f %s", (double)(signed)(Report.DiskSizeBytes / + swprintf (Text, L"%.2f %s", (double)(signed)(Report.DiskSizeBytes / (BytesDivisor / 1024)) / 1024.0, BytesUnits); } else { AddCommas (Text, Report.DiskSizeBytes / BytesDivisor); - strcat (Text, " "); - strcat (Text, BytesUnits); + wcscat (Text, L" "); + wcscat (Text, BytesUnits); } SetDlgItemText (Dlg, IDC_DISKSIZEBYTES, Text); @@ -44,24 +44,24 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, char *B // DiskFreeBytes if (Fractional) { - sprintf (Text, "%.2f %s", (double)(signed)(Defrag->GetVolume().GetVolumeInfo().FreeBytes / + swprintf (Text, L"%.2f %s", (double)(signed)(Defrag->GetVolume().GetVolumeInfo().FreeBytes / (BytesDivisor / 1024)) / 1024.0, BytesUnits); } else { AddCommas (Text, Defrag->GetVolume().GetVolumeInfo().FreeBytes / BytesDivisor); - strcat (Text, " "); - strcat (Text, BytesUnits); + wcscat (Text, L" "); + wcscat (Text, BytesUnits); } SetDlgItemText (Dlg, IDC_DISKFREEBYTES, Text); // DiskSizeClusters AddCommas (Text, Defrag->GetVolume().GetVolumeInfo().ClusterCount); - strcat (Text, " clusters"); + wcscat (Text, L" clusters"); SetDlgItemText (Dlg, IDC_DISKSIZECLUSTERS, Text); // DiskClusterSize - sprintf (Text, "%u bytes", Defrag->GetVolume().GetVolumeInfo().ClusterSize); + swprintf (Text, L"%u bytes", Defrag->GetVolume().GetVolumeInfo().ClusterSize); SetDlgItemText (Dlg, IDC_DISKCLUSTERSIZE, Text); // DirsCount @@ -73,40 +73,40 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, char *B SetDlgItemText (Dlg, IDC_FILESCOUNT, Text); // FilesFragged - sprintf (Text, "(%.2f%%)", Report.PercentFragged); + swprintf (Text, L"(%.2f%%)", Report.PercentFragged); AddCommas (Text2, Report.FraggedFiles.size()); - sprintf (Text3, "%s %s", Text, Text2); + swprintf (Text3, L"%s %s", Text, Text2); SetDlgItemText (Dlg, IDC_FILESFRAGGED, Text3); // Average Frags - sprintf (Text, "%.2f", Report.AverageFragments); + swprintf (Text, L"%.2f", Report.AverageFragments); SetDlgItemText (Dlg, IDC_AVERAGEFRAGS, Text); // FilesSizeBytes if (Fractional) { - sprintf (Text, "%.2f %s", (double)(signed)(Report.FilesSizeBytes / + swprintf (Text, L"%.2f %s", (double)(signed)(Report.FilesSizeBytes / (BytesDivisor / 1024)) / 1024.0, BytesUnits); } else { AddCommas (Text, Report.FilesSizeBytes / (uint64)BytesDivisor); - strcat (Text, " "); - strcat (Text, BytesUnits); + wcscat (Text, L" "); + wcscat (Text, BytesUnits); } SetDlgItemText (Dlg, IDC_FILESSIZEBYTES, Text); // Files SizeOnDisk if (Fractional) { - sprintf (Text, "%.2f %s", (double)(signed)((Report.FilesSizeBytes + Report.FilesSlackBytes) / + swprintf (Text, L"%.2f %s", (double)(signed)((Report.FilesSizeBytes + Report.FilesSlackBytes) / (BytesDivisor / 1024)) / 1024.0, BytesUnits); } else { AddCommas (Text, (Report.FilesSizeBytes + Report.FilesSlackBytes) / (uint64)BytesDivisor); - strcat (Text, " "); - strcat (Text, BytesUnits); + wcscat (Text, L" "); + wcscat (Text, BytesUnits); } SetDlgItemText (Dlg, IDC_FILESSIZEONDISK, Text); @@ -114,17 +114,17 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, char *B // FilesSlackBytes if (Fractional) { - sprintf (Text, "%.2f %s", (double)(signed)(Report.FilesSlackBytes / + swprintf (Text, L"%.2f %s", (double)(signed)(Report.FilesSlackBytes / (BytesDivisor / 1024)) / 1024.0, BytesUnits); } else { AddCommas (Text, Report.FilesSlackBytes / BytesDivisor); - strcat (Text, " "); - strcat (Text, BytesUnits); + wcscat (Text, L" "); + wcscat (Text, BytesUnits); } - sprintf (Text2, "(%.2f%%)", Report.PercentSlack); - sprintf (Text3, "%s %s", Text2, Text); + swprintf (Text2, L"(%.2f%%)", Report.PercentSlack); + swprintf (Text3, L"%s %s", Text2, Text); SetDlgItemText (Dlg, IDC_FILESSLACKBYTES, Text3); // Recommendation @@ -137,55 +137,55 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, char *B if (Report.AverageFragments >= 1.1f) AFRec = true; - strcpy (Text, "* "); + wcscpy (Text, L"* "); if (PFRec) { - sprintf + swprintf ( Text2, - "%.2f%% of the files on this volume are fragmented. ", + L"%.2f%% of the files on this volume are fragmented. ", Report.PercentFragged ); - strcat (Text, Text2); + wcscat (Text, Text2); } if (AFRec) { - sprintf + swprintf ( Text2, - "The average fragments per file (%.2f) indicates a high degree of fragmentation. ", + L"The average fragments per file (%.2f) indicates a high degree of fragmentation. ", Report.AverageFragments ); - strcat (Text, Text2); + wcscat (Text, Text2); } if (Report.PercentFragged < 5.0f && Report.AverageFragments < 1.1f) - sprintf (Text, "* No defragmentation is necessary at this point."); + swprintf (Text, L"* No defragmentation is necessary at this point."); else if (Report.PercentFragged < 15.0f && Report.AverageFragments < 1.3f) - strcat (Text, "It is recommended that you perform a Fast Defrag."); + wcscat (Text, L"It is recommended that you perform a Fast Defrag."); else - strcat (Text, "It is recommended that you perform an Extensive Defrag."); + wcscat (Text, L"It is recommended that you perform an Extensive Defrag."); // Should we recommend a smaller cluster size? if (Report.PercentSlack >= 10.0f) { - sprintf + swprintf ( Text2, - "\n* A large amount of disk space (%.2f%%) is being lost " - "due to a large (%u bytes) cluster size. It is recommended " - "that you use a disk utility such as Partition Magic to " - "reduce the cluster size of this volume.", + L"\n* A large amount of disk space (%.2f%%) is being lost " + L"due to a large (%u bytes) cluster size. It is recommended " + L"that you use a disk utility such as Partition Magic to " + L"reduce the cluster size of this volume.", Report.PercentSlack, Defrag->GetVolume().GetVolumeInfo().ClusterSize ); - strcat (Text, Text2); + wcscat (Text, Text2); } SetDlgItemText (Dlg, IDC_RECOMMEND, Text); @@ -199,7 +199,7 @@ INT_PTR CALLBACK ReportDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LPa switch (Msg) { case WM_INITDIALOG: - SetReportInfo (Dlg, Defrag->GetDefragReport (), 1, "bytes", false); + SetReportInfo (Dlg, Defrag->GetDefragReport (), 1, L"bytes", false); return (1); case WM_COMMAND: @@ -210,19 +210,19 @@ INT_PTR CALLBACK ReportDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LPa return (1); case IDC_GIGABYTES: - SetReportInfo (Dlg, Defrag->GetDefragReport (), 1024*1024*1024, "GB", true); + SetReportInfo (Dlg, Defrag->GetDefragReport (), 1024*1024*1024, L"GB", true); return (1); case IDC_MEGABYTES: - SetReportInfo (Dlg, Defrag->GetDefragReport (), 1024*1024, "MB", false); + SetReportInfo (Dlg, Defrag->GetDefragReport (), 1024*1024, L"MB", false); return (1); case IDC_KILOBYTES: - SetReportInfo (Dlg, Defrag->GetDefragReport (), 1024, "KB", false); + SetReportInfo (Dlg, Defrag->GetDefragReport (), 1024, L"KB", false); return (1); case IDC_BYTES: - SetReportInfo (Dlg, Defrag->GetDefragReport (), 1, "bytes", false); + SetReportInfo (Dlg, Defrag->GetDefragReport (), 1, L"bytes", false); return (1); } } diff --git a/rosapps/fraginator/Unfrag.cpp b/rosapps/fraginator/Unfrag.cpp index 23477fd9ce7..dcf9bf407db 100644 --- a/rosapps/fraginator/Unfrag.cpp +++ b/rosapps/fraginator/Unfrag.cpp @@ -27,7 +27,7 @@ bool CheckWinVer (void) // Need Windows 2000! // Check for NT first - // Actually what we do is check that we're not on Win31+Win32s and that we're + // Actually what we do is check that weLL're not on Win31+Win32s and that we're // not in Windows 9x. It's possible that there could be more Windows "platforms" // in the future and there's no sense in claiming incompatibility. if (OSVersion.dwPlatformId == VER_PLATFORM_WIN32s || @@ -36,7 +36,7 @@ bool CheckWinVer (void) return (false); } - // Ok we're in Windows NT, now make sure we're in 2000 + // Ok weLL're in Windows NT, now make sure we're in 2000 if (OSVersion.dwMajorVersion < 5) return (false); @@ -45,27 +45,27 @@ bool CheckWinVer (void) } -char *AddCommas (char *Result, uint64 Number) +wchar_t *AddCommas (wchar_t *Result, uint64 Number) { - char Temp[128]; + wchar_t Temp[128]; int TempLen; - char *p = NULL; + wchar_t *p = NULL; int AddCommas = 0; - char *StrPosResult = NULL; - char *StrPosOrig = NULL; + wchar_t *StrPosResult = NULL; + wchar_t *StrPosOrig = NULL; // we get the string form of the number, then we count down w/ AddCommas // while copying the string from Temp1 to Result. when AddCommas % 3 == 1, // slap in a commas as well, before the #. - sprintf (Temp, "%I64u", Number); - AddCommas = TempLen = strlen (Temp); + swprintf (Temp, L"%I64u", Number); + AddCommas = TempLen = wcslen (Temp); StrPosOrig = Temp; StrPosResult = Result; while (AddCommas) { if ((AddCommas % 3) == 0 && AddCommas != TempLen) // avoid stuff like ",345" { - *StrPosResult = ','; + *StrPosResult = L','; StrPosResult++; } @@ -84,9 +84,9 @@ char *AddCommas (char *Result, uint64 Number) void PrintBanner (void) { - printf ("%s v%s\n", APPNAME_CLI, APPVER_STR); - printf ("%s\n", APPCOPYRIGHT); - printf ("\n"); + wprintf (L"%s v%s\n", APPNAME_CLI, APPVER_STR); + wprintf (L"%s\n", APPCOPYRIGHT); + wprintf (L"\n"); return; } @@ -94,23 +94,23 @@ void PrintBanner (void) void FraggerHelp (void) { - printf ("Usage: unfrag drive: [...] <-f | -e>\n"); - printf ("\n"); - printf ("drive: : The drive to defrag. Should be two characters long, ie 'c:' or 'd:'.\n"); - printf (" Multiple drives may be given, and all will be simultaneously\n"); - printf (" defragmented using the same options.\n"); - printf ("-f : Do a fast defragmentation. Files that are not fragmented will not be\n"); - printf (" moved. Only one pass is made over the file list. Using this option\n"); - printf (" may result in not all files being defragmented, depending on\n"); - printf (" available disk space.\n"); - printf ("-e : Do an extensive defragmention. Files will be moved in an attempt to\n"); - printf (" defragment both files and free space.\n"); + wprintf (L"Usage: unfrag drive: [...] <-f | -e>\n"); + wprintf (L"\n"); + wprintf (L"drive: : The drive to defrag. Should be two characters long, ie 'c:' or 'd:'.\n"); + wprintf (L" Multiple drives may be given, and all will be simultaneously\n"); + wprintf (L" defragmented using the same options.\n"); + wprintf (L"-f : Do a fast defragmentation. Files that are not fragmented will not be\n"); + wprintf (L" moved. Only one pass is made over the file list. Using this option\n"); + wprintf (L" may result in not all files being defragmented, depending on\n"); + wprintf (L" available disk space.\n"); + wprintf (L"-e : Do an extensive defragmention. Files will be moved in an attempt to\n"); + wprintf (L" defragment both files and free space.\n"); if (!CheckWinVer()) { - printf ("\n"); - printf ("NOTE: This program requires Windows 2000, which is not presently running on\n"); - printf ("this system.\n"); + wprintf (L"\n"); + wprintf (L"NOTE: This program requires Windows 2000, which is not presently running on\n"); + wprintf (L"this system.\n"); } return; @@ -129,7 +129,7 @@ void __cdecl DefragThread (LPVOID parm) } -Defragment *StartDefragThread (string Drive, DefragType Method, HANDLE &Handle) +Defragment *StartDefragThread (wstring Drive, DefragType Method, HANDLE &Handle) { Defragment *Defragger; unsigned long Thread; @@ -143,12 +143,11 @@ Defragment *StartDefragThread (string Drive, DefragType Method, HANDLE &Handle) // Main Initialization -int __cdecl main (int argc, char **argv) +int wmain (int argc, wchar_t **argv) { - vector Drives; + vector Drives; vector Defrags; DefragType DefragMode = DefragInvalid; - int d; PrintBanner (); @@ -156,21 +155,21 @@ int __cdecl main (int argc, char **argv) bool ValidCmdLine = false; for (int c = 0; c < argc; c++) { - if (strlen(argv[c]) == 2 && argv[c][1] == ':') + if (wcslen(argv[c]) == 2 && argv[c][1] == L':') { - Drives.push_back (strupr(argv[c])); + Drives.push_back (wcsupr(argv[c])); } else - if (argv[c][0] == '-' || argv[c][0] == '/' && strlen(argv[c]) == 2) + if (argv[c][0] == L'-' || argv[c][0] == L'/' && wcslen(argv[c]) == 2) { switch (tolower(argv[c][1])) { - case '?' : - case 'h' : + case L'?' : + case L'h' : FraggerHelp (); return (0); - case 'f' : + case L'f' : if (DefragMode != DefragInvalid) { ValidCmdLine = false; @@ -180,7 +179,7 @@ int __cdecl main (int argc, char **argv) ValidCmdLine = true; break; - case 'e' : + case L'e' : if (DefragMode != DefragInvalid) { ValidCmdLine = false; @@ -199,25 +198,25 @@ int __cdecl main (int argc, char **argv) if (!ValidCmdLine) { - printf ("Invalid command-line options. Use '%s -?' for help.\n", argv[0]); + wprintf (L"Invalid command-line options. Use '%s -?' for help.\n", argv[0]); return (0); } // Check OS requirements if (!CheckWinVer()) { - printf ("Fatal Error: This program requires Windows 2000.\n"); + wprintf (L"Fatal Error: This program requires Windows 2000.\n"); return (0); } - for (d = 0; d < Drives.size (); d++) + for (size_t d = 0; d < Drives.size (); d++) { HANDLE TossMe; Defrags.push_back (StartDefragThread (Drives[d], DefragMode, TossMe)); } - for (d = 0; d < Drives.size () - 1; d++) - printf ("\n "); + for (size_t d = 0; d < Drives.size () - 1; d++) + wprintf (L"\n "); bool Continue = true; HANDLE Screen; @@ -237,14 +236,14 @@ int __cdecl main (int argc, char **argv) ScreenInfo.dwCursorPosition.Y -= Drives.size(); SetConsoleCursorPosition (Screen, ScreenInfo.dwCursorPosition); - for (d = 0; d < Drives.size (); d++) + for (size_t d = 0; d < Drives.size (); d++) { - printf ("\n%6.2f%% %-70s", Defrags[d]->GetStatusPercent(), Defrags[d]->GetStatusString().c_str()); + wprintf (L"\n%6.2f%% %-70s", Defrags[d]->GetStatusPercent(), Defrags[d]->GetStatusString().c_str()); } // Determine if we should keep going Continue = false; - for (d = 0; d < Drives.size (); d++) + for (size_t d = 0; d < Drives.size (); d++) { if (!Defrags[d]->IsDoneYet() && !Defrags[d]->HasError()) Continue = true; @@ -260,43 +259,43 @@ int __cdecl main (int argc, char **argv) Drive = new DriveVolume; // First thing: build a file list. - printf ("Opening volume %s ...", Drives[d].c_str()); + wprintf (L"Opening volume %s ...", Drives[d].c_str()); if (!Drive->Open (Drives[d])) { - printf ("FAILED\n\n"); + wprintf (L"FAILED\n\n"); delete Drive; continue; } - printf ("\n"); + wprintf (L"\n"); - printf (" Getting drive bitmap ..."); + wprintf (L" Getting drive bitmap ..."); if (!Drive->GetBitmap ()) { - printf ("FAILED\n\n"); + wprintf (L"FAILED\n\n"); delete Drive; continue; } - printf ("\n"); + wprintf (L"\n"); - printf (" Obtaining drive geometry ..."); + wprintf (L" Obtaining drive geometry ..."); if (!Drive->ObtainInfo ()) { - printf ("FAILED\n\n"); + wprintf (L"FAILED\n\n"); delete Drive; continue; } - printf ("\n"); + wprintf (L"\n"); - printf (" Building file database for drive %s ...", Drives[d].c_str()); + wprintf (L" Building file database for drive %s ...", Drives[d].c_str()); if (!Drive->BuildFileList ()) { - printf ("FAILED\n\n"); + wprintf (L"FAILED\n\n"); delete Drive; continue; } - printf ("\n"); + wprintf (L"\n"); - printf (" %u files\n", Drive->GetDBFileCount ()); + wprintf (L" %u files\n", Drive->GetDBFileCount ()); // Analyze only? if (DefragMode == DefragAnalyze) @@ -306,9 +305,9 @@ int __cdecl main (int argc, char **argv) uint64 SlackBytes = 0; // wasted space due to slack uint32 Fragged = 0; // fragmented files - printf (" Analyzing ..."); + wprintf (L" Analyzing ..."); if (VerboseMode) - printf ("\n"); + wprintf (L"\n"); for (int i = 0; i < Drive->GetDBFileCount(); i++) { @@ -328,16 +327,16 @@ int __cdecl main (int argc, char **argv) if (VerboseMode) { - printf (" %s%s, ", Drive->GetDBDir (Info.DirIndice).c_str(), Info.Name.c_str()); + wprintf (L" %s%s, ", Drive->GetDBDir (Info.DirIndice).c_str(), Info.Name.c_str()); if (Info.Attributes.AccessDenied) - printf ("access was denied\n"); + wprintf (L"access was denied\n"); else { if (Info.Attributes.Unmovable == 1) - printf ("unmovable, "); + wprintf (L"unmovable, "); - printf ("%I64u bytes, %I64u bytes on disk, %I64u bytes slack, %u fragments\n", + wprintf (L"%I64u bytes, %I64u bytes on disk, %I64u bytes slack, %u fragments\n", Info.Size, Used, Slack, Info.Fragments.size()); } } @@ -347,23 +346,23 @@ int __cdecl main (int argc, char **argv) } if (!VerboseMode) - printf ("\n"); + wprintf (L"\n"); // TODO: Make it not look like ass - printf ("\n"); - printf (" Overall Analysis\n"); - printf (" ----------------\n"); - printf (" %u clusters\n", Drive->GetClusterCount ()); - printf (" %u bytes per cluster\n", Drive->GetClusterSize()); - printf (" %I64u total bytes on drive\n", (uint64)Drive->GetClusterCount() * (uint64)Drive->GetClusterSize()); - printf ("\n"); - printf (" %u files\n", Drive->GetDBFileCount ()); - printf (" %u contiguous files\n", Drive->GetDBFileCount () - Fragged); - printf (" %u fragmented files\n", Fragged); - printf ("\n"); - printf (" %I64u bytes\n", TotalBytes); - printf (" %I64u bytes on disk\n", UsedBytes); - printf (" %I64u bytes slack\n", SlackBytes); + wprintf (L"\n"); + wprintf (L" Overall Analysis\n"); + wprintf (L" ----------------\n"); + wprintf (L" %u clusters\n", Drive->GetClusterCount ()); + wprintf (L" %u bytes per cluster\n", Drive->GetClusterSize()); + wprintf (L" %I64u total bytes on drive\n", (uint64)Drive->GetClusterCount() * (uint64)Drive->GetClusterSize()); + wprintf (L"\n"); + wprintf (L" %u files\n", Drive->GetDBFileCount ()); + wprintf (L" %u contiguous files\n", Drive->GetDBFileCount () - Fragged); + wprintf (L" %u fragmented files\n", Fragged); + wprintf (L"\n"); + wprintf (L" %I64u bytes\n", TotalBytes); + wprintf (L" %I64u bytes on disk\n", UsedBytes); + wprintf (L" %I64u bytes slack\n", SlackBytes); } // Fast defragment! @@ -371,14 +370,14 @@ int __cdecl main (int argc, char **argv) { uint32 i; uint64 FirstFreeLCN; - char PrintName[80]; + wchar_t PrintName[80]; int Width = 66; if (DefragMode == DefragFast) - printf (" Performing fast file defragmentation ...\n"); + wprintf (L" Performing fast file defragmentation ...\n"); else if (DefragMode == DefragExtensive) - printf (" Performing extensive file defragmentation\n"); + wprintf (L" Performing extensive file defragmentation\n"); // Find first free LCN for speedier searches ... Drive->FindFreeRange (0, 1, FirstFreeLCN); @@ -389,12 +388,12 @@ int __cdecl main (int argc, char **argv) bool Result; uint64 TargetLCN; - printf ("\r"); + wprintf (L"\r"); Info = Drive->GetDBFile (i); FitName (PrintName, Drive->GetDBDir (Info.DirIndice).c_str(), Info.Name.c_str(), Width); - printf (" %6.2f%% %-66s", (float)i / (float)Drive->GetDBFileCount() * 100.0f, PrintName); + wprintf (L" %6.2f%% %-66s", (float)i / (float)Drive->GetDBFileCount() * 100.0f, PrintName); // Can't defrag 0 byte files :) if (Info.Fragments.size() == 0) @@ -446,17 +445,17 @@ int __cdecl main (int argc, char **argv) } if (!Success) - printf ("\n -> failed\n"); + wprintf (L"\n -> failed\n"); Drive->FindFreeRange (0, 1, FirstFreeLCN); } } - printf ("\n"); + wprintf (L"\n"); } - printf ("Closing volume %s ...", Drives[d].c_str()); + wprintf (L"Closing volume %s ...", Drives[d].c_str()); delete Drive; - printf ("\n"); + wprintf (L"\n"); } #endif diff --git a/rosapps/fraginator/Unfrag.h b/rosapps/fraginator/Unfrag.h index 877d7cc39a8..47e9a75603d 100644 --- a/rosapps/fraginator/Unfrag.h +++ b/rosapps/fraginator/Unfrag.h @@ -32,12 +32,12 @@ #include -#define APPNAME_CLI "Unfrag" -#define APPNAME_GUI "Fraginator" -#define APPVER_STR "1.03" +#define APPNAME_CLI L"Unfrag" +#define APPNAME_GUI L"Fraginator" +#define APPVER_STR L"1.03" #define APPVER_NUM 1.03f -#define APPAUTHOR "Rick Brewster" -#define APPCOPYRIGHT "Copyright 2000-2002 Rick Brewster" +#define APPAUTHOR L"Rick Brewster" +#define APPCOPYRIGHT L"Copyright 2000-2002 Rick Brewster" #include @@ -73,10 +73,10 @@ extern bool CheckWinVer (void); class Defragment; -extern Defragment *StartDefragThread (string Drive, DefragType Method, HANDLE &Handle); +extern Defragment *StartDefragThread (wstring Drive, DefragType Method, HANDLE &Handle); -extern char *AddCommas (char *Result, uint64 Number); +extern wchar_t *AddCommas (wchar_t *Result, uint64 Number); #endif // UNFRAG_H diff --git a/rosapps/fraginator/default1.bin b/rosapps/fraginator/default1.bin index 5d598c0a91d..32ad2f1bf3d 100644 --- a/rosapps/fraginator/default1.bin +++ b/rosapps/fraginator/default1.bin @@ -1,4 +1,4 @@ - + diff --git a/rosapps/fraginator/unfrag.exe b/rosapps/fraginator/unfrag.exe deleted file mode 100644 index bcb1aef99a0..00000000000 Binary files a/rosapps/fraginator/unfrag.exe and /dev/null differ diff --git a/rosapps/fraginator/unfrag.mak b/rosapps/fraginator/unfrag.mak deleted file mode 100644 index 838fc089b9f..00000000000 --- a/rosapps/fraginator/unfrag.mak +++ /dev/null @@ -1,184 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on unfrag.dsp -!IF "$(CFG)" == "" -CFG=unfrag - Win32 Debug -!MESSAGE No configuration specified. Defaulting to unfrag - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "unfrag - Win32 Release" && "$(CFG)" != "unfrag - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "unfrag.mak" CFG="unfrag - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "unfrag - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "unfrag - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -CPP=xicl6.exe -RSC=rc.exe - -!IF "$(CFG)" == "unfrag - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -ALL : "$(OUTDIR)\unfrag.exe" - - -CLEAN : - -@erase "$(INTDIR)\Defragment.obj" - -@erase "$(INTDIR)\DriveVolume.obj" - -@erase "$(INTDIR)\Unfrag.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(OUTDIR)\unfrag.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /G6 /Gr /MD /W3 /GX /Ox /Ot /Og /Oi /Ob2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\unfrag.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\unfrag.bsc" -BSC32_SBRS= \ - -LINK32=xilink6.exe -LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\unfrag.pdb" /machine:I386 /out:"$(OUTDIR)\unfrag.exe" -LINK32_OBJS= \ - "$(INTDIR)\Defragment.obj" \ - "$(INTDIR)\DriveVolume.obj" \ - "$(INTDIR)\Unfrag.obj" - -"$(OUTDIR)\unfrag.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -SOURCE="$(InputPath)" -PostBuild_Desc=Copying to Program Files ... -DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep - -ALL : $(DS_POSTBUILD_DEP) - -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -$(DS_POSTBUILD_DEP) : "$(OUTDIR)\unfrag.exe" - copy Release\unfrag.exe "c:\Program Files\Fraginator\unfrag.exe" - echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)" - -!ELSEIF "$(CFG)" == "unfrag - Win32 Debug" - -OUTDIR=.\unfrag___Win32_Debug -INTDIR=.\unfrag___Win32_Debug -# Begin Custom Macros -OutDir=.\unfrag___Win32_Debug -# End Custom Macros - -ALL : "$(OUTDIR)\unfrag.exe" - - -CLEAN : - -@erase "$(INTDIR)\Defragment.obj" - -@erase "$(INTDIR)\DriveVolume.obj" - -@erase "$(INTDIR)\Unfrag.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\unfrag.exe" - -@erase "$(OUTDIR)\unfrag.ilk" - -@erase "$(OUTDIR)\unfrag.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\unfrag.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\unfrag.bsc" -BSC32_SBRS= \ - -LINK32=xilink6.exe -LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\unfrag.pdb" /debug /machine:I386 /out:"$(OUTDIR)\unfrag.exe" /pdbtype:sept -LINK32_OBJS= \ - "$(INTDIR)\Defragment.obj" \ - "$(INTDIR)\DriveVolume.obj" \ - "$(INTDIR)\Unfrag.obj" - -"$(OUTDIR)\unfrag.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("unfrag.dep") -!INCLUDE "unfrag.dep" -!ELSE -!MESSAGE Warning: cannot find "unfrag.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "unfrag - Win32 Release" || "$(CFG)" == "unfrag - Win32 Debug" -SOURCE=.\Defragment.cpp - -"$(INTDIR)\Defragment.obj" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\DriveVolume.cpp - -"$(INTDIR)\DriveVolume.obj" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\Unfrag.cpp - -"$(INTDIR)\Unfrag.obj" : $(SOURCE) "$(INTDIR)" - - - -!ENDIF - diff --git a/rosapps/fraginator/unfrag.plg b/rosapps/fraginator/unfrag.plg deleted file mode 100644 index 5e0486eb640..00000000000 --- a/rosapps/fraginator/unfrag.plg +++ /dev/null @@ -1,48 +0,0 @@ - - -
-

Build Log

-

---------------------Configuration: unfrag - Win32 Release-------------------- -

-

Command Lines

-Creating temporary file "C:\TEMP\RSP9D8.tmp" with contents -[ -/nologo /G6 /Gr /MD /W3 /GX /Ox /Ot /Og /Oi /Ob2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fo"Release/" /Fd"Release/" /FD /c -"C:\src\Fraginator\Defragment.cpp" -"C:\src\Fraginator\DriveVolume.cpp" -"C:\src\Fraginator\Unfrag.cpp" -] -Creating command line "xicl6.exe @C:\TEMP\RSP9D8.tmp" -Creating temporary file "C:\TEMP\RSP9D9.tmp" with contents -[ -kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /pdb:"Release/unfrag.pdb" /machine:I386 /out:"Release/unfrag.exe" -.\Release\Defragment.obj -.\Release\DriveVolume.obj -.\Release\Unfrag.obj -] -Creating command line "xilink6.exe @C:\TEMP\RSP9D9.tmp" -

Output Window

-Compiling... -Defragment.cpp -DriveVolume.cpp -Unfrag.cpp -Generating Code... -Linking... -xilink6: executing 'C:\PROGRA~1\MIAF9D~1\VC98\Bin\link.exe' -Creating temporary file "C:\TEMP\RSP9DB.bat" with contents -[ -@echo off -copy Release\unfrag.exe "c:\Program Files\Fraginator\unfrag.exe" -] -Creating command line "C:\TEMP\RSP9DB.bat" -Copying to Program Files ... - 1 file(s) copied. - - - -

Results

-unfrag.exe - 0 error(s), 0 warning(s) -
- - diff --git a/rosapps/fraginator/unfrag.vcproj b/rosapps/fraginator/unfrag.vcproj index efb793fbf41..e8d9aebc79b 100644 --- a/rosapps/fraginator/unfrag.vcproj +++ b/rosapps/fraginator/unfrag.vcproj @@ -1,158 +1,233 @@ - + + ProjectGUID="{8E7E76C1-739B-46E5-99C2-A0504558164B}" + > + Name="Win32" + /> + + + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + + + + + + SuppressStartupBanner="true" + CallingConvention="1" + /> - - - - - + Name="VCManagedResourceCompilerTool" + /> + Culture="1033" + /> + Name="VCPreLinkEventTool" + /> + Name="VCLinkerTool" + AdditionalOptions="/MACHINE:I386" + LinkIncremental="1" + SuppressStartupBanner="true" + GenerateManifest="false" + GenerateDebugInformation="true" + SubSystem="1" + /> + + + + + + + + + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + + + + + + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> - - - - - + Name="VCManagedResourceCompilerTool" + /> + Culture="1033" + /> + Name="VCPreLinkEventTool" + /> + Name="VCLinkerTool" + AdditionalOptions="/MACHINE:I386" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateManifest="false" + GenerateDebugInformation="true" + SubSystem="1" + /> + + + + + + + + + + + Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" + > + RelativePath=".\Defragment.cpp" + > + RelativePath=".\DriveVolume.cpp" + > + RelativePath=".\Unfrag.cpp" + > + Filter="h;hpp;hxx;hm;inl" + > + RelativePath=".\Defragment.h" + > + RelativePath=".\DriveVolume.h" + > + RelativePath=".\Mutex.h" + > + RelativePath=".\Unfrag.h" + > + Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" + >