Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.

This commit is contained in:
Colin Finck 2017-10-03 07:45:34 +00:00
parent b94e2d8ca0
commit c2c66aff7d
24198 changed files with 0 additions and 37285 deletions

View file

@ -0,0 +1,15 @@
add_subdirectory(chklib)
add_subdirectory(ctm)
add_subdirectory(fontsub)
add_subdirectory(gettype)
add_subdirectory(kill)
add_subdirectory(logevent)
add_subdirectory(lsdd)
add_subdirectory(man)
add_subdirectory(pedump)
add_subdirectory(regexpl)
add_subdirectory(rosddt)
add_subdirectory(screenshot)
add_subdirectory(systeminfo)
add_subdirectory(tlist)
add_subdirectory(utils)

View file

@ -0,0 +1,6 @@
add_executable(chklib chklib.c chklib.rc)
set_module_type(chklib win32cui)
target_link_libraries(chklib win32err)
add_importlibs(chklib msvcrt kernel32)
add_cd_file(TARGET chklib DESTINATION reactos/system32 FOR all)

View file

@ -0,0 +1,199 @@
/*
* chklib.c
*
* Copyright (C) 1998, 1999 Emanuele Aliberti.
*
* --------------------------------------------------------------------
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this software; see the file COPYING. If
* not, write to the Free Software Foundation, Inc., 675 Mass Ave,
* Cambridge, MA 02139, USA.
*
* --------------------------------------------------------------------
* Check a PE DLL for loading and get an exported symbol's address
* (relocated).
*
*/
//#define UNICODE
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include "../win32err.h"
#ifdef DISPLAY_VERSION
static
void
DisplayVersion(
HANDLE dll,
PCHAR ModuleName
)
{
DWORD Zero;
DWORD Size;
PVOID vi = NULL;
assert(ModuleName);
Size = GetFileVersionInfoSize(
ModuleName,
& Zero
);
if (Size == 0)
{
PrintWin32Error(
L"GetFileVersionInfoSize",
GetLastError()
);
return;
}
vi = (PVOID) LocalAlloc(LMEM_ZEROINIT,Size);
if (!vi) return;
assert(dll != INVALID_HANDLE_VALUE);
if (0 == GetFileVersionInfo(
ModuleName,
(DWORD) dll,
Size,
vi
)
) {
PrintWin32Error(
L"GetFileVersionInfo",
GetLastError()
);
return;
}
/*
VerQueryValue(
vi,
L"\\StringFileInfo\\040904E4\\FileDescription",
& lpBuffer,
& dwBytes
);
*/
LocalFree(vi);
}
#endif /* def DISPLAY_VERSION */
static
void
DisplayEntryPoint(
const HANDLE dll,
LPCSTR SymbolName
)
{
FARPROC EntryPoint;
printf(
"[%s]\n",
SymbolName
);
EntryPoint = GetProcAddress(
dll,
SymbolName
);
if (!EntryPoint)
{
PrintWin32Error(
L"GetProcAddress",
GetLastError()
);
return;
}
printf(
"0x%p %s\n",
EntryPoint,
SymbolName
);
}
/* --- MAIN --- */
int
main(
int argc,
char * argv []
)
{
HINSTANCE dll;
TCHAR ModuleName [_MAX_PATH];
if (argc < 2)
{
fprintf(
stderr,
"\
ReactOS System Tools\n\
Check a Dynamic Link Library (DLL) for loading\n\
Copyright (c) 1998, 1999 Emanuele Aliberti\n\n\
usage: %s module [symbol [, ...]]\n",
argv[0]
);
exit(EXIT_FAILURE);
}
dll = LoadLibraryA(argv[1]);
if (!dll)
{
UINT LastError;
LastError = GetLastError();
PrintWin32Error(L"LoadLibrary",LastError);
fprintf(
stderr,
"%s: loading %s failed (%d).\n",
argv[0],
argv[1],
LastError
);
exit(EXIT_FAILURE);
}
GetModuleFileName(
(HANDLE) dll,
ModuleName,
sizeof ModuleName
);
printf(
"%s loaded.\n",
ModuleName
);
#ifdef DISPLAY_VERSION
DisplayVersion(dll,ModuleName);
#endif
if (argc > 2)
{
int CurrentSymbol;
for ( CurrentSymbol = 2;
(CurrentSymbol < argc);
++CurrentSymbol
)
{
DisplayEntryPoint( dll, argv[CurrentSymbol] );
}
}
FreeLibrary(dll);
printf(
"%s unloaded.\n",
ModuleName
);
return EXIT_SUCCESS;
}
/* EOF */

View file

@ -0,0 +1,5 @@
#define REACTOS_STR_FILE_DESCRIPTION "Tool to check a dynamic library for a symbol\0"
#define REACTOS_STR_INTERNAL_NAME "chklib\0"
#define REACTOS_STR_ORIGINAL_FILENAME "chklib.exe\0"
#include <reactos/version.rc>

View file

@ -0,0 +1,6 @@
#ifndef _INC_CONFIG_H
#define _INC_CONFIG_H
#define FMIFS_IMPORT_DLL
#define REACTOS_NO_SECURITY_SS
#endif /* ndef _INC_CONFIG_H */

View file

@ -0,0 +1,6 @@
add_executable(ctm ctm.c ctm.rc)
set_module_type(ctm win32cui UNICODE)
target_link_libraries(ctm epsapi)
add_importlibs(ctm ntdll user32 msvcrt kernel32)
add_cd_file(TARGET ctm DESTINATION reactos/system32 FOR all)

View file

@ -0,0 +1,728 @@
/* Console Task Manager
ctm.c - main program file
Written by: Aleksey Bragin (aleksey@reactos.org)
Most of the code dealing with getting system parameters is taken from
ReactOS Task Manager written by Brian Palmer (brianp@reactos.org)
Localization features added by Hervé Poussineau (hpoussin@reactos.org)
History:
24 October 2004 - added localization features
09 April 2003 - v0.1, fixed bugs, added features, ported to mingw
20 March 2003 - v0.03, works good under ReactOS, and allows process
killing
18 March 2003 - Initial version 0.01, doesn't work under RectOS
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows //headers
#define WIN32_NO_STATUS
#include <windows.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#define NTOS_MODE_USER
#include <ndk/ntndk.h>
#include <epsapi/epsapi.h>
#include "ctm.h"
#include "resource.h"
#define TIMES
HANDLE hStdin;
HANDLE hStdout;
HINSTANCE hInst;
DWORD inConMode;
DWORD outConMode;
DWORD columnRightPositions[6];
TCHAR lpSeparator[80];
TCHAR lpHeader[80];
TCHAR lpMemUnit[3];
TCHAR lpIdleProcess[80];
TCHAR lpTitle[80];
TCHAR lpHeader[80];
TCHAR lpMenu[80];
TCHAR lpEmpty[80];
TCHAR KEY_QUIT, KEY_KILL;
TCHAR KEY_YES, KEY_NO;
int ProcPerScreen = 17; // 17 processess are displayed on one page
int ScreenLines=25;
ULONG ProcessCountOld = 0;
ULONG ProcessCount = 0;
double dbIdleTime;
double dbKernelTime;
double dbSystemTime;
LARGE_INTEGER liOldIdleTime = {{0,0}};
LARGE_INTEGER liOldKernelTime = {{0,0}};
LARGE_INTEGER liOldSystemTime = {{0,0}};
PPERFDATA pPerfDataOld = NULL; // Older perf data (saved to establish delta values)
PPERFDATA pPerfData = NULL; // Most recent copy of perf data
int selection=0;
int scrolled=0; // offset from which process start showing
int first = 0; // first time in DisplayScreen
SYSTEM_BASIC_INFORMATION SystemBasicInfo;
CONSOLE_SCREEN_BUFFER_INFO screenBufferInfo;
#define NEW_CONSOLE
// Functions that are needed by epsapi
void *PsaiMalloc(SIZE_T size) { return malloc(size); }
void *PsaiRealloc(void *ptr, SIZE_T size) { return realloc(ptr, size); }
void PsaiFree(void *ptr) { free(ptr); }
// Prototypes
unsigned int GetKeyPressed();
void GetInputOutputHandles()
{
#ifdef NEW_CONSOLE
HANDLE console = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
0, CONSOLE_TEXTMODE_BUFFER, 0);
if (SetConsoleActiveScreenBuffer(console) == FALSE)
{
hStdin = GetStdHandle(STD_INPUT_HANDLE);
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
}
else
{
hStdin = GetStdHandle(STD_INPUT_HANDLE);//console;
hStdout = console;
}
#else
hStdin = GetStdHandle(STD_INPUT_HANDLE);
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
#endif
}
void RestoreConsole()
{
SetConsoleMode(hStdin, inConMode);
SetConsoleMode(hStdout, outConMode);
#ifdef NEW_CONSOLE
SetConsoleActiveScreenBuffer(GetStdHandle(STD_OUTPUT_HANDLE));
#endif
}
void DisplayScreen()
{
COORD pos;
COORD size;
TCHAR lpStr[80];
DWORD numChars;
int lines;
int idx;
GetConsoleScreenBufferInfo(hStdout,&screenBufferInfo);
size=screenBufferInfo.dwSize;
ScreenLines=size.Y;
ProcPerScreen = ScreenLines-7;
if (first == 0)
{
// Header
pos.X = 1; pos.Y = 1;
WriteConsoleOutputCharacter(hStdout, lpTitle, _tcslen(lpTitle), pos, &numChars);
pos.X = 1; pos.Y = 2;
WriteConsoleOutputCharacter(hStdout, lpSeparator, _tcslen(lpSeparator), pos, &numChars);
pos.X = 1; pos.Y = 3;
WriteConsoleOutputCharacter(hStdout, lpHeader, _tcslen(lpHeader), pos, &numChars);
pos.X = 1; pos.Y = 4;
WriteConsoleOutputCharacter(hStdout, lpSeparator, _tcslen(lpSeparator), pos, &numChars);
// Footer
pos.X = 1; pos.Y = ScreenLines-2;
WriteConsoleOutputCharacter(hStdout, lpSeparator, _tcslen(lpSeparator), pos, &numChars);
// Menu
pos.X = 1; pos.Y = ScreenLines-1;
WriteConsoleOutputCharacter(hStdout, lpEmpty, _tcslen(lpEmpty), pos, &numChars);
WriteConsoleOutputCharacter(hStdout, lpMenu, _tcslen(lpMenu), pos, &numChars);
first = 1;
}
// Processess
lines = ProcessCount;
if (lines > ProcPerScreen)
lines = ProcPerScreen;
for (idx=0; idx<ProcPerScreen; idx++)
{
int len, i;
TCHAR lpNumber[5];
TCHAR lpPid[8];
TCHAR lpCpu[6];
TCHAR lpMemUsg[12];
TCHAR lpPageFaults[15];
WORD wColor;
for (i = 0; i < 80; i++)
lpStr[i] = _T(' ');
// data
if (idx < lines && scrolled + idx < ProcessCount)
{
// number
_stprintf(lpNumber, _T("%3d"), idx+scrolled);
_tcsncpy(&lpStr[2], lpNumber, 3);
// image name
#ifdef _UNICODE
len = wcslen(pPerfData[scrolled+idx].ImageName);
#else
WideCharToMultiByte(CP_ACP, 0, pPerfData[scrolled+idx].ImageName, -1,
imgName, MAX_PATH, NULL, NULL);
len = strlen(imgName);
#endif
if (len > columnRightPositions[1])
{
len = columnRightPositions[1];
}
#ifdef _UNICODE
wcsncpy(&lpStr[columnRightPositions[0]+3], pPerfData[scrolled+idx].ImageName, len);
#else
strncpy(&lpStr[columnRightPositions[0]+3], imgName, len);
#endif
// PID
_stprintf(lpPid, _T("%6ld"), pPerfData[scrolled+idx].ProcessId);
_tcsncpy(&lpStr[columnRightPositions[2] - 6], lpPid, 6);
#ifdef TIMES
// CPU
_stprintf(lpCpu, _T("%3d%%"), pPerfData[scrolled+idx].CPUUsage);
_tcsncpy(&lpStr[columnRightPositions[3] - 4], lpCpu, 4);
#endif
// Mem usage
_stprintf(lpMemUsg, _T("%6ld %s"), pPerfData[scrolled+idx].WorkingSetSizeBytes / 1024, lpMemUnit);
_tcsncpy(&lpStr[columnRightPositions[4] - 9], lpMemUsg, 9);
// Page Fault
_stprintf(lpPageFaults, _T("%12ld"), pPerfData[scrolled+idx].PageFaultCount);
_tcsncpy(&lpStr[columnRightPositions[5] - 12], lpPageFaults, 12);
}
// columns
lpStr[0] = _T(' ');
lpStr[1] = _T('|');
for (i = 0; i < 6; i++)
lpStr[columnRightPositions[i] + 1] = _T('|');
pos.X = 0; pos.Y = 5+idx;
WriteConsoleOutputCharacter(hStdout, lpStr, 80, pos, &numChars);
// Attributes now...
pos.X = columnRightPositions[0] + 1; pos.Y = 5+idx;
if (selection == idx)
{
wColor = BACKGROUND_GREEN |
FOREGROUND_RED |
FOREGROUND_GREEN |
FOREGROUND_BLUE;
}
else
{
wColor = BACKGROUND_BLUE |
FOREGROUND_RED |
FOREGROUND_GREEN |
FOREGROUND_BLUE;
}
FillConsoleOutputAttribute(
hStdout, // screen buffer handle
wColor, // color to fill with
columnRightPositions[1] - 4, // number of cells to fill
pos, // first cell to write to
&numChars); // actual number written
}
return;
}
// returns TRUE if exiting
int ProcessKeys(int numEvents)
{
DWORD numChars;
TCHAR key;
if ((ProcessCount-scrolled < 17) && (ProcessCount > 17))
scrolled = ProcessCount-17;
key = GetKeyPressed(numEvents);
if (key == KEY_QUIT)
return TRUE;
else if (key == KEY_KILL)
{
// user wants to kill some process, get his acknowledgement
DWORD pId;
COORD pos;
TCHAR lpStr[100];
pos.X = 1; pos.Y =ScreenLines-1;
if (LoadString(hInst, IDS_KILL_PROCESS, lpStr, 100))
WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
do {
GetNumberOfConsoleInputEvents(hStdin, &pId);
key = GetKeyPressed(pId);
} while (key != KEY_YES && key != KEY_NO);
if (key == KEY_YES)
{
HANDLE hProcess;
pId = pPerfData[selection+scrolled].ProcessId;
hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, pId);
if (hProcess)
{
if (!TerminateProcess(hProcess, 0))
{
if (LoadString(hInst, IDS_KILL_PROCESS_ERR1, lpStr, 80))
{
WriteConsoleOutputCharacter(hStdout, lpEmpty, _tcslen(lpEmpty), pos, &numChars);
WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
}
Sleep(1000);
}
CloseHandle(hProcess);
}
else
{
if (LoadString(hInst, IDS_KILL_PROCESS_ERR2, lpStr, 80))
{
WriteConsoleOutputCharacter(hStdout, lpEmpty, _tcslen(lpEmpty), pos, &numChars);
_stprintf(lpStr, lpStr, pId);
WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars);
}
Sleep(1000);
}
}
first = 0;
}
else if (key == VK_UP)
{
if (selection > 0)
selection--;
else if ((selection == 0) && (scrolled > 0))
scrolled--;
}
else if (key == VK_DOWN)
{
if ((selection < ProcPerScreen-1) && (selection < ProcessCount-1))
selection++;
else if ((selection == ProcPerScreen-1) && (selection+scrolled < ProcessCount-1))
scrolled++;
}
else if (key == VK_PRIOR)
{
if (scrolled>ProcPerScreen-1)
scrolled-=ProcPerScreen-1;
else
{
scrolled=0; //First
selection=0;
}
//selection=0;
}
else if (key == VK_NEXT)
{
scrolled+=ProcPerScreen-1;
if (scrolled>ProcessCount-ProcPerScreen)
{
scrolled=ProcessCount-ProcPerScreen; //End
selection=ProcPerScreen-1;
}
//selection=ProcPerScreen-1;
if (ProcessCount<=ProcPerScreen) //If there are less process than fits on the screen
{
scrolled=0;
selection=(ProcessCount%ProcPerScreen)-1;
}
}
else if (key == VK_HOME)
{
selection=0;
scrolled=0;
}
else if (key == VK_END)
{
selection=ProcPerScreen-1;
scrolled=ProcessCount-ProcPerScreen;
if (ProcessCount<=ProcPerScreen) //If there are less process than fits on the screen
{
scrolled=0;
selection=(ProcessCount%ProcPerScreen)-1;
}
}
return FALSE;
}
void PerfInit()
{
NtQuerySystemInformation(SystemBasicInformation, &SystemBasicInfo, sizeof(SystemBasicInfo), 0);
}
void PerfDataRefresh()
{
LONG status;
ULONG ulSize;
LPBYTE pBuffer;
ULONG Idx, Idx2;
PSYSTEM_PROCESS_INFORMATION pSPI;
PPERFDATA pPDOld;
#ifdef EXTRA_INFO
HANDLE hProcess;
HANDLE hProcessToken;
TCHAR szTemp[MAX_PATH];
DWORD dwSize;
#endif
#ifdef TIMES
LARGE_INTEGER liCurrentKernelTime;
LARGE_INTEGER liCurrentIdleTime;
LARGE_INTEGER liCurrentTime;
#endif
PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcessorTimeInfo;
SYSTEM_TIMEOFDAY_INFORMATION SysTimeInfo;
#ifdef TIMES
// Get new system time
status = NtQuerySystemInformation(SystemTimeInformation, &SysTimeInfo, sizeof(SysTimeInfo), 0);
if (status != NO_ERROR)
return;
#endif
// Get processor information
SysProcessorTimeInfo = (PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)malloc(sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * SystemBasicInfo.NumberOfProcessors);
status = NtQuerySystemInformation(SystemProcessorPerformanceInformation, SysProcessorTimeInfo, sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * SystemBasicInfo.NumberOfProcessors, &ulSize);
// Get process information
PsaCaptureProcessesAndThreads((PSYSTEM_PROCESS_INFORMATION *)&pBuffer);
#ifdef TIMES
liCurrentKernelTime.QuadPart = 0;
liCurrentIdleTime.QuadPart = 0;
for (Idx=0; Idx<SystemBasicInfo.NumberOfProcessors; Idx++) {
liCurrentKernelTime.QuadPart += SysProcessorTimeInfo[Idx].KernelTime.QuadPart;
liCurrentKernelTime.QuadPart += SysProcessorTimeInfo[Idx].DpcTime.QuadPart;
liCurrentKernelTime.QuadPart += SysProcessorTimeInfo[Idx].InterruptTime.QuadPart;
liCurrentIdleTime.QuadPart += SysProcessorTimeInfo[Idx].IdleTime.QuadPart;
}
// If it's a first call - skip idle time calcs
if (liOldIdleTime.QuadPart != 0) {
// CurrentValue = NewValue - OldValue
liCurrentTime.QuadPart = liCurrentIdleTime.QuadPart - liOldIdleTime.QuadPart;
dbIdleTime = Li2Double(liCurrentTime);
liCurrentTime.QuadPart = liCurrentKernelTime.QuadPart - liOldKernelTime.QuadPart;
dbKernelTime = Li2Double(liCurrentTime);
liCurrentTime.QuadPart = SysTimeInfo.CurrentTime.QuadPart - liOldSystemTime.QuadPart;
dbSystemTime = Li2Double(liCurrentTime);
// CurrentCpuIdle = IdleTime / SystemTime
dbIdleTime = dbIdleTime / dbSystemTime;
dbKernelTime = dbKernelTime / dbSystemTime;
// CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessors
dbIdleTime = 100.0 - dbIdleTime * 100.0 / (double)SystemBasicInfo.NumberOfProcessors;// + 0.5;
dbKernelTime = 100.0 - dbKernelTime * 100.0 / (double)SystemBasicInfo.NumberOfProcessors;// + 0.5;
}
// Store new CPU's idle and system time
liOldIdleTime = liCurrentIdleTime;
liOldSystemTime = SysTimeInfo.CurrentTime;
liOldKernelTime = liCurrentKernelTime;
#endif
// Determine the process count
// We loop through the data we got from PsaCaptureProcessesAndThreads
// and count how many structures there are (until PsaWalkNextProcess
// returns NULL)
ProcessCountOld = ProcessCount;
ProcessCount = 0;
pSPI = PsaWalkFirstProcess((PSYSTEM_PROCESS_INFORMATION)pBuffer);
while (pSPI) {
ProcessCount++;
pSPI = PsaWalkNextProcess(pSPI);
}
// Now alloc a new PERFDATA array and fill in the data
if (pPerfDataOld) {
free(pPerfDataOld);
}
pPerfDataOld = pPerfData;
pPerfData = (PPERFDATA)malloc(sizeof(PERFDATA) * ProcessCount);
pSPI = PsaWalkFirstProcess((PSYSTEM_PROCESS_INFORMATION)pBuffer);
for (Idx=0; Idx<ProcessCount; Idx++) {
// Get the old perf data for this process (if any)
// so that we can establish delta values
pPDOld = NULL;
for (Idx2=0; Idx2<ProcessCountOld; Idx2++) {
if (pPerfDataOld[Idx2].ProcessId == (ULONG)(pSPI->UniqueProcessId) &&
/* check also for the creation time, a new process may have an id of an old one */
pPerfDataOld[Idx2].CreateTime.QuadPart == pSPI->CreateTime.QuadPart) {
pPDOld = &pPerfDataOld[Idx2];
break;
}
}
// Clear out process perf data structure
memset(&pPerfData[Idx], 0, sizeof(PERFDATA));
if (pSPI->ImageName.Buffer) {
wcsncpy(pPerfData[Idx].ImageName, pSPI->ImageName.Buffer, pSPI->ImageName.Length / sizeof(WCHAR));
pPerfData[Idx].ImageName[pSPI->ImageName.Length / sizeof(WCHAR)] = 0;
}
else
{
#ifdef _UNICODE
wcscpy(pPerfData[Idx].ImageName, lpIdleProcess);
#else
MultiByteToWideChar(CP_ACP, 0, lpIdleProcess, strlen(lpIdleProcess), pPerfData[Idx].ImageName, MAX_PATH);
#endif
}
pPerfData[Idx].ProcessId = (ULONG)(pSPI->UniqueProcessId);
pPerfData[Idx].CreateTime = pSPI->CreateTime;
if (pPDOld) {
#ifdef TIMES
double CurTime = Li2Double(pSPI->KernelTime) + Li2Double(pSPI->UserTime);
double OldTime = Li2Double(pPDOld->KernelTime) + Li2Double(pPDOld->UserTime);
double CpuTime = (CurTime - OldTime) / dbSystemTime;
CpuTime = CpuTime * 100.0 / (double)SystemBasicInfo.NumberOfProcessors; // + 0.5;
pPerfData[Idx].CPUUsage = (ULONG)CpuTime;
#else
pPerfData[Idx].CPUUsage = 0;
#endif
}
pPerfData[Idx].CPUTime.QuadPart = pSPI->UserTime.QuadPart + pSPI->KernelTime.QuadPart;
pPerfData[Idx].WorkingSetSizeBytes = pSPI->WorkingSetSize;
pPerfData[Idx].PeakWorkingSetSizeBytes = pSPI->PeakWorkingSetSize;
if (pPDOld)
pPerfData[Idx].WorkingSetSizeDelta = labs((LONG)pSPI->WorkingSetSize - (LONG)pPDOld->WorkingSetSizeBytes);
else
pPerfData[Idx].WorkingSetSizeDelta = 0;
pPerfData[Idx].PageFaultCount = pSPI->PageFaultCount;
if (pPDOld)
pPerfData[Idx].PageFaultCountDelta = labs((LONG)pSPI->PageFaultCount - (LONG)pPDOld->PageFaultCount);
else
pPerfData[Idx].PageFaultCountDelta = 0;
pPerfData[Idx].VirtualMemorySizeBytes = pSPI->VirtualSize;
pPerfData[Idx].PagedPoolUsagePages = pSPI->QuotaPagedPoolUsage;
pPerfData[Idx].NonPagedPoolUsagePages = pSPI->QuotaNonPagedPoolUsage;
pPerfData[Idx].BasePriority = pSPI->BasePriority;
pPerfData[Idx].HandleCount = pSPI->HandleCount;
pPerfData[Idx].ThreadCount = pSPI->NumberOfThreads;
//pPerfData[Idx].SessionId = pSPI->SessionId;
#ifdef EXTRA_INFO
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, (DWORD)pSPI->UniqueProcessId);
if (hProcess) {
if (OpenProcessToken(hProcess, TOKEN_QUERY|TOKEN_DUPLICATE|TOKEN_IMPERSONATE, &hProcessToken)) {
ImpersonateLoggedOnUser(hProcessToken);
memset(szTemp, 0, sizeof(TCHAR[MAX_PATH]));
dwSize = MAX_PATH;
GetUserName(szTemp, &dwSize);
#ifndef UNICODE
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTemp, -1, pPerfData[Idx].UserName, MAX_PATH);
#endif
RevertToSelf();
CloseHandle(hProcessToken);
}
CloseHandle(hProcess);
}
#endif
#ifdef TIMES
pPerfData[Idx].UserTime.QuadPart = pSPI->UserTime.QuadPart;
pPerfData[Idx].KernelTime.QuadPart = pSPI->KernelTime.QuadPart;
#endif
pSPI = PsaWalkNextProcess(pSPI);
}
PsaFreeCapture(pBuffer);
free(SysProcessorTimeInfo);
}
// Code partly taken from slw32tty.c from mc/slang
unsigned int GetKeyPressed(int events)
{
DWORD bytesRead;
INPUT_RECORD record;
int i;
for (i=0; i<events; i++)
{
if (!ReadConsoleInput(hStdin, &record, 1, &bytesRead)) {
return 0;
}
if (record.EventType == KEY_EVENT && record.Event.KeyEvent.bKeyDown)
return record.Event.KeyEvent.wVirtualKeyCode;//.uChar.AsciiChar;
}
return 0;
}
int _tmain(int argc, char **argv)
{
int i;
TCHAR lpStr[80];
for (i = 0; i < 80; i++)
lpEmpty[i] = lpHeader[i] = _T(' ');
lpEmpty[79] = _T('\0');
/* Initialize global variables */
hInst = 0 /* FIXME: which value? [used with LoadString(hInst, ..., ..., ...)] */;
if (LoadString(hInst, IDS_COLUMN_NUMBER, lpStr, 80))
{
columnRightPositions[0] = _tcslen(lpStr) + 3;
_tcsncpy(&lpHeader[2], lpStr, _tcslen(lpStr));
}
if (LoadString(hInst, IDS_COLUMN_IMAGENAME, lpStr, 80))
{
columnRightPositions[1] = columnRightPositions[0] + _tcslen(lpStr) + 3;
_tcsncpy(&lpHeader[columnRightPositions[0] + 2], lpStr, _tcslen(lpStr));
}
if (LoadString(hInst, IDS_COLUMN_PID, lpStr, 80))
{
columnRightPositions[2] = columnRightPositions[1] + _tcslen(lpStr) + 3;
_tcsncpy(&lpHeader[columnRightPositions[1] + 2], lpStr, _tcslen(lpStr));
}
if (LoadString(hInst, IDS_COLUMN_CPU, lpStr, 80))
{
columnRightPositions[3] = columnRightPositions[2] + _tcslen(lpStr) + 3;
_tcsncpy(&lpHeader[columnRightPositions[2] + 2], lpStr, _tcslen(lpStr));
}
if (LoadString(hInst, IDS_COLUMN_MEM, lpStr, 80))
{
columnRightPositions[4] = columnRightPositions[3] + _tcslen(lpStr) + 3;
_tcsncpy(&lpHeader[columnRightPositions[3] + 2], lpStr, _tcslen(lpStr));
}
if (LoadString(hInst, IDS_COLUMN_PF, lpStr, 80))
{
columnRightPositions[5] = columnRightPositions[4] + _tcslen(lpStr) + 3;
_tcsncpy(&lpHeader[columnRightPositions[4] + 2], lpStr, _tcslen(lpStr));
}
for (i = 0; i < columnRightPositions[5]; i++)
lpSeparator[i] = _T('-');
lpHeader[0] = _T('|');
lpSeparator[0] = _T('+');
for (i = 0; i < 6; i++)
{
lpHeader[columnRightPositions[i]] = _T('|');
lpSeparator[columnRightPositions[i]] = _T('+');
}
lpSeparator[columnRightPositions[5] + 1] = _T('\0');
lpHeader[columnRightPositions[5] + 1] = _T('\0');
if (!LoadString(hInst, IDS_APP_TITLE, lpTitle, 80))
lpTitle[0] = _T('\0');
if (!LoadString(hInst, IDS_COLUMN_MEM_UNIT, lpMemUnit, 3))
lpMemUnit[0] = _T('\0');
if (!LoadString(hInst, IDS_MENU, lpMenu, 80))
lpMenu[0] = _T('\0');
if (!LoadString(hInst, IDS_IDLE_PROCESS, lpIdleProcess, 80))
lpIdleProcess[0] = _T('\0');
if (LoadString(hInst, IDS_MENU_QUIT, lpStr, 2))
KEY_QUIT = lpStr[0];
if (LoadString(hInst, IDS_MENU_KILL_PROCESS, lpStr, 2))
KEY_KILL = lpStr[0];
if (LoadString(hInst, IDS_YES, lpStr, 2))
KEY_YES = lpStr[0];
if (LoadString(hInst, IDS_NO, lpStr, 2))
KEY_NO = lpStr[0];
GetInputOutputHandles();
if (hStdin == INVALID_HANDLE_VALUE || hStdout == INVALID_HANDLE_VALUE)
{
if (LoadString(hInst, IDS_CTM_GENERAL_ERR1, lpStr, 80))
_tprintf(lpStr);
return -1;
}
if (GetConsoleMode(hStdin, &inConMode) == 0)
{
if (LoadString(hInst, IDS_CTM_GENERAL_ERR2, lpStr, 80))
_tprintf(lpStr);
return -1;
}
if (GetConsoleMode(hStdout, &outConMode) == 0)
{
if (LoadString(hInst, IDS_CTM_GENERAL_ERR3, lpStr, 80))
_tprintf(lpStr);
return -1;
}
SetConsoleMode(hStdin, 0); //FIXME: Should check for error!
SetConsoleMode(hStdout, 0); //FIXME: Should check for error!
PerfInit();
while (1)
{
DWORD numEvents;
PerfDataRefresh();
DisplayScreen();
/* WaitForSingleObject for console handles is not implemented in ROS */
WaitForSingleObject(hStdin, 1000);
GetNumberOfConsoleInputEvents(hStdin, &numEvents);
if (numEvents > 0)
{
if (ProcessKeys(numEvents) == TRUE)
break;
}
}
RestoreConsole();
return 0;
}

View file

