ReactOS 0.4.15-dev-8116-gf69e256
Unfrag.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <string>
#include <winioctl.h>
#include <vector>
Include dependency graph for Unfrag.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define APPNAME_CLI   L"Unfrag"
 
#define APPNAME_GUI   L"Fraginator"
 
#define APPVER_STR   L"1.03"
 
#define APPVER_NUM   1.03f
 
#define APPAUTHOR   L"Rick Brewster"
 
#define APPCOPYRIGHT   L"Copyright 2000-2002 Rick Brewster"
 

Typedefs

typedef unsigned __int8 uint8
 
typedef signed __int8 sint8
 
typedef unsigned __int16 uint16
 
typedef signed __int16 sint16
 
typedef unsigned __int32 uint32
 
typedef signed __int32 sint32
 
typedef unsigned __int64 uint64
 
typedef signed __int64 sint64
 
typedef unsigned char uchar
 

Enumerations

enum  DefragType { DefragInvalid , DefragFast , DefragExtensive , DefragAnalyze }
 

Functions

bool CheckWinVer (void)
 
DefragmentStartDefragThread (wstring Drive, DefragType Method, HANDLE &Handle)
 
wchar_tAddCommas (wchar_t *Result, uint64 Number)
 

Variables

bool QuietMode
 
bool VerboseMode
 

Macro Definition Documentation

◆ APPAUTHOR

#define APPAUTHOR   L"Rick Brewster"

Definition at line 42 of file Unfrag.h.

◆ APPCOPYRIGHT

#define APPCOPYRIGHT   L"Copyright 2000-2002 Rick Brewster"

Definition at line 43 of file Unfrag.h.

◆ APPNAME_CLI

#define APPNAME_CLI   L"Unfrag"

Definition at line 38 of file Unfrag.h.

◆ APPNAME_GUI

#define APPNAME_GUI   L"Fraginator"

Definition at line 39 of file Unfrag.h.

◆ APPVER_NUM

#define APPVER_NUM   1.03f

Definition at line 41 of file Unfrag.h.

◆ APPVER_STR

#define APPVER_STR   L"1.03"

Definition at line 40 of file Unfrag.h.

Typedef Documentation

◆ sint16

Definition at line 54 of file Unfrag.h.

◆ sint32

Definition at line 56 of file Unfrag.h.

◆ sint64

Definition at line 58 of file Unfrag.h.

◆ sint8

typedef signed __int8 sint8

Definition at line 52 of file Unfrag.h.

◆ uchar

typedef unsigned char uchar

Definition at line 59 of file Unfrag.h.

◆ uint16

Definition at line 53 of file Unfrag.h.

◆ uint32

Definition at line 55 of file Unfrag.h.

◆ uint64

Definition at line 57 of file Unfrag.h.

◆ uint8

Definition at line 51 of file Unfrag.h.

Enumeration Type Documentation

◆ DefragType

Enumerator
DefragInvalid 
DefragFast 
DefragExtensive 
DefragAnalyze 

Definition at line 66 of file Unfrag.h.

67{
DefragType
Definition: Unfrag.h:67
@ DefragExtensive
Definition: Unfrag.h:70
@ DefragAnalyze
Definition: Unfrag.h:71
@ DefragInvalid
Definition: Unfrag.h:68
@ DefragFast
Definition: Unfrag.h:69

Function Documentation

◆ AddCommas()

wchar_t * AddCommas ( wchar_t Result,
uint64  Number 
)

Definition at line 48 of file Unfrag.cpp.

49{
50 wchar_t Temp[128];
51 int TempLen;
52 //wchar_t *p = NULL;
53 int AddCommas = 0;
54 wchar_t *StrPosResult = NULL;
55 wchar_t *StrPosOrig = NULL;
56
57 // we get the string form of the number, then we count down w/ AddCommas
58 // while copying the string from Temp1 to Result. when AddCommas % 3 == 1,
59 // slap in a commas as well, before the #.
60 swprintf (Temp, L"%I64u", Number);
61 AddCommas = TempLen = wcslen (Temp);
62 StrPosOrig = Temp;
63 StrPosResult = Result;
64 while (AddCommas)
65 {
66 if ((AddCommas % 3) == 0 && AddCommas != TempLen) // avoid stuff like ",345"
67 {
68 *StrPosResult = L',';
69 StrPosResult++;
70 }
71
72 *StrPosResult = *StrPosOrig;
73 StrPosResult++;
74 StrPosOrig++;
75
76 *StrPosResult = 0;
77
78 AddCommas--;
79 }
80
81 return (Result);
82}
wchar_t * AddCommas(wchar_t *Result, uint64 Number)
Definition: Unfrag.cpp:48
#define NULL
Definition: types.h:112
#define swprintf
Definition: precomp.h:40
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:207
#define L(x)
Definition: ntvdm.h:50
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by AddCommas(), and SetReportInfo().

◆ CheckWinVer()

bool CheckWinVer ( void  )

Definition at line 19 of file Unfrag.cpp.

20{
21 OSVERSIONINFO OSVersion;
22
23 ZeroMemory (&OSVersion, sizeof (OSVersion));
24 OSVersion.dwOSVersionInfoSize = sizeof (OSVersion);
25 GetVersionEx (&OSVersion);
26
27 // Need Windows 2000!
28
29 // Check for NT first
30 // Actually what we do is check that weLL're not on Win31+Win32s and that we're
31 // not in Windows 9x. It's possible that there could be more Windows "platforms"
32 // in the future and there's no sense in claiming incompatibility.
33 if (OSVersion.dwPlatformId == VER_PLATFORM_WIN32s ||
35 {
36 return (false);
37 }
38
39 // Ok weLL're in Windows NT, now make sure we're in 2000
40 if (OSVersion.dwMajorVersion < 5)
41 return (false);
42
43 // Kew, we're in at least Windows 2000 ("NT 5.0")
44 return (true);
45}
#define VER_PLATFORM_WIN32_WINDOWS
Definition: rtltypes.h:237
#define VER_PLATFORM_WIN32s
Definition: rtltypes.h:236
ULONG dwPlatformId
Definition: rtltypes.h:241
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:237
ULONG dwMajorVersion
Definition: rtltypes.h:238
#define ZeroMemory
Definition: winbase.h:1712
#define GetVersionEx
Definition: winbase.h:3852

Referenced by FraggerHelp(), and wWinMain().

◆ StartDefragThread()

Defragment * StartDefragThread ( wstring  Drive,
DefragType  Method,
HANDLE Handle 
)

Definition at line 132 of file Unfrag.cpp.

133{
134 Defragment *Defragger;
135 unsigned long Thread;
136
137 Defragger = new Defragment (Drive, Method);
138 //Thread = /*CreateThread*/ _beginthreadex (NULL, 0, DefragThread, Defragger, 0, &ThreadID);
139 Thread = _beginthread (DefragThread, 0, Defragger);
140 Handle = *((HANDLE *)&Thread);
141 return (Defragger);
142}
void __cdecl DefragThread(LPVOID parm)
Definition: Unfrag.cpp:120
PWCHAR Drive
Definition: chkdsk.c:73
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
ULONG Handle
Definition: gdb_input.c:15
_CRTIMP uintptr_t __cdecl _beginthread(_In_ void(__cdecl *_StartAddress)(void *), _In_ unsigned _StackSize, _In_opt_ void *_ArgList)

Referenced by MainDialogProc().

Variable Documentation

◆ QuietMode

bool QuietMode
extern

Definition at line 14 of file Unfrag.cpp.

◆ VerboseMode

bool VerboseMode
extern

Definition at line 15 of file Unfrag.cpp.