@ -0,0 +1,60 @@
/* Console Task Manager
ctm.h - header file for main program
Written by: Aleksey Bragin (aleksey@reactos.org)
Most of this file content is taken from
ReactOS Task Manager written by Brian Palmer (brianp@reactos.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef TMTM_H
#define TMTM_H
#define Li2Double(x) ((double)((x).u.HighPart) * 4.294967296E9 + (double)((x).u.LowPart))
typedef struct _PERFDATA
{
WCHAR ImageName[MAX_PATH];
ULONG ProcessId;
WCHAR UserName[MAX_PATH];
ULONG SessionId;
ULONG CPUUsage;
LARGE_INTEGER CPUTime;
ULONG WorkingSetSizeBytes;
ULONG PeakWorkingSetSizeBytes;
ULONG WorkingSetSizeDelta;
ULONG PageFaultCount;
ULONG PageFaultCountDelta;
ULONG VirtualMemorySizeBytes;
ULONG PagedPoolUsagePages;
ULONG NonPagedPoolUsagePages;
ULONG BasePriority;
ULONG HandleCount;
ULONG ThreadCount;
ULONG USERObjectCount;
ULONG GDIObjectCount;
//IO_COUNTERS IOCounters;
LARGE_INTEGER UserTime;
LARGE_INTEGER KernelTime;
LARGE_INTEGER CreateTime;
} PERFDATA, *PPERFDATA;
#define SystemTimeInformation 3
#endif

View file

@ -0,0 +1,37 @@
#include <windows.h>
#include "resource.h"
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Console Task Manager\0"
#define REACTOS_STR_INTERNAL_NAME "ctm\0"
#define REACTOS_STR_ORIGINAL_FILENAME "ctm.exe\0"
#define REACTOS_STR_ORIGINAL_COPYRIGHT "2003, Aleksey Bragin\0"
#include <reactos/version.rc>
/* UTF-8 */
#pragma code_page(65001)
#ifdef LANGUAGE_DE_DE
#include "lang/de-DE.rc"
#endif
#ifdef LANGUAGE_EL_GR
#include "lang/el-GR.rc"
#endif
#ifdef LANGUAGE_EN_US
#include "lang/en-US.rc"
#endif
#ifdef LANGUAGE_FR_FR
#include "lang/fr-FR.rc"
#endif
#ifdef LANGUAGE_NO_NO
#include "lang/no-NO.rc"
#endif
#ifdef LANGUAGE_RO_RO
#include "lang/ro-RO.rc"
#endif
#ifdef LANGUAGE_RU_RU
#include "lang/ru-RU.rc"
#endif
#ifdef LANGUAGE_UK_UA
#include "lang/uk-UA.rc"
#endif

View file

@ -0,0 +1,32 @@
// German (Germany) resources
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "Console TaskManager von Aleksey Bragin <aleksey@reactos.org>"
IDS_COLUMN_NUMBER "# "
IDS_COLUMN_IMAGENAME "Dateiname "
IDS_COLUMN_PID "PID "
IDS_COLUMN_CPU "CPU"
IDS_COLUMN_MEM "Speicher"
IDS_COLUMN_MEM_UNIT "KB"
IDS_COLUMN_PF "Seitenfehler"
IDS_IDLE_PROCESS "Leerlaufprozess"
IDS_YES "J"
IDS_NO "N"
IDS_MENU "Tasten: q - Beenden, k - Prozess beenden"
IDS_MENU_QUIT "Q"
IDS_MENU_KILL_PROCESS "K"
IDS_KILL_PROCESS "Sind Sie sicher diesen Prozess beenden zu wollen? (j/n)"
IDS_KILL_PROCESS_ERR1 "Fehler beim Beenden des Prozesses aufgetreten..."
IDS_KILL_PROCESS_ERR2 "Fehler beim Beenden des Prozesses %d aufgetreten (OpenProcess unmöglich)"
IDS_CTM_GENERAL_ERR1 "ctm: Kann die Konsole nicht verwenden."
IDS_CTM_GENERAL_ERR2 "ctm: Kann GetConsoleMode() für die Eingabekonsole nicht verwenden."
IDS_CTM_GENERAL_ERR3 "ctm: Kann GetConsoleMode() für die Ausgabekonsole nicht verwenden."
END

View file

@ -0,0 +1,32 @@
// Greek resources by Dj Apal
LANGUAGE LANG_GREEK, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "Console TaskManager by Aleksey Bragin <aleksey@reactos.org>"
IDS_COLUMN_NUMBER "# "
IDS_COLUMN_IMAGENAME "Image name "
IDS_COLUMN_PID "PID "
IDS_COLUMN_CPU "CPU"
IDS_COLUMN_MEM "Χρήση μνήμης"
IDS_COLUMN_MEM_UNIT "KB"
IDS_COLUMN_PF "Page Faults"
IDS_IDLE_PROCESS "Αδρανής διαδικασία"
IDS_YES "Y"
IDS_NO "N"
IDS_MENU "Πατήστε: q - έξοδος, k - τέλος διεργασίας"
IDS_MENU_QUIT "Q"
IDS_MENU_KILL_PROCESS "K"
IDS_KILL_PROCESS "Θέλετε να σταματήσετε αυτή τη διεργασία? (y/n)"
IDS_KILL_PROCESS_ERR1 "Αδύνατον να τερματιστεί η διεργασία..."
IDS_KILL_PROCESS_ERR2 "Αδύνατον να τερματιστεί η διεργασία %d (unable to OpenProcess)"
IDS_CTM_GENERAL_ERR1 "ctm: can't use console."
IDS_CTM_GENERAL_ERR2 "ctm: can't GetConsoleMode() for input console."
IDS_CTM_GENERAL_ERR3 "ctm: can't GetConsoleMode() for output console."
END

View file

@ -0,0 +1,32 @@
// English (U.S.) resources
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "Console TaskManager by Aleksey Bragin <aleksey@reactos.org>"
IDS_COLUMN_NUMBER "# "
IDS_COLUMN_IMAGENAME "Image name "
IDS_COLUMN_PID "PID "
IDS_COLUMN_CPU "CPU"
IDS_COLUMN_MEM "Mem Usage"
IDS_COLUMN_MEM_UNIT "KB"
IDS_COLUMN_PF "Page Faults"
IDS_IDLE_PROCESS "System Idle Process"
IDS_YES "Y"
IDS_NO "N"
IDS_MENU "Press: q - quit, k - kill process"
IDS_MENU_QUIT "Q"
IDS_MENU_KILL_PROCESS "K"
IDS_KILL_PROCESS "Are you sure you want to kill this process? (y/n)"
IDS_KILL_PROCESS_ERR1 "Unable to terminate this process..."
IDS_KILL_PROCESS_ERR2 "Unable to terminate process %d (unable to OpenProcess)"
IDS_CTM_GENERAL_ERR1 "ctm: can't use console."
IDS_CTM_GENERAL_ERR2 "ctm: can't GetConsoleMode() for input console."
IDS_CTM_GENERAL_ERR3 "ctm: can't GetConsoleMode() for output console."
END

View file

@ -0,0 +1,32 @@
// French (France) resources
LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "Console TaskManager par Aleksey Bragin <aleksey@reactos.org>"
IDS_COLUMN_NUMBER "# "
IDS_COLUMN_IMAGENAME "Image name "
IDS_COLUMN_PID "PID "
IDS_COLUMN_CPU "CPU"
IDS_COLUMN_MEM "Util. mém"
IDS_COLUMN_MEM_UNIT "KO"
IDS_COLUMN_PF "Défauts de page"
IDS_IDLE_PROCESS "Processus inactif du système"
IDS_YES "O"
IDS_NO "N"
IDS_MENU "Menu: Quitter (q), Tuer processus (t)"
IDS_MENU_QUIT "Q"
IDS_MENU_KILL_PROCESS "T"
IDS_KILL_PROCESS "Etes-vous sûr de vouloir tuer ce processus (o/n) ?"
IDS_KILL_PROCESS_ERR1 "Impossible de terminer ce processus..."
IDS_KILL_PROCESS_ERR2 "Impossible de terminer le processus %d (erreur lors de OpenProcess)"
IDS_CTM_GENERAL_ERR1 "ctm: impossible d'utiliser la console."
IDS_CTM_GENERAL_ERR2 "ctm: impossible de récupérer les paramètres de la console d'entrée."
IDS_CTM_GENERAL_ERR3 "ctm: impossible de récupérer les paramètres de la console de sortie."
END

View file

@ -0,0 +1,32 @@
// Norwegian (N.O.) resources
LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "Konsoll oppgavebehandler av Aleksey Bragin <aleksey@reactos.org>"
IDS_COLUMN_NUMBER "# "
IDS_COLUMN_IMAGENAME "Bilde navn "
IDS_COLUMN_PID "PID "
IDS_COLUMN_CPU "Prosesor"
IDS_COLUMN_MEM "Minnebruk"
IDS_COLUMN_MEM_UNIT "KB"
IDS_COLUMN_PF "Page Faults"
IDS_IDLE_PROCESS "System Idle Process"
IDS_YES "J"
IDS_NO "N"
IDS_MENU "Trykk: S - slutt, A - avslutt prosess"
IDS_MENU_QUIT "S"
IDS_MENU_KILL_PROCESS "A"
IDS_KILL_PROCESS "Er du sikker på at du vil avslutte denne prosessen? (J/n)"
IDS_KILL_PROCESS_ERR1 "Ikke mulig og avslutte denne prosessen..."
IDS_KILL_PROCESS_ERR2 "Ikke mulig og avslutte prosess %d (Ikke mulig og ÅpneProsess)"
IDS_CTM_GENERAL_ERR1 "ctm: kan ikke bruke konsoll."
IDS_CTM_GENERAL_ERR2 "ctm: Kan ikke GetConsoleMode() for input konsoll."
IDS_CTM_GENERAL_ERR3 "ctm: kan ikke GetConsoleMode() for output konsoll."
END

View file

@ -0,0 +1,40 @@
/*
* PROJECT: ReactOS Console Task Manager
* LICENSE: GPL - See COPYING in the top level directory
* FILE: rosapps/applications/sysutils/ctm/lang/ro-RO.rc
* PURPOSE: Romanian Language File for Console Task Manager
* TRANSLATOR: Ștefan Fulea (stefan dot fulea at mail dot md)
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
#pragma code_page(65001)
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "Gestionar de activități consolă v0.1 de Aleksey Bragin <aleksey@reactos.org>"
IDS_COLUMN_NUMBER "# "
IDS_COLUMN_IMAGENAME "Nume proces "
IDS_COLUMN_PID "IDP "
IDS_COLUMN_CPU "UCP"
IDS_COLUMN_MEM "Uz memor."
IDS_COLUMN_MEM_UNIT "ko"
IDS_COLUMN_PF "Er. de pag."
IDS_IDLE_PROCESS "Proces de inactivitate sistem"
IDS_YES "D"
IDS_NO "N"
IDS_MENU "Apasă: q - ieșire, k - oprește proces"
IDS_MENU_QUIT "Q"
IDS_MENU_KILL_PROCESS "K"
IDS_KILL_PROCESS "Sigur doriți oprirea procesului? (d|n)"
IDS_KILL_PROCESS_ERR1 "Nu se reușește oprirea procesului..."
IDS_KILL_PROCESS_ERR2 "Nu se reușește oprirea procesului %d (eșec la OpenProcess)"
IDS_CTM_GENERAL_ERR1 "ctm: eșec la folosirea consolei."
IDS_CTM_GENERAL_ERR2 "ctm: eșec la GetConsoleMode() pentru consola de intrare."
IDS_CTM_GENERAL_ERR3 "ctm: eșec la GetConsoleMode() pentru consola de ieșire."
END

View file

@ -0,0 +1,32 @@
// Russian (RU) resources
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "Консольный Диспетчер задач от Алексея Брагина <aleksey@reactos.org>"
IDS_COLUMN_NUMBER "# "
IDS_COLUMN_IMAGENAME "Имя образа "
IDS_COLUMN_PID "PID "
IDS_COLUMN_CPU "ЦП"
IDS_COLUMN_MEM "Использование памяти"
IDS_COLUMN_MEM_UNIT "КБ"
IDS_COLUMN_PF "Ошибок страницы"
IDS_IDLE_PROCESS "Бездействие системы"
IDS_YES "Y"
IDS_NO "N"
IDS_MENU "Нажмите: q - выход, k - завершить процесс"
IDS_MENU_QUIT "Q"
IDS_MENU_KILL_PROCESS "K"
IDS_KILL_PROCESS "Вы уверены, что нужно завершить процесс? (y/n)"
IDS_KILL_PROCESS_ERR1 "Не удалось завершить этот процесс..."
IDS_KILL_PROCESS_ERR2 "Не удалось завершить процесс %d (невозможно выполнить OpenProcess)"
IDS_CTM_GENERAL_ERR1 "ctm: невозможно использовать консоль."
IDS_CTM_GENERAL_ERR2 "ctm: невозможно использовать GetConsoleMode() для ввода в консоли."
IDS_CTM_GENERAL_ERR3 "ctm: невозможно использовать GetConsoleMode() для вывода в консоли."
END

View file

@ -0,0 +1,38 @@
/*
* PROJECT: ReactOS Console Task Manager
* LICENSE: GPL - See COPYING in the top level directory
* FILE: rosapps/sysutils/ctm/Uk.rc
* PURPOSE: Ukraianian Language File for Console Task Manager
* TRANSLATOR: Artem Reznikov
*/
LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "Консольний Диспетчер завдань від Aleksey Bragin <aleksey@reactos.org>"
IDS_COLUMN_NUMBER "# "
IDS_COLUMN_IMAGENAME "Ім'я образу "
IDS_COLUMN_PID "PID "
IDS_COLUMN_CPU "CPU"
IDS_COLUMN_MEM "Використання пам'яті"
IDS_COLUMN_MEM_UNIT "KB"
IDS_COLUMN_PF "Помилок сторінки"
IDS_IDLE_PROCESS "Недіяння системи"
IDS_YES "Y"
IDS_NO "N"
IDS_MENU "Натисніть: q - вийти, k - завершити процес"
IDS_MENU_QUIT "Q"
IDS_MENU_KILL_PROCESS "K"
IDS_KILL_PROCESS "Ви впевнені, що хочете завершити цей процес? (y/n)"
IDS_KILL_PROCESS_ERR1 "Неможливо завершити цей процес..."
IDS_KILL_PROCESS_ERR2 "Неможливо завершити процес %d (неможливо виконати OpenProcess)"
IDS_CTM_GENERAL_ERR1 "ctm: неможливо використовувати консоль."
IDS_CTM_GENERAL_ERR2 "ctm: неможливо виконати GetConsoleMode() для введення в консолі."
IDS_CTM_GENERAL_ERR3 "ctm: неможливо виконати GetConsoleMode() для виведення в консолі."
END

View file

@ -0,0 +1,45 @@
/*
* CTM resource definitions
*
* Copyright 2004 ReactOS team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define IDS_APP_TITLE 0
#define IDS_COLUMN_NUMBER 10
#define IDS_COLUMN_IMAGENAME 11
#define IDS_COLUMN_PID 12
#define IDS_COLUMN_CPU 13
#define IDS_COLUMN_MEM 14
#define IDS_COLUMN_MEM_UNIT 15
#define IDS_COLUMN_PF 16
#define IDS_IDLE_PROCESS 100
#define IDS_YES 101
#define IDS_NO 102
#define IDS_MENU 200
#define IDS_MENU_QUIT 201
#define IDS_MENU_KILL_PROCESS 202
#define IDS_KILL_PROCESS 1000
#define IDS_KILL_PROCESS_ERR1 1001
#define IDS_KILL_PROCESS_ERR2 1002
#define IDS_CTM_GENERAL_ERR1 32768
#define IDS_CTM_GENERAL_ERR2 32769
#define IDS_CTM_GENERAL_ERR3 32770

View file

@ -0,0 +1,16 @@
# FontSub by Katayama Hirofumi MZ
#
# To the extent possible under law, the person who associated CC0 with
# FontSub has waived all copyright and related or neighboring rights
# to FontSub.
#
# You should have received a copy of the CC0 legalcode along with this
# work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
set_cpp(WITH_RUNTIME WITH_STL WITH_EXCEPTIONS)
add_executable(fontsubedit fontsub.cpp fontsub_res.rc)
set_module_type(fontsubedit win32gui UNICODE)
add_importlibs(fontsubedit advapi32 comctl32 comdlg32 shell32 gdi32 user32 msvcrt kernel32)
set_target_properties(fontsubedit PROPERTIES OUTPUT_NAME "fontsub")
add_cd_file(TARGET fontsubedit DESTINATION reactos/system32 FOR all)

View file

@ -0,0 +1,122 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -0,0 +1,368 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="256"
height="256"
viewBox="0 0 256 256"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="fontsub.svg"
inkscape:export-filename="C:\Users\katahiromz\Desktop\fontsub2\fontsub.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.35"
inkscape:cx="-96.950454"
inkscape:cy="-3.229257"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true"
inkscape:snap-intersection-paths="true"
inkscape:object-paths="true"
inkscape:object-nodes="true"
inkscape:snap-smooth-nodes="true"
inkscape:snap-midpoints="true"
inkscape:snap-object-midpoints="true"
inkscape:snap-center="true"
inkscape:snap-text-baseline="true"
inkscape:snap-page="true"
inkscape:snap-global="true"
inkscape:window-width="1366"
inkscape:window-height="705"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
units="px" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="レイヤー 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-796.36219)">
<g
id="g4467"
transform="matrix(0.2822222,0,0,0.2822222,0,755.36218)">
<rect
y="362.76154"
x="2.6432549e-006"
height="689.60077"
width="907.08661"
id="rect4240-2"
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" />
<rect
y="145.27559"
x="7.7024585e-015"
height="254.62881"
width="907.08661"
id="rect4240"
style="opacity:1;fill:#b1b1b1;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" />
<rect
y="145.27559"
x="2.6432549e-006"
height="37.142868"
width="907.08661"
id="rect3336"
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" />
<rect
y="1015.2194"
x="2.6432549e-006"
height="37.142868"
width="907.08661"
id="rect3336-9"
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" />
<rect
transform="matrix(0,-1,1,0,0,0)"
y="0"
x="-1052.3622"
height="37.142868"
width="907.08661"
id="rect3336-9-4"
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" />
<rect
transform="matrix(0,-1,1,0,0,0)"
y="869.94373"
x="-1052.3623"
height="37.142868"
width="907.08661"
id="rect3336-9-4-9"
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" />
<rect
transform="matrix(0,-1,1,0,0,0)"
y="434.97186"
x="-1052.3623"
height="37.142868"
width="907.08661"
id="rect3336-9-4-8"
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" />
<rect
y="580.2475"
x="2.6432549e-006"
height="37.142868"
width="907.08661"
id="rect3336-9-4-8-9"
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" />
<rect
y="362.76154"
x="2.6432549e-006"
height="37.142868"
width="907.08661"
id="rect3336-9-4-8-9-9"
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" />
<rect
y="797.73346"
x="2.6432549e-006"
height="37.142868"
width="907.08661"
id="rect3336-9-4-8-9-9-0"
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" />
<g
id="g4346">
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98"
width="147.08661"
height="37.142868"
x="-564.2475"
y="87.599564"
transform="matrix(0,-1,1,0,0,0)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1"
width="118.51518"
height="37.142868"
x="-206.11475"
y="-454.30377"
transform="scale(-1,-1)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1-8"
width="94.285751"
height="37.142868"
x="-181.88531"
y="-516.64795"
transform="scale(-1,-1)" />
</g>
<g
transform="translate(0,-2)"
id="g4351">
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-4"
width="85.427803"
height="37.142868"
x="-502.58875"
y="506.45667"
transform="matrix(0,-1,1,0,0,0)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1-6"
width="118.51518"
height="37.142868"
x="-624.97186"
y="-454.3038"
transform="scale(-1,-1)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1-8-7"
width="117.19617"
height="37.142868"
x="-623.65283"
y="-510.8382"
transform="scale(-1,-1)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-4-1"
width="72.800896"
height="37.142868"
x="-552.87671"
y="586.50995"
transform="matrix(0,-1,1,0,0,0)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1-6-6"
width="118.51518"
height="37.142868"
x="-623.65283"
y="-567.37256"
transform="scale(-1,-1)" />
</g>
<g
id="g4346-9"
transform="translate(0,217.11474)">
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-6"
width="147.08661"
height="37.142868"
x="-564.2475"
y="87.599564"
transform="matrix(0,-1,1,0,0,0)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1-5"
width="118.51518"
height="37.142868"
x="-206.11475"
y="-454.30377"
transform="scale(-1,-1)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1-8-8"
width="94.285751"
height="37.142868"
x="-181.88531"
y="-516.64795"
transform="scale(-1,-1)" />
</g>
<g
id="g4346-9-6"
transform="translate(0,434.22944)">
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-6-9"
width="147.08661"
height="37.142868"
x="-564.2475"
y="87.599564"
transform="matrix(0,-1,1,0,0,0)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1-5-2"
width="118.51518"
height="37.142868"
x="-206.11475"
y="-454.30377"
transform="scale(-1,-1)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1-8-8-5"
width="94.285751"
height="37.142868"
x="-181.88531"
y="-516.64795"
transform="scale(-1,-1)" />
</g>
<g
transform="translate(0,215.61916)"
id="g4351-9">
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-4-8"
width="85.427803"
height="37.142868"
x="-502.58875"
y="506.45667"
transform="matrix(0,-1,1,0,0,0)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1-6-7"
width="118.51518"
height="37.142868"
x="-624.97186"
y="-454.3038"
transform="scale(-1,-1)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1-8-7-3"
width="117.19617"
height="37.142868"
x="-623.65283"
y="-510.8382"
transform="scale(-1,-1)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-4-1-2"
width="72.800896"
height="37.142868"
x="-552.87671"
y="586.50995"
transform="matrix(0,-1,1,0,0,0)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1-6-6-4"
width="118.51518"
height="37.142868"
x="-623.65283"
y="-567.37256"
transform="scale(-1,-1)" />
</g>
<g
transform="translate(0,433.23832)"
id="g4351-1">
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-4-15"
width="85.427803"
height="37.142868"
x="-502.58875"
y="506.45667"
transform="matrix(0,-1,1,0,0,0)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1-6-64"
width="118.51518"
height="37.142868"
x="-624.97186"
y="-454.3038"
transform="scale(-1,-1)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1-8-7-9"
width="117.19617"
height="37.142868"
x="-623.65283"
y="-510.8382"
transform="scale(-1,-1)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-4-1-5"
width="72.800896"
height="37.142868"
x="-552.87671"
y="586.50995"
transform="matrix(0,-1,1,0,0,0)" />
<rect
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901"
id="rect3336-9-4-98-1-6-6-6"
width="118.51518"
height="37.142868"
x="-623.65283"
y="-567.37256"
transform="scale(-1,-1)" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -0,0 +1,52 @@
/* FontSub by Katayama Hirofumi MZ
*
* To the extent possible under law, the person who associated CC0 with
* FontSub has waived all copyright and related or neighboring rights
* to FontSub.
*
* You should have received a copy of the CC0 legalcode along with this
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#include <windef.h>
#include <winuser.h>
#include <dlgs.h>
#include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Font Substitute Editor"
#define REACTOS_STR_INTERNAL_NAME "fontsub"
#define REACTOS_STR_ORIGINAL_FILENAME "fontsub.exe"
#include <reactos/version.rc>
/* UTF-8 */
#pragma code_page(65001)
1 ICON "fontsub.ico"
2 BITMAP "up.bmp"
3 BITMAP "down.bmp"
4 BITMAP "nil.bmp"
#ifdef LANGUAGE_DE_DE
#include "lang/de-DE.rc"
#endif
#ifdef LANGUAGE_EN_US
#include "lang/en-US.rc"
#endif
#ifdef LANGUAGE_JA_JP
#include "lang/ja-JP.rc"
#endif
#ifdef LANGUAGE_RU_RU
#include "lang/ru-RU.rc"
#endif
1 ACCELERATORS
BEGIN
"O", ID_IMPORT, CONTROL, VIRTKEY
"S", ID_EXPORT, CONTROL, VIRTKEY
"N", ID_NEW, CONTROL, VIRTKEY
"L", ID_RELOAD, CONTROL, VIRTKEY
"U", ID_UPDATE_REGISTRY, CONTROL, VIRTKEY
END

View file

@ -0,0 +1,106 @@
/* FontSub by Katayama Hirofumi MZ
*
* To the extent possible under law, the person who associated CC0 with
* FontSub has waived all copyright and related or neighboring rights
* to FontSub.
*
* You should have received a copy of the CC0 legalcode along with this
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
/* UTF-8 */
#pragma code_page(65001)
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
1 MENU
BEGIN
POPUP "&Datei"
BEGIN
MENUITEM "&Import von...\tStrg+O", ID_IMPORT
MENUITEM "&Export nach...\tStrg+S", ID_EXPORT
MENUITEM SEPARATOR
MENUITEM "Neu&laden aus Registry\tStrg+L", ID_RELOAD
MENUITEM "&Registry aktualisieren\tStrg+U", ID_UPDATE_REGISTRY
MENUITEM SEPARATOR
MENUITEM "Öffne in Reg&edit", ID_OPEN_REGKEY
MENUITEM SEPARATOR
MENUITEM "B&eenden\tAlt+F4", ID_EXIT
END
POPUP "&Bearbeiten"
BEGIN
MENUITEM "&Neues Item\tStrg+N", ID_NEW
MENUITEM SEPARATOR
MENUITEM "B&earbeite Item\tEnter", ID_EDIT
MENUITEM SEPARATOR
MENUITEM "&Lösche Item\tEntf", ID_DELETE
END
POPUP "&Hilfe"
BEGIN
MENUITEM "&Über...", ID_ABOUT
END
END
2 MENU
BEGIN
POPUP "Popup"
BEGIN
MENUITEM "&Neues Item\tStrg+N", ID_NEW
MENUITEM SEPARATOR
MENUITEM "B&earbeite Item\tEnter", ID_EDIT
MENUITEM SEPARATOR
MENUITEM "&Lösche Item\tDel", ID_DELETE
END
END
STRINGTABLE
BEGIN
IDS_TITLE, "Font Substitute Editor"
IDS_FONTNAME, "Schriftname"
IDS_SUBSTITUTE, "Ersetzung"
IDS_ENTERNAME, "(Geben Sie einen Schriftnamen ein...)"
IDS_IMPORT, "Import"
IDS_EXPORT, "Export"
IDS_CANTIMPORT, "Import fehlgeschlagen."
IDS_CANTEXPORT, "Export fehlgeschlagen."
IDS_INPFILTER, "Registrierungsdateien (*.reg)|*.reg|Alle Dateien (*.*)|*.*|"
IDS_OUTFILTER, "Registrierungsdateien (*.reg)|*.reg|"
IDS_QUERYUPDATE, "Ersetzungsinfo wurde verändert. Registrierung aktualisieren?"
IDS_ALREADYEXISTS, "Der selbe Name existiert bereits."
IDS_ENTERNAME2, "Geben Sie den Schriftnamen ein."
IDS_QUERYDELETE, "Möchten Sie das Item wirklich löschen?"
IDS_CANTOPENKEY, "Registrierungsschlüssel konnte nicht geöffnet werden."
IDS_REBOOTNOW, "Registrierung wurde aktualisiert. Möchten Sie das System Neustarten?"
IDS_ABOUT, "FontSub (Font Substitute Editor) Version 0.5\r\nvon Katayama Hirofumi MZ und dem ReactOS Team\r\n\r\nDiese Software wurde unter CC0 1.0 Lizenz veröffentlicht."
END
IDD_ADD DIALOGEX 0, 0, 315, 65
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "Ersetzung hinzufügen"
FONT 10, "MS Shell Dlg"
BEGIN
CONTROL "Schrift&name:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 5, 55, 15
CONTROL "", cmb1, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 6, 120, 120
CONTROL "", cmb3, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 6, 115, 120
CONTROL "Er&setzung:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 25, 55, 15
CONTROL "", cmb2, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 26, 120, 120
CONTROL "", cmb4, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 26, 115, 120
CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 175, 45, 60, 14
CONTROL "Abbrechen", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 240, 45, 60, 14
END
IDD_EDIT DIALOGEX 0, 0, 315, 65
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "Ersetzung bearbeiten"
FONT 10, "MS Shell Dlg"
BEGIN
CONTROL "Schrift&name:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 5, 55, 15
CONTROL "", edt1, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 70, 6, 120, 14
CONTROL "", cmb3, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 6, 115, 120
CONTROL "Er&setzung:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 25, 55, 15
CONTROL "", cmb2, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 26, 120, 120
CONTROL "", cmb4, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 26, 115, 120
CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 175, 45, 60, 14
CONTROL "Abbrechen", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 240, 45, 60, 14
CONTROL "&Löschen", psh1, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 45, 60, 14
END

View file

@ -0,0 +1,106 @@
/* FontSub by Katayama Hirofumi MZ
*
* To the extent possible under law, the person who associated CC0 with
* FontSub has waived all copyright and related or neighboring rights
* to FontSub.
*
* You should have received a copy of the CC0 legalcode along with this
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
/* UTF-8 */
#pragma code_page(65001)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
1 MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Import From...\tCtrl+O", ID_IMPORT
MENUITEM "&Export To...\tCtrl+S", ID_EXPORT
MENUITEM SEPARATOR
MENUITEM "Re&load from Registry\tCtrl+L", ID_RELOAD
MENUITEM "Update &Registry\tCtrl+U", ID_UPDATE_REGISTRY
MENUITEM SEPARATOR
MENUITEM "Open in Reg&edit", ID_OPEN_REGKEY
MENUITEM SEPARATOR
MENUITEM "E&xit\tAlt+F4", ID_EXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "&New Item\tCtrl+N", ID_NEW
MENUITEM SEPARATOR
MENUITEM "&Edit Item\tEnter", ID_EDIT
MENUITEM SEPARATOR
MENUITEM "&Delete Item\tDel", ID_DELETE
END
POPUP "&Help"
BEGIN
MENUITEM "&About...", ID_ABOUT
END
END
2 MENU
BEGIN
POPUP "Popup"
BEGIN
MENUITEM "&New Item\tCtrl+N", ID_NEW
MENUITEM SEPARATOR
MENUITEM "&Edit Item\tEnter", ID_EDIT
MENUITEM SEPARATOR
MENUITEM "&Delete Item\tDel", ID_DELETE
END
END
STRINGTABLE
BEGIN
IDS_TITLE, "Font Substitutes Editor"
IDS_FONTNAME, "Font Name"
IDS_SUBSTITUTE, "Substitute"
IDS_ENTERNAME, "(Please enter a font name...)"
IDS_IMPORT, "Import"
IDS_EXPORT, "Export"
IDS_CANTIMPORT, "Could not import."
IDS_CANTEXPORT, "Could not export."
IDS_INPFILTER, "Registry Files (*.reg)|*.reg|All Files (*.*)|*.*|"
IDS_OUTFILTER, "Registry Files (*.reg)|*.reg|"
IDS_QUERYUPDATE, "Substitutes info has been modified. Update registry now?"
IDS_ALREADYEXISTS, "The same name already exists."
IDS_ENTERNAME2, "Enter the font name."
IDS_QUERYDELETE, "Do you really want to delete this item?"
IDS_CANTOPENKEY, "Could not open the registry key."
IDS_REBOOTNOW, "Registry was updated. Reboot system now?"
IDS_ABOUT, "FontSub (Font Substitute Editor) Version 0.5\r\nby Katayama Hirofumi MZ and The ReactOS Team\r\n\r\nThis software was released under CC0 1.0 license."
END
IDD_ADD DIALOGEX 0, 0, 315, 65
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "Add Substitute Item"
FONT 10, "MS Shell Dlg"
BEGIN
CONTROL "Font &Name:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 5, 55, 15
CONTROL "", cmb1, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 6, 120, 120
CONTROL "", cmb3, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 6, 115, 120
CONTROL "&Substitute:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 25, 55, 15
CONTROL "", cmb2, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 26, 120, 120
CONTROL "", cmb4, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 26, 115, 120
CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 175, 45, 60, 14
CONTROL "Cancel", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 240, 45, 60, 14
END
IDD_EDIT DIALOGEX 0, 0, 315, 65
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "Edit Substitute Item"
FONT 10, "MS Shell Dlg"
BEGIN
CONTROL "Font &Name:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 5, 55, 15
CONTROL "", edt1, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 70, 6, 120, 14
CONTROL "", cmb3, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 6, 115, 120
CONTROL "&Substitute:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 25, 55, 15
CONTROL "", cmb2, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 26, 120, 120
CONTROL "", cmb4, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 26, 115, 120
CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 175, 45, 60, 14
CONTROL "Cancel", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 240, 45, 60, 14
CONTROL "&Delete", psh1, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 45, 60, 14
END

View file

@ -0,0 +1,106 @@
/* FontSub by Katayama Hirofumi MZ
*
* To the extent possible under law, the person who associated CC0 with
* FontSub has waived all copyright and related or neighboring rights
* to FontSub.
*
* You should have received a copy of the CC0 legalcode along with this
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
/* UTF-8 */
#pragma code_page(65001)
LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
1 MENU
BEGIN
POPUP "ファイル(&F)"
BEGIN
MENUITEM "インポート(&I)...\tCtrl+O", ID_IMPORT
MENUITEM "エクスポート(&E)...\tCtrl+S", ID_EXPORT
MENUITEM SEPARATOR
MENUITEM "レジストリから再読み込み(&L)\tCtrl+L", ID_RELOAD
MENUITEM "レジストリの更新(&R)\tCtrl+U", ID_UPDATE_REGISTRY
MENUITEM SEPARATOR
MENUITEM "Regeditで開く(&E)", ID_OPEN_REGKEY
MENUITEM SEPARATOR
MENUITEM "終了(&X)\tAlt+F4", ID_EXIT
END
POPUP "編集(&E)"
BEGIN
MENUITEM "新しい項目(&N)\tCtrl+N", ID_NEW
MENUITEM SEPARATOR
MENUITEM "項目の編集(&E)\tEnter", ID_EDIT
MENUITEM SEPARATOR
MENUITEM "項目の削除(&D)\tDel", ID_DELETE
END
POPUP "ヘルプ(&H)"
BEGIN
MENUITEM "バージョン情報(&A)...", ID_ABOUT
END
END
2 MENU
BEGIN
POPUP "ポップアップ"
BEGIN
MENUITEM "新しい項目(&N)\tCtrl+N", ID_NEW
MENUITEM SEPARATOR
MENUITEM "項目の編集(&E)\tEnter", ID_EDIT
MENUITEM SEPARATOR
MENUITEM "項目の削除(&D)\tDel", ID_DELETE
END
END
STRINGTABLE
BEGIN
IDS_TITLE, "フォント代替エディタ"
IDS_FONTNAME, "フォント名"
IDS_SUBSTITUTE, "代替名"
IDS_ENTERNAME, "(フォント名を入力して下さい...)"
IDS_IMPORT, "インポート"
IDS_EXPORT, "エクスポート"
IDS_CANTIMPORT, "インポートできません。"
IDS_CANTEXPORT, "エクスポートできません。"
IDS_INPFILTER, "レジストリ ファイル (*.reg)|*.reg|すべてのファイル (*.*)|*.*|"
IDS_OUTFILTER, "レジストリ ファイル (*.reg)|*.reg|"
IDS_QUERYUPDATE, "代替情報は変更されています。レジストリを更新しますか?"
IDS_ALREADYEXISTS, "すでに同じ名前が存在します。"
IDS_ENTERNAME2, "フォント名を入力して下さい。"
IDS_QUERYDELETE, "本当にこの項目を削除したいですか?"
IDS_CANTOPENKEY, "レジストリキーが開けませんでした。"
IDS_REBOOTNOW, "レジストリが更新されました。Windowsを再起動しますか"
IDS_ABOUT, "FontSub (Font Substitute Editor) Version 0.5\r\nby Katayama Hirofumi MZ and The ReactOS Team\r\n\r\nThis software was released under CC0 1.0 license."
END
IDD_ADD DIALOGEX 0, 0, 315, 65
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "代替項目を追加する"
FONT 10, "MS UI Gothic"
BEGIN
CONTROL "フォント名(&N):", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 5, 55, 15
CONTROL "", cmb1, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 6, 120, 120
CONTROL "", cmb3, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 6, 115, 120
CONTROL "代替名(&S):", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 25, 55, 15
CONTROL "", cmb2, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 26, 120, 120
CONTROL "", cmb4, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 26, 115, 120
CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 175, 45, 60, 14
CONTROL "キャンセル", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 240, 45, 60, 14
END
IDD_EDIT DIALOGEX 0, 0, 315, 65
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "代替項目を編集する"
FONT 10, "MS UI Gothic"
BEGIN
CONTROL "フォント名(&N):", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 5, 55, 15
CONTROL "", edt1, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 70, 6, 120, 14
CONTROL "", cmb3, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 6, 115, 120
CONTROL "代替名(&S):", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 25, 55, 15
CONTROL "", cmb2, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 26, 120, 120
CONTROL "", cmb4, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 26, 115, 120
CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 175, 45, 60, 14
CONTROL "キャンセル", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 240, 45, 60, 14
CONTROL "削除(&D)", psh1, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 45, 60, 14
END

View file

@ -0,0 +1,106 @@
/* FontSub by Katayama Hirofumi MZ
*
* To the extent possible under law, the person who associated CC0 with
* FontSub has waived all copyright and related or neighboring rights
* to FontSub.
*
* You should have received a copy of the CC0 legalcode along with this
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
/* UTF-8 */
#pragma code_page(65001)
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
1 MENU
BEGIN
POPUP "&Файл"
BEGIN
MENUITEM "&Импорт из...\tCtrl+O", ID_IMPORT
MENUITEM "&Экспорт в...\tCtrl+S", ID_EXPORT
MENUITEM SEPARATOR
MENUITEM "За&грузить из реестра\tCtrl+L", ID_RELOAD
MENUITEM "Записать в &реестр\tCtrl+U", ID_UPDATE_REGISTRY
MENUITEM SEPARATOR
MENUITEM "Открыть в Reg&edit", ID_OPEN_REGKEY
MENUITEM SEPARATOR
MENUITEM "В&ыход\tAlt+F4", ID_EXIT
END
POPUP "&Правка"
BEGIN
MENUITEM "&Создать\tCtrl+N", ID_NEW
MENUITEM SEPARATOR
MENUITEM "&Редактировать\tEnter", ID_EDIT
MENUITEM SEPARATOR
MENUITEM "&Удалить\tDel", ID_DELETE
END
POPUP "&Справка"
BEGIN
MENUITEM "О программ&е", ID_ABOUT
END
END
2 MENU
BEGIN
POPUP "Popup"
BEGIN
MENUITEM "&Добавить\tCtrl+N", ID_NEW
MENUITEM SEPARATOR
MENUITEM "&Редактировать\tEnter", ID_EDIT
MENUITEM SEPARATOR
MENUITEM "&Удалить\tDel", ID_DELETE
END
END
STRINGTABLE
BEGIN
IDS_TITLE, "Редактор таблицы соответствия шрифтов"
IDS_FONTNAME, "Шрифт"
IDS_SUBSTITUTE, "Замена"
IDS_ENTERNAME, "(Пожалуйста, выберите шрифт...)"
IDS_IMPORT, "Импорт"
IDS_EXPORT, "Экспорт"
IDS_CANTIMPORT, "Не удалось импортировать."
IDS_CANTEXPORT, "Не удалось экспортировать."
IDS_INPFILTER, "Файлы реестра (*.reg)|*.reg|Все файлы (*.*)|*.*|"
IDS_OUTFILTER, "Файлы реестра (*.reg)|*.reg|"
IDS_QUERYUPDATE, "Информация о соответствии шрифтов была обновлена.\r\nОбновить значения реестра сейчас?"
IDS_ALREADYEXISTS, "Шрифт с таким именем уже используется."
IDS_ENTERNAME2, "Введите имя шрифта."
IDS_QUERYDELETE, "Вы действительно хотите удалить этот элемент?"
IDS_CANTOPENKEY, "Не удалось открыть ключ реестра."
IDS_REBOOTNOW, "Реестр был обновлен. Перезагрузить систему сейчас?"
IDS_ABOUT, "FontSub (Редактор таблицы соответствия шрифтов) Версия 0.5\r\nот Katayama Hirofumi MZ и команды ReactOS.\r\n\r\nДанное программное обеспечение выпущено\r\nпод лицензией CC0 1.0."
END
IDD_ADD DIALOGEX 0, 0, 315, 65
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "Добавить соответствие шрифтов"
FONT 10, "MS Shell Dlg"
BEGIN
CONTROL "&Шрифт:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 5, 55, 15
CONTROL "", cmb1, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 6, 120, 120
CONTROL "", cmb3, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 6, 115, 120
CONTROL "&Замена:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 25, 55, 15
CONTROL "", cmb2, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 26, 120, 120
CONTROL "", cmb4, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 26, 115, 120
CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 175, 45, 60, 14
CONTROL "Отмена", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 240, 45, 60, 14
END
IDD_EDIT DIALOGEX 0, 0, 315, 65
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "Редактировать соответствие шрифтов"
FONT 10, "MS Shell Dlg"
BEGIN
CONTROL "&Шрифт:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 5, 55, 15
CONTROL "", edt1, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 70, 6, 120, 14
CONTROL "", cmb3, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 6, 115, 120
CONTROL "&Замена:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 25, 55, 15
CONTROL "", cmb2, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 26, 120, 120
CONTROL "", cmb4, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 26, 115, 120
CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 175, 45, 60, 14
CONTROL "Отмена", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 240, 45, 60, 14
CONTROL "У&далить", psh1, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 45, 60, 14
END

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,40 @@
/* FontSub by Katayama Hirofumi MZ
*
* To the extent possible under law, the person who associated CC0 with
* FontSub has waived all copyright and related or neighboring rights
* to FontSub.
*
* You should have received a copy of the CC0 legalcode along with this
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#define ID_NEW 100
#define ID_EDIT 101
#define ID_EXIT 102
#define ID_UPDATE_REGISTRY 103
#define ID_DELETE 104
#define ID_IMPORT 105
#define ID_EXPORT 106
#define ID_RELOAD 107
#define ID_ABOUT 108
#define ID_OPEN_REGKEY 109
#define IDD_ADD 1
#define IDD_EDIT 2
#define IDS_TITLE 1
#define IDS_FONTNAME 2
#define IDS_SUBSTITUTE 3
#define IDS_ENTERNAME 4
#define IDS_IMPORT 5
#define IDS_EXPORT 6
#define IDS_CANTIMPORT 7
#define IDS_CANTEXPORT 8
#define IDS_INPFILTER 9
#define IDS_OUTFILTER 10
#define IDS_QUERYUPDATE 11
#define IDS_ALREADYEXISTS 12
#define IDS_ENTERNAME2 13
#define IDS_QUERYDELETE 14
#define IDS_CANTOPENKEY 15
#define IDS_REBOOTNOW 16
#define IDS_ABOUT 17

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,5 @@
add_executable(gettype gettype.c)
set_module_type(gettype win32cui UNICODE)
add_importlibs(gettype shell32 mpr netapi32 msvcrt kernel32)
add_cd_file(TARGET gettype DESTINATION reactos/system32 FOR all)

View file

@ -0,0 +1,394 @@
/*
* ReactOS Win32 Applications
* Copyright (C) 2005 ReactOS Team
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS arp utility
* FILE: apps/utils/gettype/gettype.c
* PURPOSE:
* PROGRAMMERS: Brandon Turner (turnerb7@msu.edu)
* REVISIONS:
* GM 30/10/05 Created
*
* FIXME: gettype only supports local computer.
*/
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <lm.h>
#include <shellapi.h>
enum
{
GETTYPE_ROLE = 0x001,
GETTYPE_HELP = 0x002,
GETTYPE_SP = 0x004,
GETTYPE_VER = 0x008,
GETTYPE_MINV = 0x010,
GETTYPE_MAJV = 0x020,
GETTYPE_TYPE = 0x040,
GETTYPE_BUILD = 0x080
};
INT
GetVersionNumber(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
{
INT VersionNumber = 255;
if(pBuf102 != NULL && !bLocal)
{
VersionNumber = pBuf102->sv102_version_major * 1000;
VersionNumber += (pBuf102->sv102_version_minor * 100);
}
else if(bLocal)
{
VersionNumber = osvi->dwMajorVersion * 1000;
VersionNumber += (osvi->dwMinorVersion * 100);
}
return VersionNumber;
}
INT
GetMajValue(BOOL Major, BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
{
INT VersionNumber = 255;
if(pBuf102 != NULL && !bLocal)
{
if(Major)
VersionNumber = pBuf102->sv102_version_major * 1000;
else
VersionNumber = pBuf102->sv102_version_minor * 100;
}
else
{
if(Major)
VersionNumber = osvi->dwMajorVersion * 1000;
else
VersionNumber = osvi->dwMinorVersion * 100;
}
return VersionNumber;
}
INT
GetSystemRole(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
{
if(pBuf102 != NULL && !bLocal)
{
if ((pBuf102->sv102_type & SV_TYPE_DOMAIN_CTRL) ||
(pBuf102->sv102_type & SV_TYPE_DOMAIN_BAKCTRL))
return 1;
else if(pBuf102->sv102_type & SV_TYPE_SERVER_NT)
return 2;
else
return 3;
}
else
{
if(osvi->wProductType == VER_NT_DOMAIN_CONTROLLER)
return 1;
else if(osvi->wProductType == VER_NT_SERVER)
return 2;
else if(osvi->wProductType == VER_NT_WORKSTATION)
return 3;
}
return 255;
}
INT
GetServicePack(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102, TCHAR * Server)
{
INT SPNumber = 255;
if(!bLocal)
{
/* FIXME: Use Registry to get value */
}
else
{
SPNumber = osvi->wServicePackMajor;
}
return SPNumber;
}
INT
GetBuildNumber(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
{
INT BuildNum = 255;
if(!bLocal)
{
/* FIXME: Use Registry to get value */
}
else
{
BuildNum = osvi->dwBuildNumber;
}
return BuildNum;
}
INT GetType(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
{
if(bLocal)
{
if(osvi->dwMajorVersion == 5)
{
if(osvi->dwMinorVersion == 1)
{
if(osvi->wSuiteMask & VER_SUITE_PERSONAL)
return 1;
else
return 2;
}
else if(osvi->dwMinorVersion == 2)
{
if(osvi->wSuiteMask & VER_SUITE_BLADE)
return 6;
else if(osvi->wSuiteMask & VER_SUITE_DATACENTER)
return 5;
else if(osvi->wSuiteMask & VER_SUITE_ENTERPRISE)
return 4;
else
return 3;
}
}
}
else
{
/* FIXME: Get this value from registry */
}
return 255;
}
VOID
GetBasicInfo(LPOSVERSIONINFOEX osvi, TCHAR * HostName, TCHAR * OSName, TCHAR * Version, TCHAR * Role, TCHAR * Components)
{
/* Host Name - COMPUTERNAME*/
DWORD bufCharCount = 1024;
GetComputerName(HostName, &bufCharCount);
/* OSName - Windows XP Home Editition */
if(osvi->dwMajorVersion == 4)
{
_tcscpy(OSName, _T("Microsoft Windows NT 4.0 "));
}
else if(osvi->dwMajorVersion == 5)
{
if(osvi->dwMajorVersion == 0)
{
_tcscpy(OSName, _T("Microsoft Windows 2000 "));
}
else if(osvi->dwMinorVersion == 1)
{
_tcscpy(OSName, _T("Microsoft Windows XP "));
}
else if(osvi->dwMinorVersion == 2)
{
_tcscpy(OSName, _T("Microsoft Windows Server 2003 "));
}
}
else if(osvi->dwMajorVersion == 6)
{
_tcscpy(OSName, _T("Microsoft Windows Vista "));
}
else
{
_tcscpy(OSName, _T("Microsoft Windows "));
}
if(osvi->wSuiteMask & VER_SUITE_BLADE)
_tcscat(OSName, _T("Web Edition"));
if(osvi->wSuiteMask & VER_SUITE_DATACENTER)
_tcscat(OSName, _T("Datacenter"));
if(osvi->wSuiteMask & VER_SUITE_ENTERPRISE)
_tcscat(OSName, _T("Enterprise"));
if(osvi->wSuiteMask & VER_SUITE_EMBEDDEDNT)
_tcscat(OSName, _T("Embedded"));
if(osvi->wSuiteMask & VER_SUITE_PERSONAL)
_tcscat(OSName, _T("Home Edition"));
if(osvi->wSuiteMask & VER_SUITE_SMALLBUSINESS_RESTRICTED && osvi->wSuiteMask & VER_SUITE_SMALLBUSINESS)
_tcscat(OSName, _T("Small Bussiness Edition"));
/* Version - 5.1 Build 2600 Serivce Pack 2 */
_stprintf(Version, _T("%d.%d Build %d %s"),(int)osvi->dwMajorVersion,(int)osvi->dwMinorVersion,(int)osvi->dwBuildNumber, osvi->szCSDVersion);
/* Role - Workgroup / Server / Domain Controller */
if(osvi->wProductType == VER_NT_DOMAIN_CONTROLLER)
_tcscpy(Role, _T("Domain Controller"));
else if(osvi->wProductType == VER_NT_SERVER)
_tcscpy(Role, _T("Server"));
else if(osvi->wProductType == VER_NT_WORKSTATION)
_tcscpy(Role, _T("Workgroup"));
/* Components - FIXME: what is something that might be installed? */
_tcscat(Components, _T("Not Installed"));
}
INT
_tmain (VOID)
{
DWORD Operations = 0;
INT ret = 255;
INT i = 0;
INT argc = 0;
/* True if the target is local host */
BOOL bLocal = TRUE;
DWORD nStatus = 0;
TCHAR ServerName[32];
TCHAR RemoteResource[32];
TCHAR UserName[32] = _T("");
TCHAR Password[32] = _T("");
LPOSVERSIONINFOEX osvi = NULL;
LPSERVER_INFO_102 pBuf102 = NULL;
LPTSTR * argv;
osvi = (LPOSVERSIONINFOEX)malloc(sizeof(LPOSVERSIONINFOEX));
pBuf102 = (LPSERVER_INFO_102)malloc(sizeof(LPSERVER_INFO_102));
/* Get the command line correctly since it is unicode */
argv = CommandLineToArgvW(GetCommandLineW(), &argc);
/* Process flags */
if(argc)
{
for (i = 1; i < argc; i++)
{
if(!_tcsicmp(argv[i], _T("/ROLE")) && !Operations)
Operations |= GETTYPE_ROLE;
else if(!_tcsicmp(argv[i], _T("/VER")) && !Operations)
Operations |= GETTYPE_VER;
else if(!_tcsicmp(argv[i], _T("/MAJV")) && !Operations)
Operations |= GETTYPE_MAJV;
else if(!_tcsicmp(argv[i], _T("/MINV")) && !Operations)
Operations |= GETTYPE_MINV;
else if(!_tcsicmp(argv[i], _T("/SP")) && !Operations)
Operations |= GETTYPE_SP;
else if(!_tcsicmp(argv[i], _T("/BUILD")) && !Operations)
Operations |= GETTYPE_BUILD;
else if(!_tcsicmp(argv[i], _T("/TYPE")) && !Operations)
Operations |= GETTYPE_TYPE;
else if(!_tcsicmp(argv[i], _T("/?")) && !Operations)
Operations |= GETTYPE_HELP;
else if(!_tcsicmp(argv[i], _T("/S")) && i + 1 < argc)
{
_tcscpy(ServerName,argv[++i]);
bLocal = FALSE;
}
else if(!_wcsicmp(argv[i], L"/U") && i + 1 < argc)
_tcscpy(UserName,argv[++i]);
else if(!_wcsicmp(argv[i], L"/P") && i + 1 < argc)
_tcscpy(Password,argv[++i]);
else
{
wprintf(L"Error in paramters, please see usage\n");
return 255;
}
}
}
/* Some debug info */
//_tprintf(_T("%s - %s - %s - %d"), ServerName, UserName, Password, (int)Operations);
if(!bLocal)
{
NETRESOURCE nr;
/* \\*IP or Computer Name*\*Share* */
_stprintf(RemoteResource, _T("\\\\%s\\IPC$"), ServerName);
nr.dwType = RESOURCETYPE_ANY;
nr.lpLocalName = NULL;
nr.lpProvider= NULL;
nr.lpRemoteName = RemoteResource;
/* open a connection to the server with difference user/pass. */
nStatus = WNetAddConnection2(&nr, UserName[0]?UserName:NULL,Password[0]?Password:NULL, CONNECT_INTERACTIVE | CONNECT_COMMANDLINE);
if(nStatus != NO_ERROR)
{
_tprintf(_T("Error:%d-%d\n"),(int)nStatus,GetLastError());
return 255;
}
}
/* Use GetVersionEx for anything that we are looking for locally */
if(bLocal)
{
osvi->dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if(!GetVersionEx((LPOSVERSIONINFO)osvi))
{
_tprintf(_T("Failed to get local information\n"));
return 255;
}
}
else
{
nStatus = NetServerGetInfo(NULL,102,(LPBYTE *)&pBuf102);
if (nStatus != NERR_Success)
{
_tprintf(_T("Failed to connection to remote machine\n"));
return 255;
}
}
if(Operations & GETTYPE_VER)
{
ret = GetVersionNumber(bLocal, osvi, pBuf102);
}
else if(Operations & GETTYPE_MAJV)
{
ret = GetMajValue(TRUE, bLocal, osvi, pBuf102);
}
else if(Operations & GETTYPE_MINV)
{
ret = GetMajValue(FALSE, bLocal, osvi, pBuf102);
}
else if(Operations & GETTYPE_ROLE)
{
ret = GetSystemRole(bLocal, osvi, pBuf102);
}
else if(Operations & GETTYPE_SP)
{
ret = GetServicePack(bLocal, osvi, pBuf102, ServerName);
}
else if(Operations & GETTYPE_BUILD)
{
ret = GetBuildNumber(bLocal, osvi, pBuf102);
}
else if(Operations & GETTYPE_TYPE)
{
ret = GetType(bLocal, osvi, pBuf102);
}
else if(Operations & GETTYPE_HELP)
{
wprintf(L"GETTYPE [/ROLE | /SP | /VER | /MAJV | /MINV | /TYPE | /BUILD]");
ret = 0;
}
else if(!Operations && bLocal)
{
/* FIXME: what happens when no flags except remote machine, does it
it print this info for the remote server? */
TCHAR HostName[1024] = _T("");
TCHAR OSName[1024] = _T("");
TCHAR VersionInfo[1024] = _T("");
TCHAR Role[1024] = _T("");
TCHAR Components[1024] = _T("");
GetBasicInfo(osvi, HostName, OSName, VersionInfo, Role, Components);
_tprintf(_T("\nHostname: %s\nName: %s\nVersion:%s\n") ,HostName, OSName, VersionInfo);
_tprintf(_T("Role: %s\nComponent: %s\n"), Role, Components);
ret = 0;
}
/* Clean up some stuff that that was opened */
if(pBuf102)
NetApiBufferFree(pBuf102);
LocalFree(argv);
if(!bLocal)
{
WNetCancelConnection2(RemoteResource,0,TRUE);
}
return ret;
}

View file

@ -0,0 +1,5 @@
add_executable(kill kill.c kill.rc)
set_module_type(kill win32cui)
add_importlibs(kill ntdll user32 msvcrt kernel32)
add_cd_file(TARGET kill DESTINATION reactos/system32 FOR all)

View file

@ -0,0 +1,78 @@
/*
* ReactOS kill
* Copyright (C) 2003 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kill.exe
* FILE: apps/utils/kill/kill.c
* PURPOSE: Kill a running Process
* PROGRAMMER: Steven Edwards (Steven_Ed4153@yahoo.com)
*/
/* Thanks to David, Capser, Eric and others for the example code
* from the old shell.exe
*/
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
int
ExecuteKill(char * lpPid)
{
HANDLE hProcess;
DWORD dwProcessId;
dwProcessId = (DWORD) atol(lpPid);
fprintf( stderr, "Killing PID %ld...\n",dwProcessId);
hProcess = OpenProcess(
PROCESS_TERMINATE,
FALSE,
dwProcessId
);
if (NULL == hProcess)
{
fprintf( stderr, "Could not open the process with PID = %ld\n", dwProcessId);
return 0;
}
if (FALSE == TerminateProcess(
hProcess,
0
)
) {
fprintf( stderr, "Could not terminate the process with PID = %ld\n", dwProcessId);
return 0;
}
CloseHandle(hProcess);
return 0;
}
int main(int argc, char *argv[])
{
char tail;
DBG_UNREFERENCED_LOCAL_VARIABLE(tail);
if (argc < 2)
{
fprintf( stderr, "Usage: %s PID (Process ID) \n", argv[0] );
return 1;
}
tail = ExecuteKill(argv[1]);
return 0;
}

View file

@ -0,0 +1,5 @@
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS W32 Kill Process Utility\0"
#define REACTOS_STR_INTERNAL_NAME "kill\0"
#define REACTOS_STR_ORIGINAL_FILENAME "kill.exe\0"
#include <reactos/version.rc>

View file

@ -0,0 +1,8 @@
add_executable(logevent logevent.c logevent.rc)
set_module_type(logevent win32cui)
if(NOT MSVC)
add_target_compile_flags(logevent "-Wno-unused-but-set-variable")
endif()
add_importlibs(logevent advapi32 msvcrt kernel32)
add_cd_file(TARGET logevent DESTINATION reactos/system32 FOR all)

View file

@ -0,0 +1,205 @@
/*
* ReactOS Win32 Applications
* Copyright (C) 2007 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* COPYRIGHT : See COPYING in the top level directory
* PROJECT : Event Logging Utility
* FILE : logevent.c
* PROGRAMMER: Marc Piulachs (marc.piulachs at codexchange [dot] net)
*/
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <tchar.h>
#include <stdarg.h>
TCHAR* m_MachineName = NULL;
TCHAR* m_Text = "No User Event Text";
TCHAR* m_Source = "User Event";
WORD m_Severity = EVENTLOG_INFORMATION_TYPE;
WORD m_Category = 0;
DWORD m_EventID = 1;
void
Usage(VOID)
{
fputs("Usage: logevent.exe [-m \\MachineName] [options] \"Event Text\"", stderr);
fputs("\n\n", stderr);
fputs("Options:\n", stderr);
fputs(" -s Severity one of:\n", stderr);
fputs(" \t(S)uccess\n", stderr);
fputs(" \t(I)nformation\n", stderr);
fputs(" \t(W)arning\n", stderr);
fputs(" \t(E)rror\n", stderr);
fputs(" \t(F)ailure\n", stderr);
fputs(" -r Source\n", stderr);
fputs(" -c Category number\n", stderr);
fputs(" -e Event ID\n", stderr);
fputs(" /? Help\n", stderr);
}
void
WriteEvent (VOID)
{
HANDLE hAppLog;
BOOL bSuccess;
LPCTSTR arrLogEntry[] = { m_Text }; //writing just one entry
/* Get a handle to the Application event log */
hAppLog = RegisterEventSource(
(LPCSTR)m_MachineName, /* machine */
(LPCSTR)m_Source); /* source name */
/* Now report the event, which will add this event to the event log */
bSuccess = ReportEvent(
hAppLog, /* event-log handle */
m_Severity, /* event type */
m_Category, /* category */
m_EventID, /* event ID */
NULL, /* no user SID */
1, /* number of substitution strings */
0, /* no binary data */
arrLogEntry, /* string array */
NULL); /* address of data */
DeregisterEventSource(hAppLog);
return;
}
/* Parse command line parameters */
static BOOL ParseCmdline(int argc, TCHAR **argv)
{
INT i;
BOOL ShowUsage;
BOOL FoundEventText;
BOOL InvalidOption;
if (argc < 2) {
ShowUsage = TRUE;
} else {
ShowUsage = FALSE;
}
FoundEventText = FALSE;
InvalidOption = FALSE;
for (i = 1; i < argc; i++) {
if (argv[i][0] == '-' || argv[i][0] == '/') {
switch (argv[i][1]) {
case 's':
case 'S':
switch (argv[i + 1][0])
{
case 's':
case 'S':
m_Severity = EVENTLOG_SUCCESS;
i++;
break;
case 'i':
case 'I':
m_Severity = EVENTLOG_INFORMATION_TYPE;
i++;
break;
case 'w':
case 'W':
m_Severity = EVENTLOG_WARNING_TYPE;
i++;
break;
case 'e':
case 'E':
m_Severity = EVENTLOG_ERROR_TYPE;
i++;
break;
case 'f':
case 'F':
m_Severity = EVENTLOG_ERROR_TYPE;
i++;
break;
default:
printf("Bad option %s.\n", argv[i]);
Usage();
return FALSE;
}
break;
case 'm':
case 'M':
m_MachineName = argv[i + 1];
i++;
break;
case 'r':
case 'R':
m_Source = argv[i + 1];
i++;
break;
case 'c':
case 'C':
m_Category = atoi(argv[i + 1]);
i++;
break;
case 'e':
case 'E':
m_EventID = atoi(argv[i + 1]);
i++;
break;
case '?':
ShowUsage = TRUE;
break;
default:
printf("Bad option %s.\n", argv[i]);
Usage();
return FALSE;
}
if (InvalidOption) {
printf("Bad option format %s.\n", argv[i]);
return FALSE;
}
} else {
if (FoundEventText) {
printf("Bad parameter %s.\n", argv[i]);
return FALSE;
} else {
m_Text = argv[i];
FoundEventText = TRUE;
}
}
}
if ((!ShowUsage) && (!FoundEventText)) {
printf("The event text must be specified.\n");
return FALSE;
}
if (ShowUsage) {
Usage();
return FALSE;
}
return TRUE;
}
int main(int argc, char **argv)
{
if (ParseCmdline(argc, argv))
WriteEvent ();
return 0;
}

View file

@ -0,0 +1,5 @@
#define REACTOS_STR_FILE_DESCRIPTION "Win32 logevent utility\0"
#define REACTOS_STR_INTERNAL_NAME "logevent\0"
#define REACTOS_STR_ORIGINAL_FILENAME "logevent.exe\0"
#include <reactos/version.rc>

View file

@ -0,0 +1,6 @@
add_executable(lsdd lsdd.c lsdd.rc)
set_module_type(lsdd win32cui)
target_link_libraries(lsdd win32err)
add_importlibs(lsdd user32 msvcrt kernel32)
add_cd_file(TARGET lsdd DESTINATION reactos/system32 FOR all)

View file

@ -0,0 +1,125 @@
/*
* FILE : lsdd.c
* AUTHOR: Emanuele ALIBERTI
* DATE : 2000-08-04
* DESC : List DOS devices, i.e. symbolic links created
* in the \?? object manager's name space.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <reactos/buildno.h>
#include "../win32err.h"
#define LINKS_SIZE 32768
#define DEVICE_SIZE 8192
static const LPWSTR error_prefix = L"lsdd: ";
static char SymbolicLinks [LINKS_SIZE];
static char DosDeviceName [DEVICE_SIZE];
static char DeviceNames [DEVICE_SIZE];
static char DeviceName [DEVICE_SIZE];
BOOL
WINAPI
GetNextString (
char * BufferIn,
char * BufferOut,
char ** Next
)
{
char * next = *Next;
char * w;
if ('\0' == *next) return FALSE;
for ( w = BufferOut;
('\0' != *next);
next ++
)
{
*(w ++) = *next;
}
*w = '\0';
*Next = ++ next;
return TRUE;
}
int
main (int argc, char * argv [] )
{
printf (
"ReactOS/Win32 %s - List DOS Devices Utility\n"
"Written by E.Aliberti (%s)\n\n",
KERNEL_VERSION_STR,
__DATE__
);
if (0 != QueryDosDevice (
NULL, /* dump full directory */
SymbolicLinks,
sizeof SymbolicLinks
)
)
{
char * NextDosDevice = SymbolicLinks;
char * NextDevice;
while (TRUE == GetNextString (
SymbolicLinks,
DosDeviceName,
& NextDosDevice
)
)
{
printf ("%s\n", DosDeviceName);
if (0 != QueryDosDevice (
DosDeviceName,
DeviceNames,
sizeof DeviceNames
)
)
{
NextDevice = DeviceNames;
while (TRUE == GetNextString (
DeviceNames,
DeviceName,
& NextDevice
)
)
{
printf (" -> \"%s\"\n", DeviceName);
}
}
else
{
PrintWin32Error (
error_prefix,
GetLastError ()
);
}
printf ("\n");
}
}
else
{
PrintWin32Error (
error_prefix,
GetLastError ()
);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
/* EOF */

View file

@ -0,0 +1,5 @@
#define REACTOS_STR_FILE_DESCRIPTION "Tool to list the device names visible to the W32 subsystem (also known as DOS Devices).\0"
#define REACTOS_STR_INTERNAL_NAME "lsdd\0"
#define REACTOS_STR_ORIGINAL_FILENAME "lsdd.exe\0"
#include <reactos/version.rc>

View file

@ -0,0 +1,5 @@
add_executable(man man.c)
set_module_type(man win32cui)
add_importlibs(man user32 msvcrt kernel32 ntdll)
add_cd_file(TARGET man DESTINATION reactos/system32 FOR all)

View file

@ -0,0 +1,235 @@
/*
* FILE : man.c
* NATIVE NAME: ReactOS manual browser
* AUTHOR : Semyon Novikov (tappak)
* PROJECT : ReactOS Operating System
* DESCRIPTION: manual file browser (Use Linux man file syntax)
* DATE : 2004-03-29
* LICENSE : GPL
*/
/* Known issues.
* 1. Scroll screen
* 2. Non ENVIRONMENT manpath varrible
* 3. At the end of man page must be ./" tag!
*/
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <wincon.h>
#define MAXLINE 256
#define BOLD 7|9
#define ITALIC 3|9
#define NORMAL 7|0
/*===[functions]===*/
void SetCl(WORD cl);
int OpenF(char* name);
int CloseF(void);
void Usage(void);
int AnalyzeArgv(char *);
int AnalyzeFile();
/*=================*/
/*====[Globals]====*/
FILE* manfile;
char OpenFlag=0;
char manpath[MAXLINE]="c:\\man\\";
/*=================*/
void
SetCl(WORD cl)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),cl);
}
int
OpenF(char* name)
{
int retval=0;
char *manpath_local=(char*)malloc(sizeof(char)*MAXLINE);
strcpy(manpath_local, manpath); //save mandir value
if((manfile=fopen((strcat(manpath_local,name)),"r"))!=NULL)
{
OpenFlag=1;
AnalyzeFile();
}
else
retval=-1;
free(manpath_local);
return retval;
}
int
CloseF()
{
int retval=0;
if(fclose(manfile))
OpenFlag=0;
else retval=-1;
return retval;
}
void
Usage()
{
puts("usage: man [command]");
puts("see \"man man\" for details");
}
int
AnalyzeArgv(char *argument)
{
int element=0;
char HelpFlag=0;
char *keys[]={"--help","/h","/?","-h"};
char *sections[]={".1",".2",".3",".4",".5",".6",".7",".8",".9"};
char *filename=(char*)malloc(sizeof(char)*MAXLINE);
strcpy(filename,argument); //save argument value
for(element=0; element < 5;element++)
if(!strcmp(keys[element],argument))
{
Usage();
HelpFlag=1;
}
element = 0;
if(!HelpFlag)
if(OpenF(filename))
while(OpenF(strcat(filename,sections[element])) && (element<9))
{
strcpy(filename,argument);
element++;
}
if(element>8) printf("No manual for %s\n",argument);
return element;
}
void sh_outp(char *cur_string)
{
int symbol;
putchar('\n');
putchar('\n');
for(symbol=3;putchar(cur_string[symbol]); symbol++);
}
void th_outp(char *cur_string, char *THtag)
{
int symbol;
putchar('\n');
putchar('\n');
putchar('\t');
putchar('\t');
SetCl(ITALIC);
for(symbol=3;putchar(THtag[symbol]); symbol++);
putchar('\n');
SetCl(NORMAL);
}
void text_outp(char *cur_string)
{
int symbol=0;
if(cur_string[0]=='.')
while(cur_string[symbol]!=' ')
symbol++;
for(;cur_string[symbol]!='\n'; symbol++)
putchar(cur_string[symbol]);
putchar(' ');
}
int
AnalyzeFile()
{
char *cur_string=(char*)malloc(sizeof(char)*MAXLINE);
char *THtag=(char*)malloc(sizeof(char)*MAXLINE);
while(fgets(cur_string,MAXLINE,manfile))
/* TAGs processing */
if((cur_string[0]=='.')&&(cur_string[1]=='S')&&
(cur_string[2]=='H')) // .SH tag
{
SetCl(BOLD);
sh_outp(cur_string);
SetCl(NORMAL);
}
else
if((cur_string[0]=='.')&&(cur_string[1]=='I')&&
(cur_string[2]==' ')) // .I tag
{
SetCl(ITALIC);
text_outp(cur_string);
SetCl(NORMAL);
}
else
if((cur_string[0]=='.')&&(cur_string[1]=='/')&&
(cur_string[2]=='\"')); // ./" tag (comment)
else
if((cur_string[0]=='.')&&(cur_string[1]=='T')&&
(cur_string[2]=='H')) // .TH tag
{
strcpy(THtag,cur_string);
}
else
if((cur_string[0]=='.')&&(cur_string[1]=='B')&&
(cur_string[2]==' ')) // .B tag
{
SetCl(BOLD);
text_outp(cur_string);
SetCl(NORMAL);
}
else
if((cur_string[0]=='.')&&(cur_string[1]=='N')&&
(cur_string[2]=='L'))
{
putchar('\n');
putchar(' ');
}
else text_outp(cur_string); // print plane text
th_outp(cur_string, THtag);
/* END of TAGs processing */
free(cur_string);
free(THtag);
return 0;
}
int
main(int argc, char *argv[])
{
switch(argc)
{
case 1: Usage(); break;
case 2: AnalyzeArgv(argv[1]);break;
default: Usage();break;
}
if(OpenFlag)CloseF();
SetCl(NORMAL);
return 0;
}

View file

@ -0,0 +1,54 @@
@echo off
rem []------[ReactOS MAN Project ]--------[]
rem Project: ReactOS manual browser
rem File: man.cmd
rem Purpose: Clone of UNIX man
rem Programmers: Semyon Novikov
rem Version: 0.1.2
rem OS: WinNT/ReactOS/os2 eCs(testing)
rem License: GPL
rem []------------------------------------[]
rem []==[Config area]==[]
set MANED=edit
set MANMORE=cat
set MAN=c:\ReactOS\man
rem []==[End of config area]==[]
goto chk_param
:chk_param
if "%4"=="/create" attrib -r %MAN%\%SECTION%\%1.man
if "%4"=="/create" %ED% %MAN%\%SECTION%\%1.man
if "%4"=="/create" goto end
if "%2"=="/e" set ED=%MANED%
if "%2"=="/e" goto locate
if "%3"=="/e" set ED=%MANED%
if "%3"=="/e" goto chk_section
if "%2"=="" set ED=%MANMORE%
if "%2"=="" goto locate
:chk_section
set SECTION=%2
set ED=%MANMORE%
if "%3"=="/e" set ED=%MANED%
goto open_page
:locate
if exist %MAN%\1\%1.man set SECTION=1
if exist %MAN%\2\%1.man set SECTION=2
if exist %MAN%\3\%1.man set SECTION=3
if exist %MAN%\4\%1.man set SECTION=4
if exist %MAN%\5\%1.man set SECTION=5
:open_page
if not exist %MAN%\%SECTION%\%1.man echo No manual for %1
if exist %MAN%\%SECTION%\%1.man cls
if exist %MAN%\%SECTION%\%1.man %ED% %MAN%\%SECTION%\%1.man
:end

View file

@ -0,0 +1,13 @@
[]==============================[chkdsk.exe]===============================[]
Author: Mark Russinovich
Purpose: Disk checking tool
Port on ROS: Emanuele Aliberti
License: GPL
Usage: %s [drive:] [-F] [-V] [-R] [-C]\n\n\
[drive:] Specifies the drive to check.\n\
-F Fixes errors on the disk.\n\
-V Displays the full path of every file on the disk.\n\
-R Locates bad sectors and recovers readable information.\n\
-C Checks the drive only if it is dirty.\n\n"

View file

@ -0,0 +1,8 @@
[]===============================[chklib.exe]================================[]
Purpose: Check a Dynamic Link Library (DLL) for loading
Author: Emanuele Aliberti
License: GPL
Usage: chklib.exe module [symbol [, ...]]

View file

@ -0,0 +1,22 @@
[]=================================[format.com]==============================[]
Author: Mark Russinovich
Purpose: Disk Format Utility
Port on ROS: Emanuele Aliberti
License: GPL
Usage: format.com drive: [-FS:file-system] [-V:label] [-Q] [-A:size] [-C]
[drive:] Specifies the drive to format.
-FS:file-system Specifies the type of file system (e.g. FAT).
-V:label Specifies volume label.
-Q Performs a quick format.
-A:size Overrides the default allocation unit size.
Default settings are strongly recommended for general
use NTFS supports 512, 1024, 2048, 4096, 8192, 16K,
32K, 64K. FAT supports 8192, 16K, 32K, 64K, 128K, 256K.
NTFS compression is not supported for allocation
unit sizes above 4096.
-C Files created on the new volume will be compressed by
default.

View file

@ -0,0 +1,21 @@
[]=========================[ReactOS Man project]========================[]
Author: Semyon Novikov <tappak>
Purpose: ReactOS manual browser and manual pages
License: GPL
1. Built in cmd.exe commands
2. Console utils
3. GUI utils
4. Developer tools
5. Games & other
options: /e - open with editor
/create - create new page
Usage: man [command] [section] [/e] [/create]
Example: o man man
o man man /e
o man man 2
o man quake3 5 /e /create

View file

@ -0,0 +1,13 @@
[]==============================[ping.exe]=======================================[]
Ptoject: ReactOS ping utility
Purpose: Network test utility
Programmers: Casper S. Hornstrup (chorns@users.sourceforge.net)
Usage: ping [-t] [-n count] [-l size] [-w timeout] destination-host\n\n
-t Ping the specified host until stopped.
To stop - type Control-C.
-n count Number of echo requests to send.
-l size Send buffer size.
-w timeout Timeout in milliseconds to wait for each reply.

View file

@ -0,0 +1,8 @@
[]=====================[ReactOS GUI task Manager]======================[]
Author: Brian Palmer
Purpose: ROS task manager
License: GPL

View file

@ -0,0 +1,78 @@
.\" Process this file with
.\" groff -man -Tascii foo.1
.\"
.TH FOO 1 "MARCH 1995" Linux "User Manuals"
.SH NAME
foo \- frobnicate the bar library
.SH SYNOPSIS
.B foo [-bar] [-c
.I config-file
.B ]
.I file
.B ...
.SH DESCRIPTION
.B foo
frobnicates the bar library by tweaking internal
symbol tables. By default it parses all baz segments
and rearranges them in reverse order by time for the
.BR xyzzy (1)
linker to find them. The symdef entry is then compressed
using the WBG (Whiz-Bang-Gizmo) algorithm.
All files are processed in the order specified.
.SH OPTIONS
.IP -b
Do not write 'busy' to stdout while processing.
.IP "-c config-file"
Use the alternate system wide
.I config-file
instead of
.IR /etc/foo.conf .
This overrides any
.B FOOCONF
environment variable.
.IP -a
In addition to the baz segments, also parse the
blurfl headers.
.IP -r
Recursive mode. Operates as fast as lightning
at the expense of a megabyte of virtual memory.
.SH FILES
.I /etc/foo.conf
.RS
The system wide configuration file. See
.BR foo (5)
for further details.
.RE
.I ~/.foorc
.RS
Per user configuration file. See
.BR foo (5)
for further details.
.SH ENVIRONMENT
.IP FOOCONF
If non-null the full pathname for an alternate system wide
.IR foo.conf .
Overridden by the
.B -c
option.
.SH DIAGNOSTICS
The following diagnostics may be issued on stderr:
Bad magic number.
.RS
The input file does not look like an archive file.
.RE
Old style baz segments.
.RS
.B foo
can only handle new style baz segments. COBOL
object libraries are not supported in this version.
.SH BUGS
The command name should have been chosen more carefully
to reflect its purpose.
.SH AUTHOR
Jens Schweikhardt <schweikh@noc.dfn.de>
.SH "SEE ALSO"
.BR bar (1),
.BR foo (5),
.BR xyzzy (1)

View file

@ -0,0 +1,100 @@
./" My first man page for ReactOS :)
.TH ReactOS manual project 2004
.SH NAME
man.exe - manual browser for ReactOS
.SH SYNOPSIS
.B man [
.I manual page
.B ]
.SH DESCRIPTION
This project is UNIX(tm) man compatible tool for ReactOS.
.NL
Manual browser support next tags:
.NL
.I ./"
as comment tag
.NL
.I .NL
as "new line" tag (ReactOS only)
.NL
.I .B
as "bold" tag
.NL
.I .I
as "italic" tag
.NL
.I .SH
as part tag
.NL
.I .TH
as page descriptor
.NL
.SH OPTIONS
At this moment man support only
.B "/?, /h, -h, --help"
arguments :)
.SH FILES
Now all of manual pages must be in
.B c:\man\
directory. This is hack or
bug, i don't know... We planed use ENVIRONMENT
varrible to set manual path.
.NL
Manual files should have extension which marks section of his content.
.NL
.SH SECTIONS
.B (1)
basic commands. (dir,del,man,etc...)
.NL
.B (2)
kernel calls
.NL
.B (3)
calls from system librares
.NL
.B (4)
device files or devices
.NL
.B (5)
file syntax description
.NL
.B (6)
games
.NL
.B (7)
different information (such as licences, manifestos, etc...)
.NL
.B (8)
administration tools (Admin or root only)
.NL
.B (9)
additional kernel information
.NL
.SH ENVIRONMENT
Comming soon
.SH BUGS
Heh... A lot of. For example:
.NL
.I Scroll-bug
man can't correctly scroll screen
.NL
.I .NL hack
tag who absent in original man
.NL
.I ./" hack
at the end of man file must be ./" tag
.NL
.I putchar() method
all text displays with putchar() function.
.NL
And we have non correct word carry.
.SH AUTHOR
Semyon <tappak> Novikov
.NL
.I <tappak@freemail.ru>
.NL
Sorry for my English. I'm just a Russian first-year student.
./"

View file

@ -0,0 +1,7 @@
.B bold
.I italic
.SH section (BOLD string without /n)
.TH at the end (page comment)
.NL
.\" comment

View file

@ -0,0 +1,41 @@
Announcing the release of mkdosfs version 0.3b (Yggdrasil)
It seems I didn't get the bug completely fixed in 0.3a. Some
borderline cases would still allocate too many sectors for the FAT.
Again, nothing to worry about, just a nitpick -- this one would only
in certain cases add one sector per FAT.
Announcing the release of mkdosfs version 0.3a (Yggdrasil)
Fixed a bug which would cause too many sectors to be reserved for the
FAT (filesystem will still work fine, but have slightly less space
available).
Announcing the release of mkdosfs version 0.3 (Yggdrasil)
This version correctly handles even very large filesystems, and
properly supports the modern (3.3+) DOS bootsector format, including a
message printed on boot attempts.
Peter Anvin
Yggdrasil Computing, Inc.
hpa@yggdrasil.com
--------------
Announcing the release of mkdosfs version 0.2
I've just uploaded mkdosfs to sunsite.unc.edu. It works in a similar way
to Remy Card's mke2fs, but creates an MS-DOS file system.
The filename is mkdosfs-0.2.tar.gz.
This second release should fix a small bug that could lead to FAT sizes that
Linux's dosfs would accept but MS-DOS wouldn't.
The archive contains a manual page, binary and source versions.
Dave Hudson
dave@humbug.demon.co.uk

View file

@ -0,0 +1,347 @@
The GPL below is copyrighted by the Free Software
Foundation, but the instance of code that it refers to (the mkdosfs
utility is copyrighted by me
- David Hudson
----------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View file

@ -0,0 +1,18 @@
28th January 1995 H. Peter Anvin (hpa@yggdrasil.com)
Better algorithm to select cluster sizes on large filesystems.
Added bogus boot sector code that on attempts to boot prints a
message (which can be chosen at mkdosfs time) and lets the user
press any key and try again. Corrected support for 1.2 Mb
floppies. mkdosfs now generates the extended bootsector
(superblock) format of DOS 3.3+, with support for volume ID's and
volume labels (volume labels are also written to the root
directory, as they should).
18th February 1994 Dave Hudson (dave@humbug.demon.co.uk)
Released version 0.2 - clears a bug in the FAT sizing code.
1st September 1993 Dave Hudson (dave@humbug.demon.co.uk)
Released version 0.1 - ALPHA release of mkdosfs

View file

@ -0,0 +1,31 @@
OBJECTS = mkdosfs.o
all: mkdosfs
mkdosfs: $(OBJECTS)
$(CC) $(LDFLAGS) $^ -o $@
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
install: mkdosfs
mkdir -p $(SBINDIR) $(MANDIR)
install -m 755 mkdosfs $(SBINDIR)
install -m 644 mkdosfs.8 $(MANDIR)
rm -f $(SBINDIR)/mkfs.msdos
rm -f $(SBINDIR)/mkfs.vfat
ln -s mkdosfs $(SBINDIR)/mkfs.msdos
ln -s mkdosfs $(SBINDIR)/mkfs.vfat
rm -f $(MANDIR)/mkfs.msdos.8
ln -s mkdosfs.8 $(MANDIR)/mkfs.msdos.8
ln -s mkdosfs.8 $(MANDIR)/mkfs.vfat.8
clean :
echo *.o *.i *.s *~ \#*# core .#* .new*
rm -f *.o *.i *.s *~ \#*# core .#* .new*
distclean: clean
rm -f mkdosfs *.a *# *.orig *.rej TAGS
dep:

View file

@ -0,0 +1,50 @@
mkdosfs - Make DOS file system utilty.
I wrote this, partially to complement the dosfsck utility written by Werner
Almesberger (who graciously gave me some pointers when I asked for some
advice about writing this code), and also to avoid me having to boot DOS
just to create data partitions (I use Linux to back up DOS :-) ).
The code is really derived from Remy Card's mke2fs utility - I used this as a
framework, although all of the file system specific stuff was removed and the
DOS stuff inserted. I believe originally mke2fs was based on Linus' mkfs
code, hence the acknowledgements in the source code.
Neither Remy nor Linus have had any involvement with mkdosfs, so if there are
any bugs they're almost certainly "all my own work".
The code has been available for ftp since 1st September 1993, and I have yet
to receive any bug reports from users. I don't know of any bugs, but if you
do find a bug or have any constructive comments, please mail me!
The only bug I found with version 0.1 was an obscure fault that could lead
to an invalid (for MS-DOS, not Linux's dos fs) number of sectors used in the
file allocation table(s).
Dave Hudson
dave@humbug.demon.co.uk
FAT32 support
=============
mkdosfs now can also create filesystems in the new FAT32 format. To do
this, give mkdosfs a "-F 32" option. FAT32 isn't selected
automatically (yet), even if very large clusters are needed with
FAT16. With FAT32 you have two additional options, -R to select the
number of reserved sectors (usually 32), and -b to select the location
of the backup boot sector (default 6). Of course such a backup is
created, as well as the new info sector. On FAT32, the root directory
is always created as a cluster chain. Sorry, there's no switch to
generate an old static root dir.
One bigger bug fix besides FAT32 was to reject filesystems that need a
16 bit FAT to fit all possible clusters, but the bigger FAT needs some
more sectors, so the total number of clusters drop below the border
where MS-DOS expects a 12 bit FAT. So such filesystems would be FAT16,
but interpreted as FAT32 by DOS. The fix is to reduce filesystem size
a bit.
- Roman <Roman.Hodek@informatik.uni-erlangen.de>

View file

@ -0,0 +1,62 @@
/*
* This is an unpublished work copyright (c) 1998 HELIOS Software GmbH
* 30827 Garbsen, Germany
*/
#include <stdio.h>
#include <string.h>
#ifdef HAS_UNISTD
# include <unistd.h>
#endif
char *optarg;
int optind = 1;
int opterr = 1;
int optopt;
static int subopt;
static int suboptind = 1;
int getopt(int argc, char *const argv[], const char * optstring)
{
char *curopt;
char *p;
int cursubopt;
if (suboptind == optind-1 && argv[suboptind][subopt] != '\0') {
curopt = (char *)argv[suboptind];
} else {
curopt = (char *)argv[optind];
if (curopt == NULL || curopt[0] != '-' || strcmp(curopt, "-") == 0)
return -1;
suboptind = optind;
subopt = 1;
optind++;
if (strcmp(curopt, "--") == 0)
return -1;
}
cursubopt = subopt++;
if ((p = strchr(optstring, curopt[cursubopt])) == NULL) {
optopt = curopt[cursubopt];
if (opterr)
fprintf(stderr, "%s: illegal option -- %c\n", argv[0], optopt);
return '?';
}
if (p[1] == ':') {
if (curopt[cursubopt+1] != '\0') {
optarg = curopt+cursubopt+1;
suboptind++;
return p[0];
}
if (argv[optind] == NULL) {
optopt = p[0];
if (opterr)
fprintf(stderr, "%s: option requires an argument -- %c\n", argv[0], optopt);
if (*optstring == ':')
return ':';
return '?';
}
optarg = argv[optind++];
}
return p[0];
}

View file

@ -0,0 +1,19 @@
Begin3
Title: mkdosfs
Version: Yggdrasil 0.3b
Entered-date: 05MAY95
Description: A utility to create MS-DOS FAT filesystems under
Linux. This version uses the enhanced boot
sector/superblock format of DOS 3.3+ as well as
provides a default dummy boot sector code.
This is a bug fix release.
Keywords: mkdosfs, DOS FAT filesystem
Author: Dave Hudson <dave@humbug.demon.co.uk>
Maintained-by: H. Peter Anvin <hpa@yggdrasil.com>
Primary-site: sunsite.unc.edu /pub/Linux/system/Filesystems/dosfs
18531 mkdosfs-ygg-0.3b.tar.gz
Alternate-site: ftp.yggdrasil.com /pub/dist/mkdosfs
Original-site:
Platform: Linux
Copying-policy: GPL
End

View file

@ -0,0 +1,198 @@
.\" -*- nroff -*-
.TH MKDOSFS 8 "5 May 1995" "Version 2.x"
.SH NAME
.B mkdosfs
\- create an MS-DOS file system under Linux
.SH SYNOPSIS
.B mkdosfs
[
.B \-A
]
[
.B \-b
.I sector-of-backup
]
[
.B \-c
]
[
.B \-l
.I filename
]
[
.B \-C
]
[
.B \-f
.I number-of-FATs
]
[
.B \-F
.I FAT-size
]
[
.B \-i
.I volume-id
]
.RB [ " \-I " ]
[
.B \-m
.I message-file
]
[
.B \-n
.I volume-name
]
[
.B \-r
.I root-dir-entries
]
[
.B \-R
.I number-of-reserved-sectors
]
[
.B \-s
.I sectors-per-cluster
]
[
.B \-S
.I logical-sector-size
]
[
.B \-v
]
.I device
[
.I block-count
]
.SH DESCRIPTION
.B mkdosfs
is used to create an MS-DOS file system under Linux on a device (usually
a disk partition).
.I device
is the special file corresponding to the device (e.g /dev/hdXX).
.I block-count
is the number of blocks on the device. If omitted,
.B mkdosfs
automatically determiness the file system size.
.SH OPTIONS
.TP
.B \-A
Use Atari variation of the MS-DOS filesystem. This is default if
\fBmkdosfs\fP is run on an Atari, then this option turns off Atari
format. There are some differences when using Atari format: If not
directed otherwise by the user, \fBmkdosfs\fP will always use 2
sectors per cluster, since GEMDOS doesn't like other values very much.
It will also obey the maximum number of sectors GEMDOS can handle.
Larger filesystems are managed by raising the logical sector size.
Under Atari format, an Atari-compatible serial number for the
filesystem is generated, and a 12 bit FAT is used only for filesystems
that have one of the usual floppy sizes (720k, 1.2M, 1.44M, 2.88M), a
16 bit FAT otherwise. This can be overridden with the \fB\-F\fP
option. Some PC-specific boot sector fields aren't written, and a boot
message (option \fB\-m\fP) is ignored.
.TP
.BI \-b " sector-of-backup "
Selects the location of the backup boot sector for FAT32. Default
depends on number of reserved sectors, but usually is sector 6. The
backup must be within the range of reserved sectors.
.TP
.B \-c
Check the device for bad blocks before creating the file system.
.TP
.B \-C
Create the file given as \fIdevice\fP on the command line, and write
the to-be-created file system to it. This can be used to create the
new file system in a file instead of on a real device, and to avoid
using \fBdd\fP in advance to create a file of appropriate size. With
this option, the \fIblock-count\fP must be given, because otherwise
the intended size of the file system wouldn't be known. The file
created is a sparse file, which actually only contains the meta-data
areas (boot sector, FATs, and root directory). The data portions won't
be stored on the disk, but the file nevertheless will have the
correct size. The resulting file can be copied later to a floppy disk
or other device, or mounted through a loop device.
.TP
.BI \-f " number-of-FATs"
Specify the number of file allocation tables in the file system. The
default is 2. Currently the Linux MS-DOS file system does not support
more than 2 FATs.
.TP
.BI \-F " FAT-size"
Specifies the type of file allocation tables used (12, 16 or 32 bit).
If nothing is specified, \fBmkdosfs\fR will automatically select
between 12 and 16 bit, whatever fits better for the filesystem size.
32 bit FAT (FAT32 format) must (still) be selected explicitly if you
want it.
.TP
.BI \-i " volume-id"
Sets the volume ID of the newly created filesystem;
.I volume-id
is a 32-bit hexadecimal number (for example, 2e24ec82). The default
is a number which depends on the filesystem creation time.
.TP
.B \-I
Normally you are not allowed to use any 'full' fixed disk devices.
.B mkdosfs
will complain and tell you that it refuses to work. This is different
when usind MO disks. One doesn't always need partitions on MO disks.
The filesytem can go directly to the whole disk. Under other OSes
this is known as the 'superfloppy' format.
This switch will force
.B mkdosfs
to work properly.
.TP
.BI \-l " filename"
Read the bad blocks list from
.IR filename .
.TP
.BI \-m " message-file"
Sets the message the user receives on attempts to boot this filesystem
without having properly installed an operating system. The message
file must not exceed 418 bytes once line feeds have been converted to
carriage return-line feed combinations, and tabs have been expanded.
If the filename is a hyphen (-), the text is taken from standard input.
.TP
.BI \-n " volume-name"
Sets the volume name (label) of the filesystem. The volume name can
be up to 11 characters long. The default is no label.
.TP
.BI \-r " root-dir-entries"
Select the number of entries available in the root directory. The
default is 112 or 224 for floppies and 512 for hard disks.
.TP
.BI \-R " number-of-reserved-sectors "
Select the number of reserved sectos. With FAT32 format at least 2
reserved sectors are needed, the default is 32. Otherwise the default
is 1 (only the boot sector).
.TP
.BI \-s " sectors-per-cluster"
Specify the number of disk sectors per cluster. Must be a power of 2,
i.e. 1, 2, 4, 8, ... 128.
.TP
.BI \-S " logical-sector-size"
Specify the number of bytes per logical sector. Must be a power of 2
and greater than or equal to 512, i.e. 512, 1024, 2048, 4096, 8192,
16384, or 32768.
.TP
.B \-v
Verbose execution.
.SH BUGS
None are know at the moment. If you find any, please report it them
to <hpa@yggdrasil.com>. Please include the version number (Yggdrasil 0.3a).
.SH AUTHOR
Dave Hudson - <dave@humbug.demon.co.uk>; modified by Peter Anvin
<hpa@yggdrasil.com>. Fixes and additions by Roman Hodek
<Roman.Hodek@informatik.uni-erlangen.de> for Debian/GNU Linux.
.SH ACKNOWLEDGEMENTS
.B mkdosfs
is based on code from
.BR mke2fs
(written by Remy Card - <card@masi.ibp.fr>) which is itself based on
.BR mkfs
(written by Linus Torvalds - <torvalds@cs.helsinki.fi>).
.SH SEE ALSO
.BR dosfsck (8),
.BR mkfs (8)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,104 @@
# Microsoft Developer Studio Project File - Name="mkdosfs" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=mkdosfs - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "mkdosfs.mak".
!MESSAGE
!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 "mkdosfs.mak" CFG="mkdosfs - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mkdosfs - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "mkdosfs - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "mkdosfs - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x407 /d "NDEBUG"
# ADD RSC /l 0x407 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.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:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.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:console /machine:I386
!ELSEIF "$(CFG)" == "mkdosfs - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x407 /d "_DEBUG"
# ADD RSC /l 0x407 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.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:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.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:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "mkdosfs - Win32 Release"
# Name "mkdosfs - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\getopt.c
# End Source File
# Begin Source File
SOURCE=.\mkdosfs.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View file

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "mkdosfs"=".\mkdosfs.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View file

@ -0,0 +1,49 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: mkdosfs - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOKUME~1\JENS-U~1\LOKALE~1\Temp\RSP173.tmp" with contents
[
/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Release/mkdosfs.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c
"C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c"
]
Creating command line "cl.exe @"C:\DOKUME~1\JENS-U~1\LOKALE~1\Temp\RSP173.tmp""
Creating temporary file "C:\DOKUME~1\JENS-U~1\LOKALE~1\Temp\RSP174.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 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/mkdosfs.pdb" /machine:I386 /out:"Release/mkdosfs.exe"
".\Release\getopt.obj"
".\Release\mkdosfs.obj"
]
Creating command line "link.exe @"C:\DOKUME~1\JENS-U~1\LOKALE~1\Temp\RSP174.tmp""
<h3>Output Window</h3>
Compiling...
mkdosfs.c
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(272) : warning C4244: '=' : conversion from '__int64 ' to 'long ', possible loss of data
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(273) : warning C4244: '=' : conversion from '__int64 ' to 'long ', possible loss of data
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(487) : warning C4305: 'initializing' : truncation from 'const int ' to 'char '
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(487) : warning C4305: 'initializing' : truncation from 'const int ' to 'char '
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(704) : warning C4018: '<' : signed/unsigned mismatch
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(706) : warning C4018: '>' : signed/unsigned mismatch
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(717) : warning C4018: '<' : signed/unsigned mismatch
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(813) : warning C4244: 'return' : conversion from '__int64 ' to 'int ', possible loss of data
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(888) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(889) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(1197) : warning C4244: '=' : conversion from '__int64 ' to 'unsigned int ', possible loss of data
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(1223) : warning C4244: '=' : conversion from '__int64 ' to 'unsigned int ', possible loss of data
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(1242) : warning C4244: '=' : conversion from '__int64 ' to 'unsigned int ', possible loss of data
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(1270) : warning C4244: '=' : conversion from '__int64 ' to 'unsigned int ', possible loss of data
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(1387) : warning C4244: '=' : conversion from '__int64 ' to 'unsigned int ', possible loss of data
C:\cygwin\home\jum\dosfstools-2.8\mkdosfs\mkdosfs.c(1400) : warning C4018: '<=' : signed/unsigned mismatch
Linking...
<h3>Results</h3>
mkdosfs.exe - 0 error(s), 16 warning(s)
</pre>
</body>
</html>

View file

@ -0,0 +1,8 @@
add_executable(pedump pedump.c pedump.rc)
set_module_type(pedump win32cui)
if(NOT MSVC)
add_target_compile_flags(pedump "-Wno-unused-but-set-variable")
endif()
add_importlibs(pedump msvcrt kernel32 ntdll)
add_cd_file(TARGET pedump DESTINATION reactos/system32 FOR all)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
#define REACTOS_STR_FILE_DESCRIPTION "Tool to dump a PE image file.\0"
#define REACTOS_STR_INTERNAL_NAME "pedump\0"
#define REACTOS_STR_ORIGINAL_FILENAME "pedump.exe\0"
#define REACTOS_STR_ORIGINAL_COPYRIGHT "1993 Randy Kath; 1997 Sang Cho\0"
#include <reactos/version.rc>

View file

@ -0,0 +1,110 @@
/*
* regexpl - Console Registry Explorer
*
* Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
// ArgumentParser.cpp: implementation of the CArgumentParser class.
//
//////////////////////////////////////////////////////////////////////
#include "ph.h"
#include "ArgumentParser.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CArgumentParser::CArgumentParser()
{
m_pchArgumentList = NULL;
m_pchArgumentListEnd = NULL;
m_pchArgument = NULL;
}
CArgumentParser::~CArgumentParser()
{
}
void CArgumentParser::SetArgumentList(TCHAR *pchArguments)
{
TCHAR *pch = m_pchArgumentList = pchArguments;
m_pchArgumentListEnd = pchArguments + _tcslen(pchArguments);
BOOL blnLongArg = FALSE;
while (*pch)
{
switch(*pch)
{
case _T('^'): // argument parser ignores escape sequences
if (pch[1])
pch++;
break;
case _T('\"'):
blnLongArg = !blnLongArg;
break;
case _T(' '):
case _T('\t'):
case _T('\r'):
case _T('\n'):
if (!blnLongArg)
*pch = 0;
break;
}
pch++;
}
ResetArgumentIteration();
}
TCHAR * CArgumentParser::GetNextArgument()
{
ASSERT(m_pchArgumentList); // call SetArgumentList() before calling this function
ASSERT(m_pchArgumentListEnd); // call SetArgumentList() before calling this function
ASSERT(m_pchArgumentListEnd >= m_pchArgumentList);
// if this is begin of iteration
if (!m_pchArgument)
m_pchArgument = m_pchArgumentList;
while(m_pchArgument)
{
if (m_pchArgument > m_pchArgumentListEnd)
{ // if end of arguments list reached
ASSERT(m_pchArgument - 1 == m_pchArgumentListEnd);
break;
}
TCHAR *pchArg = m_pchArgument;
// Next argument
m_pchArgument += _tcslen(m_pchArgument)+1;
if(*pchArg)
{ // if argument is not an empty string
return pchArg;
}
}
return NULL;
}
void CArgumentParser::ResetArgumentIteration()
{
m_pchArgument = NULL;
}

View file

@ -0,0 +1,41 @@
//
// ArgumentParser.h: interface for the CArgumentParser class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(ARGUMENTPARSER_H__D4C1F637_BEBF_11D3_91EE_204C4F4F5020__INCLUDED_)
#define ARGUMENTPARSER_H__D4C1F637_BEBF_11D3_91EE_204C4F4F5020__INCLUDED_
// Use this class to create parser of command line object
class CArgumentParser
{
public:
// Call this function to specify buffer containing the command line to be parsed
// Parameters:
// pchArguments - pointer to buffer containing the command line. This buffer is modified by object,
// and must not be accessed extrenaly when object is used, unless you interate it
// only once and modify only substrings returned by GetNextArgument.
//
// Remarks:
// This object can be reused by setting the buffer multiple times.
void SetArgumentList(TCHAR *pchArguments);
// Call this function to reset argument iteration. You don't need to call this function after call
// to set SetArgumentList, because calling SetArgumentList resets iteration with new buffer.
void ResetArgumentIteration();
// Call this function to get next argument from command line.
//
// Returns:
// Function returns next argument. If this is first call after calling SetArgumentList or
// ResetArgumentIteration, functions returns the first argument (The command itself ?).
TCHAR * GetNextArgument();
CArgumentParser();
virtual ~CArgumentParser();
private:
TCHAR *m_pchArgumentList; // points to begin of argumet list
const TCHAR *m_pchArgumentListEnd; // points to last 0 in argument list
TCHAR *m_pchArgument;
};
#endif // !defined(ARGUMENTPARSER_H__D4C1F637_BEBF_11D3_91EE_204C4F4F5020__INCLUDED_)

View file

@ -0,0 +1,36 @@
set_cpp(WITH_RUNTIME WITH_STL WITH_EXCEPTIONS)
list(APPEND SOURCE
ArgumentParser.cpp
Console.cpp
RegistryExplorer.cpp
RegistryKey.cpp
RegistryTree.cpp
SecurityDescriptor.cpp
ShellCommand.cpp
ShellCommandChangeKey.cpp
ShellCommandConnect.cpp
ShellCommandDACL.cpp
ShellCommandDeleteKey.cpp
ShellCommandDeleteValue.cpp
ShellCommandDir.cpp
ShellCommandExit.cpp
ShellCommandHelp.cpp
ShellCommandNewKey.cpp
ShellCommandOwner.cpp
ShellCommandSACL.cpp
ShellCommandSetValue.cpp
ShellCommandValue.cpp
ShellCommandVersion.cpp
ShellCommandsLinkedList.cpp
TextHistory.cpp
Completion.cpp
Pattern.cpp
Settings.cpp
Prompt.cpp)
add_executable(regexpl ${SOURCE} regexpl.rc)
set_module_type(regexpl win32cui)
add_importlibs(regexpl user32 advapi32 msvcrt kernel32 ntdll)
add_cd_file(TARGET regexpl DESTINATION reactos/system32 FOR all)

View file

@ -0,0 +1,514 @@
/*
* regexpl - Console Registry Explorer
*
* Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
// Completion.cpp : Defines the completion related functions.
#include "ph.h"
#include "RegistryKey.h"
#include "RegistryTree.h"
#define COMPLETION_BUFFER_SIZE 4096
extern CRegistryTree Tree;
BOOL g_blnCompletionCycle = TRUE;
class CCompletionMatch
{
public:
CCompletionMatch()
{
m_pNext = m_pPrev = NULL;
m_pszText = NULL;
};
BOOL Init(const TCHAR *pszText)
{
// find the offset to "unique" part
const TCHAR *pszUnique = _tcsrchr(pszText,_T('\\'));
pszUnique = pszUnique?(pszUnique+1):pszText;
BOOL b = _tcschr(pszUnique,_T(' ')) != NULL; // has it spaces in it ???
size_t s = _tcslen(pszText);
if (m_pszText)
delete[] m_pszText;
m_pszText = new (std::nothrow) TCHAR [s+(b?3:1)]; // if we have spaces in unique part, we need 2 addtional chars for "
if (!m_pszText)
return FALSE;
ASSERT(pszText <= pszUnique);
s = pszUnique - pszText; // calculate offset of the unique part
if (s)
_tcsncpy(m_pszText,pszText,s);
if (b)
m_pszText[s++] = _T('\"');
_tcscpy(m_pszText+s,pszUnique);
if (b)
_tcscat(m_pszText,_T("\""));
return TRUE;
}
~CCompletionMatch()
{
if (m_pszText)
delete[] m_pszText;
}
private:
TCHAR *m_pszText;
BOOL m_blnIsKey;
CCompletionMatch *m_pNext;
CCompletionMatch *m_pPrev;
friend class CCompletionList;
};
class CCompletionList
{
public:
CCompletionList();
~CCompletionList();
BOOL IsNewCompletion(const TCHAR *pszContext, const TCHAR *pszBegin, BOOL& rblnNew);
BOOL Add(const TCHAR *pszText, BOOL blnIsKey);
const TCHAR *Get(unsigned __int64 nIndex, BOOL& rblnIsKey);
unsigned __int64 GetCount();
const TCHAR * GetContext();
const TCHAR * GetBegin();
void DeleteList();
void Invalidate();
private:
CCompletionMatch *m_pHead; // head of completions linked list
CCompletionMatch *m_pTail; // tail of completions linked list
CCompletionMatch *m_pLastSearched;
unsigned int m_nLastSearched;
TCHAR *m_pszContext;
TCHAR *m_pszBegin;
TCHAR *m_pszCurrentKey;
unsigned __int64 m_nCount;
} g_Completion;
// --- begin of CCompletionList implementation ---
CCompletionList::CCompletionList()
{
m_pHead = NULL;
m_pTail = NULL;
m_nCount = 0;
m_pLastSearched = NULL;
m_pszContext = NULL;
m_pszBegin = NULL;
m_pszCurrentKey = NULL;
}
CCompletionList::~CCompletionList()
{
DeleteList();
if (m_pszContext)
delete[] m_pszContext;
if (m_pszBegin)
delete[] m_pszBegin;
if (m_pszCurrentKey)
delete[] m_pszCurrentKey;
}
void CCompletionList::Invalidate()
{
if (m_pszCurrentKey)
{
delete[] m_pszCurrentKey;
m_pszCurrentKey = NULL;
}
}
BOOL CCompletionList::IsNewCompletion(const TCHAR *pszContext, const TCHAR *pszBegin, BOOL& rblnNew)
{
const TCHAR *pszCurrentKey = Tree.GetCurrentPath();
if (!m_pszContext ||
!m_pszBegin ||
!m_pszCurrentKey ||
(_tcscmp(m_pszContext,pszContext) != 0) ||
(_tcscmp(m_pszBegin,pszBegin) != 0) ||
(_tcscmp(m_pszCurrentKey,pszCurrentKey)))
{ // new completion
DeleteList();
rblnNew = TRUE;
if (m_pszContext)
{
delete[] m_pszContext;
m_pszContext = NULL;
}
if (m_pszBegin)
{
delete[] m_pszBegin;
m_pszBegin = NULL;
}
if (m_pszCurrentKey)
{
delete[] m_pszCurrentKey;
m_pszCurrentKey = NULL;
}
size_t s = _tcslen(pszContext);
m_pszContext = new (std::nothrow) TCHAR[s+1];
if (!m_pszContext)
return FALSE;
_tcscpy(m_pszContext,pszContext);
s = _tcslen(pszBegin);
m_pszBegin = new (std::nothrow) TCHAR[s+1];
if (!m_pszBegin)
{
delete[] m_pszContext;
m_pszContext = NULL;
return FALSE;
}
_tcscpy(m_pszBegin,pszBegin);
s = _tcslen(pszCurrentKey);
m_pszCurrentKey = new (std::nothrow) TCHAR[s+1];
if (!m_pszCurrentKey)
{
delete[] m_pszContext;
delete[] m_pszBegin;
m_pszContext = NULL;
m_pszBegin = NULL;
return FALSE;
}
_tcscpy(m_pszCurrentKey,pszCurrentKey);
return TRUE;
}
rblnNew = FALSE;
return TRUE;
}
BOOL CCompletionList::Add(const TCHAR *pszText, BOOL blnIsKey)
{
if (_tcsnicmp(pszText,m_pszBegin,_tcslen(m_pszBegin)) != 0)
return TRUE;
CCompletionMatch *pNode = new (std::nothrow) CCompletionMatch;
if (!pNode)
return FALSE;
if (!pNode->Init(pszText))
return FALSE;
ASSERT(pNode->m_pszText);
ASSERT(pNode->m_pNext == NULL);
// add new node to tail
pNode->m_blnIsKey = blnIsKey;
if (m_pTail)
{
pNode->m_pPrev = m_pTail;
ASSERT(m_pTail->m_pNext == NULL);
m_pTail->m_pNext = pNode;
m_pTail = pNode;
}
else
{
ASSERT(m_pHead == NULL);
m_pHead = m_pTail = pNode;
}
m_nCount++;
m_pLastSearched = NULL;
return TRUE;
}
const TCHAR * CCompletionList::Get(unsigned __int64 nIndex, BOOL& rblnIsKey)
{
ASSERT(nIndex < m_nCount);
BOOL blnForward = FALSE;
CCompletionMatch *pNode = NULL;
unsigned __int64 nRelativeIndex = 0;
if (m_pLastSearched)
{
pNode = m_pLastSearched;
blnForward = nIndex > m_nLastSearched;
nRelativeIndex = blnForward?(nIndex-m_nLastSearched):(m_nLastSearched-nIndex);
if ((nRelativeIndex > nIndex)||(nRelativeIndex > m_nCount-nIndex-1))
pNode = NULL; // seraching from tail or from head is more effective
}
if (!pNode && (nIndex <= m_nCount/2))
{ // search from head
pNode = m_pHead;
blnForward = TRUE;
nRelativeIndex = nIndex;
}
if (!pNode)
{ // search from tail
pNode = m_pTail;
blnForward = FALSE;
nRelativeIndex = m_nCount-nIndex-1;
}
while(pNode)
{
if (nRelativeIndex == 0)
{
m_nLastSearched = nIndex;
m_pLastSearched = pNode;
rblnIsKey = pNode->m_blnIsKey;
if (!pNode->m_pszText)
ASSERT(FALSE);
return pNode->m_pszText;
}
nRelativeIndex--;
pNode = blnForward?(pNode->m_pNext):(pNode->m_pPrev);
}
ASSERT(FALSE);
return NULL;
}
unsigned __int64 CCompletionList::GetCount()
{
return m_nCount;
}
const TCHAR * CCompletionList::GetContext()
{
return m_pszContext;
}
const TCHAR * CCompletionList::GetBegin()
{
return m_pszBegin;
}
void CCompletionList::DeleteList()
{
CCompletionMatch *pNode;
while(m_pHead)
{
pNode = m_pHead;
m_pHead = m_pHead->m_pNext;
delete pNode;
}
m_pTail = NULL;
ASSERT(m_pHead == NULL);
m_nCount = 0;
}
// --- end of CCompletionList implementation ---
BOOL FillCompletion(const TCHAR *pszKey)
{
g_Completion.DeleteList();
LONG nError;
CRegistryKey Key;
TCHAR *pszSubkeyName = NULL;
DWORD dwMaxSubkeyNameLength;
TCHAR *pszValueName = NULL;
DWORD dwMaxValueNameSize;
if (!Tree.GetKey(pszKey?pszKey:_T("."),KEY_ENUMERATE_SUB_KEYS|KEY_QUERY_VALUE,Key))
return FALSE;
BOOL blnCompletionOnKeys = TRUE;
BOOL blnCompletionOnValues = TRUE;
/* if ((_tcsnicmp(pchContext,DIR_CMD,DIR_CMD_LENGTH) == 0)||
(_tcsnicmp(pchContext,CD_CMD,CD_CMD_LENGTH) == 0)||
(_tcsnicmp(pchContext,OWNER_CMD,OWNER_CMD_LENGTH) == 0)||
(_tcsnicmp(pchContext,DACL_CMD,DACL_CMD_LENGTH) == 0)||
(_tcsnicmp(pchContext,SACL_CMD,SACL_CMD_LENGTH) == 0))
{
blnCompletionOnValues = FALSE;
}*/
// else if (_tcsnicmp(pchContext,VALUE_CMD,VALUE_CMD_LENGTH) == 0)
// {
// blnCompletionOnKeys = FALSE;
// }
size_t nKeyNameSize = 0;
if (pszKey)
{
nKeyNameSize = _tcslen(pszKey);
if (_tcscmp(pszKey,_T("\\")))
nKeyNameSize++;
}
if (blnCompletionOnKeys)
{
nError = Key.GetSubkeyNameMaxLength(dwMaxSubkeyNameLength);
if (nError != ERROR_SUCCESS)
return FALSE;
pszSubkeyName = new (std::nothrow) TCHAR[nKeyNameSize+dwMaxSubkeyNameLength+1];
if (!pszSubkeyName)
goto Abort;
if (pszKey)
_stprintf(pszSubkeyName,_tcscmp(pszKey,_T("\\"))?_T("%s\\"):_T("%s"),pszKey);
Key.InitSubkeyEnumeration(pszSubkeyName+nKeyNameSize,dwMaxSubkeyNameLength);
while ((nError = Key.GetNextSubkeyName()) == ERROR_SUCCESS)
if (!g_Completion.Add(pszSubkeyName,TRUE))
{
ASSERT(FALSE);
goto Abort;
}
if ((nError != ERROR_SUCCESS)&&(nError != ERROR_NO_MORE_ITEMS))
{
ASSERT(FALSE);
goto Abort;
}
}
if (blnCompletionOnValues)
{
nError = Key.GetMaxValueNameLength(dwMaxValueNameSize);
if (nError != ERROR_SUCCESS)
{
ASSERT(FALSE);
goto Abort;
}
pszValueName = new (std::nothrow) TCHAR[nKeyNameSize+dwMaxValueNameSize+1];
if (!pszValueName)
goto Abort;
if (pszKey)
_stprintf(pszValueName,_tcscmp(pszKey,_T("\\"))?_T("%s\\"):_T("%s"),pszKey);
Key.InitValueEnumeration(pszValueName+nKeyNameSize,dwMaxValueNameSize,NULL,0,NULL);
while((nError = Key.GetNextValue()) == ERROR_SUCCESS)
if (!g_Completion.Add(pszValueName,FALSE))
{
ASSERT(FALSE);
goto Abort;
}
if ((nError != ERROR_SUCCESS)&&(nError != ERROR_NO_MORE_ITEMS))
{
ASSERT(FALSE);
goto Abort;
}
}
if (pszValueName)
delete[] pszValueName;
if (pszSubkeyName)
delete[] pszSubkeyName;
return TRUE;
Abort:
if (pszValueName)
delete[] pszValueName;
if (pszSubkeyName)
delete[] pszSubkeyName;
return FALSE;
}
const TCHAR * CompletionCallback(unsigned __int64 & rnIndex,
const BOOL *pblnForward,
const TCHAR *pszContext,
const TCHAR *pszBegin)
{
static TCHAR pszBuffer[COMPLETION_BUFFER_SIZE];
// Find first non-white space in context
while(*pszContext && _istspace(*pszContext))
pszContext++;
BOOL blnNewCompletion = TRUE;
if (!g_Completion.IsNewCompletion(pszContext,pszBegin,blnNewCompletion))
{
ASSERT(FALSE);
return NULL;
}
if (blnNewCompletion)
{
_tcsncpy(pszBuffer,pszBegin,COMPLETION_BUFFER_SIZE-1);
pszBuffer[COMPLETION_BUFFER_SIZE-1] = 0;
TCHAR *pszSeparator = pszBuffer; // set it to aby non null value
if (_tcscmp(pszBuffer,_T("\\")))
{
pszSeparator = _tcsrchr(pszBuffer,_T('\\'));
if (pszSeparator)
*pszSeparator = 0;
}
if (!FillCompletion(pszSeparator?pszBuffer:NULL))
return NULL;
}
unsigned __int64 nTotalItems = g_Completion.GetCount();
if (nTotalItems == 0)
return NULL;
if (rnIndex >= nTotalItems)
rnIndex = nTotalItems-1;
if (pblnForward)
{
if (*pblnForward)
{
rnIndex++;
if (rnIndex >= nTotalItems)
{
if (g_blnCompletionCycle)
rnIndex = 0;
else
rnIndex--;
}
}
else
{
if (rnIndex)
rnIndex--;
else if (g_blnCompletionCycle)
rnIndex = nTotalItems-1;
}
}
BOOL blnIsKey = FALSE;
const TCHAR *pszName = g_Completion.Get(rnIndex,blnIsKey);
ASSERT(pszName);
_sntprintf(pszBuffer,COMPLETION_BUFFER_SIZE-1,_T("%s%s"),pszName,(blnIsKey?_T("\\"):_T("")));
pszBuffer[COMPLETION_BUFFER_SIZE-1] = 0;
return pszBuffer;
}
void InvalidateCompletion()
{
g_Completion.Invalidate();
}

View file

@ -0,0 +1,16 @@
//
// Completion.h - declaration for completion related functions
#if !defined(COMLPETION_H__INCLUDED_)
#define COMPLETION_H__INCLUDED_
typedef const TCHAR * (*ReplaceCompletionCallback)(unsigned __int64& rnIndex, const BOOL *pblnForward,
const TCHAR *pchContext, const TCHAR *pchBegin);
extern const TCHAR * CompletionCallback(unsigned __int64 & rnIndex,
const BOOL *pblnForward,
const TCHAR *pchContext,
const TCHAR *pchBegin);
extern void InvalidateCompletion();
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,60 @@
//
// Console.h: interface for the CConsole class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(CONSOLE_H__FEF419EC_6EB6_11D3_907D_204C4F4F5020__INCLUDED_)
#define CONSOLE_H__FEF419EC_6EB6_11D3_907D_204C4F4F5020__INCLUDED_
#include "TextHistory.h"
#include "Completion.h"
class CConsole
{
public:
void EnableWrite();
void DisableWrite();
void SetReplaceCompletionCallback(ReplaceCompletionCallback pfCallback);
BOOL SetInsertMode(BOOL blnInsetMode);
void BeginScrollingOperation();
TCHAR * Init(DWORD dwBufferSize, DWORD dwMaxHistoryLines = 0);
BOOL ReadLine();
BOOL FlushInputBuffer();
// BOOL SetOutputMode(DWORD dwMode);
// BOOL SetInputMode(DWORD dwMode);
BOOL SetTextAttribute(WORD wAttributes);
BOOL GetTextAttribute(WORD& rwAttributes);
BOOL SetTitle(const TCHAR *p);
BOOL Write(const TCHAR *p, DWORD dwChars = 0);
CConsole();
virtual ~CConsole();
unsigned int GetTabWidth();
private:
HANDLE m_hStdOut;
HANDLE m_hStdIn;
HANDLE m_hStdError;
COORD m_CursorPosition;
COORD m_BufferSize;
WORD m_wAttributes;
SHORT m_Lines;
BOOL WriteString(const TCHAR *pchString, COORD Position);
BOOL WriteChar(TCHAR ch);
BOOL m_blnInsetMode; // TRUE - insert, FALSE - overwrite
DWORD m_dwInsertModeCursorHeight;
DWORD m_dwOverwriteModeCursorHeight;
TCHAR *m_pchBuffer;
TCHAR *m_pchBuffer1;
TCHAR *m_pchBuffer2;
DWORD m_dwBufferSize;
ReplaceCompletionCallback m_pfReplaceCompletionCallback;
SHORT m_LinesScrolled;
BOOL m_blnMoreMode;
CTextHistory m_History;
BOOL m_blnDisableWrite;
DWORD m_dwOldOutputMode;
DWORD m_dwOldInputMode;
BOOL m_blnOldInputModeSaved;
BOOL m_blnOldOutputModeSaved;
};
#endif // !defined(CONSOLE_H__FEF419EC_6EB6_11D3_907D_204C4F4F5020__INCLUDED_)

View file

@ -0,0 +1,58 @@
/*
* regexpl - Console Registry Explorer
*
* Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
// Pattern.cpp: implementation of pattern functions
#include "ph.h"
// based on wstrcmpjoki() by Jason Filby (jasonfilby@yahoo.com)
// reactos kernel, services/fs/vfat/string.c
BOOL PatternMatch(const TCHAR *pszPattern, const TCHAR *pszTry)
{
while ((*pszPattern == _T('?'))||((_totlower(*pszTry)) == (_totlower(*pszPattern))))
{
if (((*pszTry) == 0) && ((*pszPattern) == 0))
return TRUE;
if (((*pszTry) == 0) || ((*pszPattern) == 0))
return FALSE;
pszTry++;
pszPattern++;
}
if (*pszPattern == _T('*'))
{
pszPattern++;
while (*pszTry)
{
if (PatternMatch(pszPattern,pszTry))
return TRUE;
else
pszTry++;
}
}
if (((*pszTry) == 0) && ((*pszPattern) == 0))
return TRUE;
return FALSE;
}

View file

@ -0,0 +1,11 @@
//
// Pattern.h: decalration for pattern functions
#if !defined(PATTERN_H__INCLUDED_)
#define PATTERN_H__INCLUDED_
#define PATTERN_MATCH_ALL _T("*")
BOOL PatternMatch(const TCHAR *pszPattern, const TCHAR *pszTry);
#endif

View file

@ -0,0 +1,93 @@
/*
* regexpl - Console Registry Explorer
*
* Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
// prompt for Registry Explorer
#include "ph.h"
#include "Prompt.h"
#define ESCAPE_CHAR _T("\\")
#define CURRENT_PATH_ALIAS_CHAR _T("w")
#define CURRENT_PATH_ALIAS ESCAPE_CHAR CURRENT_PATH_ALIAS_CHAR
#define DEFAULT_PROMPT CURRENT_PATH_ALIAS _T("\n# ")
CPrompt::CPrompt(CRegistryTree& rTree, HRESULT& rhr):m_rTree(rTree)
{
m_pszPrompt = new (std::nothrow) TCHAR[_tcslen(DEFAULT_PROMPT)+1];
if (!m_pszPrompt)
{
rhr = E_OUTOFMEMORY;
return;
}
_tcscpy(m_pszPrompt,DEFAULT_PROMPT);
}
HRESULT CPrompt::SetPrompt(LPCTSTR pszPrompt)
{
if (!pszPrompt)
{
ASSERT(FALSE);
return E_UNEXPECTED;
}
m_pszPrompt = new (std::nothrow) TCHAR[_tcslen(pszPrompt)+1];
if (!m_pszPrompt)
return E_OUTOFMEMORY;
_tcscpy(m_pszPrompt,pszPrompt);
return S_OK;
}
CPrompt::~CPrompt()
{
if (m_pszPrompt)
delete[] m_pszPrompt;
}
void CPrompt::ShowPrompt(CConsole &rConsole)
{
TCHAR *pch = m_pszPrompt;
TCHAR Buffer[2] = " ";
const TCHAR *pszCurrentPath;
while (*pch)
{
if (_tcsncmp(pch,CURRENT_PATH_ALIAS,_tcslen(CURRENT_PATH_ALIAS)) == 0)
{
pszCurrentPath = m_rTree.GetCurrentPath();
rConsole.Write(pszCurrentPath?pszCurrentPath:_T("NULL (Internal Error)"));
pch += _tcslen(CURRENT_PATH_ALIAS);
}
else
{
Buffer[0] = *pch++;
rConsole.Write(Buffer);
}
}
}
LPCTSTR CPrompt::GetDefaultPrompt()
{
return DEFAULT_PROMPT;
}

View file

@ -0,0 +1,21 @@
#ifndef PROMPT_H__d2442d41_b6b3_47b5_8cb8_e6c597e570b9__INCLUDED
#define PROMPT_H__d2442d41_b6b3_47b5_8cb8_e6c597e570b9__INCLUDED
#include "RegistryTree.h"
#include "Console.h"
class CPrompt
{
public:
CPrompt(CRegistryTree& rTree, HRESULT& rhr);
~CPrompt();
HRESULT SetPrompt(LPCTSTR pszPrompt);
void ShowPrompt(CConsole &rConsole);
static LPCTSTR GetDefaultPrompt();
private:
CRegistryTree& m_rTree;
LPTSTR m_pszPrompt;
};
#endif // #ifndef PROMPT_H__d2442d41_b6b3_47b5_8cb8_e6c597e570b9__INCLUDED

View file

@ -0,0 +1,17 @@
Registry Explorer is console mode tool for reading/writing ReactOS
registry. Currently, access is provided only by means of interactive
commands, but scrpting support is planned too. Some of features are:
- Registry object name completion.
- DACL/SACL/Owner read access for keys.
- Remote machine registry access.
TODO:
- Scripting support
- Support for pessimistic completion and other console interfaces
(simple stdout, ncurses).
- Write access to DACL/SACL/Owner of registry keys.
Notes:
- Site at http://www.geocities.com/registryexplorer/ is discontinued.
For more info see this file and ReactOS site.

View file

@ -0,0 +1,270 @@
/*
* regexpl - Console Registry Explorer
*
* Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
// RegistryExplorer.cpp : Defines the entry point for the Regiistry Explorer.
//
#include "ph.h"
#include "RegistryExplorer.h"
#include "Console.h"
#include "RegistryKey.h"
#include "RegistryTree.h"
#include "SecurityDescriptor.h"
#include "ArgumentParser.h"
#include "ShellCommandsLinkedList.h"
#include "ShellCommandExit.h"
#include "ShellCommandVersion.h"
#include "ShellCommandHelp.h"
#include "ShellCommandDir.h"
#include "ShellCommandChangeKey.h"
#include "ShellCommandValue.h"
#include "ShellCommandOwner.h"
#include "ShellCommandDACL.h"
#include "ShellCommandSACL.h"
//#include "ShellCommandDOKA.h"
#include "ShellCommandConnect.h"
#include "ShellCommandNewKey.h"
#include "ShellCommandDeleteKey.h"
#include "ShellCommandSetValue.h"
#include "ShellCommandDeleteValue.h"
#include "Prompt.h"
#include "Settings.h"
TCHAR pchCurrentKey[PROMPT_BUFFER_SIZE];
CRegistryTree Tree;
CConsole Console;
BOOL blnCommandExecutionInProgress = FALSE;
BOOL WINAPI HandlerRoutine(DWORD dwCtrlType)
{
switch(dwCtrlType)
{
case CTRL_C_EVENT:
case CTRL_BREAK_EVENT:
if (blnCommandExecutionInProgress)
{
/* Beep(1000,100);
Beep(2000,100);
Beep(3000,100);
Beep(4000,100);
Beep(5000,100);
Beep(4000,100);
Beep(3000,100);
Beep(2000,100);
Beep(1000,100);*/
Console.Write(_T("\n"));
Console.DisableWrite();
}
return TRUE;
default:
return FALSE;
}
}
//int _tmain(/*int argc, TCHAR* argv[], TCHAR* envp[]*/)
int main ()
{
int nRetCode = 0;
HRESULT hr;
CSettings *pSettings = NULL;
CPrompt *pPrompt = NULL;
CShellCommandsLinkedList CommandsList(Console);
CShellCommandExit ExitCommand;
CommandsList.AddCommand(&ExitCommand);
CShellCommandVersion VersionCommand;
CommandsList.AddCommand(&VersionCommand);
CShellCommandHelp HelpCommand(CommandsList);
CommandsList.AddCommand(&HelpCommand);
CShellCommandDir DirCommand(Tree);
CommandsList.AddCommand(&DirCommand);
CShellCommandChangeKey ChangeKeyCommand(Tree);
CommandsList.AddCommand(&ChangeKeyCommand);
CShellCommandValue ValueCommand(Tree);
CommandsList.AddCommand(&ValueCommand);
CShellCommandOwner OwnerCommand(Tree);
CommandsList.AddCommand(&OwnerCommand);
CShellCommandDACL DACLCommand(Tree);
CommandsList.AddCommand(&DACLCommand);
CShellCommandSACL SACLCommand(Tree);
CommandsList.AddCommand(&SACLCommand);
CShellCommandConnect ConnectCommand(Tree);
CommandsList.AddCommand(&ConnectCommand);
CShellCommandNewKey NewKeyCommand(Tree);
CommandsList.AddCommand(&NewKeyCommand);
CShellCommandDeleteKey DeleteKeyCommand(Tree);
CommandsList.AddCommand(&DeleteKeyCommand);
CShellCommandSetValue SetValueCommand(Tree);
CommandsList.AddCommand(&SetValueCommand);
CShellCommandDeleteValue DeleteValueCommand(Tree);
CommandsList.AddCommand(&DeleteValueCommand);
CArgumentParser Parser;
pSettings = new (std::nothrow) CSettings();
if (!pSettings)
{
_ftprintf(stderr,_T("Cannot initialize settings. Out of memory.\n"));
goto Abort;
}
hr = pSettings->Load(SETTINGS_REGISTRY_KEY);
if (FAILED(hr))
{
_ftprintf(stderr,_T("Cannot load settings. Error is 0x%X.\n"),(unsigned int)hr);
goto Abort;
}
pPrompt = new (std::nothrow) CPrompt(Tree,hr);
if (!pPrompt)
{
_ftprintf(stderr,_T("Cannot initialize prompt. Out of memory.\n"));
goto Abort;
}
if (FAILED(hr))
{
_ftprintf(stderr,_T("Cannot initialize prompt. Error is 0x%X.\n"),(unsigned int)hr);
goto Abort;
}
// input buffer size in chars
#define INPUT_BUFFER_SIZE 1024
//#define INPUT_BUFFER_SIZE 128
//#define INPUT_BUFFER_SIZE 10
TCHAR *pchCommand;
pchCommand = Console.Init(INPUT_BUFFER_SIZE,10);
if (pchCommand == NULL)
{
_ftprintf(stderr,_T("Cannot initialize console.\n"));
nRetCode = 1;
goto Exit;
}
Console.SetReplaceCompletionCallback(CompletionCallback);
WORD wOldConsoleAttribute;
if (!Console.GetTextAttribute(wOldConsoleAttribute)) goto Abort;
Console.SetTitle(_T("Registry Explorer"));
Console.SetTextAttribute(pSettings->GetNormalTextAttributes());
VERIFY(SetConsoleCtrlHandler((PHANDLER_ROUTINE)HandlerRoutine,TRUE));
if (!Console.Write(HELLO_MSG
//(_L(__TIMESTAMP__))
)) goto Abort;
//Tree.SetDesiredOpenKeyAccess(KEY_READ);
hr = pPrompt->SetPrompt(pSettings->GetPrompt());
if (FAILED(hr))
{
_ftprintf(stderr,_T("Cannot initialize prompt. Error is 0x%X.\n"),(unsigned int)hr);
goto Abort;
}
GetCommand:
// prompt
// TODO: make prompt user-customizable
Console.EnableWrite();
pPrompt->ShowPrompt(Console);
Console.FlushInputBuffer();
blnCommandExecutionInProgress = FALSE;
// Set command line color
Console.SetTextAttribute(pSettings->GetCommandTextAttributes());
if (!Console.ReadLine())
goto Abort;
// Set normal color
Console.SetTextAttribute(pSettings->GetNormalTextAttributes());
Console.BeginScrollingOperation();
blnCommandExecutionInProgress = TRUE;
// Parse command line (1st step - convert to multi sz)
Parser.SetArgumentList(pchCommand);
int nCommandReturnValue;
switch(CommandsList.Execute(Parser,nCommandReturnValue))
{
case -1: // not recognized command
{
Parser.ResetArgumentIteration();
TCHAR *pchCommandItself = Parser.GetNextArgument();
size_t cmdlen = _tcslen(pchCommandItself);
if ((!cmdlen)||
(pchCommandItself[cmdlen-1] != _T('\\'))||
(Parser.GetNextArgument())||
(!Tree.ChangeCurrentKey(pchCommandItself)))
{
Console.Write(_T("Unknown command \""));
Console.Write(pchCommandItself);
Console.Write(_T("\"\n"));
}
}
case -2: // empty line
goto GetCommand;
case 0: // exit command
nRetCode = 0;
Console.SetTextAttribute(wOldConsoleAttribute);
goto Exit;
default:
Console.Write(_T("\n"));
goto GetCommand;
}
Abort:
_ftprintf(stderr,_T("Abnormal program termination.\nPlease report bugs to ") EMAIL _T("\n"));
nRetCode = 1;
Exit:
if (pSettings)
delete pSettings;
if (pPrompt)
delete pPrompt;
return nRetCode;
}

View file

@ -0,0 +1,51 @@
#ifndef _REGISTRY_EXPLORER_H__INCLUDED
#define _REGISTRY_EXPLORER_H__INCLUDED
#define CURRENT_VERSION _T("0.20+")
#define EMAIL _T("nedko@users.sourceforge.net")
//#define __L(x) L ## x
//#define _L(x) __L(x)
#define PRODUCT_NAME _T("Registry Explorer")
#define HELLO_MSG _T("ReactOS ") PRODUCT_NAME _T(" version ") CURRENT_VERSION _T("\n")\
_T("License is GNU GPL. Type `help gpl` for details.\n\n")
#define NOWARANTY_MSG _T("Registry Explorer comes with ABSOLUTELY NO WARRANTY\n")\
_T("This is free software, and you are welcome to redistribute it\n")\
_T("under certain conditions; type `help gpl' for details.\n")
#define COPYRIGHT_MSG _T("Copyright (C) 2000-2005 Nedko Arnaudov\n")
#define CREDITS_MSG _T("Registry Explorer is written by Nedko Arnaudov\n")\
_T("Special thanks to ReactOS team.\n")
#define BUGS_MSG _T("Please report bugs to ") EMAIL _T("\n")
#define VER_MSG COPYRIGHT_MSG\
_T("\n")\
NOWARANTY_MSG\
_T("\n")\
CREDITS_MSG\
_T("\n")\
BUGS_MSG
#define GOODBYE_MSG _T("\nThank you for using Registry Explorer !!!\n")
//#define COMMAND_LENGTH(cmd) (sizeof(DIR_CMD)-sizeof(TCHAR))/sizeof(TCHAR)
#define COMMAND_LENGTH(cmd) _tcslen(cmd)
#define PROMPT_BUFFER_SIZE 1024
#define COMMAND_NA_ON_ROOT _T(" is not applicable to root key.\n")
#define SETTINGS_REGISTRY_KEY _T("Software\\Registry Explorer\\")
#define NORMAL_TEXT_ATTRIBUTES_VALUE_NAME _T("Normal Text Color")
#define COMMAND_TEXT_ATTRIBUTES_VALUE_NAME _T("Command Text Color")
#define PROMPT_VALUE_NAME _T("Prompt")
#define DEFAULT_ESCAPE_CHAR _T('^')
#endif //#ifndef _REGISTRY_EXPLORER_H__INCLUDED

View file

@ -0,0 +1,575 @@
/*
* regexpl - Console Registry Explorer
*
* Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
// RegistryKey.cpp: implementation of the CRegistryKey class.
//
//////////////////////////////////////////////////////////////////////
#include "ph.h"
#include "RegistryKey.h"
static const TCHAR *g_ppszHiveNames[] =
{
_T("HKEY_CLASSES_ROOT"),
_T("HKEY_CURRENT_USER"),
_T("HKEY_LOCAL_MACHINE"),
_T("HKEY_USERS"),
_T("HKEY_PERFORMANCE_DATA"),
_T("HKEY_CURRENT_CONFIG"),
_T("HKEY_DYN_DATA")
};
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CRegistryKey::CRegistryKey()
{
m_pszKeyName = NULL;
m_pszMachineName = NULL;
m_CurrentAccess = 0;
m_hKey = NULL;
}
HRESULT CRegistryKey::InitRoot(const TCHAR *pszMachineName)
{
if ((pszMachineName)&&
((_tcslen(pszMachineName) < 3)||
(pszMachineName[0] != _T('\\'))||
(pszMachineName[1] != _T('\\'))
)
)
{
return E_INVALIDARG;
}
HRESULT hr = Uninit();
if (FAILED(hr))
return hr;
if (pszMachineName)
{ // copy machine name
size_t size = _tcslen(pszMachineName);
m_pszMachineName = new (std::nothrow) TCHAR [size+2];
if (!m_pszMachineName)
return E_OUTOFMEMORY;
_tcscpy(m_pszMachineName,pszMachineName);
m_pszMachineName[size] = _T('\\');
m_pszMachineName[size+1] = 0;
}
else
{
m_pszMachineName = NULL; // local registry
}
ASSERT(m_pszKeyName == NULL);
m_CurrentAccess = 0;
ASSERT(m_hKey == NULL);
return S_OK;
}
HRESULT CRegistryKey::Init(HKEY hKey, const TCHAR *pszPath, const TCHAR *pszKeyName, REGSAM CurrentAccess)
{
HRESULT hr = Uninit();
if (FAILED(hr))
return hr;
if (!pszKeyName || !hKey)
return E_INVALIDARG;
// copy key name name
size_t size = _tcslen(pszKeyName);
if (pszPath)
size += _tcslen(pszPath);
m_pszKeyName = new (std::nothrow) TCHAR [size+2];
if (!m_pszKeyName)
return E_OUTOFMEMORY;
_stprintf(m_pszKeyName,_T("%s%s\\"),pszPath?pszPath:_T(""),pszKeyName);
m_CurrentAccess = CurrentAccess;
m_hKey = hKey;
ASSERT(m_hKey);
return S_OK;
}
HRESULT CRegistryKey::Uninit()
{
if (m_pszKeyName)
{
delete [] m_pszKeyName;
m_pszKeyName = NULL;
}
if (m_pszMachineName)
{
delete [] m_pszMachineName;
m_pszMachineName = NULL;
}
LONG nError = ERROR_SUCCESS;
if((m_hKey != NULL)&&(!IsHive(m_hKey)))
nError = RegCloseKey(m_hKey);
m_hKey = NULL;
return (nError == ERROR_SUCCESS)?S_OK:E_FAIL;
}
BOOL CRegistryKey::IsHive(HKEY hKey)
{
return ((hKey == HKEY_CLASSES_ROOT)||
(hKey == HKEY_CURRENT_USER)||
(hKey == HKEY_LOCAL_MACHINE)||
(hKey == HKEY_USERS)||
(hKey == HKEY_PERFORMANCE_DATA)||
(hKey == HKEY_CURRENT_CONFIG)||
(hKey == HKEY_DYN_DATA));
}
CRegistryKey::~CRegistryKey()
{
Uninit();
}
const TCHAR * CRegistryKey::GetKeyName()
{
return m_pszKeyName?m_pszKeyName:(m_pszMachineName?m_pszMachineName:_T("\\"));
}
BOOL CRegistryKey::IsRoot()
{
return m_hKey == NULL;
}
LONG CRegistryKey::OpenSubkey(REGSAM samDesired, const TCHAR *pszSubkeyName, HKEY &rhKey)
{
if (m_hKey == NULL)
{ // subkey of root key is hive root key.
if ((_tcsicmp(pszSubkeyName,_T("HKCR")) == 0)||
(_tcsicmp(pszSubkeyName,_T("HKEY_CLASSES_ROOT")) == 0))
{
rhKey = HKEY_CLASSES_ROOT;
if (m_pszMachineName)
return ERROR_FILE_NOT_FOUND;
return ERROR_SUCCESS;
}
else if ((_tcsicmp(pszSubkeyName,_T("HKCU")) == 0)||
(_tcsicmp(pszSubkeyName,_T("HKEY_CURRENT_USER")) == 0))
{
rhKey = HKEY_CURRENT_USER;
if (m_pszMachineName)
return ERROR_FILE_NOT_FOUND;
return ERROR_SUCCESS;
}
else if ((_tcsicmp(pszSubkeyName,_T("HKLM")) == 0)||
(_tcsicmp(pszSubkeyName,_T("HKEY_LOCAL_MACHINE")) == 0))
{
rhKey = HKEY_LOCAL_MACHINE;
if (m_pszMachineName)
return RegConnectRegistry(m_pszMachineName,rhKey,&rhKey);
return ERROR_SUCCESS;
}
else if ((_tcsicmp(pszSubkeyName,_T("HKU")) == 0)||
(_tcsicmp(pszSubkeyName,_T("HKEY_USERS")) == 0))
{
rhKey = HKEY_USERS;
if (m_pszMachineName)
return RegConnectRegistry(m_pszMachineName,rhKey,&rhKey);
return ERROR_SUCCESS;
}
else if ((_tcsicmp(pszSubkeyName,_T("HKPD")) == 0)||
(_tcsicmp(pszSubkeyName,_T("HKEY_PERFORMANCE_DATA")) == 0))
{
rhKey = HKEY_PERFORMANCE_DATA;
if (m_pszMachineName)
return RegConnectRegistry(m_pszMachineName,rhKey,&rhKey);
return ERROR_SUCCESS;
}
else if ((_tcsicmp(pszSubkeyName,_T("HKDD")) == 0)||
(_tcsicmp(pszSubkeyName,_T("HKEY_DYN_DATA")) == 0))
{
rhKey = HKEY_DYN_DATA;
if (m_pszMachineName)
return RegConnectRegistry(m_pszMachineName,rhKey,&rhKey);
return ERROR_SUCCESS;
}
else if ((_tcsicmp(pszSubkeyName,_T("HKCC")) == 0)||
(_tcsicmp(pszSubkeyName,_T("HKEY_CURRENT_CONFIG")) == 0))
{
rhKey = HKEY_CURRENT_CONFIG;
if (m_pszMachineName)
{
TCHAR *pch = m_pszMachineName;
while (*pch)
pch++;
pch--;
ASSERT(*pch == _T('\\'));
if (*pch != _T('\\'))
return ERROR_INTERNAL_ERROR;
*pch = 0;
LONG nError = RegConnectRegistry(m_pszMachineName,rhKey,&rhKey);
*pch = _T('\\');
return nError;
}
return ERROR_SUCCESS;
}
else
{
return ERROR_FILE_NOT_FOUND;
}
}
return RegOpenKeyEx(m_hKey,pszSubkeyName,0,samDesired,&rhKey);
}
LONG CRegistryKey::OpenSubkey(REGSAM samDesired, const TCHAR *pszSubkeyName, CRegistryKey &rKey)
{
HKEY hKey;
LONG nError = OpenSubkey(samDesired, pszSubkeyName, hKey);
if (nError == ERROR_SUCCESS)
{
const TCHAR *pszKeyName = GetKeyName();
size_t size = _tcslen(pszKeyName) + _tcslen(pszSubkeyName) + 1;
TCHAR *pszSubkeyFullName = new (std::nothrow) TCHAR [size];
if (!pszSubkeyFullName)
{
nError = RegCloseKey(hKey);
ASSERT(nError == ERROR_SUCCESS);
return ERROR_OUTOFMEMORY;
}
_tcscpy(pszSubkeyFullName,pszKeyName);
_tcscat(pszSubkeyFullName,pszSubkeyName);
HRESULT hr = rKey.Init(hKey,GetKeyName(),pszSubkeyName,samDesired);
delete[] pszSubkeyName;
if (FAILED(hr))
{
nError = RegCloseKey(hKey);
ASSERT(nError == ERROR_SUCCESS);
if (hr == (HRESULT)E_OUTOFMEMORY)
return ERROR_OUTOFMEMORY;
else
return ERROR_INTERNAL_ERROR;
}
}
return nError;
}
LONG CRegistryKey::GetSubkeyNameMaxLength(DWORD &rdwMaxSubkeyNameLength)
{
if (m_hKey == NULL)
{ // root key
rdwMaxSubkeyNameLength = 0;
for(int i = 0; i < 7 ; i++)
{
size_t l = _tcslen(g_ppszHiveNames[i]);
if (rdwMaxSubkeyNameLength < l)
rdwMaxSubkeyNameLength = l;
}
rdwMaxSubkeyNameLength++; // terminating null
return ERROR_SUCCESS;
}
LONG nRet;
nRet = RegQueryInfoKey(m_hKey,NULL,NULL,NULL,NULL,&rdwMaxSubkeyNameLength,NULL,NULL,NULL,NULL,NULL,NULL);
rdwMaxSubkeyNameLength = (nRet == ERROR_SUCCESS)?(rdwMaxSubkeyNameLength+1):0;
return nRet;
}
void CRegistryKey::InitSubkeyEnumeration(TCHAR *pszSubkeyNameBuffer, DWORD dwBufferSize)
{
m_pchSubkeyNameBuffer = pszSubkeyNameBuffer;
m_dwSubkeyNameBufferSize = dwBufferSize;
m_dwCurrentSubKeyIndex = 0;
}
LONG CRegistryKey::GetNextSubkeyName(DWORD *pdwActualSize)
{
LONG nError;
if (m_hKey == NULL)
{
if (m_dwCurrentSubKeyIndex < (DWORD)(m_pszMachineName?5:7))
{
DWORD dwIndex = m_pszMachineName?m_dwCurrentSubKeyIndex+2:m_dwCurrentSubKeyIndex;
_tcsncpy(m_pchSubkeyNameBuffer,g_ppszHiveNames[dwIndex],m_dwSubkeyNameBufferSize);
nError = ERROR_SUCCESS;
if (pdwActualSize)
*pdwActualSize = strlen(m_pchSubkeyNameBuffer);
}
else
{
nError = ERROR_NO_MORE_ITEMS;
}
}
else
{
DWORD dwActualSize = m_dwSubkeyNameBufferSize;
FILETIME ft;
nError = RegEnumKeyEx(m_hKey,
m_dwCurrentSubKeyIndex,
m_pchSubkeyNameBuffer,
&dwActualSize,
NULL,
NULL,
NULL,
&ft);
if (pdwActualSize)
*pdwActualSize = dwActualSize;
}
m_dwCurrentSubKeyIndex++;
if (pdwActualSize)
*pdwActualSize = strlen(m_pchSubkeyNameBuffer);
return nError;
}
LONG CRegistryKey::GetSubkeyCount(DWORD &rdwSubkeyCount)
{
return RegQueryInfoKeyW(m_hKey,NULL,NULL,NULL,&rdwSubkeyCount,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
}
LONG CRegistryKey::GetMaxValueDataSize(DWORD& rdwMaxValueDataBuferSize)
{
return RegQueryInfoKeyW(m_hKey,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,&rdwMaxValueDataBuferSize,NULL,NULL);
}
LONG CRegistryKey::GetMaxValueNameLength(DWORD& rdwMaxValueNameBuferSize)
{
rdwMaxValueNameBuferSize = 0;
if (!m_hKey)
return 0; // the root key abstraction has only subkeys (hives)
LONG nError = RegQueryInfoKeyW(m_hKey,NULL,NULL,NULL,NULL,NULL,NULL,NULL,&rdwMaxValueNameBuferSize,NULL,NULL,NULL);
rdwMaxValueNameBuferSize++;
return nError;
}
void CRegistryKey::InitValueEnumeration(TCHAR *pszValueNameBuffer,
DWORD dwValueNameBufferSize,
BYTE *pbValueDataBuffer,
DWORD dwValueDataBufferSize,
DWORD *pdwType)
{
m_pszValueNameBuffer = pszValueNameBuffer;
m_dwValueNameBufferSize = dwValueNameBufferSize;
m_pbValueDataBuffer = pbValueDataBuffer;
m_dwValueDataBufferSize = dwValueDataBufferSize;
m_pdwType = pdwType;
m_dwCurrentValueIndex = 0;
}
// On input dwValueNameSize is size in characters of buffer pointed by pchValueNameBuffer
// On output dwValueNameSize contains number of characters stored in buffer
LONG CRegistryKey::GetNextValue(DWORD *pdwNameActualSize, DWORD *pdwDataActualSize)
{
if (!m_hKey)
return ERROR_NO_MORE_ITEMS; // the root key abstraction has only subkeys (hives)
DWORD dwValueNameBufferSize = m_dwValueNameBufferSize;
DWORD dwValueDataBufferSize = m_dwValueDataBufferSize;
LONG nError = RegEnumValue(m_hKey,
m_dwCurrentValueIndex,
m_pszValueNameBuffer,
&dwValueNameBufferSize,
NULL,
m_pdwType,
m_pbValueDataBuffer,
&dwValueDataBufferSize);
if (pdwNameActualSize)
*pdwNameActualSize = dwValueNameBufferSize;
if (pdwDataActualSize)
*pdwDataActualSize = dwValueDataBufferSize;
m_dwCurrentValueIndex++;
return nError;
}
LONG CRegistryKey::GetValueCount(DWORD& rdwValueCount)
{
if (!m_hKey)
return 0; // the root key abstraction has only subkeys (hives)
return RegQueryInfoKeyW(m_hKey,NULL,NULL,NULL,NULL,NULL,NULL,&rdwValueCount,NULL,NULL,NULL,NULL);
}
LONG CRegistryKey::GetDefaultValue(DWORD *pdwType,
BYTE *pbValueDataBuffer,
DWORD dwValueDataBufferSize,
DWORD *pdwValueDataActualSize)
{
DWORD dwBufferSize = dwValueDataBufferSize;
LONG nError = RegQueryValueEx(m_hKey,NULL,NULL,pdwType,pbValueDataBuffer,&dwBufferSize);
if (pdwValueDataActualSize && (nError == ERROR_SUCCESS))
*pdwValueDataActualSize = dwBufferSize;
return nError;
}
const TCHAR * CRegistryKey::GetValueTypeName(DWORD dwType)
{
switch(dwType)
{
case REG_NONE:
return _T("REG_NONE");
case REG_SZ:
return _T("REG_SZ");
case REG_EXPAND_SZ:
return _T("REG_EXPAND_SZ");
case REG_BINARY:
return _T("REG_BINARY");
case REG_DWORD_LITTLE_ENDIAN:
return _T("REG_DWORD_LITTLE_ENDIAN");
case REG_DWORD_BIG_ENDIAN:
return _T("REG_DWORD_BIG_ENDIAN");
case REG_LINK:
return _T("REG_LINK");
case REG_MULTI_SZ:
return _T("REG_MULTI_SZ");
case REG_RESOURCE_LIST:
return _T("REG_RESOURCE_LIST");
case REG_FULL_RESOURCE_DESCRIPTOR:
return _T("REG_FULL_RESOURCE_DESCRIPTOR");
case REG_RESOURCE_REQUIREMENTS_LIST:
return _T("REG_RESOURCE_REQUIREMENTS_LIST");
default:
return _T("Unkown Type");
}
}
DWORD CRegistryKey::GetValue(TCHAR *pchValueName, DWORD *pdwType, LPBYTE lpValueDataBuffer, DWORD *pdwValueDataSize)
{
return RegQueryValueEx(m_hKey,pchValueName,NULL,pdwType,lpValueDataBuffer,pdwValueDataSize);
}
LONG CRegistryKey::CreateSubkey(REGSAM samDesired,
const TCHAR *pszSubkeyName,
HKEY &rhKey,
BOOL *pblnOpened,
BOOL blnVolatile)
{
DWORD dwDisposition;
LONG nError = RegCreateKeyEx(
m_hKey,
pszSubkeyName,
0,
NULL,
blnVolatile?REG_OPTION_VOLATILE:REG_OPTION_NON_VOLATILE,
samDesired,
NULL,
&rhKey,
&dwDisposition);
if ((nError == ERROR_SUCCESS)&&(pblnOpened))
*pblnOpened = dwDisposition == REG_OPENED_EXISTING_KEY;
return nError;
}
LONG CRegistryKey::GetLastWriteTime(SYSTEMTIME &st)
{
FILETIME ftLocal,ft;
LONG nError = RegQueryInfoKeyW(m_hKey,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,&ft);
if (nError == ERROR_SUCCESS)
{
FileTimeToLocalFileTime(&ft,&ftLocal);
FileTimeToSystemTime(&ftLocal,&st);
}
return nError;
}
const TCHAR * CRegistryKey::GetLastWriteTime()
{
SYSTEMTIME st;
if (GetLastWriteTime(st) != ERROR_SUCCESS)
return _T("(Cannot get time last write time)");
static TCHAR Buffer[256];
_stprintf(Buffer,_T("%d.%d.%d %02d:%02d:%02d"),st.wDay,st.wMonth,st.wYear,st.wHour,st.wMinute,st.wSecond);
return Buffer;
}
LONG CRegistryKey::GetSecurityDescriptorLength(DWORD *pdwSecurityDescriptor)
{
return RegQueryInfoKeyW(m_hKey,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,pdwSecurityDescriptor,NULL);
}
LONG CRegistryKey::GetSecurityDescriptor(SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, LPDWORD lpcbSecurityDescriptor)
{
return RegGetKeySecurity(m_hKey,SecurityInformation,pSecurityDescriptor,lpcbSecurityDescriptor);
}
LONG CRegistryKey::DeleteSubkey(const TCHAR *pszSubkeyName)
{
return RegDeleteKey(m_hKey,pszSubkeyName);
}
LONG CRegistryKey::SetValue(LPCTSTR pszValueName, DWORD dwType, BYTE *lpData, DWORD dwDataSize)
{
return RegSetValueEx(m_hKey,pszValueName,0,dwType,lpData,dwDataSize);
}
LONG CRegistryKey::DeleteValue(const TCHAR *pszValueName)
{
return RegDeleteValue(m_hKey,pszValueName);
}

View file

@ -0,0 +1,258 @@
//
// RegistryKey.h: interface for the CRegistryKey class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(REGISTRYKEY_H__FEF419ED_6EB6_11D3_907D_204C4F4F5020__INCLUDED_)
#define REGISTRYKEY_H__FEF419ED_6EB6_11D3_907D_204C4F4F5020__INCLUDED_
class CRegistryKey
{
public:
// Constructor. Call InitXXX methods to make real construct.
CRegistryKey();
// Call this key to init root key.
//
// Parameters:
// pszMachineName - pointer to buffer containing machine name. NULL means local machine.
//
// Return value:
// S_OK - All ok.
// E_XXX - Error.
HRESULT InitRoot(const TCHAR *pszMachineName = NULL);
// Call this method to init normal key.
//
// Parameters:
// hKey - handle to opened key.
// pszPath - optional path string. NULL if pszKeyName is the needed name.
// pszKeyName - pointer to buffer conatining name of key.
// CurrentAccess - Access of hKey.
//
// Remarks:
// Constructs key object from handle.
// The constructed object hold the handle and closes it on destruction. Do not close handle outside.
// If pszPath is not NULL, it is concatenated with pszKeyName.
//
// Return value:
// S_OK - All ok.
// E_XXX - Error.
HRESULT Init(HKEY hKey, const TCHAR *pszPath, const TCHAR *pszKeyName, REGSAM CurrentAccess);
// Call this method to uninitialize the object.
//
// Return value:
// S_OK - All ok.
// E_XXX - Error.
HRESULT Uninit();
// Destructor
virtual ~CRegistryKey();
// Call ths function to check if handle to key is handle to hive root.
//
// Parameters:
// hKey - handle to check.
//
// Return value:
// TRUE - hKey is handle to hive root.
// FALSE - hKey is not handle to hive root.
static BOOL IsHive(HKEY hKey);
// Call this method to get name of key represented by this object.
//
// Return value:
// Pointer to buffer containing key name. Return value is valid until next call to this object method.
const TCHAR * GetKeyName();
BOOL IsRoot();
// Call this method to open existing subkey of this key.
//
// Parameters:
// samDesired - deisred access.
// pszSubkeyName - pointer to bufer containing name of key to open.
// rhKey - reference to variable that receives handle of opened key. If method fails, variable value is unchanged.
//
// Return value:
// If the method succeeds, the return value is ERROR_SUCCESS.
// If the method fails, the return value is a nonzero error code defined in winerror.h.
LONG OpenSubkey(REGSAM samDesired, const TCHAR *pszSubkeyName, HKEY &rhKey);
// Call this method to open existing subkey of this key.
//
// Parameters:
// samDesired - deisred access.
// pszSubkeyName - pointer to bufer containing name of key to open.
// rKey - reference to CRegistryKey object. If method succeeds, rKey is initialized with newly opened key.
//
// Return value:
// If the method succeeds, the return value is ERROR_SUCCESS.
// If the method fails, the return value is a nonzero error code defined in winerror.h.
LONG OpenSubkey(REGSAM samDesired, const TCHAR *pszSubkeyName, CRegistryKey &rKey);
// Call this method to get the length in TCHARs of longest subkey name, including terminating null.
//
// Parameters:
// rdwMaxSubkeyNameLength, reference to variable that receives size in TCHARs of longest subkey name.
//
// Return value.
// If the method succeeds, the return value is ERROR_SUCCESS.
// If the method fails, the return value is a nonzero error code defined in winerror.h.
LONG GetSubkeyNameMaxLength(DWORD &rdwMaxSubkeyNameLength);
// Call this method to init subkey enumeration. I.e. before first call to GetSubkeyName()
//
// Parameters:
// pchSubkeyNameBuffer - pointer to buffer receiving subkey name.
// dwBufferSize - size, in TCHARs of buffer pointed by pchSubkeyNameBuffer.
//
void InitSubkeyEnumeration(TCHAR *pchSubkeyNameBuffer, DWORD dwBufferSize);
// Call this method to get next subkey name. Name is stored in buffer specified in call to InitSubKeyEnumeration.
//
// Parameters:
// pdwActualSize - optional pointer to variable receiving actual size, in TCHARs, of key name. The count returned does not include the terminating null.
//
// Return value:
// If the method succeeds, the return value is ERROR_SUCCESS.
// If the method fails, the return value is a nonzero error code defined in winerror.h.
// If no more items available, return error is ERROR_NO_MORE_ITEMS.
LONG GetNextSubkeyName(DWORD *pdwActualSize = NULL);
// Call this method to get count of subkeys.
//
// Parameters:
// rdwSubkeyCount - reference to variable that receives subkey count.
//
// Return value:
// If the method succeeds, the return value is ERROR_SUCCESS.
// If the method fails, the return value is a nonzero error code defined in winerror.h.
LONG GetSubkeyCount(DWORD &rdwSubkeyCount);
// Call this method to get the length in TCHARs of longest value name, including terminating null.
//
// Parameters:
// rdwMaxValueNameBufferSize receives the length, in TCHARs, of the key's longest value name.
//
// Return value:
// If the method succeeds, the return value is ERROR_SUCCESS.
// If the method fails, the return value is a nonzero error code defined in winerror.h.
LONG GetMaxValueNameLength(DWORD& rdwMaxValueNameBufferSize);
// Call this method to get the size of larges value data.
//
// Parameters:
// rdwMaxValueDataBufferSize receives the length, in bytes, of the longest data component among the key's values.
//
// Return value:
// If the method succeeds, the return value is ERROR_SUCCESS.
// If the method fails, the return value is a nonzero error code defined in winerror.h.
LONG GetMaxValueDataSize(DWORD& rdwMaxValueDataBufferSize);
// Call this method to init subkey enumeration. I.e. before first call to GetSubkeyName()
//
// Parameters:
// pszValueNameBuffer - pointer to buffer receiving value name. If NULL, value name in not received upon iteration.
// dwValueNameBufferSize - size, in TCHARs of buffer pointed by pszValueNameBuffer. If pszValueNameBuffer is NULL, parameter is ignored.
// pbValueDataBuffer - pointer to buffer receiving value name. If NULL, value data is not received upon iteration.
// dwValueDataBufferSize - size, in bytes of buffer pointed by pbValueDataBuffer. If pbValueDataBuffer is NULL, parameter is ignored.
// pdwType - pointer to variable receiving value type. If NULL, value type is not received upon iteration.
void InitValueEnumeration(TCHAR *pszValueNameBuffer,
DWORD dwValueNameBufferSize,
BYTE *pbValueDataBuffer,
DWORD dwValueDataBufferSize,
DWORD *pdwType);
// Call this method to get next value name/data/type. Name/data/type is/are stored in buffer(s) specified in call to InitValueEnumeration.
//
// Parameters:
// pdwNameActualSize - optional pointer to variable receiving actual size, in TCHARs, of value name. The count returned includes the terminating null.
// pdwActualSize - optional pointer to variable receiving actual size, in bytes, of key name. The count returned does not include the terminating null.
//
// Return value:
// If the method succeeds, the return value is ERROR_SUCCESS.
// If the method fails, the return value is a nonzero error code defined in winerror.h.
// If no more items available, return error is ERROR_NO_MORE_ITEMS.
LONG GetNextValue(DWORD *pdwNameActualSize = NULL, DWORD *pdwDataActualSize = NULL);
// Call this method to get count of values.
//
// Parameters:
// rdwValueCount - reference to variable that receives value count.
//
// Return value:
// If the method succeeds, the return value is ERROR_SUCCESS.
// If the method fails, the return value is a nonzero error code defined in winerror.h.
LONG GetValueCount(DWORD& rdwValueCount);
// Call this method to get data and/or type of default value.
//
// Parameters:
// pdwType - optional pointer to variable receiving default value type. NULL if not requred.
// pbValueDataBuffer - optional pointer to buffer receiving default value data. NULL if not requred.
// dwValueDataBufferSize - size of buffer pointer by pbValueDataBuffer. Ignored if pbValueDataBuffer is NULL.
// pdwValueDataActualSize - optional pointer to variable receiving size, in bytes, of data stored into buffer. If pbValueDataBuffer is NULL, returned value is size of default value data, in bytes.
//
// Return value:
// If the method succeeds, the return value is ERROR_SUCCESS.
// If the method fails, the return value is a nonzero error code defined in winerror.h.
LONG GetDefaultValue(DWORD *pdwType, BYTE *pbValueDataBuffer, DWORD dwValueDataBufferSize, DWORD *pdwValueDataActualSize);
// Call this function to get text representation of value type.
//
// Parameters:
// dwType - type to get text representation from.
//
// Return value:
// text representation od value type.
static const TCHAR * GetValueTypeName(DWORD dwType);
DWORD GetValue(TCHAR *pchValueName, DWORD *pdwType, LPBYTE lpValueDataBuffer, DWORD *pdwValueDataSize);
// Call this method to create subkey of this key.
//
// Parameters:
// samDesired - deisred access.
// pszKeyName - pointer to bufer containing name of key to create.
// rhKey - reference to variable that receives handle of opened key. If method fails, variable value is unchanged.
// pblnOpened - optional pointer to variable that receives create/open status. If subkey is opened value is TRUE. If key is created value is FALSE.
// blnVolatile - opitional parameter specifining if created key is volatile.
//
// Return value:
// If the method succeeds, the return value is ERROR_SUCCESS.
// If the method fails, the return value is a nonzero error code defined in winerror.h.
LONG CreateSubkey(REGSAM samDesired, const TCHAR *pszKeyName, HKEY &rhKey, BOOL *pblnOpened = NULL, BOOL blnVolatile = FALSE);
LONG GetLastWriteTime(SYSTEMTIME& st);
const TCHAR * GetLastWriteTime();
LONG DeleteValue(const TCHAR *pszValueName);
LONG DeleteSubkey(const TCHAR *pszPatternSubkeyName);
LONG SetValue(LPCTSTR pszValueName, DWORD dwType, BYTE *lpData, DWORD dwDataSize);
TCHAR * GetSubKeyNameByIndex(DWORD dwIndex);
LONG GetSecurityDescriptor(SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, LPDWORD lpcbSecurityDescriptor);
LONG GetSecurityDescriptorLength(DWORD *pdwSecurityDescriptor);
BOOL IsPredefined();
operator HKEY(){return m_hKey;};
private:
DWORD m_dwCurrentSubKeyIndex;
TCHAR *m_pchSubkeyNameBuffer;
DWORD m_dwSubkeyNameBufferSize;
DWORD m_dwCurrentValueIndex;
TCHAR *m_pszValueNameBuffer;
DWORD m_dwValueNameBufferSize;
BYTE *m_pbValueDataBuffer;
DWORD m_dwValueDataBufferSize;
DWORD *m_pdwType;
HKEY m_hKey;
TCHAR *m_pszKeyName;
TCHAR *m_pszMachineName;
REGSAM m_CurrentAccess;
};
#endif // !defined(REGISTRYKEY_H__FEF419ED_6EB6_11D3_907D_204C4F4F5020__INCLUDED_)

View file

@ -0,0 +1,643 @@
/*
* regexpl - Console Registry Explorer
*
* Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
// RegistryTree.cpp: implementation of the CRegistryTree class.
#include "ph.h"
#include "RegistryTree.h"
#include "Pattern.h"
#include "RegistryExplorer.h"
CRegistryTree::CRegistryTree()
{
m_pszMachineName = NULL;
VERIFY(SUCCEEDED(m_Root.m_Key.InitRoot()));
m_Root.m_pUp = NULL;
m_pCurrentKey = &m_Root;
ASSERT(m_pCurrentKey->m_Key.IsRoot());
m_ErrorMsg[ERROR_MSG_BUFFER_SIZE] = 0;
}
CRegistryTree::CRegistryTree(const CRegistryTree& Tree)
{
m_pszMachineName = NULL;
VERIFY(SUCCEEDED(m_Root.m_Key.InitRoot()));
m_Root.m_pUp = NULL;
m_pCurrentKey = &m_Root;
ASSERT(m_pCurrentKey->m_Key.IsRoot());
const TCHAR *pszPath = Tree.GetCurrentPath();
if ((pszPath[0] == _T('\\')) && (pszPath[1] == _T('\\')))
{ // path has machine name
pszPath += 2;
while (*pszPath && (*pszPath != _T('\\')))
pszPath++;
ASSERT(*pszPath == _T('\\')); // if path begins with \\ it must be followed by machine name
}
if (Tree.m_pszMachineName)
SetMachineName(Tree.m_pszMachineName);
VERIFY(ChangeCurrentKey(pszPath));
}
CRegistryTree::~CRegistryTree()
{
if (m_pszMachineName)
delete[] m_pszMachineName;
CNode *pNode;
while(m_pCurrentKey->m_pUp)
{
pNode = m_pCurrentKey;
m_pCurrentKey = m_pCurrentKey->m_pUp;
delete pNode;
}
// We are on root
ASSERT(m_pCurrentKey->m_Key.IsRoot());
ASSERT(m_pCurrentKey == &m_Root);
}
const TCHAR * CRegistryTree::GetCurrentPath() const
{
return m_pCurrentKey->m_Key.GetKeyName();
}
BOOL CRegistryTree::IsCurrentRoot()
{
return m_pCurrentKey->m_Key.IsRoot();
}
BOOL CRegistryTree::ChangeCurrentKey(const TCHAR *pszRelativePath)
{
if (*pszRelativePath == _T('\\'))
GotoRoot(); // This is full absolute path.
// split path to key names.
const TCHAR *pszSeps = _T("\\");
// Make buffer and copy relative path into it.
TCHAR *pszBuffer = new (std::nothrow) TCHAR[_tcslen(pszRelativePath)+1];
if (!pszBuffer)
{
SetError(ERROR_OUTOFMEMORY);
return FALSE;
}
_tcscpy(pszBuffer,pszRelativePath);
// We accept names in form "\"blablabla\\blab labla\"\\"
size_t size = _tcslen(pszBuffer);
if (size)
{
if (pszBuffer[size-1] == _T('\\'))
pszBuffer[--size] = 0;
TCHAR *psz;
if (*pszBuffer == _T('\"') && (psz = _tcschr(pszBuffer+1,_T('\"'))) && size_t(psz-pszBuffer) == size-1)
{
size--;
pszBuffer[size] = 0;
pszBuffer++;
}
}
const TCHAR *pszNewKey = _tcstok(pszBuffer,pszSeps);
if ((!pszNewKey)&&((*pszRelativePath != _T('\\'))||(*(pszRelativePath+1) != 0)))
{
SetError(_T("Invalid key name"));
goto Abort;
};
// change keys
while (pszNewKey)
{
if (!InternalChangeCurrentKey(pszNewKey,KEY_READ))
goto Abort; // InternalChangeCurrentKey sets last error description
// Get next key name
pszNewKey = _tcstok(NULL,pszSeps);
}
return TRUE;
Abort:
delete[] pszBuffer;
return FALSE;
}
const TCHAR * CRegistryTree::GetLastErrorDescription()
{
return m_ErrorMsg;
}
void CRegistryTree::GotoRoot()
{
// Delete current tree
CNode *pNode;
while(m_pCurrentKey->m_pUp)
{
pNode = m_pCurrentKey;
m_pCurrentKey = m_pCurrentKey->m_pUp;
delete pNode;
}
// We are on root
ASSERT(m_pCurrentKey->m_Key.IsRoot());
ASSERT(m_pCurrentKey == &m_Root);
}
BOOL CRegistryTree::SetMachineName(LPCTSTR pszMachineName)
{
GotoRoot();
// If we are going to local machine...
if (pszMachineName == NULL)
{
// Delete previous machine name buffer if allocated.
if (m_pszMachineName)
delete[] m_pszMachineName;
m_pszMachineName = NULL;
m_Root.m_Key.InitRoot();
return TRUE;
}
// Skip leading backslashes if any.
while ((*pszMachineName)&&(*pszMachineName == _T('\\')))
pszMachineName++;
ASSERT(*pszMachineName); // No machine name.
TCHAR *pszNewMachineName = new (std::nothrow) TCHAR[_tcslen(pszMachineName)+3]; // two leading backslashes + terminating null
if (!pszNewMachineName)
{
SetError(ERROR_OUTOFMEMORY);
return FALSE;
}
// Delete previous machine name buffer if allocated.
if (m_pszMachineName)
delete[] m_pszMachineName;
m_pszMachineName = pszNewMachineName;
_tcscpy(m_pszMachineName,_T("\\\\")); // leading backslashes
_tcscpy(m_pszMachineName+2,pszMachineName); // machine name itself
_tcsupr(m_pszMachineName+2); // upercase it
VERIFY(SUCCEEDED(m_Root.m_Key.InitRoot(m_pszMachineName)));
return TRUE;
}
BOOL CRegistryTree::NewKey(const TCHAR *pszKeyName, const TCHAR *pszPath, BOOL blnVolatile)
{
if (!m_pCurrentKey)
{
SetErrorCommandNAOnRoot(_T("Creating new key "));
return FALSE;
}
CRegistryTree Tree(*this);
if (!Tree.ChangeCurrentKey(pszPath))
{
SetError(Tree.GetLastErrorDescription());
return FALSE;
}
BOOL blnOpened;
HKEY hKey;
LONG nError = Tree.m_pCurrentKey->m_Key.CreateSubkey(KEY_READ,
pszKeyName,
hKey,
&blnOpened,
blnVolatile);
if (nError == ERROR_SUCCESS)
{
LONG nError = RegCloseKey(hKey);
ASSERT(nError == ERROR_SUCCESS);
}
if ((nError == ERROR_SUCCESS) && blnOpened)
{
SetError(_T("A key \"%s\" already exists."),pszKeyName);
return FALSE;
}
if (nError != ERROR_SUCCESS)
{
SetError(_T("Cannot create key : %s%s\nError %d (%s)\n"),
GetCurrentPath(),pszKeyName,nError,GetErrorDescription(nError));
return FALSE;
}
return TRUE;
}
BOOL CRegistryTree::DeleteSubkeys(const TCHAR *pszKeyPattern, const TCHAR *pszPath, BOOL blnRecursive)
{
CRegistryKey Key;
if (!GetKey(pszPath,KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS|DELETE,Key))
return FALSE;
return DeleteSubkeys(Key, pszKeyPattern, blnRecursive);
}
BOOL CRegistryTree::DeleteSubkeys(CRegistryKey& rKey, const TCHAR *pszKeyPattern, BOOL blnRecursive)
{
LONG nError;
// enumerate subkeys
DWORD dwMaxSubkeyNameLength;
nError = rKey.GetSubkeyNameMaxLength(dwMaxSubkeyNameLength);
if (nError != ERROR_SUCCESS)
{
SetError(_T("Cannot delete subkeys(s) of key %s.\nRequesting info about key failed.\nError %d (%s)\n"),
rKey.GetKeyName(),nError,GetErrorDescription(nError));
return FALSE;
}
TCHAR *pszSubkeyName = new (std::nothrow) TCHAR [dwMaxSubkeyNameLength];
rKey.InitSubkeyEnumeration(pszSubkeyName, dwMaxSubkeyNameLength);
BOOL blnKeyDeleted = FALSE;
while ((nError = rKey.GetNextSubkeyName()) == ERROR_SUCCESS)
{
if (PatternMatch(pszKeyPattern,pszSubkeyName))
{
if (blnRecursive)
{ // deltion is recursive, delete subkey subkeys
CRegistryKey Subkey;
// open subkey
nError = rKey.OpenSubkey(DELETE,pszSubkeyName,Subkey);
// delete subkey subkeys
if (DeleteSubkeys(Subkey, PATTERN_MATCH_ALL, TRUE))
{
AddErrorDescription(_T("Cannot delete subkey(s) of key %s. Subkey deletion failed.\n"),Subkey.GetKeyName());
return FALSE;
}
}
nError = rKey.DeleteSubkey(pszSubkeyName);
if (nError != ERROR_SUCCESS)
{
SetError(_T("Cannot delete the %s subkey of key %s.\nError %d (%s)\n"),
pszSubkeyName,rKey.GetKeyName(),nError,GetErrorDescription(nError));
return FALSE;
}
blnKeyDeleted = TRUE;
rKey.InitSubkeyEnumeration(pszSubkeyName, dwMaxSubkeyNameLength); // reset iteration
}
}
ASSERT(nError != ERROR_SUCCESS);
if (nError != ERROR_NO_MORE_ITEMS)
{
SetError(_T("Cannot delete subkeys(s) of key %s.\nSubkey enumeration failed.\nError %d (%s)\n"),
rKey.GetKeyName(),nError,GetErrorDescription(nError));
return FALSE;
}
if (!blnKeyDeleted)
SetError(_T("The key %s has no subkeys that match %s pattern.\n"),rKey.GetKeyName(),pszKeyPattern);
return blnKeyDeleted;
}
const TCHAR * CRegistryTree::GetErrorDescription(LONG nError)
{
switch(nError)
{
case ERROR_ACCESS_DENIED:
return _T("Access denied");
case ERROR_FILE_NOT_FOUND:
return _T("The system cannot find the key specified");
case ERROR_INTERNAL_ERROR:
return _T("Internal error");
case ERROR_OUTOFMEMORY:
return _T("Out of memory");
default:
return _T("Unknown error");
}
}
void CRegistryTree::SetError(LONG nError)
{
SetError(_T("Error %u (%s)"),nError,GetErrorDescription(nError));
}
void CRegistryTree::SetError(const TCHAR *pszFormat, ...)
{
va_list args;
va_start(args,pszFormat);
if (_vsntprintf(m_ErrorMsg,ERROR_MSG_BUFFER_SIZE,pszFormat,args) < 0)
m_ErrorMsg[ERROR_MSG_BUFFER_SIZE] = 0;
va_end(args);
}
void CRegistryTree::SetInternalError()
{
SetError(_T("Internal Error"));
}
void CRegistryTree::AddErrorDescription(const TCHAR *pszFormat, ...)
{
size_t size = _tcslen(m_ErrorMsg);
if (size < ERROR_MSG_BUFFER_SIZE)
{
TCHAR *pszAdd = m_ErrorMsg+size;
va_list args;
va_start(args,pszFormat);
size = ERROR_MSG_BUFFER_SIZE-size;
if (_vsntprintf(pszAdd,size,pszFormat,args) < 0)
m_ErrorMsg[size] = 0;
va_end(args);
}
}
void CRegistryTree::SetErrorCommandNAOnRoot(const TCHAR *pszCommand)
{
ASSERT(pszCommand);
if (pszCommand)
SetError(_T("%s") COMMAND_NA_ON_ROOT,pszCommand);
else
SetInternalError();
}
BOOL CRegistryTree::InternalChangeCurrentKey(const TCHAR *pszSubkeyName, REGSAM DesiredAccess)
{
size_t size = _tcslen(pszSubkeyName);
TCHAR *pszSubkeyNameBuffer = new (std::nothrow) TCHAR[size+3];
if (!pszSubkeyNameBuffer)
{
SetError(_T("Cannot open key : %s%s\nError %d (%s)\n"),
GetCurrentPath(),pszSubkeyName,ERROR_OUTOFMEMORY,GetErrorDescription(ERROR_OUTOFMEMORY));
}
_tcscpy(pszSubkeyNameBuffer,pszSubkeyName);
if (size && (pszSubkeyName[0] == _T('\"')) && (pszSubkeyName[size-1] == _T('\"')))
{
pszSubkeyNameBuffer[size-1] = 0;
pszSubkeyName = pszSubkeyNameBuffer+1;
}
if (_tcscmp(pszSubkeyName,_T(".")) == 0)
{
delete[] pszSubkeyNameBuffer;
return TRUE;
}
if (_tcscmp(pszSubkeyName,_T("..")) == 0)
{
// Up level abstraction
if (m_pCurrentKey->m_Key.IsRoot())
{
// We are on root
ASSERT(m_pCurrentKey->m_pUp == NULL);
SetError(_T("Cannot open key. The root is not child.\n"));
delete[] pszSubkeyNameBuffer;
return FALSE;
}
ASSERT(m_pCurrentKey->m_pUp);
if (!m_pCurrentKey->m_pUp)
{
SetInternalError();
delete[] pszSubkeyNameBuffer;
return FALSE;
}
CNode *pNode = m_pCurrentKey;
m_pCurrentKey = m_pCurrentKey->m_pUp;
delete pNode;
delete[] pszSubkeyNameBuffer;
return TRUE;
}
CNode *pNewKey = new CNode;
if (!pNewKey)
{
SetError(_T("Cannot open key : %s%s\nError %d (%s)\n"),
GetCurrentPath(),pszSubkeyName,ERROR_OUTOFMEMORY,GetErrorDescription(ERROR_OUTOFMEMORY));
delete[] pszSubkeyNameBuffer;
return FALSE;
}
if (!InternalGetSubkey(pszSubkeyName,DesiredAccess,pNewKey->m_Key))
{
delete pNewKey;
delete[] pszSubkeyNameBuffer;
return FALSE;
}
pNewKey->m_pUp = m_pCurrentKey;
m_pCurrentKey = pNewKey;
delete[] pszSubkeyNameBuffer;
return TRUE;
}
BOOL CRegistryTree::InternalGetSubkey(const TCHAR *pszSubkeyName, REGSAM DesiredAccess, CRegistryKey& rKey)
{
LONG nError;
HKEY hNewKey = NULL;
TCHAR *pszSubkeyNameCaseUpdated = NULL;
nError = m_pCurrentKey->m_Key.OpenSubkey(DesiredAccess,pszSubkeyName,hNewKey);
if (nError != ERROR_SUCCESS)
{
SetError(_T("Cannot open key : %s%s\nError %u (%s)\n"),
GetCurrentPath(),pszSubkeyName,nError,GetErrorDescription(nError));
return FALSE;
}
// enum subkeys to find the subkey and get its name in stored case.
DWORD dwMaxSubkeyNameLength;
nError = m_pCurrentKey->m_Key.GetSubkeyNameMaxLength(dwMaxSubkeyNameLength);
if (nError != ERROR_SUCCESS)
goto SkipCaseUpdate;
pszSubkeyNameCaseUpdated = new (std::nothrow) TCHAR [dwMaxSubkeyNameLength];
m_pCurrentKey->m_Key.InitSubkeyEnumeration(pszSubkeyNameCaseUpdated, dwMaxSubkeyNameLength);
while ((nError = m_pCurrentKey->m_Key.GetNextSubkeyName()) == ERROR_SUCCESS)
if (_tcsicmp(pszSubkeyNameCaseUpdated, pszSubkeyName) == 0)
break;
if (nError != ERROR_SUCCESS)
{
delete[] pszSubkeyNameCaseUpdated;
pszSubkeyNameCaseUpdated = NULL;
}
SkipCaseUpdate:
HRESULT hr;
ASSERT(hNewKey);
if (pszSubkeyNameCaseUpdated)
{
hr = rKey.Init(hNewKey,GetCurrentPath(),pszSubkeyNameCaseUpdated,DesiredAccess);
if (FAILED(hr))
{
if (hr == (HRESULT)E_OUTOFMEMORY)
SetError(_T("Cannot open key : %s%s\nError %d (%s)\n"),
GetCurrentPath(),pszSubkeyName,ERROR_OUTOFMEMORY,GetErrorDescription(ERROR_OUTOFMEMORY));
else
SetError(_T("Cannot open key : %s%s\nUnknown error\n"), GetCurrentPath(), pszSubkeyName);
goto Abort;
}
delete[] pszSubkeyNameCaseUpdated;
}
else
{
hr = rKey.Init(hNewKey,GetCurrentPath(),pszSubkeyName,DesiredAccess);
if (FAILED(hr))
{
if (hr == (HRESULT)E_OUTOFMEMORY)
SetError(_T("Cannot open key : %s%s\nError %d (%s)\n"),
GetCurrentPath(),pszSubkeyName,ERROR_OUTOFMEMORY,GetErrorDescription(ERROR_OUTOFMEMORY));
else
SetError(_T("Cannot open key : %s%s\nUnknown error \n"),
GetCurrentPath(),
pszSubkeyName);
goto Abort;
}
}
return TRUE;
Abort:
if (pszSubkeyNameCaseUpdated)
delete[] pszSubkeyNameCaseUpdated;
if (hNewKey)
{
LONG nError = RegCloseKey(hNewKey);
ASSERT(nError == ERROR_SUCCESS);
}
return FALSE;
}
BOOL CRegistryTree::GetKey(const TCHAR *pszRelativePath, REGSAM DesiredAccess, CRegistryKey& rKey)
{
CRegistryTree Tree(*this);
if (!Tree.ChangeCurrentKey(pszRelativePath))
{
SetError(Tree.GetLastErrorDescription());
return FALSE;
}
if (Tree.m_pCurrentKey->m_Key.IsRoot())
{
HRESULT hr = rKey.InitRoot(m_pszMachineName);
if (FAILED(hr))
{
if (hr == (HRESULT)E_OUTOFMEMORY)
SetError(_T("\nError %d (%s)\n"),
ERROR_OUTOFMEMORY,GetErrorDescription(ERROR_OUTOFMEMORY));
else
SetInternalError();
return FALSE;
}
return TRUE;
}
// open key with desired access
// may be call to DuplicateHandle() is better.
// registry key handles returned by the RegConnectRegistry function cannot be used in a call to DuplicateHandle.
// Get short key name now...
const TCHAR *pszKeyName = Tree.m_pCurrentKey->m_Key.GetKeyName();
if (pszKeyName == NULL)
{
SetInternalError();
return FALSE;
}
size_t size = _tcslen(pszKeyName);
ASSERT(size);
if (!size)
{
SetInternalError();
return FALSE;
}
const TCHAR *pszShortKeyName_ = pszKeyName + size-1;
pszShortKeyName_--; // skip ending backslash
size = 0;
while (pszShortKeyName_ >= pszKeyName)
{
if (*pszShortKeyName_ == _T('\\'))
break;
pszShortKeyName_--;
size++;
}
if (!size || (*pszShortKeyName_ != _T('\\')))
{
ASSERT(FALSE);
SetInternalError();
return FALSE;
}
TCHAR *pszShortKeyName = new (std::nothrow) TCHAR [size+1];
if (!pszShortKeyName)
{
SetError(ERROR_OUTOFMEMORY);
return FALSE;
}
memcpy(pszShortKeyName,pszShortKeyName_+1,size*sizeof(TCHAR));
pszShortKeyName[size] = 0;
// change to parent key
if (!Tree.InternalChangeCurrentKey(_T(".."),READ_CONTROL))
{
delete[] pszShortKeyName;
ASSERT(FALSE);
SetInternalError();
return FALSE;
}
// change back to target key
if (!Tree.InternalGetSubkey(pszShortKeyName,DesiredAccess,rKey))
{
delete[] pszShortKeyName;
SetError(Tree.GetLastErrorDescription());
return FALSE;
}
delete[] pszShortKeyName;
return TRUE;
}

View file

@ -0,0 +1,115 @@
//
// RegistryTree.h: interface for the CRegistryTree class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(REGISTRYTREE_H__239A6461_70F2_11D3_9085_204C4F4F5020__INCLUDED_)
#define REGISTRYTREE_H__239A6461_70F2_11D3_9085_204C4F4F5020__INCLUDED_
#include "RegistryKey.h"
// Max size of error description.
#define ERROR_MSG_BUFFER_SIZE 1024
class CRegistryTree
{
public:
// Constructor
//
// Parameters:
// nMaxPathSize - size in characters of longest path including terminating NULL char
CRegistryTree();
// Destructor
virtual ~CRegistryTree();
// Call this function after fail of this class method.
//
// Return value:
// Pointer to buffer containing description of last error.
// return value is valid until next method of this class is called.
const TCHAR * GetLastErrorDescription();
// Call this function to get string representation (path) of current key.
//
// Return value:
// Pointer to buffer containing current key path. The pointer is valid until next call to this objet method.
const TCHAR * GetCurrentPath() const;
// Call this function to check if current key is the root key.
//
// Return value:
// FALSE - current key is not the root key.
// TRUE - current key is the root key.
BOOL IsCurrentRoot();
// Call this function to change the current key.
//
// Parameters:
// pchRelativePath - relative path to target key.
//
// Return value:
// TRUE - current key changed successfully.
// FALSE - failed to change current key. Call GetLastErrorDescription() to get error description.
BOOL ChangeCurrentKey(const TCHAR *pchRelativePath);
// Call this function to obtain key at relative path and opened with desired access.
//
// Parametes:
// pchRelativePath - path to key to be opened.
// DesiredAccess - desired access to key.
// rKey - reference to variable that receives pointer to key. Caller must free object with delete operator, when object is not longer needed.
//
// Return value:
// TRUE - key opened successfully.
// FALSE - failed to open desired key path size. Call GetLastErrorDescription() to get error description.
BOOL GetKey(const TCHAR *pchRelativePath, REGSAM DesiredAccess, CRegistryKey& rKey);
// Call this function to delete key subkeys.
//
// Parameters:
// pszKeyPattern - pattern to specifying which subkeys to delete.
// pszPath - path to key which subkeys will be deleted.
// blnRecursive - if FALSE and particular subkey has subkeys, it will not be deleted.
//
// Return value:
// TRUE - key opened successfully.
// FALSE - error. Call GetLastErrorDescription() to get error description.
BOOL DeleteSubkeys(const TCHAR *pszKeyPattern, const TCHAR *pszPath, BOOL blnRecursive = FALSE);
BOOL NewKey(const TCHAR *pszKeyName, const TCHAR *pszPath, BOOL blnVolatile = FALSE);
BOOL SetMachineName(LPCTSTR pszMachineName);
// Internal methods
private:
CRegistryTree(const CRegistryTree& Tree);
// returns description of error value returned by RegXXXX functions in advapi32.
const TCHAR *GetErrorDescription(LONG nError);
void SetError(LONG nError);
void SetError(const TCHAR *pszFormat, ...);
void SetErrorCommandNAOnRoot(const TCHAR *pszCommand);
void SetInternalError();
void AddErrorDescription(const TCHAR *pszFormat, ...);
BOOL InternalChangeCurrentKey(const TCHAR *pszSubkeyName, REGSAM DesiredAccess);
BOOL InternalGetSubkey(const TCHAR *pszSubkeyName, REGSAM DesiredAccess, CRegistryKey& rKey);
void GotoRoot();
BOOL DeleteSubkeys(CRegistryKey& rKey, const TCHAR *pszKeyPattern, BOOL blnRecursive);
private:
class CNode
{
public:
CNode *m_pUp;
CRegistryKey m_Key;
} m_Root;
CNode *m_pCurrentKey; // The current key.
TCHAR m_ErrorMsg[ERROR_MSG_BUFFER_SIZE+1]; // Last error description buffer.
LPTSTR m_pszMachineName; // Pointer to buffer containing machine name with leading backslashes. NULL if local.
};
#endif // !defined(REGISTRYTREE_H__239A6461_70F2_11D3_9085_204C4F4F5020__INCLUDED_)

View file

@ -0,0 +1,289 @@
/*
* regexpl - Console Registry Explorer
*
* Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
// SecurityDescriptor.cpp: implementation of the CSecurityDescriptor class.
//
//////////////////////////////////////////////////////////////////////
#include "ph.h"
#include "SecurityDescriptor.h"
BOOL GetTextualSid(
PSID pSid, // binary Sid
LPTSTR TextualSid, // buffer for Textual representation of Sid
LPDWORD lpdwBufferLen // required/provided TextualSid buffersize
)
{
PSID_IDENTIFIER_AUTHORITY psia;
DWORD dwSubAuthorities;
DWORD dwSidRev=SID_REVISION;
DWORD dwCounter;
DWORD dwSidSize;
// Validate the binary SID.
if(!IsValidSid(pSid)) return FALSE;
// Get the identifier authority value from the SID.
psia = GetSidIdentifierAuthority(pSid);
// Get the number of subauthorities in the SID.
dwSubAuthorities = *GetSidSubAuthorityCount(pSid);
// Compute the buffer length.
// S-SID_REVISION- + IdentifierAuthority- + subauthorities- + NULL
dwSidSize=(15 + 12 + (12 * dwSubAuthorities) + 1) * sizeof(TCHAR);
// Check input buffer length.
// If too small, indicate the proper size and set last error.
if (*lpdwBufferLen < dwSidSize)
{
*lpdwBufferLen = dwSidSize;
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
// Add 'S' prefix and revision number to the string.
dwSidSize=wsprintf(TextualSid, TEXT("S-%lu-"), dwSidRev );
// Add SID identifier authority to the string.
if ( (psia->Value[0] != 0) || (psia->Value[1] != 0) )
{
dwSidSize+=wsprintf(TextualSid + lstrlen(TextualSid),
TEXT("0x%02hx%02hx%02hx%02hx%02hx%02hx"),
(USHORT)psia->Value[0],
(USHORT)psia->Value[1],
(USHORT)psia->Value[2],
(USHORT)psia->Value[3],
(USHORT)psia->Value[4],
(USHORT)psia->Value[5]);
}
else
{
dwSidSize+=wsprintf(TextualSid + lstrlen(TextualSid),
TEXT("%lu"),
(ULONG)(psia->Value[5] ) +
(ULONG)(psia->Value[4] << 8) +
(ULONG)(psia->Value[3] << 16) +
(ULONG)(psia->Value[2] << 24) );
}
// Add SID subauthorities to the string.
//
for (dwCounter=0 ; dwCounter < dwSubAuthorities ; dwCounter++)
{
dwSidSize+=wsprintf(TextualSid + dwSidSize, TEXT("-%lu"),
*GetSidSubAuthority(pSid, dwCounter) );
}
return TRUE;
}
const TCHAR * GetSidTypeName(SID_NAME_USE Use)
{
switch(Use)
{
case SidTypeUser:
return _T("User SID");
case SidTypeGroup:
return _T("Group SID");
case SidTypeDomain:
return _T("Domain SID");
case SidTypeAlias:
return _T("Alias SID");
case SidTypeWellKnownGroup:
return _T("SID for a well-known group");
case SidTypeDeletedAccount:
return _T("SID for a deleted account");
case SidTypeInvalid:
return _T("Invalid SID");
case SidTypeUnknown:
return _T("Unknown SID type");
default:
return _T("Error. Cannot recognize SID type.");
}
}
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CSecurityDescriptor::CSecurityDescriptor()
{
m_pSecurityDescriptor = NULL;
m_pCurrentACEHeader = NULL;
}
CSecurityDescriptor::~CSecurityDescriptor()
{
}
void CSecurityDescriptor::AssociateDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor)
{
m_pSecurityDescriptor = pSecurityDescriptor;
}
DWORD CSecurityDescriptor::BeginDACLInteration()
{
if (!GetSecurityDescriptorDacl(m_pSecurityDescriptor,&m_blnDACLPresent,&m_pDACL,&m_blnDACLDefaulted))
{
throw GetLastError();
}
return ERROR_SUCCESS;
}
BOOL CSecurityDescriptor::DescriptorContainsDACL()
{
return m_blnDACLPresent;
}
DWORD CSecurityDescriptor::BeginSACLInteration()
{
if (!GetSecurityDescriptorSacl(m_pSecurityDescriptor,&m_blnSACLPresent,&m_pSACL,&m_blnSACLDefaulted))
throw GetLastError();
return ERROR_SUCCESS;
}
BOOL CSecurityDescriptor::DescriptorContainsSACL()
{
return m_blnSACLPresent;
}
BOOL CSecurityDescriptor::HasNULLDACL()
{
ASSERT(m_blnDACLPresent);
return (m_pDACL == NULL);
}
BOOL CSecurityDescriptor::HasValidDACL()
{
ASSERT(m_blnDACLPresent);
ASSERT(m_pDACL != NULL);
return IsValidAcl(m_pDACL);
}
BOOL CSecurityDescriptor::HasNULLSACL()
{
ASSERT(m_blnSACLPresent);
return (m_pSACL == NULL);
}
BOOL CSecurityDescriptor::HasValidSACL()
{
ASSERT(m_blnSACLPresent);
ASSERT(m_pSACL != NULL);
return IsValidAcl(m_pSACL);
}
DWORD CSecurityDescriptor::GetDACLEntriesCount()
{
ACL_SIZE_INFORMATION SizeInfo;
if (!GetAclInformation(m_pDACL,&SizeInfo,sizeof(SizeInfo),AclSizeInformation))
throw GetLastError();
return SizeInfo.AceCount;
}
DWORD CSecurityDescriptor::GetSACLEntriesCount()
{
ACL_SIZE_INFORMATION SizeInfo;
if (!GetAclInformation(m_pSACL,&SizeInfo,sizeof(SizeInfo),AclSizeInformation))
throw GetLastError();
return SizeInfo.AceCount;
}
CSecurityDescriptor::ACEntryType CSecurityDescriptor::GetDACLEntry(DWORD nIndex)
{
void *pACE;
if (!GetAce(m_pDACL,nIndex,&pACE)) throw GetLastError();
m_pCurrentACEHeader = (PACE_HEADER)pACE;
if (m_pCurrentACEHeader->AceType == ACCESS_ALLOWED_ACE_TYPE)
{
return AccessAlowed;
}
if (m_pCurrentACEHeader->AceType == ACCESS_DENIED_ACE_TYPE)
{
return AccessDenied;
}
return Unknown;
}
CSecurityDescriptor::ACEntryType CSecurityDescriptor::GetSACLEntry(DWORD nIndex, BOOL& blnFailedAccess, BOOL& blnSeccessfulAccess)
{
void *pACE;
if (!GetAce(m_pSACL,nIndex,&pACE)) throw GetLastError();
m_pCurrentACEHeader = (PACE_HEADER)pACE;
if (m_pCurrentACEHeader->AceType == SYSTEM_AUDIT_ACE_TYPE)
{
blnFailedAccess = m_pCurrentACEHeader->AceFlags & FAILED_ACCESS_ACE_FLAG;
blnSeccessfulAccess = m_pCurrentACEHeader->AceFlags & SUCCESSFUL_ACCESS_ACE_FLAG;
return SystemAudit;
}
return Unknown;
}
PSID CSecurityDescriptor::GetCurrentACE_SID()
{
ASSERT(m_pCurrentACEHeader != NULL);
switch(m_pCurrentACEHeader->AceType)
{
case ACCESS_ALLOWED_ACE_TYPE:
return ((PSID)&(((ACCESS_ALLOWED_ACE *)m_pCurrentACEHeader)->SidStart));
case ACCESS_DENIED_ACE_TYPE:
return ((PSID)&(((ACCESS_DENIED_ACE *)m_pCurrentACEHeader)->SidStart));
case SYSTEM_AUDIT_ACE_TYPE:
return ((PSID)&(((SYSTEM_AUDIT_ACE *)m_pCurrentACEHeader)->SidStart));
default:
ASSERT(FALSE); // Do not call this function for unknown ACE types !!!
return NULL;
}
}
void CSecurityDescriptor::GetCurrentACE_AccessMask(DWORD& dwMask)
{
ASSERT(m_pCurrentACEHeader != NULL);
switch(m_pCurrentACEHeader->AceType)
{
case ACCESS_ALLOWED_ACE_TYPE:
dwMask = (((ACCESS_ALLOWED_ACE *)m_pCurrentACEHeader)->Mask);
return;
case ACCESS_DENIED_ACE_TYPE:
dwMask = (((ACCESS_DENIED_ACE *)m_pCurrentACEHeader)->Mask);
return;
case SYSTEM_AUDIT_ACE_TYPE:
dwMask = (((SYSTEM_AUDIT_ACE *)m_pCurrentACEHeader)->Mask);
return;
default:
ASSERT(FALSE); // Do not call this function for unknown ACE types !!!
return;
}
}
void CSecurityDescriptor::GetCurrentACE_Flags(BYTE& bFlags)
{
ASSERT(m_pCurrentACEHeader != NULL);
bFlags = m_pCurrentACEHeader->AceFlags;
}

View file

@ -0,0 +1,56 @@
//
// SecurityDescriptor.h: interface for the CSecurityDescriptor class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(SECURITYDESCRIPTOR_H__71D0A7E6_8A00_11D3_9103_204C4F4F5020__INCLUDED_)
#define SECURITYDESCRIPTOR_H__71D0A7E6_8A00_11D3_9103_204C4F4F5020__INCLUDED_
BOOL GetTextualSid(
PSID pSid, // binary Sid
LPTSTR TextualSid, // buffer for Textual representation of Sid
LPDWORD lpdwBufferLen // required/provided TextualSid buffersize
);
const TCHAR * GetSidTypeName(SID_NAME_USE Use);
class CSecurityDescriptor
{
public:
void GetCurrentACE_Flags(BYTE& bFlags);
void GetCurrentACE_AccessMask(DWORD& dwMask);
PSID GetCurrentACE_SID();
enum ACEntryType
{
Unknown,
AccessAlowed,
AccessDenied,
SystemAudit
};
ACEntryType GetDACLEntry(DWORD nIndex);
ACEntryType GetSACLEntry(DWORD nIndex, BOOL& blnFailedAccess, BOOL& blnSeccessfulAccess);
DWORD GetDACLEntriesCount();
DWORD GetSACLEntriesCount();
BOOL HasValidDACL();
BOOL HasNULLDACL();
BOOL HasValidSACL();
BOOL HasNULLSACL();
BOOL DescriptorContainsDACL();
BOOL DescriptorContainsSACL();
DWORD BeginDACLInteration();
DWORD BeginSACLInteration();
void AssociateDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor);
CSecurityDescriptor();
virtual ~CSecurityDescriptor();
private:
PSECURITY_DESCRIPTOR m_pSecurityDescriptor;
BOOL m_blnDACLPresent;
BOOL m_blnDACLDefaulted;
PACL m_pDACL;
BOOL m_blnSACLPresent;
BOOL m_blnSACLDefaulted;
PACL m_pSACL;
ACE_HEADER *m_pCurrentACEHeader;
};
#endif // !defined(SECURITYDESCRIPTOR_H__71D0A7E6_8A00_11D3_9103_204C4F4F5020__INCLUDED_)

View file

@ -0,0 +1,145 @@
/*
* regexpl - Console Registry Explorer
*
* Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
// Settings.cpp : implemetation of CSettings class - user customizable settings for Registry Explorer
#include "ph.h"
#include "RegistryExplorer.h"
#include "Settings.h"
#include "Prompt.h"
#define DEFAULT_NORMAL_TEXT_ATTRIBUTES FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED
#define DEFAULT_COMMAND_TEXT_ATTRIBUTES FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED
CSettings::CSettings()
{
m_pszPrompt = NULL;
m_wNormalTextAttributes = DEFAULT_NORMAL_TEXT_ATTRIBUTES;
m_wCommandTextAttributes = DEFAULT_COMMAND_TEXT_ATTRIBUTES;
}
CSettings::~CSettings()
{
VERIFY(SUCCEEDED(Clean()));
}
HRESULT CSettings::Clean()
{
if (m_pszPrompt)
{
delete[] m_pszPrompt;
m_pszPrompt = NULL;
}
return S_OK;
}
HRESULT CSettings::Load(LPCTSTR pszLoadKey)
{
HKEY hKey = NULL;
HRESULT hr;
DWORD dwType;
DWORD dwSize;
DWORD w;
hr = Clean();
if (FAILED(hr))
return hr;
hr = S_OK;
LONG nError = RegOpenKeyEx(HKEY_CURRENT_USER,pszLoadKey,0,KEY_QUERY_VALUE,&hKey);
if (nError != ERROR_SUCCESS)
return S_FALSE;
nError = RegQueryValueEx(hKey,PROMPT_VALUE_NAME,NULL,&dwType,NULL,&dwSize);
if (nError == ERROR_SUCCESS && dwType == REG_SZ)
{
m_pszPrompt = (TCHAR *) new (std::nothrow) BYTE[dwSize];
if (!m_pszPrompt)
{
hr = E_OUTOFMEMORY;
goto Exit;
}
nError = RegQueryValueEx(hKey,PROMPT_VALUE_NAME,NULL,&dwType,(BYTE *)m_pszPrompt,&dwSize);
if (nError != ERROR_SUCCESS || dwType != REG_SZ)
{
delete m_pszPrompt;
m_pszPrompt = NULL;
hr = S_FALSE;
}
}
else
{
hr = S_FALSE;
}
dwSize = sizeof(DWORD);
nError = RegQueryValueEx(hKey,NORMAL_TEXT_ATTRIBUTES_VALUE_NAME,NULL,&dwType,(BYTE *)&w,&dwSize);
if (nError != ERROR_SUCCESS || dwType != REG_DWORD)
{
hr = S_FALSE;
}
else
{
m_wNormalTextAttributes = (WORD)w;
}
dwSize = sizeof(DWORD);
nError = RegQueryValueEx(hKey,COMMAND_TEXT_ATTRIBUTES_VALUE_NAME,NULL,&dwType,(BYTE *)&w,&dwSize);
if (nError != ERROR_SUCCESS || dwType != REG_DWORD)
{
hr = S_FALSE;
}
else
{
m_wCommandTextAttributes = (WORD)w;
}
Exit:
if (hKey)
VERIFY(RegCloseKey(hKey) == ERROR_SUCCESS);
return hr;
}
HRESULT CSettings::Store(LPCTSTR pszLoadKey)
{
return S_OK;
}
LPCTSTR CSettings::GetPrompt()
{
return m_pszPrompt?m_pszPrompt:CPrompt::GetDefaultPrompt();
}
WORD CSettings::GetNormalTextAttributes()
{
return m_wNormalTextAttributes;
}
WORD CSettings::GetCommandTextAttributes()
{
return m_wCommandTextAttributes;
}

View file

@ -0,0 +1,22 @@
#ifndef OPTIONS_H__a7382d2d_96b4_4472_974d_801281bd5327___INCLUDED
#define OPTIONS_H__a7382d2d_96b4_4472_974d_801281bd5327___INCLUDED
class CSettings
{
public:
CSettings();
~CSettings();
HRESULT Load(LPCTSTR pszLoadKey);
HRESULT Store(LPCTSTR pszStoreKey);
LPCTSTR GetPrompt();
WORD GetNormalTextAttributes();
WORD GetCommandTextAttributes();
private:
HRESULT Clean();
LPTSTR m_pszPrompt;
WORD m_wNormalTextAttributes;
WORD m_wCommandTextAttributes;
};
#endif // #ifndef OPTIONS_H__a7382d2d_96b4_4472_974d_801281bd5327___INCLUDED

View file

@ -0,0 +1,41 @@
/*
* regexpl - Console Registry Explorer
*
* Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
// ShellCommand.cpp: implementation of the CShellCommand class.
//
//////////////////////////////////////////////////////////////////////
#include "ph.h"
#include "ShellCommand.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CShellCommand::CShellCommand()
{
}
CShellCommand::~CShellCommand()
{
}

View file

@ -0,0 +1,24 @@
//
// ShellCommand.h: interface for the CShellCommand class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(SHELLCOMMAND_H__D29C1193_5942_11D4_A037_C5AC8D00940F__INCLUDED_)
#define SHELLCOMMAND_H__D29C1193_5942_11D4_A037_C5AC8D00940F__INCLUDED_
#include "Console.h"
#include "ArgumentParser.h"
// this class provides common interface to shell commands
class CShellCommand
{
public:
CShellCommand();
virtual ~CShellCommand();
virtual BOOL Match(const TCHAR *pchCommand) = 0;
virtual int Execute(CConsole &rConsole, CArgumentParser& rArguments) = 0;
virtual const TCHAR * GetHelpString() = 0;
virtual const TCHAR * GetHelpShortDescriptionString() = 0;
};
#endif // !defined(SHELLCOMMAND_H__D29C1193_5942_11D4_A037_C5AC8D00940F__INCLUDED_)

View file

@ -0,0 +1,105 @@
/*
* regexpl - Console Registry Explorer
*
* Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
// ShellCommandChangeKey.cpp: implementation of the CShellCommandChangeKey class.
//
//////////////////////////////////////////////////////////////////////
#include "ph.h"
#include "RegistryExplorer.h"
#include "ShellCommandChangeKey.h"
#define CD_CMD _T("CD")
#define CD_CMD_LENGTH COMMAND_LENGTH(CD_CMD)
#define CD_CMD_SHORT_DESC CD_CMD _T(" command changes current key.\n")
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CShellCommandChangeKey::CShellCommandChangeKey(CRegistryTree& rTree):m_rTree(rTree)
{
}
CShellCommandChangeKey::~CShellCommandChangeKey()
{
}
BOOL CShellCommandChangeKey::Match(const TCHAR *pchCommand)
{
if (_tcsicmp(pchCommand,CD_CMD) == 0)
return TRUE;
if (_tcsnicmp(pchCommand,CD_CMD _T(".."),CD_CMD_LENGTH+1*sizeof(TCHAR)) == 0)
return TRUE;
if (_tcsnicmp(pchCommand,CD_CMD _T("\\"),CD_CMD_LENGTH+2*sizeof(TCHAR)) == 0)
return TRUE;
return FALSE;
}
int CShellCommandChangeKey::Execute(CConsole &rConsole, CArgumentParser& rArguments)
{
BOOL blnHelp = FALSE;
rArguments.ResetArgumentIteration();
const TCHAR *pchCommandItself = rArguments.GetNextArgument();
const TCHAR *pchPath = rArguments.GetNextArgument();
if ((_tcsnicmp(pchCommandItself,CD_CMD _T(".."),CD_CMD_LENGTH+2*sizeof(TCHAR)) == 0)||
(_tcsnicmp(pchCommandItself,CD_CMD _T("\\"),CD_CMD_LENGTH+1*sizeof(TCHAR)) == 0))
{
if (!pchPath) pchPath = pchCommandItself + CD_CMD_LENGTH;
else blnHelp = TRUE;
}
if ((!blnHelp)&&(pchPath != NULL)&&(!rArguments.GetNextArgument()))
{
size_t size = _tcslen(pchPath);
ASSERT(size <= PROMPT_BUFFER_SIZE);
if (!m_rTree.ChangeCurrentKey(pchPath))
{
rConsole.Write(m_rTree.GetLastErrorDescription());
rConsole.Write(_T("\n"));
}
}
else
{
rConsole.Write(GetHelpString());
}
return 0;
}
const TCHAR * CShellCommandChangeKey::GetHelpString()
{
return CD_CMD_SHORT_DESC
_T("Syntax: ") CD_CMD _T(" <KEY>\n\n")
_T(" <KEY> - Relative path of desired key.\n\n")
_T("Without parameters, command displays this help.\n");
}
const TCHAR * CShellCommandChangeKey::GetHelpShortDescriptionString()
{
return CD_CMD_SHORT_DESC;
}

View file

@ -0,0 +1,25 @@
//
// ShellCommandChangeKey.h: interface for the CShellCommandChangeKey class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(SHELLCOMMANDCHANGEKEY_H__848A2506_5A0F_11D4_A039_FC2CE602E70F__INCLUDED_)
#define SHELLCOMMANDCHANGEKEY_H__848A2506_5A0F_11D4_A039_FC2CE602E70F__INCLUDED_
#include "ShellCommand.h"
#include "RegistryTree.h"
class CShellCommandChangeKey : public CShellCommand
{
public:
CShellCommandChangeKey(CRegistryTree& rTree);
virtual ~CShellCommandChangeKey();
virtual BOOL Match(const TCHAR *pchCommand);
virtual int Execute(CConsole &rConsole, CArgumentParser& rArguments);
virtual const TCHAR * GetHelpString();
virtual const TCHAR * GetHelpShortDescriptionString();
private:
CRegistryTree& m_rTree;
};
#endif // !defined(SHELLCOMMANDCHANGEKEY_H__848A2506_5A0F_11D4_A039_FC2CE602E70F__INCLUDED_)

View file

@ -0,0 +1,102 @@
/*
* regexpl - Console Registry Explorer
*
* Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
// ShellCommandConnect.cpp: implementation of the CShellCommandConnect class.
//
//////////////////////////////////////////////////////////////////////
#include "ph.h"
#include "ShellCommandConnect.h"
#define CONNECT_CMD _T("CONNECT")
#define CONNECT_CMD_SHORT_DESC CONNECT_CMD _T(" command is used to connect to remote registry.\n")
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CShellCommandConnect::CShellCommandConnect(CRegistryTree& rTree):m_rTree(rTree)
{
}
CShellCommandConnect::~CShellCommandConnect()
{
}
BOOL CShellCommandConnect::Match(const TCHAR *pchCommand)
{
return _tcsicmp(pchCommand,CONNECT_CMD) == 0;
}
int CShellCommandConnect::Execute(CConsole &rConsole, CArgumentParser& rArguments)
{
const TCHAR *pchArg;
const TCHAR *pchMachine = NULL;
BOOL blnHelp = FALSE;
VERIFY(m_rTree.ChangeCurrentKey(_T("\\")));
while ((pchArg = rArguments.GetNextArgument()) != NULL)
{
if ((_tcsicmp(pchArg,_T("/?")) == 0)
||(_tcsicmp(pchArg,_T("-?")) == 0))
{
blnHelp = TRUE;
}
// else if ((_tcsicmp(pchArg,_T("-a")) == 0)||
// (_tcsicmp(pchArg,_T("/a")) == 0))
// {
// }
else
{
pchMachine = pchArg;
}
}
if (blnHelp)
rConsole.Write(GetHelpString());
if (!m_rTree.SetMachineName(pchMachine))
{
rConsole.Write(m_rTree.GetLastErrorDescription());
rConsole.Write(_T("\n"));
}
return 0;
}
const TCHAR * CShellCommandConnect::GetHelpString()
{
return CONNECT_CMD_SHORT_DESC
// _T("Syntax: ") CONNECT_CMD _T(" [Switches] [/?] machine\n\n")
_T("Syntax: ") CONNECT_CMD _T(" /? | MACHINE\n\n")
_T(" /? - This help.\n\n")
// _T("Switches are:\n")
// _T(" -a anonymous login.\n")
_T(" MACHINE is name/ip of the remote machine.\n")
_T("Example:\n")
_T(" ") CONNECT_CMD _T(" BOB");
}
const TCHAR * CShellCommandConnect::GetHelpShortDescriptionString()
{
return CONNECT_CMD_SHORT_DESC;
}

View file

@ -0,0 +1,25 @@
//
// ShellCommandConnect.h: interface for the CShellCommandConnect class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(SHELLCOMMANDCONNECT_H__848A250C_5A0F_11D4_A039_FC2CE602E70F__INCLUDED_)
#define SHELLCOMMANDCONNECT_H__848A250C_5A0F_11D4_A039_FC2CE602E70F__INCLUDED_
#include "ShellCommand.h"
#include "RegistryTree.h"
class CShellCommandConnect : public CShellCommand
{
public:
CShellCommandConnect(CRegistryTree& rTree);
virtual ~CShellCommandConnect();
virtual BOOL Match(const TCHAR *pchCommand);
virtual int Execute(CConsole &rConsole, CArgumentParser& rArguments);
virtual const TCHAR * GetHelpString();
virtual const TCHAR * GetHelpShortDescriptionString();
private:
CRegistryTree& m_rTree;
};
#endif // !defined(SHELLCOMMANDCONNECT_H__848A250C_5A0F_11D4_A039_FC2CE602E70F__INCLUDED_)

View file

@ -0,0 +1,382 @@
/*
* regexpl - Console Registry Explorer
*
* Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
// ShellCommandDACL.cpp: implementation of the CShellCommandDACL class.
//
//////////////////////////////////////////////////////////////////////
#include "ph.h"
#include "ShellCommandDACL.h"
#include "RegistryExplorer.h"
#include "SecurityDescriptor.h"
#define DACL_CMD _T("DACL")
#define DACL_CMD_LENGTH COMMAND_LENGTH(DACL_CMD)
#define DACL_CMD_SHORT_DESC DACL_CMD _T(" command is used to view")/*"/edit"*/_T(" key's DACL.\n")
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CShellCommandDACL::CShellCommandDACL(CRegistryTree& rTree):m_rTree(rTree)
{
}
CShellCommandDACL::~CShellCommandDACL()
{
}
BOOL CShellCommandDACL::Match(const TCHAR *pchCommand)
{
if (_tcsicmp(pchCommand,DACL_CMD) == 0)
return TRUE;
if (_tcsnicmp(pchCommand,DACL_CMD _T(".."),DACL_CMD_LENGTH+2*sizeof(TCHAR)) == 0)
return TRUE;
if (_tcsnicmp(pchCommand,DACL_CMD _T("/") ,DACL_CMD_LENGTH+1*sizeof(TCHAR)) == 0)
return TRUE;
if (_tcsnicmp(pchCommand,DACL_CMD _T("\\"),DACL_CMD_LENGTH+1*sizeof(TCHAR)) == 0)
return TRUE;
return FALSE;
}
int CShellCommandDACL::Execute(CConsole &rConsole, CArgumentParser& rArguments)
{
rArguments.ResetArgumentIteration();
const TCHAR *pszKey = NULL;
BOOL blnDo = TRUE;
BOOL blnBadParameter = FALSE;
BOOL blnHelp = FALSE;
const TCHAR *pchParameter;
const TCHAR *pchCommandItself = rArguments.GetNextArgument();
LONG nError;
if ((_tcsnicmp(pchCommandItself,DACL_CMD _T(".."),DACL_CMD_LENGTH+2*sizeof(TCHAR)) == 0)||
(_tcsnicmp(pchCommandItself,DACL_CMD _T("\\"),DACL_CMD_LENGTH+1*sizeof(TCHAR)) == 0))
{
pszKey = pchCommandItself + DACL_CMD_LENGTH;
}
else if (_tcsnicmp(pchCommandItself,DACL_CMD _T("/"),DACL_CMD_LENGTH+1*sizeof(TCHAR)) == 0)
{
pchParameter = pchCommandItself + DACL_CMD_LENGTH;
goto CheckDACLArgument;
}
while((pchParameter = rArguments.GetNextArgument()) != NULL)
{
CheckDACLArgument:
blnBadParameter = FALSE;
if ((_tcsicmp(pchParameter,_T("/?")) == 0)
||(_tcsicmp(pchParameter,_T("-?")) == 0))
{
blnHelp = TRUE;
blnDo = pszKey != NULL;
}
else if (!pszKey)
{
pszKey = pchParameter;
blnDo = TRUE;
}
else
{
blnBadParameter = TRUE;
}
if (blnBadParameter)
{
rConsole.Write(_T("Bad parameter: "));
rConsole.Write(pchParameter);
rConsole.Write(_T("\n"));
}
}
CRegistryKey Key;
if (!m_rTree.GetKey(pszKey?pszKey:_T("."),KEY_QUERY_VALUE|READ_CONTROL,Key))
{
rConsole.Write(m_rTree.GetLastErrorDescription());
blnDo = FALSE;
}
if (blnHelp)
{
rConsole.Write(GetHelpString());
}
if (blnDo&&blnHelp) rConsole.Write(_T("\n"));
if (!blnDo)
return 0;
if (Key.IsRoot())
{ // root key
rConsole.Write(DACL_CMD COMMAND_NA_ON_ROOT);
return 0;
}
DWORD dwSecurityDescriptorLength;
rConsole.Write(_T("Key : "));
rConsole.Write(_T("\\"));
rConsole.Write(Key.GetKeyName());
rConsole.Write(_T("\n"));
PISECURITY_DESCRIPTOR pSecurityDescriptor = NULL;
TCHAR *pchName = NULL, *pchDomainName = NULL;
try
{
nError = Key.GetSecurityDescriptorLength(&dwSecurityDescriptorLength);
if (nError != ERROR_SUCCESS)
throw nError;
pSecurityDescriptor = (PISECURITY_DESCRIPTOR) new unsigned char [dwSecurityDescriptorLength];
DWORD dwSecurityDescriptorLength1 = dwSecurityDescriptorLength;
nError = Key.GetSecurityDescriptor((SECURITY_INFORMATION)DACL_SECURITY_INFORMATION,pSecurityDescriptor,&dwSecurityDescriptorLength1);
if (nError != ERROR_SUCCESS)
throw nError;
CSecurityDescriptor sd;
sd.AssociateDescriptor(pSecurityDescriptor);
sd.BeginDACLInteration();
ASSERT(sd.DescriptorContainsDACL());
if (sd.HasNULLDACL())
{
rConsole.Write(_T("Key has not DACL.\n(This allows all access)\n"));
}
else
{
if (!sd.HasValidDACL())
{
rConsole.Write(_T("Invalid DACL.\n"));
}
else
{
DWORD nACECount = sd.GetDACLEntriesCount();
rConsole.Write(_T("DACL has "));
TCHAR Buffer[256];
rConsole.Write(_itoa(nACECount,Buffer,10));
rConsole.Write(_T(" ACEs.\n"));
if (nACECount == 0)
{
rConsole.Write(_T("(This denies all access)\n"));
}
else
{
for (DWORD i = 0 ; i < nACECount ; i++)
{
rConsole.Write(_T("\n"));
rConsole.Write(_T("\tACE Index: "));
rConsole.Write(_itoa(i,Buffer,10));
rConsole.Write(_T("\n"));
rConsole.Write(_T("\tACE Type: "));
switch (sd.GetDACLEntry(i))
{
case CSecurityDescriptor::AccessAlowed:
rConsole.Write(_T("Access-allowed\n"));
break;
case CSecurityDescriptor::AccessDenied:
rConsole.Write(_T("Access-denied\n"));
break;
default:
rConsole.Write(_T("Unknown.\nCannot continue dumping of the ACE list.\n"));
goto AbortDumpDACL;
}
PSID pSID = sd.GetCurrentACE_SID();
if ((pSID == NULL)||(!IsValidSid(pSID)))
{
rConsole.Write(_T("\tInvalid SID.\n"));
}
else
{
DWORD dwSIDStringSize = 0;
BOOL blnRet = GetTextualSid(pSID,NULL,&dwSIDStringSize);
ASSERT(!blnRet);
ASSERT(GetLastError() == ERROR_INSUFFICIENT_BUFFER);
TCHAR *pchSID = new TCHAR[dwSIDStringSize];
if(!GetTextualSid(pSID,pchSID,&dwSIDStringSize))
{
DWORD dwError = GetLastError();
ASSERT(dwError != ERROR_INSUFFICIENT_BUFFER);
rConsole.Write(_T("Error "));
TCHAR Buffer[256];
rConsole.Write(_itoa(dwError,Buffer,10));
rConsole.Write(_T("\nGetting string representation of SID\n"));
}
else
{
rConsole.Write(_T("\tSID: "));
rConsole.Write(pchSID);
rConsole.Write(_T("\n"));
}
delete[] pchSID;
DWORD dwNameBufferLength, dwDomainNameBufferLength;
dwNameBufferLength = 1024;
dwDomainNameBufferLength = 1024;
pchName = new TCHAR [dwNameBufferLength];
pchDomainName = new TCHAR [dwDomainNameBufferLength];
DWORD dwNameLength = dwNameBufferLength, dwDomainNameLength = dwDomainNameBufferLength;
SID_NAME_USE Use;
if (!LookupAccountSid(NULL,pSID,pchName,&dwNameLength,pchDomainName,&dwDomainNameLength,&Use))
{
rConsole.Write(_T("Error "));
TCHAR Buffer[256];
rConsole.Write(_itoa(GetLastError(),Buffer,10));
rConsole.Write(_T("\n"));
}
else
{
rConsole.Write(_T("\tTrustee Domain: "));
rConsole.Write(pchDomainName);
rConsole.Write(_T("\n"));
rConsole.Write(_T("\tTrustee Name: "));
rConsole.Write(pchName);
rConsole.Write(_T("\n\tSID type: "));
rConsole.Write(GetSidTypeName(Use));
rConsole.Write(_T("\n"));
}
delete [] pchName;
pchName = NULL;
delete [] pchDomainName;
pchDomainName = NULL;
}
BYTE bFlags;
sd.GetCurrentACE_Flags(bFlags);
wsprintf(Buffer,_T("\tFlags: 0x%02lX\n"),bFlags);
rConsole.Write(Buffer);
if (bFlags & CONTAINER_INHERIT_ACE)
{
rConsole.Write(_T("\t\tCONTAINER_INHERIT_ACE\n"));
}
if (bFlags & INHERIT_ONLY_ACE)
{
rConsole.Write(_T("\t\tINHERIT_ONLY_ACE\n"));
}
if (bFlags & INHERITED_ACE)
{
rConsole.Write(_T("\t\tINHERITED_ACE\n"));
}
if (bFlags & NO_PROPAGATE_INHERIT_ACE)
{
rConsole.Write(_T("\t\tNO_PROPAGATE_INHERIT_ACE\n"));
}
if (bFlags & OBJECT_INHERIT_ACE)
{
rConsole.Write(_T("\t\tOBJECT_INHERIT_ACE\n"));
}
DWORD dwAccessMask;
sd.GetCurrentACE_AccessMask(dwAccessMask);
wsprintf(Buffer,_T("\tAccess Mask: 0x%08lX\n"),dwAccessMask);
rConsole.Write(Buffer);
if (dwAccessMask & GENERIC_READ)
{
rConsole.Write(_T("\t\tGENERIC_READ\n"));
}
if (dwAccessMask & GENERIC_WRITE)
{
rConsole.Write(_T("\t\tGENERIC_WRITE\n"));
}
if (dwAccessMask & GENERIC_EXECUTE)
{
rConsole.Write(_T("\t\tGENERIC_EXECUTE\n"));
}
if (dwAccessMask & GENERIC_ALL)
{
rConsole.Write(_T("\t\tGENERIC_ALL\n"));
}
if (dwAccessMask & SYNCHRONIZE)
{
rConsole.Write(_T("\t\tSYNCHRONIZE\n"));
}
if (dwAccessMask & WRITE_OWNER)
{
rConsole.Write(_T("\t\tWRITE_OWNER\n"));
}
if (dwAccessMask & WRITE_DAC)
{
rConsole.Write(_T("\t\tWRITE_DAC\n"));
}
if (dwAccessMask & READ_CONTROL)
{
rConsole.Write(_T("\t\tREAD_CONTROL\n"));
}
if (dwAccessMask & DELETE)
{
rConsole.Write(_T("\t\tDELETE\n"));
}
if (dwAccessMask & KEY_CREATE_LINK)
{
rConsole.Write(_T("\t\tKEY_CREATE_LINK\n"));
}
if (dwAccessMask & KEY_NOTIFY)
{
rConsole.Write(_T("\t\tKEY_NOTIFY\n"));
}
if (dwAccessMask & KEY_ENUMERATE_SUB_KEYS)
{
rConsole.Write(_T("\t\tKEY_ENUMERATE_SUB_KEYS\n"));
}
if (dwAccessMask & KEY_CREATE_SUB_KEY)
{
rConsole.Write(_T("\t\tKEY_CREATE_SUB_KEY\n"));
}
if (dwAccessMask & KEY_SET_VALUE)
{
rConsole.Write(_T("\t\tKEY_SET_VALUE\n"));
}
if (dwAccessMask & KEY_QUERY_VALUE)
{
rConsole.Write(_T("\t\tKEY_QUERY_VALUE\n"));
}
} // for
} // else (nACECount == 0)
} // else (!sd.HasValidDACL())
} // else (sd.HasNULLDACL())
AbortDumpDACL:
delete [] pSecurityDescriptor;
} // try
catch (DWORD dwError)
{
rConsole.Write(_T("Error "));
TCHAR Buffer[256];
rConsole.Write(_itoa(dwError,Buffer,10));
rConsole.Write(_T("\n"));
if (pchName) delete [] pchName;
if (pchDomainName) delete [] pchDomainName;
if (pSecurityDescriptor) delete [] pSecurityDescriptor;
}
return 0;
}
const TCHAR * CShellCommandDACL::GetHelpString()
{
return DACL_CMD_SHORT_DESC
_T("Syntax: ") DACL_CMD _T(" [<KEY>] [/?]\n\n")
_T(" <KEY> - Optional relative path of desired key.\n")
_T(" /? - This help.\n\n")
_T("Without parameters, command displays DACL of current key.\n");
}
const TCHAR * CShellCommandDACL::GetHelpShortDescriptionString()
{
return DACL_CMD_SHORT_DESC;
}

View file

@ -0,0 +1,25 @@
//
// ShellCommandDACL.h: interface for the CShellCommandDACL class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(SHELLCOMMANDDACL_H__848A2509_5A0F_11D4_A039_FC2CE602E70F__INCLUDED_)
#define SHELLCOMMANDDACL_H__848A2509_5A0F_11D4_A039_FC2CE602E70F__INCLUDED_
#include "ShellCommand.h"
#include "RegistryTree.h"
class CShellCommandDACL : public CShellCommand
{
public:
CShellCommandDACL(CRegistryTree& rTree);
virtual ~CShellCommandDACL();
virtual BOOL Match(const TCHAR *pchCommand);
virtual int Execute(CConsole &rConsole, CArgumentParser& rArguments);
virtual const TCHAR * GetHelpString();
virtual const TCHAR * GetHelpShortDescriptionString();
private:
CRegistryTree& m_rTree;
};
#endif // !defined(SHELLCOMMANDDACL_H__848A2509_5A0F_11D4_A039_FC2CE602E70F__INCLUDED_)

Some files were not shown because too many files have changed in this diff Show more