}
NewBlock = RtlAllocateHeap(CsrssApiHeap,
HEAP_ZERO_MEMORY,
- (ProcessData->HandleTableSize + 64) *
+ (ProcessData->HandleTableSize + 64) *
sizeof(HANDLE));
if (NewBlock == NULL)
{
return(STATUS_UNSUCCESSFUL);
}
- RtlCopyMemory(NewBlock,
+ RtlCopyMemory(NewBlock,
ProcessData->HandleTable,
ProcessData->HandleTableSize * sizeof(HANDLE));
RtlFreeHeap( CsrssApiHeap, 0, ProcessData->HandleTable );
ProcessData->HandleTable = (Object_t **)NewBlock;
- ProcessData->HandleTable[i] = Object;
+ ProcessData->HandleTable[i] = Object;
*Handle = (HANDLE)(((i + 1) << 2) | 0x3);
InterlockedIncrement( &Object->ReferenceCount );
ProcessData->HandleTableSize = ProcessData->HandleTableSize + 64;
PCSRSS_PROCESS_DATA pProcessData;
hash = (ULONG_PTR)ProcessId % (sizeof(ProcessData) / sizeof(*ProcessData));
-
+
LOCK;
pProcessData = ProcessData[hash];
NTSTATUS Status;
hash = (ULONG_PTR)ProcessId % (sizeof(ProcessData) / sizeof(*ProcessData));
-
+
LOCK;
pProcessData = ProcessData[hash];
ULONG hash;
int c;
PCSRSS_PROCESS_DATA pProcessData, pPrevProcessData = NULL;
-
+
hash = (ULONG_PTR)Pid % (sizeof(ProcessData) / sizeof(*ProcessData));
-
+
LOCK;
pProcessData = ProcessData[hash];
{
return(Reply->Status = STATUS_INVALID_PARAMETER);
}
-
+
Reply->Data.GetShutdownParametersReply.Level = ProcessData->ShutdownLevel;
Reply->Data.GetShutdownParametersReply.Flags = ProcessData->ShutdownFlags;
{
return(Reply->Status = STATUS_INVALID_PARAMETER);
}
-
+
ProcessData->ShutdownLevel = Request->Data.SetShutdownParametersRequest.Level;
ProcessData->ShutdownFlags = Request->Data.SetShutdownParametersRequest.Flags;
/* $Id$
- *
+ *
* reactos/subsys/csrss/api/wapi.c
*
* CSRSS port message processing
PCSRSS_API_REQUEST Request;
PCSRSS_PROCESS_DATA ProcessData;
PCSRSS_API_REPLY Reply;
-
+
DPRINT("CSR: %s called", __FUNCTION__);
Reply = NULL;
-
+
for (;;)
{
Status = NtReplyWaitReceivePort(ServerPort,
DPRINT1("CSR: NtReplyWaitReceivePort failed\n");
break;
}
-
+
if (LpcRequest.Header.MessageType == LPC_PORT_CLOSED)
{
CsrFreeProcessData( LpcRequest.Header.ClientId.UniqueProcess );
Request = (PCSRSS_API_REQUEST)&LpcRequest;
Reply = (PCSRSS_API_REPLY)&LpcReply;
-
+
ProcessData = CsrGetProcessData(LpcRequest.Header.ClientId.UniqueProcess);
if (ProcessData == NULL)
{
DPRINT1("CSR: Message %d: Unable to find data for process 0x%x\n",
LpcRequest.Header.MessageType, LpcRequest.Header.ClientId.UniqueProcess);
break;
- }
+ }
CsrApiCallHandler(ProcessData, Request, Reply);
HANDLE ServerPort = (HANDLE) 0;
HANDLE ServerThread = (HANDLE) 0;
PCSRSS_PROCESS_DATA ProcessData = NULL;
-
+
CsrInitProcessData();
-
+
DPRINT("CSR: %s called", __FUNCTION__);
for (;;)
Status = STATUS_UNSUCCESSFUL;
break;
}
-
+
ProcessData->CsrSectionViewBase = LpcRead.ViewBase;
ProcessData->CsrSectionViewSize = LpcRead.ViewSize;
-
+
Status = NtCompleteConnectPort(ServerPort);
if (!NT_SUCCESS(Status))
{
DPRINT1("CSR: NtCompleteConnectPort() failed\n");
break;
}
-
+
Status = RtlCreateUserThread(NtCurrentProcess(),
NULL,
FALSE,
} else {
DPRINT("-- 3\n");
PLPC_MESSAGE Reply = NULL;
- /*
+ /*
* Tell the init thread the SM gave the
* green light for boostrapping.
*/
/* $Id$
*
* csrss.c - Client/Server Runtime subsystem
- *
+ *
* ReactOS Operating System
- *
+ *
* --------------------------------------------------------------------
*
* This software is free software; you can redistribute it and/or
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING.LIB. If not, write
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
- * MA 02139, USA.
+ * MA 02139, USA.
*
* --------------------------------------------------------------------
- *
+ *
* 19990417 (Emanuele Aliberti)
* Do nothing native application skeleton
* 19990528 (Emanuele Aliberti)
INT i = 0;
INT afterlastspace = 0;
-
+
DPRINT("CSR: %s called\n", __FUNCTION__);
RtlZeroMemory (Argument, sizeof (COMMAND_LINE_ARGUMENT));
Argument->Vector [Argument->Count - 1] = & (Argument->Buffer.Buffer [afterlastspace]);
}
- return STATUS_SUCCESS;
+ return STATUS_SUCCESS;
}
/**********************************************************************
* NAME PRIVATE
* CsrpFreeCommandLine/2
*/
-
+
static VOID STDCALL
CsrpFreeCommandLine (HANDLE ProcessHeap,
PCOMMAND_LINE_ARGUMENT Argument)
{
DPRINT("CSR: %s called\n", __FUNCTION__);
-
+
RtlFreeHeap (ProcessHeap,
0,
Argument->Vector);
*================================================================*/
if (CsrServerInitialization (CmdLineArg.Count, CmdLineArg.Vector) == TRUE)
{
- CsrpFreeCommandLine (Peb->ProcessHeap, & CmdLineArg);
+ CsrpFreeCommandLine (Peb->ProcessHeap, & CmdLineArg);
/*
* Terminate the current thread only.
*/
{
DisplayString (L"CSR: CsrServerInitialization failed.\n");
- CsrpFreeCommandLine (Peb->ProcessHeap, & CmdLineArg);
+ CsrpFreeCommandLine (Peb->ProcessHeap, & CmdLineArg);
/*
* Tell the SM we failed.
*/
LIST_ENTRY ProcessEntry;
PCONTROLDISPATCHER CtrlDispatcher;
} CSRSS_PROCESS_DATA, *PCSRSS_PROCESS_DATA;
-
+
typedef VOID (STDCALL *CSR_CLEANUP_OBJECT_PROC)(Object_t *Object);
typedef struct tagCSRSS_OBJECT_DEFINITION
/* $Id$
- *
+ *
* reactos/subsys/csrss/init.c
*
* Initialize the CSRSS subsystem server process.
FALSE,
NULL);
NtClose (hBootstrapOk);
- return Status;
+ return Status;
}
/**********************************************************************
Status = InitRoutine[i].EntryPoint(ArgumentCount,ArgumentArray);
if(!NT_SUCCESS(Status))
{
- DPRINT1("CSR: %s: failed to %s (Status=%08lx)\n",
+ DPRINT1("CSR: %s: failed to %s (Status=%08lx)\n",
__FUNCTION__,
InitRoutine[i].ErrorMessage,
Status);
/* $Id$
*
* smss.c - Session Manager
- *
+ *
* ReactOS Operating System
- *
+ *
* --------------------------------------------------------------------
*
* This software is free software; you can redistribute it and/or
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING.LIB. If not, write
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
- * MA 02139, USA.
+ * MA 02139, USA.
*
* --------------------------------------------------------------------
- *
+ *
* 19990529 (Emanuele Aliberti)
* Compiled successfully with egcs 1.1.2
*/
VOID STDCALL DisplayString(LPCWSTR lpwString)
{
UNICODE_STRING us;
-
+
RtlInitUnicodeString (&us, lpwString);
ZwDisplayString (&us);
}
va_list ap;
UNICODE_STRING UnicodeString;
ANSI_STRING AnsiString;
-
+
va_start(ap, fmt);
vsprintf(buffer, fmt, ap);
va_end(ap);
-
+
RtlInitAnsiString (&AnsiString, buffer);
RtlAnsiStringToUnicodeString (&UnicodeString,
&AnsiString,
0,
NULL,
NULL);
- Status = ZwOpenSection(&PhysMemHandle, SECTION_ALL_ACCESS,
+ Status = ZwOpenSection(&PhysMemHandle, SECTION_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DbgPrint("NtVdmControl failed (status %x)\n", Status);
return(0);
}
-
+
/*
* Copy the real mode IVT into the right place
*/
NullAddress = (PVOID)0x0; /* Workaround for GCC 3.4 */
memcpy(NullAddress, IVT, 1024);
-
+
/*
* Get the BDA from the kernel
*/
DbgPrint("NtVdmControl failed (status %x)\n", Status);
return(0);
}
-
+
/*
* Copy the BDA into the right place
*/
ConioConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData)
{
HANDLE Thread;
-
+
DPRINT("ConioConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->ProcessId);
if (ProcessData->CtrlDispatcher)
{
DWORD Offset = 2 * (Buff->CurrentY * Buff->MaxX);
UINT Pos;
-
+
for (Pos = 0; Pos < Buff->MaxX; Pos++)
{
/* Fill the cell: Offset is incremented by the macro */
Console->Title.MaximumLength = Console->Title.Length = 0;
Console->Title.Buffer = NULL;
-
+
RtlCreateUnicodeString(&Console->Title, L"Command Prompt");
-
+
Console->Header.ReferenceCount = 0;
Console->WaitingChars = 0;
Console->WaitingLines = 0;
return Status;
}
ProcessData->CtrlDispatcher = Request->Data.AllocConsoleRequest.CtrlDispatcher;
- DPRINT("CSRSS:CtrlDispatcher address: %x\n", ProcessData->CtrlDispatcher);
+ DPRINT("CSRSS:CtrlDispatcher address: %x\n", ProcessData->CtrlDispatcher);
InsertHeadList(&ProcessData->Console->ProcessList, &ProcessData->ProcessEntry);
return STATUS_SUCCESS;
{
ConioDeleteConsole((Object_t *) Console);
}
-
+
return STATUS_SUCCESS;
}
ULONG nNumberOfCharsToRead, CharSize;
PCSRSS_CONSOLE Console;
NTSTATUS Status;
-
+
DPRINT("CsrReadConsole\n");
-
+
CharSize = (Request->Data.ReadConsoleRequest.Unicode ? sizeof(WCHAR) : sizeof(CHAR));
/* truncate length to CSRSS_MAX_READ_CONSOLE_REQUEST */
DstY = (DstRegion->top + ScreenBuffer->ShowY) % ScreenBuffer->MaxY;
SrcOffset = (SrcY * ScreenBuffer->MaxX + SrcRegion->left + ScreenBuffer->ShowX) * 2;
DstOffset = (DstY * ScreenBuffer->MaxX + DstRegion->left + ScreenBuffer->ShowX) * 2;
-
+
for (i = SrcRegion->top; i <= SrcRegion->bottom; i++)
{
RtlCopyMemory(
DWORD Delta;
ULONG i;
CHAR Char;
-
+
if(bUnicode)
ConsoleUnicodeCharToAnsiChar(Console, &Char, &CharInfo->Char.UnicodeChar);
else
ULONG CharSize = (Request->Data.WriteConsoleRequest.Unicode ? sizeof(WCHAR) : sizeof(CHAR));
DPRINT("CsrWriteConsole\n");
-
+
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
/* process Ctrl-C and Ctrl-Break */
if (Console->Mode & ENABLE_PROCESSED_INPUT &&
KeyEventRecord->InputEvent.Event.KeyEvent.bKeyDown &&
- ((KeyEventRecord->InputEvent.Event.KeyEvent.wVirtualKeyCode == VK_PAUSE) ||
+ ((KeyEventRecord->InputEvent.Event.KeyEvent.wVirtualKeyCode == VK_PAUSE) ||
(KeyEventRecord->InputEvent.Event.KeyEvent.wVirtualKeyCode == 'C')) &&
(KeyEventRecord->InputEvent.Event.KeyEvent.dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)))
{
else if (Console->ActiveBuffer->ShowY != Console->ActiveBuffer->CurrentY)
/* only scroll down if there is room to scroll down into */
{
- if (Console->ActiveBuffer->ShowY % Console->ActiveBuffer->MaxY !=
+ if (Console->ActiveBuffer->ShowY % Console->ActiveBuffer->MaxY !=
Console->ActiveBuffer->CurrentY)
{
- if (((Console->ActiveBuffer->CurrentY + 1) % Console->ActiveBuffer->MaxY) !=
+ if (((Console->ActiveBuffer->CurrentY + 1) % Console->ActiveBuffer->MaxY) !=
(Console->ActiveBuffer->ShowY + Console->ActiveBuffer->MaxY) %
Console->ActiveBuffer->MaxY)
{
RepeatCount = 1;
VirtualScanCode = (msg->lParam >> 16) & 0xff;
- Down = msg->message == WM_KEYDOWN || msg->message == WM_CHAR ||
+ Down = msg->message == WM_KEYDOWN || msg->message == WM_CHAR ||
msg->message == WM_SYSKEYDOWN || msg->message == WM_SYSCHAR;
GetKeyboardState(KeyState);
{
VirtualKeyCode = LastVirtualKey;
UnicodeChar = msg->wParam;
- }
+ }
else
- {
+ {
WCHAR Chars[2];
INT RetChars = 0;
{
AsciiChar = 0;
}
-
+
er.EventType = KEY_EVENT;
er.Event.KeyEvent.bKeyDown = Down;
er.Event.KeyEvent.wRepeatCount = RepeatCount;
er.Event.KeyEvent.wVirtualScanCode = VirtualScanCode;
if (TextMode)
- {
+ {
if (0 != (ShiftState & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED))
&& VK_TAB == VirtualKeyCode)
{
}
}
- if (NULL == Console)
+ if (NULL == Console)
{
return;
}
{
return;
}
-
+
ConInRec->InputEvent = er;
- ConInRec->Fake = UnicodeChar &&
+ ConInRec->Fake = UnicodeChar &&
(msg->message != WM_CHAR && msg->message != WM_SYSCHAR &&
msg->message != WM_KEYUP && msg->message != WM_SYSKEYUP);
ConInRec->NotChar = (msg->message != WM_CHAR && msg->message != WM_SYSCHAR);
VirtualKeyCode,
(AsciiChar >= ' ') ? AsciiChar : '.',
ShiftState);
-
+
if (! ConInRec->Fake || ! ConInRec->NotChar)
{
/* FIXME - convert to ascii */
PrivateCsrssRegisterPrimitive();
/* This call turns on the input system in win32k */
PrivateCsrssAcquireOrReleaseInputOwnership(FALSE);
-
+
while (TRUE)
{
GetMessageW(&msg, 0, 0, 0);
NTSTATUS Status;
PCSRSS_SCREEN_BUFFER Buff;
PCONSOLE_SCREEN_BUFFER_INFO pInfo;
-
+
DPRINT("CsrGetScreenBufferInfo\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
PCSRSS_SCREEN_BUFFER Buff;
LONG OldCursorX, OldCursorY;
LONG NewCursorX, NewCursorY;
-
+
DPRINT("CsrSetCursor\n");
Status = ConioConsoleFromProcessData(ProcessData, &Console);
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
-
+
CharSize = (Request->Data.WriteConsoleOutputCharRequest.Unicode ? sizeof(WCHAR) : sizeof(CHAR));
if (Request->Header.DataSize
RECT UpdateRect;
DPRINT("CsrFillOutputChar\n");
-
+
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
NTSTATUS Status;
BOOLEAN Done = FALSE;
ConsoleInput *Input;
-
+
DPRINT("CsrReadInputEvent\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Reply->Data.ReadInputReply.Event = ProcessData->ConsoleEvent;
-
+
Status = ConioLockConsole(ProcessData, Request->Data.ReadInputRequest.ConsoleHandle, &Console);
if (! NT_SUCCESS(Status))
{
Reply->Data.ReadInputReply.MoreEvents = TRUE;
break;
}
-
+
RemoveEntryList(&Input->ListEntry);
if (!Done && !Input->Fake)
}
HeapFree(Win32CsrApiHeap, 0, Input);
}
-
+
if (Done)
{
Status = STATUS_SUCCESS;
RECT UpdateRect;
DPRINT("CsrWriteConsoleOutputAttrib\n");
-
+
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
{
return Reply->Status = Status;
}
-
+
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Status = ConioLockScreenBuffer(ProcessData, Request->Data.FillOutputAttribRequest.ConsoleHandle, &Buff);
{
PCSRSS_SCREEN_BUFFER Buff;
NTSTATUS Status;
-
+
DPRINT("CsrGetCursorInfo\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
DWORD Size;
BOOL Visible;
NTSTATUS Status;
-
+
DPRINT("CsrSetCursorInfo\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
NTSTATUS Status;
PCSRSS_CONSOLE Console;
PCSRSS_SCREEN_BUFFER Buff;
- LONG OldCursorX, OldCursorY;
+ LONG OldCursorX, OldCursorY;
DPRINT("CsrSetTextAttrib\n");
PCSRSS_CONSOLE Console;
PCSRSS_SCREEN_BUFFER Buff;
NTSTATUS Status;
-
+
DPRINT("CsrCreateScreenBuffer\n");
if (ProcessData == NULL)
Status = ConioLockConsole(ProcessData, Request->Data.SetTitleRequest.Console, &Console);
if(! NT_SUCCESS(Status))
{
- Reply->Status = Status;
+ Reply->Status = Status;
}
else
{
{
NTSTATUS Status;
PCSRSS_CONSOLE Console;
-
+
DPRINT("CsrGetTitle\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
DPRINT1("Can't get console\n");
return Reply->Status = Status;
}
-
+
/* Copy title of the console to the user title buffer */
RtlZeroMemory(&Reply->Data.GetTitleReply, sizeof(CSRSS_GET_TITLE_REPLY));
Reply->Data.GetTitleReply.ConsoleHandle = Request->Data.GetTitleRequest.ConsoleHandle;
BufferCoord = Request->Data.WriteConsoleOutputRequest.BufferCoord;
CharInfo = Request->Data.WriteConsoleOutputRequest.CharInfo;
if (((PVOID)CharInfo < ProcessData->CsrSectionViewBase) ||
- (((PVOID)CharInfo + PSize) >
+ (((PVOID)CharInfo + PSize) >
(ProcessData->CsrSectionViewBase + ProcessData->CsrSectionViewSize)))
{
ConioUnlockScreenBuffer(Buff);
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = Reply->Header.MessageSize - LPC_MESSAGE_BASE_SIZE;
ReadBuffer = Reply->Data.ReadConsoleOutputCharReply.String;
-
+
CharSize = (Request->Data.ReadConsoleOutputCharRequest.Unicode ? sizeof(WCHAR) : sizeof(CHAR));
-
+
Status = ConioConsoleFromProcessData(ProcessData, &Console);
if (! NT_SUCCESS(Status))
{
for (i = 0; i < Request->Data.ReadConsoleOutputCharRequest.NumCharsToRead; ++i)
{
Char = Buff->Buffer[(Xpos * 2) + (Ypos * 2 * Buff->MaxX)];
-
+
if(Request->Data.ReadConsoleOutputCharRequest.Unicode)
{
ConsoleAnsiCharToUnicodeChar(Console, (WCHAR*)ReadBuffer, &Char);
{
ConioUnlockConsole(Console);
}
-
+
Reply->Data.ReadConsoleOutputCharReply.CharsRead = (DWORD)((ULONG_PTR)ReadBuffer - (ULONG_PTR)Reply->Data.ReadConsoleOutputCharReply.String) / CharSize;
return Reply->Status;
PLIST_ENTRY CurrentItem;
DWORD NumEvents;
ConsoleInput *Input;
-
+
DPRINT("CsrGetNumberOfConsoleInputEvents\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
{
return Reply->Status = Status;
}
-
+
CurrentItem = Console->InputEvents.Flink;
NumEvents = 0;
-
+
/* If there are any events ... */
while (CurrentItem != &Console->InputEvents)
{
}
ConioUnlockConsole(Console);
-
+
Reply->Status = STATUS_SUCCESS;
Reply->Data.GetNumInputEventsReply.NumInputEvents = NumEvents;
-
+
return Reply->Status;
}
PINPUT_RECORD InputRecord;
ConsoleInput* Item;
UINT NumItems;
-
+
DPRINT("CsrPeekConsoleInput\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
-
+
Status = ConioLockConsole(ProcessData, Request->Data.GetNumInputEventsRequest.ConsoleHandle, &Console);
if(! NT_SUCCESS(Status))
{
return Reply->Status = Status;
}
-
+
InputRecord = Request->Data.PeekConsoleInputRequest.InputRecord;
Length = Request->Data.PeekConsoleInputRequest.Length;
Size = Length * sizeof(INPUT_RECORD);
-
+
if (((PVOID)InputRecord < ProcessData->CsrSectionViewBase)
|| (((PVOID)InputRecord + Size) > (ProcessData->CsrSectionViewBase + ProcessData->CsrSectionViewSize)))
{
Reply->Status = STATUS_ACCESS_VIOLATION;
return Reply->Status ;
}
-
+
NumItems = 0;
-
+
if (! IsListEmpty(&Console->InputEvents))
{
CurrentItem = Console->InputEvents.Flink;
-
+
while (CurrentItem != &Console->InputEvents && NumItems < Length)
{
Item = CONTAINING_RECORD(CurrentItem, ConsoleInput, ListEntry);
CurrentItem = CurrentItem->Flink;
continue;
}
-
+
++NumItems;
*InputRecord = Item->InputEvent;
{
ConioInputEventToAnsi(Console, InputRecord);
}
-
+
InputRecord++;
CurrentItem = CurrentItem->Flink;
}
RECT ScreenRect;
DWORD i, Y, X, Offset;
UINT CodePage;
-
+
DPRINT("CsrReadConsoleOutput\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
-
+
Status = ConioLockScreenBuffer(ProcessData, Request->Data.ReadConsoleOutputRequest.ConsoleHandle, &Buff);
if (! NT_SUCCESS(Status))
{
return Reply->Status = Status;
}
-
+
CharInfo = Request->Data.ReadConsoleOutputRequest.CharInfo;
ReadRegion.left = Request->Data.ReadConsoleOutputRequest.ReadRegion.Left;
ReadRegion.top = Request->Data.ReadConsoleOutputRequest.ReadRegion.Top;
/* FIXME: Is this correct? */
CodePage = ProcessData->Console->OutputCodePage;
-
+
if (((PVOID)CharInfo < ProcessData->CsrSectionViewBase)
|| (((PVOID)CharInfo + Size) > (ProcessData->CsrSectionViewBase + ProcessData->CsrSectionViewSize)))
{
Reply->Status = STATUS_ACCESS_VIOLATION;
return Reply->Status ;
}
-
+
SizeY = RtlRosMin(BufferSize.Y - BufferCoord.Y, ConioRectHeight(&ReadRegion));
SizeX = RtlRosMin(BufferSize.X - BufferCoord.X, ConioRectWidth(&ReadRegion));
ReadRegion.bottom = ReadRegion.top + SizeY;
for (i = 0, Y = ReadRegion.top; Y < ReadRegion.bottom; ++i, ++Y)
{
CurCharInfo = CharInfo + (i * BufferSize.X);
-
+
Offset = (((Y + Buff->ShowY) % Buff->MaxY) * Buff->MaxX + ReadRegion.left) * 2;
for (X = ReadRegion.left; X < ReadRegion.right; ++X)
{
}
ConioUnlockScreenBuffer(Buff);
-
+
Reply->Status = STATUS_SUCCESS;
Reply->Data.ReadConsoleOutputReply.ReadRegion.Right = ReadRegion.left + SizeX - 1;
Reply->Data.ReadConsoleOutputReply.ReadRegion.Bottom = ReadRegion.top + SizeY - 1;
Reply->Data.ReadConsoleOutputReply.ReadRegion.Left = ReadRegion.left;
Reply->Data.ReadConsoleOutputReply.ReadRegion.Top = ReadRegion.top;
-
+
return Reply->Status;
}
DWORD Size;
DWORD i;
ConsoleInput* Record;
-
+
DPRINT("CsrWriteConsoleInput\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
-
+
Status = ConioLockConsole(ProcessData, Request->Data.WriteConsoleInputRequest.ConsoleHandle, &Console);
if (! NT_SUCCESS(Status))
{
return Reply->Status = Status;
}
-
+
InputRecord = Request->Data.WriteConsoleInputRequest.InputRecord;
Length = Request->Data.WriteConsoleInputRequest.Length;
Size = Length * sizeof(INPUT_RECORD);
-
+
if (((PVOID)InputRecord < ProcessData->CsrSectionViewBase)
|| (((PVOID)InputRecord + Size) > (ProcessData->CsrSectionViewBase + ProcessData->CsrSectionViewSize)))
{
Reply->Status = STATUS_ACCESS_VIOLATION;
return Reply->Status ;
}
-
+
for (i = 0; i < Length; i++)
{
Record = HeapAlloc(Win32CsrApiHeap, 0, sizeof(ConsoleInput));
}
ConioUnlockConsole(Console);
-
+
Reply->Status = STATUS_SUCCESS;
Reply->Data.WriteConsoleInputReply.Length = i;
Console->HardwareState = ConsoleHwState;
}
- return STATUS_SUCCESS;
+ return STATUS_SUCCESS;
}
return STATUS_INVALID_PARAMETER_3; /* Client: (handle, set_get, [mode]) */
{
PCSRSS_CONSOLE Console;
NTSTATUS Status;
-
+
DPRINT("CsrHardwareStateProperty\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
-
+
Status = ConioLockConsole(ProcessData,
Request->Data.ConsoleHardwareStateRequest.ConsoleHandle,
&Console);
case CONSOLE_HARDWARE_STATE_GET:
Reply->Data.ConsoleHardwareStateReply.State = Console->HardwareState;
break;
-
+
case CONSOLE_HARDWARE_STATE_SET:
DPRINT("Setting console hardware state.\n");
Reply->Status = SetConsoleHardwareState(Console, Request->Data.ConsoleHardwareStateRequest.State);
NTSTATUS Status;
DPRINT("CsrGetConsoleWindow\n");
-
+
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
-
+
Status = ConioConsoleFromProcessData(ProcessData, &Console);
if (! NT_SUCCESS(Status))
{
NTSTATUS Status;
DPRINT("CsrSetConsoleIcon\n");
-
+
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
-
+
Status = ConioConsoleFromProcessData(ProcessData, &Console);
if (! NT_SUCCESS(Status))
{
{
return Reply->Status = Status;
}
-
+
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Reply->Data.GetConsoleCodePage.CodePage = Console->CodePage;
{
return Reply->Status = Status;
}
-
+
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
if (IsValidCodePage(Request->Data.SetConsoleCodePage.CodePage))
{
return Reply->Status = Status;
}
-
+
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Reply->Data.GetConsoleOutputCodePage.CodePage = Console->OutputCodePage;
{
return Reply->Status = Status;
}
-
+
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
if (IsValidCodePage(Request->Data.SetConsoleOutputCodePage.CodePage))
NTSTATUS Status;
DPRINT("CsrGetProcessList\n");
-
+
Buffer = Reply->Data.GetProcessListReply.ProcessId;
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = Reply->Header.MessageSize - LPC_MESSAGE_BASE_SIZE;
-
+
nItems = nCopied = 0;
Reply->Data.GetProcessListReply.nProcessIdsCopied = 0;
Reply->Data.GetProcessListReply.nProcessIdsTotal = 0;
-
+
Status = ConioConsoleFromProcessData(ProcessData, &Console);
if (! NT_SUCCESS(Status))
{
}
ConioUnlockConsole(Console);
-
+
Reply->Data.GetProcessListReply.nProcessIdsCopied = nCopied;
Reply->Data.GetProcessListReply.nProcessIdsTotal = nItems;
-
+
return Reply->Status = STATUS_SUCCESS;
}
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: subsys/csrss/win32csr/dllmain.c
- * PURPOSE: Initialization
+ * PURPOSE: Initialization
*/
/* INCLUDES ******************************************************************/
SelectObject(Dc, OldFont);
GuiData->MemoryDC = CreateCompatibleDC(Dc);
- GuiData->MemoryBitmap = CreateCompatibleBitmap(Dc,
- Console->Size.X * GuiData->CharWidth,
+ GuiData->MemoryBitmap = CreateCompatibleBitmap(Dc,
+ Console->Size.X * GuiData->CharWidth,
Console->Size.Y * GuiData->CharHeight);
/* NOTE: Don't delete the "first bitmap", it's done in DeleteDC. */
SelectObject(GuiData->MemoryDC, GuiData->MemoryBitmap);
/* NOTE: Don't delete stock font. */
- SelectObject(GuiData->MemoryDC, GuiData->Font);
+ SelectObject(GuiData->MemoryDC, GuiData->Font);
ReleaseDC(hWnd, Dc);
GuiData->CursorBlinkOn = TRUE;
GuiData->ForceCursorOff = FALSE;
GuiData->Selection.left = -1;
-
+
Console->PrivateData = GuiData;
SetWindowLongPtrW(hWnd, GWL_USERDATA, (DWORD_PTR) Console);
GuiConsoleUpdateSelection(HWND hWnd, PRECT rc, PGUI_CONSOLE_DATA GuiData)
{
RECT oldRect = GuiData->Selection;
-
+
if(rc != NULL)
{
RECT changeRect = *rc;
changeRect.top *= GuiData->CharHeight;
changeRect.right *= GuiData->CharWidth;
changeRect.bottom *= GuiData->CharHeight;
-
+
if(rc->left != oldRect.left ||
rc->top != oldRect.top ||
rc->right != oldRect.right ||
if(oldRect.left != -1)
{
HRGN rgn1, rgn2;
-
+
oldRect.left *= GuiData->CharWidth;
oldRect.top *= GuiData->CharHeight;
oldRect.right *= GuiData->CharWidth;
oldRect.bottom *= GuiData->CharHeight;
-
+
/* calculate the region that needs to be updated */
if((rgn1 = CreateRectRgnIndirect(&oldRect)))
{
GuiConsoleSetTextColors(GuiData->MemoryDC, Attribute);
LastAttribute = Attribute;
}
- }
+ }
MultiByteToWideChar(Console->OutputCodePage, 0, (PCHAR)From, 1, To, 1);
To++;
From += 2;
Ps.rcPaint.right - Ps.rcPaint.left + 1,
Ps.rcPaint.bottom - Ps.rcPaint.top + 1, GuiData->MemoryDC,
Ps.rcPaint.left, Ps.rcPaint.top, SRCCOPY);
-
+
if (GuiData->Selection.left != -1)
{
RECT rc = GuiData->Selection;
-
+
rc.left *= GuiData->CharWidth;
rc.top *= GuiData->CharHeight;
rc.right *= GuiData->CharWidth;
rc.bottom *= GuiData->CharHeight;
if (IntersectRect(&rc, &Ps.rcPaint, &rc))
- {
+ {
PatBlt(Dc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, DSTINVERT);
- }
- }
-
+ }
+ }
+
EndPaint (hWnd, &Ps);
LeaveCriticalSection(&GuiData->Lock);
}
Message.message = msg;
Message.wParam = wParam;
Message.lParam = lParam;
-
+
if(msg == WM_CHAR || msg == WM_SYSKEYDOWN)
{
/* clear the selection */
PGUI_CONSOLE_DATA GuiData;
POINTS pt;
RECT rc;
-
+
GuiConsoleGetDataPointers(hWnd, &Console, &GuiData);
if (Console == NULL || GuiData == NULL) return;
rc.top = pt.y / GuiData->CharHeight;
rc.right = rc.left + 1;
rc.bottom = rc.top + 1;
-
+
GuiData->SelectionStart.x = rc.left;
GuiData->SelectionStart.y = rc.top;
-
+
SetCapture(hWnd);
-
+
GuiData->MouseDown = TRUE;
-
+
GuiConsoleUpdateSelection(hWnd, &rc, GuiData);
}
PGUI_CONSOLE_DATA GuiData;
RECT rc;
POINTS pt;
-
+
GuiConsoleGetDataPointers(hWnd, &Console, &GuiData);
if (Console == NULL || GuiData == NULL) return;
if (GuiData->Selection.left == -1 || !GuiData->MouseDown) return;
-
+
pt = MAKEPOINTS(lParam);
-
+
rc.left = GuiData->SelectionStart.x;
rc.top = GuiData->SelectionStart.y;
rc.right = (pt.x >= 0 ? (pt.x / GuiData->CharWidth) + 1 : 0);
rc.top = max(rc.bottom - 1, 0);
rc.bottom = tmp + 1;
}
-
+
GuiData->MouseDown = FALSE;
GuiConsoleUpdateSelection(hWnd, &rc, GuiData);
-
+
ReleaseCapture();
}
PGUI_CONSOLE_DATA GuiData;
RECT rc;
POINTS pt;
-
+
if (!(wParam & MK_LBUTTON)) return;
-
+
GuiConsoleGetDataPointers(hWnd, &Console, &GuiData);
if (Console == NULL || GuiData == NULL || !GuiData->MouseDown) return;
}
GuiConsoleUpdateSelection(hWnd, &rc, GuiData);
-}
+}
static VOID FASTCALL
GuiConsoleRightMouseDown(HWND hWnd)
{
PCSRSS_CONSOLE Console;
PGUI_CONSOLE_DATA GuiData;
-
+
GuiConsoleGetDataPointers(hWnd, &Console, &GuiData);
if (Console == NULL || GuiData == NULL) return;
else
{
/* FIXME - copy selection to clipboard */
-
+
GuiConsoleUpdateSelection(hWnd, NULL, GuiData);
}
-}
+}
static LRESULT CALLBACK
GuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
ScrollRect.top = Dest->top * GuiData->CharHeight;
ScrollRect.bottom = (Dest->bottom + 1) * GuiData->CharHeight;
EnterCriticalSection(&GuiData->Lock);
- BitBlt(GuiData->MemoryDC, ScrollRect.left, ScrollRect.top,
+ BitBlt(GuiData->MemoryDC, ScrollRect.left, ScrollRect.top,
ScrollRect.right - ScrollRect.left, ScrollRect.bottom - ScrollRect.top,
GuiData->MemoryDC, Source->left * GuiData->CharWidth, Source->top * GuiData->CharHeight, SRCCOPY);
{
CONSOLE_SCREEN_BUFFER_INFO ScrInfo;
DWORD BytesReturned;
-
+
ConsoleDeviceHandle = CreateFileW(L"\\\\.\\BlueScreen", FILE_ALL_ACCESS, 0, NULL,
OPEN_EXISTING, 0, NULL);
if (INVALID_HANDLE_VALUE == ConsoleDeviceHandle)
ConsoleDraw->SizeY = ConioRectHeight(Region);
ConsoleDraw->CursorX = CursorX;
ConsoleDraw->CursorY = CursorY;
-
+
TuiCopyRect((char *) (ConsoleDraw + 1), Buff, Region);
-
+
if (! DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_DRAW,
NULL, 0, ConsoleDraw, ConsoleDrawSize, &BytesReturned, NULL))
{
Console->Next->Prev = Console->Prev;
}
LeaveCriticalSection(&ActiveConsoleLock);
-
+
if (NULL != ActiveConsole)
{
ConioDrawConsole(ActiveConsole);
{
SwapConsole = ActiveConsole;
}
-
+
SwapConsole = (0 < Next ? SwapConsole->Next : SwapConsole->Prev);
Title.MaximumLength = RtlUnicodeStringToAnsiSize(&SwapConsole->Title);
Title.Length = 0;
/* $Id$
- *
+ *
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: subsys/ntvdm/ntvdm->c
BOOL result = TRUE;
DWORD dwError;
HANDLE hFile;
-
+
hFile = CreateFileW(L"\\system32\\config.nt",
GENERIC_READ,
FILE_SHARE_READ,
LoadConfigDriversForVDM(PVDM_CONFIG vdmConfig)
{
BOOL result = TRUE;
-
+
return result;
}
SetConfigOptionsForVDM(PVDM_AUTOEXEC vdmAutoexec)
{
BOOL result = TRUE;
-
+
return result;
}
//SetLastError();
return FALSE;
}
-
+
}
-
+
GetSystemInfo(&inf);
vdm->hHeap = HeapCreate(0, inf.dwAllocationGranularity, 0);
if (vdm->hHeap == NULL) {
//SetLastError();
return 2;
}
-
+
ReadConfigForVDM(&VdmCB);
if (!LoadConfigDriversForVDM(&(VdmCB.vdmConfig))) {
/* $Id$
*
* init.c - Session Manager initialization
- *
+ *
* ReactOS Operating System
- *
+ *
* --------------------------------------------------------------------
*
* This software is free software; you can redistribute it and/or
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING.LIB. If not, write
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
- * MA 02139, USA.
+ * MA 02139, USA.
*
* --------------------------------------------------------------------
*/
Status = InitRoutine[i].EntryPoint();
if(!NT_SUCCESS(Status))
{
- DPRINT1("SM: %s: failed to %s (Status=%lx)\n",
+ DPRINT1("SM: %s: failed to %s (Status=%lx)\n",
__FUNCTION__,
InitRoutine[i].ErrorMessage,
Status);
SmQryInfo /* smapyqry.c */
};
-/* TODO: optimize this address computation (it should be done
+/* TODO: optimize this address computation (it should be done
* with a macro) */
PSM_CONNECT_DATA FASTCALL SmpGetConnectData (PSM_PORT_MESSAGE Request)
{
ULONG CallbackPortNameLength = SM_SB_NAME_MAX_LENGTH; /* TODO: compute length */
SB_CONNECT_DATA SbConnectData;
ULONG SbConnectDataLength = sizeof SbConnectData;
-
+
DPRINT("SM: %s called\n", __FUNCTION__);
if(IMAGE_SUBSYSTEM_NATIVE == ConnectData->SubSystemId)
HANDLE hClientDataApiPortThread = (HANDLE) 0;
PHANDLE ClientDataApiPortThread = & hClientDataApiPortThread;
PVOID Context = NULL;
-
+
DPRINT("SM: %s called:\n SubSystemID=%d\n SbName=\"%S\"\n",
__FUNCTION__, ConnectData->SubSystemId, ConnectData->SbName);
ClientDataApiPortThread = & ClientData->ApiPortThread;
/*
* Call back the candidate environment subsystem
- * server (use the port name sent in in the
+ * server (use the port name sent in in the
* connection request message).
*/
Status = SmpCallbackServer (Request, ClientData);
* we need a thread to listen for connection request that
* creates a new thread for each connected port. This is not
* necessary in NT LPC, because server side connected ports are
- * never used to receive requests.
+ * never used to receive requests.
*/
VOID STDCALL
SmpApiThread (HANDLE ListeningPort)
LPC_MAX_MESSAGE Request = {{0}};
DPRINT("SM: %s called\n", __FUNCTION__);
-
+
while (TRUE)
{
Status = NtListenPort (ListeningPort, & Request.Header);
/* $Id$
*
* smss.c - Session Manager
- *
+ *
* ReactOS Operating System
- *
+ *
* --------------------------------------------------------------------
*
* This software is free software; you can redistribute it and/or
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING.LIB. If not, write
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
- * MA 02139, USA.
+ * MA 02139, USA.
*
* --------------------------------------------------------------------
*/
{
NTSTATUS Status;
PROCESS_BASIC_INFORMATION PBI = {0};
-
+
PrintString("ReactOS Session Manager %s (Build %s)\n",
KERNEL_RELEASE_STR,
KERNEL_VERSION_BUILD_STR);
HANDLE SbApiPort;
WCHAR SbApiPortName [SM_SB_NAME_MAX_LENGTH];
struct _SM_CLIENT_DATA * Next;
-
+
} SM_CLIENT_DATA, *PSM_CLIENT_DATA;
NTSTATUS SmInitializeClientManagement(VOID);
NTSTATUS STDCALL SmCreateClient(PSM_PORT_MESSAGE,PSM_CLIENT_DATA*);
NTSTATUS Status;
PrintString("Autochk 0.0.1\n");
-
+
Status = NtQueryInformationProcess(NtCurrentProcess(),
ProcessDeviceMap,
&DeviceMap.Query,
* Redirection safe!
*
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
/* specified routines */
VOID ExpandAlias (LPTSTR cmd, INT maxlen)
-{
+{
unsigned n = 0,
m,
i,
{
m = _tcslen (ptr->lpSubst);
if ((int)(_tcslen (cmd) - len + m - n) > maxlen)
- {
+ {
ConErrResPuts(STRING_ALIAS_ERROR);
/* the parser won't cause any problems with an empty line */
INT CommandAlias (LPTSTR cmd, LPTSTR param)
-{
+{
LPTSTR ptr;
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_ALIAS_HELP);
return 0;
}
* Added handling of multiple filenames.
*
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
INT CommandAttrib (LPTSTR cmd, LPTSTR param)
-{
+{
LPTSTR *arg;
INT argc, i;
TCHAR szPath[MAX_PATH];
/* print help */
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_ATTRIB_HELP);
return 0;
}
* 26-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Replaced CRT io functions by Win32 io functions.
* Unicode safe!
- *
+ *
* 23-Feb-2001 (Carl Nettelblad <cnettel@hem.passagen.es>)
* Fixes made to get "for" working.
*
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
*/
BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
-{
+{
HANDLE hFile;
hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_READ, NULL,
#endif
if (hFile == INVALID_HANDLE_VALUE)
- {
+ {
ConErrResPuts(STRING_BATCH_ERROR);
return FALSE;
}
* Redirection ready!
*
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
INT cmd_beep (LPTSTR cmd, LPTSTR param)
{
if (_tcsncmp (param, _T("/?"), 2) == 0)
- {
+ {
ConOutResPuts(STRING_BEEP_HELP);
return 0;
}
* Unicode and redirection safe!
*
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
*/
INT cmd_call (LPTSTR cmd, LPTSTR param)
-{
+{
LPBATCH_CONTEXT n = NULL;
#ifdef _DEBUG
DebugPrintf (_T("cmd_call: (\'%s\',\'%s\')\n"), cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_CALL_HELP);
return 0;
}
* Started.
*
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
/* print help */
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_CHCP_HELP);
return 0;
}
}
if (!SetConsoleCP(uNewCodePage))
- {
+ {
ConErrResPuts(STRING_CHCP_ERROR4);
}
else
{
-
+
SetConsoleOutputCP (uNewCodePage);
InitLocale ();
InputCodePage= GetConsoleCP();
lpOptions = Options;
if (_tcsncmp (param, _T("/?"), 2) == 0)
- {
+ {
ConOutResPuts(STRING_CHOICE_HELP);
return 0;
}
lpOptions = &arg[i][2];
if (_tcslen (lpOptions) == 0)
- {
+ {
ConErrResPuts(STRING_CHOICE_ERROR);
freep (arg);
return 1;
}
if (*s != _T(','))
- {
+ {
ConErrResPuts(STRING_CHOICE_ERROR_TXT);
freep (arg);
return 1;
* Redirection ready!
*
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
#ifdef INCLUDE_CMD_CLS
INT cmd_cls (LPTSTR cmd, LPTSTR param)
-{
+{
CONSOLE_SCREEN_BUFFER_INFO csbi;
COORD coPos;
DWORD dwWritten;
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_CLS_HELP);
return 0;
}
* Added ShellExecute call when all else fails to be able to "launch" any file.
*
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
LPTSTR ip;
LPTSTR cp;
BOOL bEchoThisLine;
-
+
do
{
*/
BOOL WINAPI BreakHandler (DWORD dwCtrlType)
{
-
+
if ((dwCtrlType != CTRL_C_EVENT) &&
(dwCtrlType != CTRL_BREAK_EVENT))
return FALSE;
#if 0
static VOID
ShowCommands (VOID)
-{
- /* print command list */
+{
+ /* print command list */
ConOutResPuts(STRING_CMD_HELP1);
PrintCommandList();
- /* print feature list */
+ /* print feature list */
ConOutResPuts(STRING_CMD_HELP2);
-#ifdef FEATURE_ALIASES
+#ifdef FEATURE_ALIASES
ConOutResPuts(STRING_CMD_HELP3);
#endif
-#ifdef FEATURE_HISTORY
+#ifdef FEATURE_HISTORY
ConOutResPuts(STRING_CMD_HELP4);
#endif
-#ifdef FEATURE_UNIX_FILENAME_COMPLETION
+#ifdef FEATURE_UNIX_FILENAME_COMPLETION
ConOutResPuts(STRING_CMD_HELP5);
#endif
-#ifdef FEATURE_DIRECTORY_STACK
+#ifdef FEATURE_DIRECTORY_STACK
ConOutResPuts(STRING_CMD_HELP6);
#endif
-#ifdef FEATURE_REDIRECTION
+#ifdef FEATURE_REDIRECTION
ConOutResPuts(STRING_CMD_HELP7);
#endif
ConOutChar(_T('\n'));
*/
static VOID
Initialize (int argc, TCHAR* argv[])
-{
+{
TCHAR commandline[CMDLINE_LENGTH];
TCHAR ModuleName[_MAX_PATH + 1];
INT i;
if (argc >= 2 && !_tcsncmp (argv[1], _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_CMD_HELP8);
ExitProcess(0);
}
/* run cmdexit.bat */
if (IsExistingFile (_T("cmdexit.bat")))
- {
+ {
ConErrResPuts(STRING_CMD_ERROR5);
ParseCommandLine (_T("cmdexit.bat"));
}
else if (IsExistingFile (_T("\\cmdexit.bat")))
- {
+ {
ConErrResPuts (STRING_CMD_ERROR5);
ParseCommandLine (_T("\\cmdexit.bat"));
}
{
#ifdef FEATURE_HISTORY
-
+
case 'K':
/*add the current command line to the history*/
if (ir.Event.KeyEvent.dwControlKeyState &
(LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
{
-
+
if (str[0])
History(0,str);
(LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
{
ClearCommandLine (str, maxlen, orgx, orgy);
- History_del_current_entry(str);
+ History_del_current_entry(str);
current = charcount = _tcslen (str);
ConOutPrintf (_T("%s"), str);
GetCursorXY (&curx, &cury);
}
-
+
}
orgy + (orgx + current) / maxx);
GetCursorXY (&curx, &cury);
}
-
+
}
}
else
{_T("goto"), CMD_BATCHONLY, cmd_goto},
-#ifdef FEATURE_HISTORY
+#ifdef FEATURE_HISTORY
{_T("history"), 0, CommandHistory},
#endif
DWORD dwWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
COORD coPos;
-
+
if ((wColor & 0xF) == (wColor &0xF0) >> 4)
- {
+ {
ConErrResPuts(STRING_COLOR_ERROR1);
}
else
}
if (StringToColor(&wColor, &rest) == FALSE)
- {
+ {
ConErrResPuts(STRING_COLOR_ERROR2);
return 1;
}
* started
*
* 03-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
VOID ConOutResPuts (UINT resID)
{
- TCHAR szMsg[RC_STRING_MAX_SIZE];
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
LoadString(CMD_ModuleHandle, resID, szMsg, RC_STRING_MAX_SIZE);
ConPuts(szMsg, STD_OUTPUT_HANDLE);
(LPTSTR) &text,
0,
&arg_ptr);
-
+
va_end (arg_ptr);
if(ret > 0)
{
VOID ConErrResPuts (UINT resID)
{
- TCHAR szMsg[RC_STRING_MAX_SIZE];
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
LoadString(CMD_ModuleHandle, resID, szMsg, RC_STRING_MAX_SIZE);
ConPuts(szMsg, STD_ERROR_HANDLE);
}
* Disabled prompting when used in batch mode.
*
* 03-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
{
// Make sure we have a clean workable path
-
+
GetFullPathName( arg[i], 128, (LPTSTR) &temp, NULL);
// printf("A Input %s, Output %s\n", arg[i], temp);
GetFullPathName( arg[i], 128, (LPTSTR) &temp, NULL);
// printf("B Input %s, Output %s\n", arg[i], temp);
-
+
if (!AddFiles(f, (TCHAR *) &temp, &source, &dest, &count, lpdwFlags))
return -1;
while (f->next != NULL)
TCHAR szOptions[4];
LoadString( CMD_ModuleHandle, STRING_COPY_OPTION, szOptions, 4);
-
+
ConOutResPuts(STRING_COPY_HELP1);
-
+
ConInString(inp, 10);
ConOutPuts(_T(""));
{
LoadString(CMD_ModuleHandle, STRING_COPY_ERROR2, szMsg, RC_STRING_MAX_SIZE);
ConErrPrintf(szMsg, source);
-
+
CloseHandle (hFileSrc);
return 0;
}
WriteFile (hFileDest, buffer, dwRead, &dwWritten, NULL);
if (dwWritten != dwRead)
- {
+ {
ConErrResPuts(STRING_COPY_ERROR3);
free (buffer);
{
// printf("Merge DIR\n");
-
+
bMultiple = FALSE;
_tcscat (from_merge, _T("\\"));
_tcscat (from_merge, find.cFileName);
INT cmd_copy (LPTSTR first, LPTSTR rest)
-{
+{
TCHAR **p;
TCHAR drive_d[_MAX_DRIVE];
TCHAR dir_d[_MAX_DIR];
DWORD dwFlags = 0;
if (!_tcsncmp (rest, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_COPY_HELP2);
return 1;
}
copied = SetupCopy (sources, p, bMultiple, drive_d, dir_d, file_d, ext_d, &append, &dwFlags);
}
else if (bDestFound && bWildcards)
- {
+ {
ConErrResPuts(STRING_COPY_ERROR4);
DeleteFileList (sources);
* Fixed date input bug.
*
* 03-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
INT cmd_date (LPTSTR cmd, LPTSTR param)
-{
+{
LPTSTR *arg;
INT argc;
INT i;
INT nDateString = -1;
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_DATE_HELP4);
return 0;
}
return 0;
}
ConErrResPuts(STRING_DATE_ERROR);
-
+
}
}
else
freep (arg);
return 0;
}
-
+
ConErrResPuts(STRING_DATE_ERROR);
}
LONG ch;
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_DEL_HELP1);
return 0;
}
arg = split (param, &args, FALSE);
-
+
if (args > 0)
{
/* check for options anywhere in command line */
#endif
/* ask for deleting */
- if (dwFlags & DEL_PROMPT)
+ if (dwFlags & DEL_PROMPT)
{
LoadString(CMD_ModuleHandle, STRING_DEL_ERROR5, szMsg, RC_STRING_MAX_SIZE);
ConErrPrintf(szMsg, szFullPath);
-
+
LoadString(CMD_ModuleHandle, STRING_DEL_ERROR6, szMsg, RC_STRING_MAX_SIZE);
res = FilePromptYN ((LPTSTR)szMsg);
INT CommandDelay (LPTSTR cmd, LPTSTR param)
-{
+{
DWORD val;
DWORD mul=1000;
if (_tcsncmp (param, _T("/?"), 2) == 0)
- {
+ {
ConOutResPuts(STRING_DELAY_HELP);
return 0;
}
*
* 01-Mar-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Replaced all runtime io functions by their Win32 counterparts.
- *
+ *
* 23-Feb-2001 (Carl Nettelblad <cnettel@hem.passagen.se>)
* dir /s now works in deeper trees
*
/* No parameters yet */
*param = NULL;
ptrLast = NULL;
-
+
/* We suppose that switch parameters
were given to avoid setting them to default
if the switch was not given */
/* we save current character as it is and its upper case */
cCurChar = *Line;
cCurUChar = _totupper(*Line);
-
+
/* 1st section (see README_DIR.txt) */
/* When a switch is expecting */
if (cCurSwitch == _T('/'))
if ((cCurChar != _T('-')) && bPNegative)
bPNegative = FALSE;
}
-
+
Line++;
}
/* Terminate the parameters */
if (!file)
return;
-
+
/* if no file spec, change to "*.*" */
if (*file == _T('\0'))
- {
- _tcscpy (file, _T("*.*"));
+ {
+ _tcscpy (file, _T("*.*"));
return;
}
// add support for *.
if ((file[0] == _T('*')) && (file[1] == _T('.') ))
- {
+ {
return;
}
/* if no . add .* */
if (!_tcschr (file, _T('.')))
{
- _tcscat (file, _T(".*"));
+ _tcscat (file, _T(".*"));
return;
}
-
+
/* if last character is '.' add '*' */
len = _tcslen (file);
if (file[len - 1] == _T('.'))
{
- _tcscat (file, _T("*"));
+ _tcscat (file, _T("*"));
return;
}
}
/*
* getExt
*
- * Get the extension of a filename
+ * Get the extension of a filename
*/
TCHAR* getExt(const TCHAR* file)
{
iLen = _tcslen(file);
else
iLen = (end - file);
-
+
_tcsncpy(dest, file, iLen);
*(dest + iLen) = _T('\0');
-
+
return dest;
}
_tcscpy(szExt, getExt( ptrFiles[i]->cFileName));
}
- /* Calculate size */
- if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ /* Calculate size */
+ if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
/* Directory, no size it's a directory*/
iSizeFormat = -17;
_tcscpy(szSize, _T("<DIR>"));
}
- else
+ else
{
/* File */
iSizeFormat = 17;
u64FileSize.LowPart = ptrFiles[i]->nFileSizeLow;
ConvertULargeInteger(u64FileSize, szSize, 20, lpFlags->bTSeperator);
}
-
+
/* Format date and time */
DirPrintFileDateTime(szDate,szTime,ptrFiles[i],lpFlags);
/*
* DirPrintFiles
- *
+ *
* The functions that prints the files list
*/
static VOID
u64File1.HighPart = lpFile1->ftLastWriteTime.dwHighDateTime ;
u64File2.LowPart = lpFile2->ftLastWriteTime.dwLowDateTime;
u64File2.HighPart = lpFile2->ftLastWriteTime.dwHighDateTime ;
- break;
+ break;
}
-
+
/* In case that differnce is too big for a long */
if (u64File1.QuadPart < u64File2.QuadPart)
iComp = -1;
the files/dirs,there is no need to calculate the others*/
if (iComp != 0) break;
}
-
+
/* Translate the value of iComp to boolean */
if (iComp > 0)
return TRUE;
/* Continue at next node at linked list */
ptrNextNode = ptrNextNode->ptrNext;
dwCount ++;
-
+
/* Grab statistics */
if (wfdFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
/* Terminate list */
ptrNextNode->ptrNext = NULL;
- /* Calculate and allocate space need for making an array of pointers */
+ /* Calculate and allocate space need for making an array of pointers */
ptrFileArray = malloc(sizeof(LPWIN32_FIND_DATA) * dwCount);
if (ptrFileArray == NULL)
{
/* Print Data */
DirPrintFiles(ptrFileArray, dwCount, szFullPath, lpFlags);
-
+
/* Free array */
free(ptrFileArray);
* pushd command
*/
INT CommandPushd (LPTSTR first, LPTSTR rest)
-{
+{
TCHAR curPath[MAX_PATH];
TCHAR newPath[MAX_PATH];
BOOL bChangePath = FALSE;
if (!_tcsncmp (rest, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_DIRSTACK_HELP1);
return 0;
}
TCHAR szPath[MAX_PATH];
if (!_tcsncmp(rest, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_DIRSTACK_HELP2);
return 0;
}
* dirs command
*/
INT CommandDirs (LPTSTR first, LPTSTR rest)
-{
+{
LPDIRENTRY lpDir;
if (!_tcsncmp(rest, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_DIRSTACK_HELP3);
return 0;
}
lpDir = lpStackBottom;
if (lpDir == NULL)
- {
+ {
ConOutResPuts(STRING_DIRSTACK_HELP4);
return 0;
}
* Implemented 'echo.' and 'echoerr.'.
*
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
#endif
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_ECHO_HELP4);
return 0;
}
#endif
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_ECHO_HELP1);
return 0;
}
#endif
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_ECHO_HELP2);
return 0;
}
#endif
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_ECHO_HELP3);
return 0;
}
* Use FormatMessage() for error reports.
*
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
VOID error_path_not_found (VOID)
-{
+{
ConErrResPuts(STRING_ERROR_PATH_NOT_FOUND);
}
VOID error_file_not_found (VOID)
-{
+{
ConErrResPuts(STRING_ERROR_FILE_NOT_FOUND);
}
VOID error_req_param_missing (VOID)
-{
+{
ConErrResPuts(STRING_ERROR_REQ_PARAM_MISSING);
}
VOID error_bad_command (VOID)
{
- ConErrResPuts(STRING_ERROR_BADCOMMAND);
+ ConErrResPuts(STRING_ERROR_BADCOMMAND);
}
VOID error_no_pipe (VOID)
{
- ConErrResPuts(STRING_ERROR_CANNOTPIPE);
+ ConErrResPuts(STRING_ERROR_CANNOTPIPE);
}
VOID error_out_of_memory (VOID)
{
- ConErrResPuts(STRING_ERROR_OUT_OF_MEMORY);
+ ConErrResPuts(STRING_ERROR_OUT_OF_MEMORY);
}
VOID error_invalid_parameter_format (LPTSTR s)
{
- ConErrResPuts(STRING_ERROR_INVALID_PARAM_FORMAT);
+ ConErrResPuts(STRING_ERROR_INVALID_PARAM_FORMAT);
}
VOID msg_pause (VOID)
{
- ConOutResPuts(STRING_ERROR_D_PAUSEMSG);
+ ConOutResPuts(STRING_ERROR_D_PAUSEMSG);
}
/* EOF */
*
* 01-Sep-1999 (Eric Kohl)
* Added help text.
- *
+ *
* 23-Feb-2001 (Carl Nettelblad <cnettel@hem.passagen.se>)
* Implemented preservation of echo flag. Some other for related
* code in other files fixed, too.
*
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
#endif
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_FOR_HELP1);
return 0;
}
* Started.
*
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
if (szVolume[0] == _T('\0'))
{
-
+
LoadString(CMD_ModuleHandle, STRING_FREE_ERROR2, szMsg, RC_STRING_MAX_SIZE);
_tcscpy (szVolume, szMsg);
}
uliSize.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl;
ConvertULargeInteger (uliSize, szFree, 40);
-
+
LoadString(CMD_ModuleHandle, STRING_FREE_HELP1, szMsg, RC_STRING_MAX_SIZE);
ConOutPrintf(szMsg, szDrive, szVolume, szSerial, szTotal, szUsed, szFree);
}
INT CommandFree (LPTSTR cmd, LPTSTR param)
-{
+{
LPTSTR szParam;
TCHAR szDefPath[MAX_PATH];
INT argc, i;
LPTSTR *arg;
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_FREE_HELP2);
return 0;
}
* Added help text ("/?").
*
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
* 06/12/99 (Paolo Pantaleo <paolopan@freemail.it>)
* started.
*
- */
+ */
#include "precomp.h"
/*set links in prev and next item*/
item->next->prev=item->prev;
- item->prev->next=item->next;
+ item->prev->next=item->next;
free(item);
static
VOID add_at_bottom(LPTSTR string)
-{
+{
LPHIST_ENTRY tmp;
-
+
/*delete first entry if maximum number of entries is reached*/
while(size>=max_size)
del(Top->prev);
if (*string==_T('\0'))
return;
-
-
+
+
/*if new entry is the same than the last do not add it*/
if(size)
if(_tcscmp(string,Bottom->next->string)==0)
return;
-
- /*fill bottom with string, it will become Bottom->next*/
+
+ /*fill bottom with string, it will become Bottom->next*/
Bottom->string=malloc((_tcslen(string)+1)*sizeof(TCHAR));
- _tcscpy(Bottom->string,string);
-
+ _tcscpy(Bottom->string,string);
+
/*save Bottom value*/
tmp=Bottom;
/*create new void Bottom*/
- Bottom=malloc(sizeof(HIST_ENTRY));
+ Bottom=malloc(sizeof(HIST_ENTRY));
Bottom->next=tmp;
Bottom->prev=NULL;
Bottom->string=NULL;
VOID History (INT dir, LPTSTR commandline)
{
-
+
if(dir==0)
{
add_at_bottom(commandline);
{
if (curr_ptr->next==Top || curr_ptr==Top)
{
-#ifdef WRAP_HISTORY
- curr_ptr=Bottom;
-#else
+#ifdef WRAP_HISTORY
+ curr_ptr=Bottom;
+#else
curr_ptr=Top;
commandline[0]=_T('\0');
return;
#endif
}
-
+
curr_ptr = curr_ptr->next;
if(curr_ptr->string)
_tcscpy(commandline,curr_ptr->string);
}
-
-
+
+
if (curr_ptr->prev==Bottom || curr_ptr==Bottom)
{
-#ifdef WRAP_HISTORY
+#ifdef WRAP_HISTORY
curr_ptr=Top;
#else
curr_ptr=Bottom;
return;
#endif
}
-
- curr_ptr=curr_ptr->prev;
+
+ curr_ptr=curr_ptr->prev;
if(curr_ptr->string)
- _tcscpy(commandline,curr_ptr->string);
-
+ _tcscpy(commandline,curr_ptr->string);
+
}
}
LPTSTR history = NULL; /*buffer to sotre all the lines*/
LPTSTR lines[MAXLINES]; /*array of pointers to each line(entry)*/
/*located in history buffer*/
-
+
INT curline = 0; /*the last line recalled by user*/
INT numlines = 0; /*number of entries, included the last*/
/*empty one*/
VOID History (INT dir, LPTSTR commandline)
{
-
+
INT count; /*used in for loops*/
INT length; /*used in the same loops of count*/
/*both to make room when is full
/*copy entry in the history bufer*/
_tcscpy (lines[numlines], commandline);
numlines++;
-
+
/*set last lines[numlines] pointer next the end of last, valid,
just setted entry (the two lines above)*/
lines[numlines] = lines[numlines - 1] + _tcslen (commandline) + 1;
* IF DEFINED variable command
*
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*
*/
#endif
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_IF_HELP1);
return 0;
}
*pp++ = _T('\0');
ValueSize = GetEnvironmentVariable(param, Value, sizeof Value);
x_flag ^= (0 == ValueSize)
- ? 0
+ ? 0
: X_EXEC;
x_flag |= X_EMPTY;
}
* Improved chdir/cd command.
*
* 02-Apr-2004 (Magnus Olsen <magnus@greatlord.com>)
- * Remove all hard code string so they can be
+ * Remove all hard code string so they can be
* translate to other langues.
*/
*
*/
INT cmd_chdir (LPTSTR cmd, LPTSTR param)
-{
+{
LPTSTR dir; /* pointer to the directory to change to */
LPTSTR lpOldPath;
LPTSTR endofstring; /* pointer to the null character in the directory to change to */
but on the other hand paths are generally not very long*/
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_CD_HELP);
return 0;
}
{
//ErrorMessage (GetLastError(), _T("CD"));
ConOutFormatMessage(GetLastError());
-
+
/* throw away current directory */
free (lpOldPath);
lpOldPath = NULL;
INT argc;
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_MKDIR_HELP);
return 0;
}
}
if (!dir)
- {
+ {
ConErrResPuts (STRING_ERROR_REQ_PARAM_MISSING);
return 1;
}
*
*/
INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
-{
+{
LPTSTR dir; /* pointer to the directory to change to */
LPTSTR place; /* used to search for the \ when no space is used */
INT argc;
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_RMDIR_HELP);
return 0;
}
}
if (!dir)
- {
+ {
ConErrResPuts(STRING_ERROR_REQ_PARAM_MISSING);
return 1;
}
INT CommandExit (LPTSTR cmd, LPTSTR param)
{
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_EXIT_HELP);
return 0;
}
INT CommandRem (LPTSTR cmd, LPTSTR param)
{
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_REM_HELP);
}
* Unicode ready!
*
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
/* print help */
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_LABEL_HELP1);
return 0;
}
GetVolumeInformation(szRootPath, szOldLabel, 80, &dwSerialNr,
NULL, NULL, NULL, 0);
- /* print drive info */
+ /* print drive info */
if (szOldLabel[0] != _T('\0'))
{
LoadString(CMD_ModuleHandle, STRING_LABEL_HELP2, szMsg, RC_STRING_MAX_SIZE);
* Started.
*
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
TCHAR szAvailVirtual[20];
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_MEMMORY_HELP1);
return 0;
}
* Added PagePrompt() and FilePrompt().
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
INT PagePrompt (VOID)
-{
+{
INPUT_RECORD ir;
-
+
ConOutResPuts(STRING_MISC_HELP1);
RemoveBreakHandler ();
* Added "/N" option.
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
" /Y\n"
" /-Y\n"
"..."));
-#else
+#else
ConOutResPuts(STRING_MOVE_HELP2);
#endif
return 0;
* started - Paolo Pantaleo <paolopan@freemail.it>
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
INT CommandMsgbox (LPTSTR cmd, LPTSTR param)
{
-
+
//used to parse command line
LPTSTR tmp;
title = buff;
if (_tcsncmp (param, _T("/?"), 2) == 0)
- {
+ {
ConOutResPuts(STRING_MSGBOX_HELP);
return 0;
}
* Fixed Win32 environment handling.
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
#include "resource.h"
INT cmd_path (LPTSTR cmd, LPTSTR param)
-{
+{
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_PATH_HELP1);
return 0;
}
if (dwBuffer == 0)
{
LoadString(CMD_ModuleHandle, STRING_VOL_HELP2, szMsg, RC_STRING_MAX_SIZE);
- ConOutPrintf(szMsg, _T("PATH"));
+ ConOutPrintf(szMsg, _T("PATH"));
return 0;
}
else if (dwBuffer > ENV_BUFFER_SIZE)
* specified.
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
INT cmd_pause (LPTSTR cmd, LPTSTR param)
-{
+{
#ifdef _DEBUG
DebugPrintf (_T("cmd_pause: \'%s\' : \'%s\')\n"), cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_PAUSE_HELP1);
return 0;
}
* Fixed Win32 environment handling.
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
#include "resource.h"
INT cmd_prompt (LPTSTR cmd, LPTSTR param)
{
-
+
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_PROMPT_HELP1);
-#ifdef FEATURE_DIRECTORY_STACK
+#ifdef FEATURE_DIRECTORY_STACK
ConOutResPuts(STRING_PROMPT_HELP2);
-#endif
+#endif
ConOutResPuts(STRING_PROMPT_HELP3);
return 0;
}
* Implemented basic rename code.
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
WIN32_FIND_DATA f;
if (!_tcsncmp(param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_REN_HELP1);
return 0;
}
* started - Paolo Pantaleo <paolopan@freemail.it>
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*
*/
INT CommandScreen (LPTSTR cmd, LPTSTR param)
-{
+{
SHORT x,y;
BOOL bSkipText = FALSE;
if (_tcsncmp (param, _T("/?"), 2) == 0)
- {
+ {
ConOutResPuts(STRING_SCREEN_HELP);
return 0;
}
* Fixed little bug.
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
INT cmd_set (LPTSTR cmd, LPTSTR param)
-{
+{
TCHAR szMsg[RC_STRING_MAX_SIZE];
LPTSTR p;
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_SET_HELP);
return 0;
}
*
* FREEDOS extension : optional parameter DOWN to allow shifting
* parameters backwards.
- *
+ *
*/
INT cmd_shift (LPTSTR cmd, LPTSTR param)
#endif
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_SHIFT_HELP);
return 0;
}
* Started.
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
TCHAR *param;
if (_tcsncmp (rest, _T("/?"), 2) == 0)
- {
+ {
ConOutResPuts(STRING_START_HELP1);
return 0;
}
#ifdef _DEBUG
DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest);
#endif
-
+
ConErrResPuts(STRING_START_ERROR1);
}
else
stui.cb = sizeof (STARTUPINFO);
stui.dwFlags = STARTF_USESHOWWINDOW;
stui.wShowWindow = SW_SHOWDEFAULT;
-
+
if (CreateProcess (szFullName, szFullCmdLine, NULL, NULL, FALSE,
CREATE_NEW_CONSOLE, NULL, NULL, &stui, &prci))
{
{_T("whi") ,_R|_G|_B },
{_T("gra") ,_I },
-
+
{_T("0") ,0 },
{_T("2") ,_G },
{_T("3") ,_B|_G },
{_T("14") ,_I|_R|_G },
{_T("15") ,_I|_R|_G|_B },
-
+
/* note that 1 is at the end of list
to avoid to confuse it with 10-15*/
{_T("1") ,_B },
/*magenta synonimous*/
{_T("pur") ,_B|_R },
-
+
{_T("") ,0},
};
static
INT chop_blank(LPTSTR *arg_str)
{
-
+
LPTSTR str;
str = _tcschr(*arg_str,_T(' '));
if(!str)
return CP_BLANK_NOT_FOUND;
}
-
+
while(_istspace(*str))
str++;
*arg_str = str;
- return CP_OK;
+ return CP_OK;
}
/*
read a color value in hex (like win nt's cmd syntax)
-if an error occurs return -1
-*/
+if an error occurs return -1
+*/
static
WORD hex_clr(LPTSTR str)
{
WORD ret= (WORD)-1;
TCHAR ch;
-
+
ch = str[1];
-
+
if(_istdigit(ch))
ret = ch-_T('0');
else
- {
+ {
ch=_totupper(ch);
if( ch >= _T('A') && ch <= _T('F') )
return (WORD)-1;
}
-
+
ch = str[0];
-
+
if(_istdigit(ch))
ret |= (ch-_T('0')) << 4;
else
- {
+ {
ch=_totupper(ch);
if( ch >= _T('A') && ch <= _T('F') )
/*
read a color value from a string (like 4nt's syntax)
-if an error occurs return -1
+if an error occurs return -1
*/
static
WORD txt_clr(LPTSTR str)
-/*search for x on y*/
+/*search for x on y*/
static
WORD str_to_color(LPTSTR* arg_str)
{
if(chop_blank(&str))
return (WORD)-1;
}
-
-
+
+
if( (tmp_clr = txt_clr(str)) == (WORD)-1 )
return (WORD)-1;
chop_blank(&str);
-
+
*arg_str = str;
return SC_HEX | ret_clr | tmp_clr << 4 | bBri << 7;
INT cmd_time (LPTSTR cmd, LPTSTR param)
-{
+{
LPTSTR *arg;
INT argc;
INT i;
INT nTimeString = -1;
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_TIME_HELP1);
return 0;
}
if (nTimeString == -1)
{
TCHAR s[40];
-
+
ConOutResPuts(STRING_TIME_HELP2);
ConInString (s, 40);
/* force input the next time around. */
nTimeString = -1;
}
-
+
ConErrResPuts(STRING_TIME_ERROR1);
}
//print timer value
#define PT(format) PrintElapsedTime(GetTickCount()-cT,format)
-
+
//current timer Time (at wich started to count)
#define cT clksT[clk_n]
#ifdef _DEBUG
DebugPrintf(_T("PrintTime(%d,%d)"),time,format);
#endif
-
+
switch (format)
{
case 0:
// all timers are kept
static DWORD clksT[10];
-
+
// timers status
// set all the clocks off by default
static BOOL clksS[10]={FALSE,FALSE,FALSE,FALSE,
// TRUE if /S in command line
BOOL bS = FALSE;
-
+
// avoid to set clk_n more than once
BOOL bCanNSet = TRUE;
// output format
INT iFormat=1;
-
-
+
+
// command line parsing variables
INT argc;
LPTSTR *p;
bCanNSet = FALSE;
continue;
}
-
+
// set s(plit) option
if (_totupper(p[i][1]) == _T('S'))
{
bS = TRUE;
continue;
}
-
+
// specify format
if (_totupper(p[i][1]) == _T('F'))
{
if(bS)
{
if(cS)
- {
+ {
PS;
PrintElapsedTime(GetTickCount()-cT, iFormat);
freep(p);
* 1999-02-11 Emanuele Aliberti
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
INT cmd_title (LPTSTR cmd, LPTSTR param)
-{
+{
/* Do nothing if no args */
if (*param == _T('\0'))
/* Asking help? */
if (!_tcsncmp(param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_TITLE_HELP);
return 0;
}
* Added multiple file support (copied from y.c)
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
}
argv = split (param, &argc, TRUE);
-
+
for (i = 0; i < argc; i++)
{
if (_T('/') == argv[i][0])
if (dwRead>0 && bRet)
WriteFile(hConsoleOut,buff,dwRead,&dwWritten,NULL);
-
+
} while(dwRead>0 && bRet);
CloseHandle(hFile);
*
*/
INT cmd_ver (LPTSTR cmd, LPTSTR param)
-{
+{
INT i;
if (_tcsstr (param, _T("/?")) != NULL)
- {
+ {
ConOutResPuts(STRING_VERSION_HELP1);
return 0;
}
/* Basic copyright notice */
if (param[0] == _T('\0'))
{
- ConOutPuts(_T("\n"SHELLINFO));
+ ConOutPuts(_T("\n"SHELLINFO));
ConOutResPuts(STRING_VERSION_HELP2);
}
else
if (_totupper (param[i]) == _T('W'))
{
- /* Warranty notice */
+ /* Warranty notice */
ConOutResPuts(STRING_VERSION_HELP3);
}
else if (_totupper (param[i]) == _T('R'))
{
- /* Redistribution notice */
+ /* Redistribution notice */
ConOutResPuts(STRING_VERSION_HELP4);
}
else if (_totupper (param[i]) == _T('C'))
{
- /* Developer listing */
- ConOutResPuts(STRING_VERSION_HELP6);
- ConOutResPuts(STRING_FREEDOS_DEV);
+ /* Developer listing */
+ ConOutResPuts(STRING_VERSION_HELP6);
+ ConOutResPuts(STRING_FREEDOS_DEV);
ConOutResPuts(STRING_VERSION_HELP7);
- ConOutResPuts(STRING_REACTOS_DEV);
+ ConOutResPuts(STRING_REACTOS_DEV);
}
else
{
}
}
}
-
+
ConOutResPuts(STRING_VERSION_HELP5);
return 0;
}
* Unicode and redirection ready!
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
#include "precomp.h"
TCHAR szMsg[RC_STRING_MAX_SIZE];
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_VERIFY_HELP1);
return 0;
}
else if (_tcsicmp (param, D_ON) == 0)
bVerify = TRUE;
else
- {
+ {
ConOutResPuts(STRING_VERIFY_HELP3);
}
INT cmd_vol (LPTSTR cmd, LPTSTR param)
-{
+{
TCHAR szRootPath[] = _T("A:\\");
TCHAR szPath[MAX_PATH];
if (!_tcsncmp (param, _T("/?"), 2))
- {
+ {
ConOutResPuts(STRING_VOL_HELP4);
return 0;
}
* (nice size optimization :)
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- * Remove all hardcode string to En.rc
+ * Remove all hardcode string to En.rc
*/
HWND hwnd;
if (_tcsncmp (param, _T("/?"), 2) == 0)
- {
+ {
ConOutResPuts(STRING_WINDOW_HELP1);
return 0;
}
INT CommandActivate (LPTSTR cmd, LPTSTR param)
-{
+{
LPTSTR str;
HWND hwnd;
if (_tcsncmp (param, _T("/?"), 2) == 0)
- {
+ {
ConOutResPuts(STRING_WINDOW_HELP2);
return 0;
}
hwnd = FindWindow(NULL, param);
if (hwnd == NULL)
- {
+ {
ConErrResPuts(STRING_WINDOW_ERROR1);
return 1;
}
if( Error ) return NULL;
Error = RegQueryInfoKey
- ( MainKey,
- NULL, NULL, NULL,
- &MaxSubKeys, &MaxSubKeyLen,
+ ( MainKey,
+ NULL, NULL, NULL,
+ &MaxSubKeys, &MaxSubKeyLen,
NULL, NULL, NULL, NULL, NULL, NULL );
DH_DbgPrint(MID_TRACE,("MaxSubKeys: %d, MaxSubKeyLen %d\n",
MaxSubKeys, MaxSubKeyLen));
-
+
CharTotal = (sizeof(PCHAR) + MaxSubKeyLen + AppendLen) * (MaxSubKeys + 1);
-
- DH_DbgPrint(MID_TRACE,("AppendLen: %d, CharTotal: %d\n",
+
+ DH_DbgPrint(MID_TRACE,("AppendLen: %d, CharTotal: %d\n",
AppendLen, CharTotal));
Out = malloc( CharTotal );
OutKeyName = ((PCHAR)&Out[MaxSubKeys+1]);
-
+
if( !Out ) { RegCloseKey( MainKey ); return NULL; }
i = 0;
PCHAR SubOut = NULL;
DWORD SubOutLen = 0, Error = 0;
HKEY ValueKey = NULL;
-
+
DH_DbgPrint(MID_TRACE,("Looking in %x:%s:%s\n", Root, Subkey, Value ));
if( Subkey && strlen(Subkey) ) {
- if( RegOpenKey( Root, Subkey, &ValueKey ) != ERROR_SUCCESS )
+ if( RegOpenKey( Root, Subkey, &ValueKey ) != ERROR_SUCCESS )
goto regerror;
} else ValueKey = Root;
DH_DbgPrint(MID_TRACE,("Got Key %x\n", ValueKey));
- if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL,
+ if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL,
(LPBYTE)SubOut, &SubOutLen )) != ERROR_SUCCESS )
goto regerror;
DH_DbgPrint(MID_TRACE,("Value %s has size %d\n", Value, SubOutLen));
- if( !(SubOut = malloc(SubOutLen)) )
+ if( !(SubOut = malloc(SubOutLen)) )
goto regerror;
if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL,
HKEY FindAdapterKey( PDHCP_ADAPTER Adapter ) {
int i = 0;
- PCHAR EnumKeyName =
+ PCHAR EnumKeyName =
"SYSTEM\\CurrentControlSet\\Control\\Class\\"
"{4D36E972-E325-11CE-BFC1-08002BE10318}";
- PCHAR TargetKeyNameStart =
+ PCHAR TargetKeyNameStart =
"SYSTEM\\CurrentControlSet\\Services\\";
PCHAR TargetKeyNameEnd = "\\Parameters\\Tcpip";
PCHAR TargetKeyName = NULL;
( EnumKey, EnumKeysLinkage[i], "RootDevice" );
DriverDesc = RegReadString
( EnumKey, EnumKeysTop[i], "DriverDesc" );
-
- if( DriverDesc &&
+
+ if( DriverDesc &&
!strcmp( DriverDesc, Adapter->DhclientInfo.name ) ) {
- TargetKeyName =
- malloc( strlen( TargetKeyNameStart ) +
+ TargetKeyName =
+ malloc( strlen( TargetKeyNameStart ) +
strlen( RootDevice ) +
strlen( TargetKeyNameEnd ) + 1 );
if( !TargetKeyName ) goto cleanup;
- sprintf( TargetKeyName, "%s%s%s",
+ sprintf( TargetKeyName, "%s%s%s",
TargetKeyNameStart, RootDevice, TargetKeyNameEnd );
- Error = RegOpenKey( HKEY_LOCAL_MACHINE, TargetKeyName, &OutKey );
+ Error = RegOpenKey( HKEY_LOCAL_MACHINE, TargetKeyName, &OutKey );
break;
} else {
free( RootDevice ); RootDevice = 0;
if( IPAddress && strcmp( IPAddress, "0.0.0.0" ) ) {
/* Non-automatic case */
DH_DbgPrint
- (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (static %s)\n",
+ (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (static %s)\n",
Adapter->DhclientInfo.name,
Adapter->BindStatus,
IPAddress));
Netmask = RegReadString( AdapterKey, NULL, "Subnetmask" );
if( !Netmask ) Netmask = "255.255.255.0";
-
+
Status = AddIPAddress( inet_addr( IPAddress ),
inet_addr( Netmask ),
Adapter->IfMib.dwIndex,
DefGatewayRow.dwForwardNextHop = inet_addr(DefaultGateway);
Error = CreateIpForwardEntry( &DefGatewayRow );
if( Error )
- warning("Failed to set default gateway %s: %d\n",
+ warning("Failed to set default gateway %s: %d\n",
DefaultGateway, Error);
}
DH_DbgPrint(MID_TRACE,("Getting Adapter List...\n"));
- while( (Error = GetIfTable(Table, &Size, 0 )) ==
+ while( (Error = GetIfTable(Table, &Size, 0 )) ==
ERROR_INSUFFICIENT_BUFFER ) {
DH_DbgPrint(MID_TRACE,("Error %d, New Buffer Size: %d\n", Error, Size));
free( Table );
DH_DbgPrint(MID_TRACE,("Got Adapter List (%d entries)\n", Table->dwNumEntries));
for( i = 0; i < Table->dwNumEntries; i++ ) {
- DH_DbgPrint(MID_TRACE,("Getting adapter %d attributes\n",
+ DH_DbgPrint(MID_TRACE,("Getting adapter %d attributes\n",
Table->table[i].dwIndex));
Adapter = calloc( sizeof( DHCP_ADAPTER ) + Table->table[i].dwMtu, 1 );
-
+
if( Adapter && Table->table[i].dwType == MIB_IF_TYPE_ETHERNET ) {
- memcpy( &Adapter->IfMib, &Table->table[i],
+ memcpy( &Adapter->IfMib, &Table->table[i],
sizeof(Adapter->IfMib) );
Adapter->DhclientInfo.client = &Adapter->DhclientState;
Adapter->DhclientInfo.rbuf = Adapter->recv_buf;
Adapter->DhclientInfo.rbuf_max = Table->table[i].dwMtu;
- Adapter->DhclientInfo.rbuf_len =
+ Adapter->DhclientInfo.rbuf_len =
Adapter->DhclientInfo.rbuf_offset = 0;
memcpy(Adapter->DhclientInfo.hw_address.haddr,
Adapter->IfMib.bPhysAddr,
Adapter->IfMib.dwPhysAddrLen);
- Adapter->DhclientInfo.hw_address.hlen =
+ Adapter->DhclientInfo.hw_address.hlen =
Adapter->IfMib.dwPhysAddrLen;
if( DhcpSocket == INVALID_SOCKET ) {
- DhcpSocket =
+ DhcpSocket =
Adapter->DhclientInfo.rfdesc =
Adapter->DhclientInfo.wfdesc =
socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP );
Adapter->ListenAddr.sin_family = AF_INET;
Adapter->ListenAddr.sin_port = htons(LOCAL_PORT);
- Adapter->BindStatus =
+ Adapter->BindStatus =
(bind( Adapter->DhclientInfo.rfdesc,
(struct sockaddr *)&Adapter->ListenAddr,
sizeof(Adapter->ListenAddr) ) == 0) ?
0 : WSAGetLastError();
} else {
- Adapter->DhclientInfo.rfdesc =
+ Adapter->DhclientInfo.rfdesc =
Adapter->DhclientInfo.wfdesc = DhcpSocket;
}
-
+
Adapter->DhclientConfig.timeout = DHCP_PANIC_TIMEOUT;
Adapter->DhclientConfig.initial_interval = DHCP_DISCOVER_INTERVAL;
Adapter->DhclientConfig.retry_interval = DHCP_DISCOVER_INTERVAL;
Adapter->DhclientConfig.select_interval = 1;
Adapter->DhclientConfig.reboot_timeout = DHCP_REBOOT_TIMEOUT;
Adapter->DhclientConfig.backoff_cutoff = DHCP_BACKOFF_MAX;
- Adapter->DhclientState.interval =
+ Adapter->DhclientState.interval =
Adapter->DhclientConfig.retry_interval;
-
+
if( PrepareAdapterForService( Adapter ) ) {
Adapter->DhclientInfo.next = ifi;
ifi = &Adapter->DhclientInfo;
}
}
-PDHCP_ADAPTER AdapterGetNext( PDHCP_ADAPTER This )
-{
+PDHCP_ADAPTER AdapterGetNext( PDHCP_ADAPTER This )
+{
if( This->ListEntry.Flink == &AdapterList ) return NULL;
return CONTAINING_RECORD
( This->ListEntry.Flink, DHCP_ADAPTER, ListEntry );
}
void if_register_send(struct interface_info *ip) {
-
+
}
void if_register_receive(struct interface_info *ip) {
Reply.Reply = Adapter ? 1 : 0;
if( Adapter ) {
- add_protocol( Adapter->DhclientInfo.name,
- Adapter->DhclientInfo.rfdesc, got_one,
+ add_protocol( Adapter->DhclientInfo.name,
+ Adapter->DhclientInfo.rfdesc, got_one,
&Adapter->DhclientInfo );
Adapter->DhclientInfo.client->state = S_INIT;
state_reboot(&Adapter->DhclientInfo);
HKEY RegKey;
struct iaddr nameserver;
char *nsbuf;
- int i, addrs =
+ int i, addrs =
new_lease->options[DHO_DOMAIN_NAME_SERVERS].len / sizeof(ULONG);
/* XXX I'm setting addrs to 1 until we are ready up the chain */
addrs = 1;
nsbuf = malloc( addrs * sizeof(IP_ADDRESS_STRING) );
nsbuf[0] = 0;
-
+
if( nsbuf && !RegOpenKeyEx
- ( HKEY_LOCAL_MACHINE,
- "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
+ ( HKEY_LOCAL_MACHINE,
+ "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
0, KEY_WRITE, &RegKey ) ) {
for( i = 0; i < addrs; i++ ) {
nameserver.len = sizeof(ULONG);
- memcpy( nameserver.iabuf,
- new_lease->options[DHO_DOMAIN_NAME_SERVERS].data +
+ memcpy( nameserver.iabuf,
+ new_lease->options[DHO_DOMAIN_NAME_SERVERS].data +
(i * sizeof(ULONG)), sizeof(ULONG) );
strcat( nsbuf, piaddr(nameserver) );
if( i != addrs-1 ) strcat( nsbuf, "," );
*/
RegSetValueEx( RegKey, "NameServer", 0, REG_SZ,
(LPBYTE)nsbuf, strlen(nsbuf) + 1 );
-
+
free( nsbuf );
}
}
if( Adapter->NteContext )
DeleteIPAddress( Adapter->NteContext );
-
+
/* Set up our default router if we got one from the DHCP server */
if( new_lease->options[DHO_SUBNET_MASK].len ) {
NTSTATUS Status;
memcpy( netmask.iabuf,
new_lease->options[DHO_SUBNET_MASK].data,
new_lease->options[DHO_SUBNET_MASK].len );
-
+
Status = AddIPAddress
( *((ULONG*)new_lease->address.iabuf),
*((ULONG*)netmask.iabuf),
Adapter->IfMib.dwIndex,
&Adapter->NteContext,
&Adapter->NteInstance );
-
+
if( !NT_SUCCESS(Status) )
warning("AddIPAddress: %x\n", Status);
- }
-
+ }
+
if( new_lease->options[DHO_ROUTERS].len ) {
MIB_IPFORWARDROW RouterMib;
NTSTATUS Status;
-
+
RouterMib.dwForwardDest = 0; /* Default route */
RouterMib.dwForwardMask = 0;
RouterMib.dwForwardMetric1 = 1;
-
+
if( old_default_route ) {
/* If we set a default route before, delete it before continuing */
RouterMib.dwForwardDest = old_default_route;
DeleteIpForwardEntry( &RouterMib );
}
-
- RouterMib.dwForwardNextHop =
+
+ RouterMib.dwForwardNextHop =
*((ULONG*)new_lease->options[DHO_ROUTERS].data);
-
+
Status = CreateIpForwardEntry( &RouterMib );
-
- if( !NT_SUCCESS(Status) )
+
+ if( !NT_SUCCESS(Status) )
warning("CreateIpForwardEntry: %x\n", Status);
else
old_default_route = RouterMib.dwForwardNextHop;
/* Timeout of zero means no timeout (some implementations seem to use
* one day).
*/
- if( ip->client->active->renewal - cur_time )
+ if( ip->client->active->renewal - cur_time )
add_timeout(ip->client->active->renewal, state_bound, ip);
note("bound to %s -- renewal in %d seconds.",
ip->client->active->renewal - cur_time);
ip->client->state = S_BOUND;
-
+
Adapter = AdapterFindInfo( ip );
if( Adapter ) setup_adapter( Adapter, new_lease );
/* Now do a preinit on the interface so that we can
discover a new address. */
- if( Adapter )
+ if( Adapter )
DeleteIPAddress( Adapter->NteContext );
-
+
ip->client->state = S_INIT;
state_init(ip);
return;
struct interface_info *ip = ifi;
if (ip) {
- // XXX Do we need to do anything?
+ // XXX Do we need to do anything?
}
}
char *tmp;
struct in_addr jnk;
int i = 0;
-
+
note("Input: %s\n", buf);
do {
/* $Id:$
- *
+ *
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Service
* FILE: subsys/system/dhcp
while( GetMessage( &msg, 0, 0, 0 ) ) {
switch( msg.message ) {
case DHCP_MANAGEADAPTER:
-
+
break;
case DHCP_UNMANAGEADAPTER:
break;
-
+
case DHCP_REQUESTPARAM:
break;
if (ip && (l->handler != got_one || !ip->dead)) {
DH_DbgPrint
(MID_TRACE,
- ("set(%d) -> %s\n",
+ ("set(%d) -> %s\n",
l->fd, FD_ISSET(l->fd, &fds) ? "true" : "false"));
i++;
}
/* Get the current time... */
time(&cur_time);
-
+
i = 0;
for (l = protocols; l; l = l->next) {
struct interface_info *ip;
}
struct protocol *
-find_protocol_by_adapter(struct interface_info *info)
+find_protocol_by_adapter(struct interface_info *info)
{
struct protocol *p;
if (!tree_evaluate (hd -> group -> options
[DHO_DHCP_CLIENT_IDENTIFIER]))
return;
-
+
/* If there's no uid hash, make one; otherwise, see if
there's already an entry in the hash for this host. */
if (!host_uid_hash) {
the addr pointer, update the host pointer to point at the host_decl
that matched, and return the subnet that matched. */
-subnet *find_host_for_network (struct host_decl **host, iaddr *addr,
+subnet *find_host_for_network (struct host_decl **host, iaddr *addr,
shared_network *share)
{
int i;
first. */
if (subnet_inner_than (subnet, scan, 1)) {
if (prev) {
- prev -> next_subnet = subnet;
+ prev -> next_subnet = subnet;
} else
subnets = subnet;
subnet -> next_subnet = scan;
subnet -> next_subnet = subnets;
subnets = subnet;
}
-
+
/* Enter a new shared network into the shared network list. */
void enter_shared_network (shared_network *share)
share -> next = shared_networks;
shared_networks = share;
}
-
+
/* Enter a lease into the system. This is called by the parser each
time it reads in a new lease. If the subnet for that lease has
already been read in (usually the case), just update that lease;
hw_hash_add (comp);
}
- /* Remove the lease from its current place in the
+ /* Remove the lease from its current place in the
timeout sequence. */
if (comp -> prev) {
comp -> prev -> next = comp -> next;
lease *find_lease_by_hw_addr (unsigned char *hwaddr, int hwlen)
{
- struct _lease *lease =
+ struct _lease *lease =
(struct _lease *)hash_lookup (lease_hw_addr_hash,
hwaddr, hwlen);
return lease;
void uid_hash_delete (lease *lease)
{
- struct _lease *head =
+ struct _lease *head =
find_lease_by_uid (lease -> uid, lease -> uid_len);
struct _lease *scan;
? user_class_hash
: vendor_class_hash, name, len);
return class;
-}
+}
struct group *clone_group (group, caller)
struct group *group;
DWORD PipeSend( COMM_DHCP_REPLY *Reply ) {
DWORD Written = 0;
- BOOL Success =
+ BOOL Success =
WriteFile( CommPipe,
Reply,
sizeof(*Reply),
case DhcpReqQueryHWInfo:
BytesWritten = DSQueryHWInfo( PipeSend, &Req );
break;
-
+
case DhcpReqLeaseIpAddress:
BytesWritten = DSLeaseIpAddress( PipeSend, &Req );
break;
-
+
case DhcpReqReleaseIpAddress:
BytesWritten = DSReleaseIpAddressLease( PipeSend, &Req );
break;
-
+
case DhcpReqRenewIpAddress:
BytesWritten = DSRenewIpAddressLease( PipeSend, &Req );
break;
ServerSocket = socket( AF_INET, SOCK_DGRAM, 0 );
}
-ssize_t send_packet( struct interface_info *ip,
+ssize_t send_packet( struct interface_info *ip,
struct dhcp_packet *p,
size_t size,
struct in_addr addr,
struct sockaddr_in *broadcast,
struct hardware *hardware ) {
- int result =
+ int result =
sendto( ip->wfdesc, (char *)p, size, 0,
(struct sockaddr *)broadcast, sizeof(*broadcast) );
-
+
if (result < 0) {
note ("send_packet: %x", result);
if (result == WSAENETUNREACH)
return result;
}
-ssize_t receive_packet(struct interface_info *ip,
+ssize_t receive_packet(struct interface_info *ip,
unsigned char *packet_data,
size_t packet_len,
- struct sockaddr_in *dest,
+ struct sockaddr_in *dest,
struct hardware *hardware ) {
int recv_addr_size = sizeof(*dest);
- int result =
+ int result =
recvfrom (ip -> rfdesc, (char *)packet_data, packet_len, 0,
(struct sockaddr *)dest, &recv_addr_size );
return result;
free_tree (right, "tree_concat");
return left;
}
-
+
/* Otherwise, allocate a new node to concatenate the two. */
if (!(nt = new_tree ("tree_concat")))
error ("No memory for data tree concatenation node.");
/* Count the number of addresses we got... */
for (i = 0; h -> h_addr_list [i]; i++)
;
-
+
/* Do we need to allocate more memory? */
new_len = i * h -> h_length;
if (dns -> buf_len < i) {
int ret;
ret = vsnprintf( buf, sizeof(buf), format, arg_begin );
-
+
DbgPrint("NOTE: %s\n", buf);
return ret;
int ret;
ret = vsnprintf( buf, sizeof(buf), format, arg_begin );
-
+
DbgPrint("DEBUG: %s\n", buf);
return ret;
-}
+}
int warn( char *format, ... ) {
va_list arg_begin;
int ret;
ret = vsnprintf( buf, sizeof(buf), format, arg_begin );
-
+
DbgPrint("WARN: %s\n", buf);
return ret;
-}
+}
int warning( char *format, ... ) {
va_list arg_begin;
int ret;
ret = vsnprintf( buf, sizeof(buf), format, arg_begin );
-
+
DbgPrint("WARNING: %s\n", buf);
return ret;
char buf[0x100];
vsnprintf( buf, sizeof(buf), format, arg_begin );
-
+
DbgPrint("ERROR: %s\n", buf);
-}
+}
int16_t getShort( unsigned char *data ) {
return (int16_t) ntohs(*(int16_t*) data);
#define IDC_STATIC -1
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 169
*ptr++ = hexchars[sigval >> 4];
*ptr++ = hexchars[sigval & 0xf];
- *ptr++ = hexchars[ESP];
+ *ptr++ = hexchars[ESP];
*ptr++ = ':';
ptr = mem2hex((char *)®isters[ESP], ptr, 4, 0); /* SP */
*ptr++ = ';';
- *ptr++ = hexchars[EBP];
+ *ptr++ = hexchars[EBP];
*ptr++ = ':';
ptr = mem2hex((char *)®isters[EBP], ptr, 4, 0); /* FP */
*ptr++ = ';';
- *ptr++ = hexchars[PC];
+ *ptr++ = hexchars[PC];
*ptr++ = ':';
ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); /* PC */
*ptr++ = ';';
#define COLUMNS 12
int _widths[COLUMNS];
int _positions[COLUMNS+1];
-
+
WindowHandle _hwndHeader;
Entry* _root;
_callback->WindowSetWidth(Variant(pDispParams->rgvarg[0]));
break;
- case DISPID_WINDOWSETHEIGHT: // sent when the put_height method is called on the WebOC
+ case DISPID_WINDOWSETHEIGHT: // sent when the put_height method is called on the WebOC
if (pDispParams->cArgs != 1)
return E_INVALIDARG;
_callback->WindowSetHeight(Variant(pDispParams->rgvarg[0]));
/// quick launch bar shortcut
struct QuickLaunchEntry
-{
+{
QuickLaunchEntry();
HBITMAP _hbmp;
/// internal task bar button management entry
struct TaskBarEntry
-{
+{
TaskBarEntry();
int _id; // ID for WM_COMMAND
virtual ~IDropTargetImpl();
void AddSuportedFormat(FORMATETC& ftetc) {m_formatetc.push_back(ftetc);}
-
+
//return values: true - release the medium. false - don't release the medium
virtual bool OnDrop(FORMATETC* pFmtEtc, STGMEDIUM& medium, DWORD *pdwEffect) = 0;
}
HRESULT InitializeFromWindow(HWND hwnd, POINT& pt,IDataObject* pDataObject)
- {
+ {
if (pDragSourceHelper == NULL)
return E_FAIL;
return pDragSourceHelper->InitializeFromWindow(hwnd, &pt, pDataObject);
//
// Explorer clone
- //
+ //
// shellclasses.h
//
// C++ wrapper classes for COM interfaces and shell objects
_p = (ITEMIDLIST*) _malloc->Alloc(l);
if (_p) memcpy(_p, pidl, l);
} else
- _p = NULL;
+ _p = NULL;
_malloc->Free(h);
}
prect->bottom = wp.rcNormalPosition.bottom-wp.rcNormalPosition.top-
2*(GetSystemMetrics(SM_CYSIZEFRAME)+GetSystemMetrics(SM_CYEDGE))-
GetSystemMetrics(SM_CYCAPTION)-GetSystemMetrics(SM_CYMENUSIZE);
- }
+ }
}
protected:
#define PM_DISPATCH_DRAWITEM (WM_APP+0x09)
- /// draw message routing for ColorButton and PictureButton
+ /// draw message routing for ColorButton and PictureButton
template<typename BASE> struct OwnerDrawParent : public BASE
{
typedef BASE super;
void PrintWin32Error( PWCHAR Message, DWORD ErrorCode )
{
LPWSTR lpMsgBuf;
-
+
FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- NULL, ErrorCode,
+ NULL, ErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(PWCHAR) &lpMsgBuf, 0, NULL );
printf("%S: %S\n", Message, lpMsgBuf );
//----------------------------------------------------------------------
-//
+//
// Usage
//
// Tell the user how to use the program
printf(" -V:label Specifies volume label.\n");
printf(" -Q Performs a quick format.\n");
printf(" -A:size Overrides the default allocation unit size. Default settings\n");
- printf(" are strongly recommended for general use\n");
+ printf(" are strongly recommended for general use\n");
printf(" NTFS supports 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K.\n");
printf(" FAT supports 8192, 16K, 32K, 64K, 128K, 256K.\n");
printf(" NTFS compression is not supported for allocation unit sizes\n");
} else if( !wcsnicmp( &argv[i][1], L"A:", 2 )) {
if( gotSize ) return -1;
- j = 0;
+ j = 0;
while( LegalSizes[j].ClusterSize &&
wcsicmp( LegalSizes[j].SizeString, &argv[i][3] )) j++;
PTEXTOUTPUT output;
PBOOLEAN status;
- //
+ //
// We get other types of commands, but we don't have to pay attention to them
//
switch( Command ) {
}
//----------------------------------------------------------------------
-//
+//
// WMain
//
-// Engine. Just get command line switches and fire off a format. This
-// could also be done in a GUI like Explorer does when you select a
+// Engine. Just get command line switches and fire off a format. This
+// could also be done in a GUI like Explorer does when you select a
// drive and run a check on it.
//
// We do this in UNICODE because the chkdsk command expects PWCHAR
return -1;
}
- //
+ //
// Get the drive's format
//
if( !Drive ) {
//
// Determine the drive's file system format
//
- if( !GetVolumeInformationW( RootDirectory,
- volumeName, sizeof(volumeName)/2,
- &serialNumber, &maxComponent, &flags,
+ if( !GetVolumeInformationW( RootDirectory,
+ volumeName, sizeof(volumeName)/2,
+ &serialNumber, &maxComponent, &flags,
fileSystem, sizeof(fileSystem)/2)) {
PrintWin32Error( L"Could not query volume", GetLastError());
return -1;
}
- if( !GetDiskFreeSpaceExW( RootDirectory,
+ if( !GetDiskFreeSpaceExW( RootDirectory,
&freeBytesAvailableToCaller,
&totalNumberOfBytes,
&totalNumberOfFreeBytes )) {
printf("Enter current volume label for drive %C: ", RootDirectory[0] );
fgetws( input, sizeof(input)/2, stdin );
input[ wcslen( input ) - 1] = 0;
-
+
if( !wcsicmp( input, volumeName )) {
break;
printf("DRIVE %C: WILL BE LOST!\n", RootDirectory[0] );
printf("Proceed with Format (Y/N)? " );
fgetws( input, sizeof(input)/2, stdin );
-
+
if( input[0] == L'Y' || input[0] == L'y' ) break;
if( input[0] == L'N' || input[0] == L'n' ) {
-
+
printf("\n");
return 0;
}
}
media = FMIFS_HARDDISK;
- }
+ }
//
// Tell the user we're doing a long format if appropriate
//
if( !QuickFormat ) {
-
+
if( totalNumberOfBytes.QuadPart > 1024*1024*10 ) {
-
+
printf("Verifying %luM\n", (DWORD) (totalNumberOfBytes.QuadPart/(1024*1024)));
-
+
} else {
- printf("Verifying %.1fM\n",
+ printf("Verifying %.1fM\n",
((float)(LONGLONG)totalNumberOfBytes.QuadPart)/(float)(1024.0*1024.0));
}
} else {
if( totalNumberOfBytes.QuadPart > 1024*1024*10 ) {
-
+
printf("QuickFormatting %luM\n", (DWORD) (totalNumberOfBytes.QuadPart/(1024*1024)));
-
+
} else {
- printf("QuickFormatting %.2fM\n",
+ printf("QuickFormatting %.2fM\n",
((float)(LONGLONG)totalNumberOfBytes.QuadPart)/(float)(1024.0*1024.0));
}
printf("Creating file system structures.\n");
//
// Format away!
- //
+ //
FormatEx( RootDirectory, media, Format, Label, QuickFormat,
ClusterSize, FormatExCallback );
if( Error ) return -1;
PrintWin32Error(L"Could not label volume", GetLastError());
return -1;
- }
+ }
}
- if( !GetVolumeInformationW( RootDirectory,
- volumeName, sizeof(volumeName)/2,
- &serialNumber, &maxComponent, &flags,
+ if( !GetVolumeInformationW( RootDirectory,
+ volumeName, sizeof(volumeName)/2,
+ &serialNumber, &maxComponent, &flags,
fileSystem, sizeof(fileSystem)/2)) {
PrintWin32Error( L"Could not query volume", GetLastError());
return -1;
}
- //
+ //
// Print out some stuff including the formatted size
//
- if( !GetDiskFreeSpaceExW( RootDirectory,
+ if( !GetDiskFreeSpaceExW( RootDirectory,
&freeBytesAvailableToCaller,
&totalNumberOfBytes,
&totalNumberOfFreeBytes )) {
//
// Get the drive's serial number
//
- if( !GetVolumeInformationW( RootDirectory,
- volumeName, sizeof(volumeName)/2,
- &serialNumber, &maxComponent, &flags,
+ if( !GetVolumeInformationW( RootDirectory,
+ volumeName, sizeof(volumeName)/2,
+ &serialNumber, &maxComponent, &flags,
fileSystem, sizeof(fileSystem)/2)) {
PrintWin32Error( L"Could not query volume", GetLastError());
}
printf("\nVolume Serial Number is %04X-%04X\n", (unsigned int)(serialNumber >> 16),
(unsigned int)(serialNumber & 0xFFFF) );
-
+
return 0;
}
prect->bottom = wp.rcNormalPosition.bottom-wp.rcNormalPosition.top-
2*(GetSystemMetrics(SM_CYSIZEFRAME)+GetSystemMetrics(SM_CYEDGE))-
GetSystemMetrics(SM_CYCAPTION)-GetSystemMetrics(SM_CYMENUSIZE);
- }
+ }
}
protected:
#define PM_DISPATCH_DRAWITEM (WM_APP+0x09)
- /// draw message routing for ColorButton and PictureButton
+ /// draw message routing for ColorButton and PictureButton
template<typename BASE> struct OwnerDrawParent : public BASE
{
typedef BASE super;
_callback->WindowSetWidth(Variant(pDispParams->rgvarg[0]));
break;
- case DISPID_WINDOWSETHEIGHT: // sent when the put_height method is called on the WebOC
+ case DISPID_WINDOWSETHEIGHT: // sent when the put_height method is called on the WebOC
if (pDispParams->cArgs != 1)
return E_INVALIDARG;
_callback->WindowSetHeight(Variant(pDispParams->rgvarg[0]));
/* $Id$
*
* reactos/subsys/system/lsass/lsass.c
- *
+ *
* ReactOS Operating System
- *
+ *
* --------------------------------------------------------------------
*
* This software is free software; you can redistribute it and/or
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING.LIB. If not, write
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
- * MA 02139, USA.
+ * MA 02139, USA.
*
* --------------------------------------------------------------------
- *
+ *
* 19990704 (Emanuele Aliberti)
* Compiled successfully with egcs 1.1.2
*/
hdrFont.lfQuality = PROOF_QUALITY;
hdrFont.lfPitchAndFamily = VARIABLE_PITCH | FF_ROMAN;
lstrcpy(hdrFont.lfFaceName, times_new_romanW);
-
+
font = CreateFontIndirect(&hdrFont);
-
+
/* Get Current Settings */
ZeroMemory(&printer, sizeof(printer));
printer.lStructSize = sizeof(printer);
printer.hwndOwner = Globals.hMainWnd;
printer.hInstance = Globals.hInstance;
-
+
/* Set some default flags */
printer.Flags = PD_RETURNDC;
printer.nFromPage = 0;
di.lpszDocName = Globals.szFileTitle;
di.lpszOutput = NULL;
di.lpszDatatype = NULL;
- di.fwType = 0;
+ di.fwType = 0;
if (StartDoc(printer.hDC, &di) <= 0) return;
-
+
/* Get the page dimensions in pixels. */
cWidthPels = GetDeviceCaps(printer.hDC, HORZRES);
cHeightPels = GetDeviceCaps(printer.hDC, VERTRES);
return;
}
size = GetWindowText(Globals.hEdit, pTemp, size);
-
+
border = 150;
for (copycount=1; copycount <= printer.nCopies; copycount++) {
i = 0;
dopage = 1;
else
dopage = 0;
-
+
old_font = SelectObject(printer.hDC, font);
GetTextExtentPoint32(printer.hDC, letterM, 1, &szMetric);
-
+
if (dopage) {
if (StartPage(printer.hDC) <= 0) {
static const WCHAR failedW[] = { 'S','t','a','r','t','P','a','g','e',' ','f','a','i','l','e','d',0 };
*/
TextOut(printer.hDC, border*2, border+szMetric.cy/2, Globals.szFileTitle, lstrlen(Globals.szFileTitle));
}
-
+
/* The starting point for the main text */
xLeft = border*2;
yTop = border+szMetric.cy*4;
-
+
SelectObject(printer.hDC, old_font);
- GetTextExtentPoint32(printer.hDC, letterM, 1, &szMetric);
-
+ GetTextExtentPoint32(printer.hDC, letterM, 1, &szMetric);
+
/* Since outputting strings is giving me problems, output the main
text one character at a time.
*/
xLeft += szMetric.cx;
}
} while (i++<size && yTop<(cHeightPels-border*2));
-
+
if (dopage)
EndPage(printer.hDC);
pagecount++;
case CMD_SEARCH: DIALOG_Search(); break;
case CMD_SEARCH_NEXT: DIALOG_SearchNext(); break;
-
+
case CMD_WRAP: DIALOG_EditWrap(); break;
case CMD_FONT: DIALOG_SelectFont(); break;
{
WCHAR delimiter;
int opt_print=0;
-
+
/* skip white space */
while (*cmdline == ' ') cmdline++;
RECT rt;
HGDIOBJ OldObj;
HDC hdc = GetDC(hWnd);
-
+
if(!SizingPattern)
{
const DWORD Pattern[4] = {0x5555AAAA, 0x5555AAAA, 0x5555AAAA, 0x5555AAAA};
TCHAR buffer[MAX_PATH];
/* load "My Computer" string */
LoadString(hInst, IDS_MY_COMPUTER, buffer, sizeof(buffer)/sizeof(TCHAR));
-
+
g_pChildWnd = pChildWnd = HeapAlloc(GetProcessHeap(), 0, sizeof(ChildWnd));
if (!pChildWnd) return 0;
_tcsncpy(pChildWnd->szPath, buffer, MAX_PATH);
{
SizingBrush = CreatePatternBrush(SizingPattern);
}
-
+
pt = MAKEPOINTS(lParam);
GetClientRect(hWnd, &rt);
pt.x = min(max(pt.x, SPLIT_MIN), rt.right - SPLIT_MIN);
}
}
break;
-
+
case WM_CONTEXTMENU:
{
POINTS pt;
EnableMenuItem(mnu, ID_EDIT_RENAME, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
EnableMenuItem(mnu, ID_EDIT_MODIFY, MF_BYCOMMAND | (cnt == 1 ? MF_ENABLED : MF_DISABLED | MF_GRAYED));
EnableMenuItem(mnu, ID_EDIT_MODIFY_BIN, MF_BYCOMMAND | (cnt == 1 ? MF_ENABLED : MF_DISABLED | MF_GRAYED));
-
+
TrackPopupMenu(mnu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd, NULL);
}
}
break;
}
-
+
case WM_SIZE:
if (wParam != SIZE_MINIMIZED && pChildWnd != NULL) {
ResizeWnd(pChildWnd, LOWORD(lParam), HIWORD(lParam));
{
DWORD llen, listlen, nl_len;
LPTSTR src, lines = NULL;
-
+
if (!(stringValueData = HeapAlloc(GetProcessHeap(), 0, valueDataLen)))
{
error(hwnd, IDS_TOO_BIG_VALUE, valueDataLen);
error(hwnd, IDS_BAD_VALUE, valueName);
goto done;
}
-
+
/* convert \0 to \r\n */
src = stringValueData;
nl_len = _tcslen(_T("\r\n")) * sizeof(TCHAR);
BOOL EmptyLines = FALSE;
LPTSTR src, lines, nl;
DWORD linechars, buflen, c_nl, dest;
-
+
src = stringValueData;
buflen = sizeof(TCHAR);
lines = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen + sizeof(TCHAR));
src += linechars + (nl != NULL ? c_nl : 0);
}
lines[++dest] = _T('\0');
-
+
if(EmptyLines)
{
warning(hwnd, IDS_MULTI_SZ_EMPTY_STRING);
}
-
+
lRet = RegSetValueEx(hKey, valueName, 0, type, (LPBYTE)lines, buflen);
HeapFree(GetProcessHeap(), 0, lines);
}
#ifndef UNICODE
LPWSTR u_valuename;
int len_vname = lstrlen(valueName);
-
+
if(len_vname > 0)
{
if(!(u_valuename = HeapAlloc(GetProcessHeap(), 0, (len_vname + 1) * sizeof(WCHAR))))
error(hwnd, IDS_TOO_BIG_VALUE, valueDataLen);
goto done;
}
-
+
/* force to use the unicode version, so editing strings in binary mode is correct */
lRet = RegQueryValueExW(hKey,
#ifndef UNICODE
BuildFilterStrings(TCHAR *Filter, PFILTERPAIR Pairs, int PairCount)
{
int i, c;
-
+
c = 0;
for(i = 0; i < PairCount; i++)
{
{
FILTERPAIR FilterPairs[3];
static TCHAR Filter[1024];
-
+
memset(pofn, 0, sizeof(OPENFILENAME));
pofn->lStructSize = sizeof(OPENFILENAME);
pofn->hwndOwner = hWnd;
pofn->hInstance = hInst;
-
+
/* create filter string */
FilterPairs[0].DisplayID = IDS_FLT_REGFILES;
FilterPairs[0].FilterID = IDS_FLT_REGFILES_FLT;
FilterPairs[2].DisplayID = IDS_FLT_ALLFILES;
FilterPairs[2].FilterID = IDS_FLT_ALLFILES_FLT;
BuildFilterStrings(Filter, FilterPairs, sizeof(FilterPairs) / sizeof(FILTERPAIR));
-
+
pofn->lpstrFilter = Filter;
pofn->lpstrCustomFilter = CustomFilterBuffer;
pofn->nMaxCustFilter = MAX_CUSTOM_FILTER_SIZE;
ofn.lpfnHook = ImportRegistryFile_OFNHookProc;
ofn.lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG1);
if (GetSaveFileName(&ofn)) {
- BOOL result;
+ BOOL result;
/* FIXME - convert strings to ascii! */
result = export_registry_key((CHAR*)ofn.lpstrFile, (CHAR*)ExportKeyPath);
/*result = export_registry_key(ofn.lpstrFile, NULL);*/
REGSAM regsam = KEY_READ;
LONG lRet;
int item;
-
+
switch (LOWORD(wParam)) {
case ID_REGISTRY_IMPORTREGISTRYFILE:
ImportRegistryFile(hWnd);
case ID_EDIT_MODIFY:
case ID_EDIT_MODIFY_BIN:
case ID_EDIT_DELETE:
- regsam |= KEY_WRITE;
+ regsam |= KEY_WRITE;
break;
}
if(MessageBox(g_pChildWnd->hWnd, msg, caption, MB_ICONQUESTION | MB_YESNO) == IDYES)
{
int ni, errs;
-
+
item = -1;
errs = 0;
while((ni = ListView_GetNextItem(g_pChildWnd->hListWnd, item, LVNI_SELECTED)) > -1)
}
item = ni;
}
-
+
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
if(errs > 0)
{
default:
result = FALSE;
}
-
+
if(hKey)
RegCloseKey(hKey);
return result;
INT CharWidth;
HFONT hFont;
BOOL SbVisible;
-
+
INT LeftMargin;
INT AddressSpacing;
INT SplitSpacing;
-
+
BOOL EditingField;
INT CaretCol;
INT CaretLine;
RegisterHexEditorClass(HINSTANCE hInstance)
{
WNDCLASSEX WndClass;
-
+
ZeroMemory(&WndClass, sizeof(WNDCLASSEX));
WndClass.cbSize = sizeof(WNDCLASSEX);
WndClass.style = CS_DBLCLKS;
WndClass.hCursor = LoadCursor(0, IDC_IBEAM);
WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
WndClass.lpszClassName = HEX_EDIT_CLASS_NAME;
-
+
return RegisterClassEx(&WndClass);
}
HEXEDIT_MoveCaret(PHEXEDIT_DATA hed, BOOL Scroll)
{
SCROLLINFO si;
-
+
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_POS;
GetScrollInfo(hed->hWndSelf, SB_VERT, &si);
-
+
if(Scroll)
{
if(si.nPos > hed->CaretLine)
}
else if(hed->CaretLine >= (hed->nVisibleLinesComplete + si.nPos))
{
- si.nPos = hed->CaretLine - hed->nVisibleLinesComplete + 1;
+ si.nPos = hed->CaretLine - hed->nVisibleLinesComplete + 1;
SetScrollInfo(hed->hWndSelf, SB_VERT, &si, TRUE);
GetScrollInfo(hed->hWndSelf, SB_VERT, &si);
InvalidateRect(hed->hWndSelf, NULL, TRUE);
}
}
-
+
if(hed->EditingField)
SetCaretPos(hed->LeftMargin + ((4 + hed->AddressSpacing + (3 * hed->CaretCol)) * hed->CharWidth) - 1, (hed->CaretLine - si.nPos) * hed->LineHeight);
else
RECT rcClient;
BOOL SbVisible;
DWORD bufsize, cvislines;
-
+
GetClientRect(hed->hWndSelf, &rcClient);
hed->style = GetWindowLong(hed->hWndSelf, GWL_STYLE);
-
+
bufsize = (hed->hBuffer ? LocalSize(hed->hBuffer) : 0);
hed->nLines = max(bufsize / hed->ColumnsPerLine, 1);
if(bufsize > hed->ColumnsPerLine && (bufsize % hed->ColumnsPerLine) > 0)
{
hed->nLines++;
}
-
+
if(hed->LineHeight > 0)
{
hed->nVisibleLinesComplete = cvislines = rcClient.bottom / hed->LineHeight;
{
hed->nVisibleLines = cvislines = 0;
}
-
+
SbVisible = bufsize > 0 && cvislines < hed->nLines;
ShowScrollBar(hed->hWndSelf, SB_VERT, SbVisible);
-
+
/* update scrollbar */
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_RANGE | SIF_PAGE;
si.nMax = ((bufsize > 0) ? hed->nLines - 1 : 0);
si.nPage = ((hed->LineHeight > 0) ? rcClient.bottom / hed->LineHeight : 0);
SetScrollInfo(hed->hWndSelf, SB_VERT, &si, TRUE);
-
+
if(IsWindowVisible(hed->hWndSelf) && SbVisible != hed->SbVisible)
{
InvalidateRect(hed->hWndSelf, NULL, TRUE);
}
-
+
hed->SbVisible = SbVisible;
}
UINT bufsize;
TCHAR hex[3], addr[17];
RECT rct;
-
+
FillRect(hDC, rc, (HBRUSH)(COLOR_WINDOW + 1));
-
+
if(hed->hBuffer)
{
bufsize = LocalSize(hed->hBuffer);
{
buf = NULL;
bufsize = 0;
-
+
if(ScrollPos + First == 0)
{
/* draw address */
TextOut(hDC, hed->LeftMargin, First * hed->LineHeight, addr, 4);
}
}
-
+
if(buf)
{
end = buf + bufsize;
linestart = (ScrollPos + First) * hed->ColumnsPerLine;
current = buf + linestart;
Last = min(hed->nLines - ScrollPos, Last);
-
+
while(First <= Last && current < end)
{
DWORD dh;
-
+
dx = hed->LeftMargin;
-
+
/* draw address */
_stprintf(addr, _T("%04X"), linestart);
TextOut(hDC, dx, dy, addr, 4);
-
+
dx += ((4 + hed->AddressSpacing) * hed->CharWidth);
dh = (3 * hed->CharWidth);
-
+
rct.left = dx;
rct.top = dy;
rct.right = rct.left + dh;
rct.bottom = dy + hed->LineHeight;
-
+
/* draw hex map */
dx += (hed->CharWidth / 2);
line = current;
{
rct.left += dh;
rct.right += dh;
-
+
_stprintf(hex, _T("%02X"), *(current++));
ExtTextOut(hDC, dx, dy, ETO_OPAQUE, &rct, hex, 2, NULL);
dx += dh;
}
-
+
/* draw ascii map */
dx = ((4 + hed->AddressSpacing + hed->SplitSpacing + (hed->ColumnsPerLine * 3)) * hed->CharWidth);
current = line;
TextOut(hDC, dx, dy, hex, 1);
dx += hed->CharWidth;
}
-
+
dy += hed->LineHeight;
linestart += hed->ColumnsPerLine;
First++;
}
}
-
+
LocalUnlock(hed->hBuffer);
}
{
WINDOWINFO wi;
int d;
-
+
if(pt.x <= hed->LeftMargin)
{
return HEHT_LEFTMARGIN;
}
-
+
pt.x -= hed->LeftMargin;
d = (4 * hed->CharWidth);
if(pt.x <= d)
{
return HEHT_ADDRESS;
}
-
+
pt.x -= d;
d = (hed->AddressSpacing * hed->CharWidth);
if(pt.x <= d)
{
return HEHT_ADDRESSSPACING;
}
-
+
pt.x -= d;
d = (3 * hed->ColumnsPerLine * hed->CharWidth);
if(pt.x <= d)
{
return HEHT_HEXDUMP;
}
-
+
pt.x -= d;
d = (hed->SplitSpacing * hed->CharWidth);
if(pt.x <= d)
{
return HEHT_HEXDUMPSPACING;
}
-
+
pt.x -= d;
d = (hed->ColumnsPerLine * hed->CharWidth);
if(pt.x <= d)
{
return HEHT_ASCIIDUMP;
}
-
+
return HEHT_RIGHTMARGIN;
}
{
SCROLLINFO si;
DWORD Pos, bufsize;
-
+
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_POS;
GetScrollInfo(hed->hWndSelf, SB_VERT, &si);
-
+
EditPos->x = 0;
-
+
if(hed->LineHeight > 0)
{
EditPos->y = min(si.nPos + (pt.y / hed->LineHeight), hed->nLines - 1);
{
EditPos->y = si.nPos;
}
-
+
switch(Hit)
{
case HEHT_LEFTMARGIN:
pt.x -= hed->LeftMargin + ((4 + hed->AddressSpacing) * hed->CharWidth);
*EditField = TRUE;
break;
-
+
default:
pt.x -= hed->LeftMargin + ((4 + hed->AddressSpacing + hed->SplitSpacing + (3 * hed->ColumnsPerLine)) * hed->CharWidth);
*EditField = FALSE;
break;
}
-
+
if(pt.x > 0)
{
INT BlockWidth = (*EditField ? hed->CharWidth * 3 : hed->CharWidth);
EditPos->x = min(hed->ColumnsPerLine, pt.x / BlockWidth);
}
-
+
bufsize = (hed->hBuffer ? LocalSize(hed->hBuffer) : 0);
Pos = (EditPos->y * hed->ColumnsPerLine) + EditPos->x;
if(Pos > bufsize)
if(Buffer != NULL && Size > 0)
{
LPVOID buf;
-
+
if(hed->MaxBuffer > 0 && Size > hed->MaxBuffer)
{
Size = hed->MaxBuffer;
}
-
+
if(hed->hBuffer)
{
if(Size > 0)
hed->hBuffer = LocalFree(hed->hBuffer);
hed->Position = 0;
HEXEDIT_Update(hed);
-
+
return 0;
}
}
{
hed->hBuffer = LocalAlloc(LHND, Size);
}
-
+
if(Size > 0)
{
buf = LocalLock(hed->hBuffer);
{
memcpy(buf, Buffer, Size);
}
- else
+ else
Size = 0;
LocalUnlock(hed->hBuffer);
}
-
+
hed->Position = 0;
HEXEDIT_Update(hed);
return Size;
hed->hBuffer = LocalFree(hed->hBuffer);
HEXEDIT_Update(hed);
}
-
+
return 0;
}
HEXEDIT_HEM_COPYBUFFER(PHEXEDIT_DATA hed, PVOID Buffer, DWORD Size)
{
DWORD nCpy;
-
+
if(!hed->hBuffer)
{
return 0;
}
-
+
if(Buffer != NULL && Size > 0)
{
nCpy = min(Size, LocalSize(hed->hBuffer));
if(nCpy > 0)
{
PVOID buf;
-
+
buf = LocalLock(hed->hBuffer);
if(buf)
{
}
return nCpy;
}
-
+
return (LRESULT)LocalSize(hed->hBuffer);
}
HEXEDIT_WM_NCCREATE(HWND hWnd, CREATESTRUCT *cs)
{
PHEXEDIT_DATA hed;
-
+
if(!(hed = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HEXEDIT_DATA))))
{
return FALSE;
}
-
+
hed->hWndSelf = hWnd;
hed->hWndParent = cs->hwndParent;
hed->style = cs->style;
-
+
hed->ColumnsPerLine = 8;
hed->LeftMargin = 2;
hed->AddressSpacing = 2;
hed->SplitSpacing = 2;
hed->EditingField = TRUE; /* in hexdump field */
-
+
SetWindowLongPtr(hWnd, 0, (DWORD_PTR)hed);
HEXEDIT_Update(hed);
-
+
return TRUE;
}
while(LocalUnlock(hed->hBuffer));
LocalFree(hed->hBuffer);
}
-
+
if(hed->hFont)
{
DeleteObject(hed->hFont);
}
-
+
SetWindowLongPtr(hed->hWndSelf, 0, (DWORD_PTR)0);
HeapFree(GetProcessHeap(), 0, hed);
-
+
return 0;
}
{
int ScrollY;
SCROLLINFO si;
-
+
ZeroMemory(&si, sizeof(SCROLLINFO));
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_ALL;
GetScrollInfo(hed->hWndSelf, SB_VERT, &si);
-
+
ScrollY = si.nPos;
switch(SbCmd)
{
case SB_TOP:
si.nPos = si.nMin;
break;
-
+
case SB_BOTTOM:
si.nPos = si.nMax;
break;
-
+
case SB_LINEUP:
si.nPos--;
break;
-
+
case SB_LINEDOWN:
si.nPos++;
break;
-
+
case SB_PAGEUP:
si.nPos -= si.nPage;
break;
-
+
case SB_PAGEDOWN:
si.nPos += si.nPage;
break;
-
+
case SB_THUMBTRACK:
si.nPos = si.nTrackPos;
break;
}
-
+
si.fMask = SIF_POS;
SetScrollInfo(hed->hWndSelf, SB_VERT, &si, TRUE);
GetScrollInfo(hed->hWndSelf, SB_VERT, &si);
-
+
if(si.nPos != ScrollY)
{
ScrollWindow(hed->hWndSelf, 0, (ScrollY - si.nPos) * hed->LineHeight, NULL, NULL);
UpdateWindow(hed->hWndSelf);
}
-
+
return 0;
}
HDC hDC;
TEXTMETRIC tm;
HFONT hOldFont = 0;
-
+
if(hFont == 0)
{
hFont = HEXEDIT_GetFixedFont();
}
-
+
hed->hFont = hFont;
hDC = GetDC(hed->hWndSelf);
if(hFont)
SelectObject(hDC, hOldFont);
}
ReleaseDC(hed->hWndSelf, hDC);
-
+
if(bRedraw)
{
InvalidateRect(hed->hWndSelf, NULL, TRUE);
}
-
+
return 0;
}
HFONT hOldFont;
HDC hTempDC;
DWORD height;
-
+
if(GetUpdateRect(hed->hWndSelf, &rc, FALSE) && (hed->LineHeight > 0))
{
ZeroMemory(&si, sizeof(SCROLLINFO));
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_POS;
GetScrollInfo(hed->hWndSelf, SB_VERT, &si);
-
+
height = (rc.bottom - rc.top);
nLines = height / hed->LineHeight;
if((height % hed->LineHeight) > 0)
nLines = hed->nLines - si.nPos;
}
nFirst = rc.top / hed->LineHeight;
-
+
BeginPaint(hed->hWndSelf, &ps);
if(!(hTempDC = CreateCompatibleDC(ps.hdc)))
{
BitBlt(ps.hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, hTempDC, rc.left, rc.top, SRCCOPY);
SelectObject(hTempDC, hOldFont);
SelectObject(hTempDC, hbmpold);
-
+
DeleteObject(hbmp);
DeleteDC(hTempDC);
-
+
epaint:
EndPaint(hed->hWndSelf, &ps);
}
-
+
return 0;
}
{
SCROLLINFO si;
int ScrollY;
-
+
SetFocus(hed->hWndSelf);
-
+
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_ALL;
GetScrollInfo(hed->hWndSelf, SB_VERT, &si);
-
+
ScrollY = si.nPos;
-
+
si.fMask = SIF_POS;
si.nPos += cyMoveLines;
SetScrollInfo(hed->hWndSelf, SB_VERT, &si, TRUE);
-
+
GetScrollInfo(hed->hWndSelf, SB_VERT, &si);
if(si.nPos != ScrollY)
{
ScrollWindow(hed->hWndSelf, 0, (ScrollY - si.nPos) * hed->LineHeight, NULL, NULL);
UpdateWindow(hed->hWndSelf);
}
-
+
return 0;
}
BOOL NewField;
POINT EditPos;
DWORD Hit = HEXEDIT_HitRegionTest(hed, Pt);
-
+
SetFocus(hed->hWndSelf);
-
- hed->Position = HEXEDIT_PositionFromPoint(hed, Pt, Hit, &EditPos, &NewField);
+
+ hed->Position = HEXEDIT_PositionFromPoint(hed, Pt, Hit, &EditPos, &NewField);
hed->EditingField = NewField;
hed->CaretCol = EditPos.x;
- hed->CaretLine = EditPos.y;
-
+ hed->CaretLine = EditPos.y;
+
HEXEDIT_MoveCaret(hed, TRUE);
-
+
return 0;
}
{
DWORD bufsize;
BOOL shift, control;
-
+
if(GetKeyState(VK_MENU) & 0x8000)
{
return FALSE;
}
-
+
shift = GetKeyState(VK_SHIFT) & 0x8000;
control = GetKeyState(VK_CONTROL) & 0x8000;
-
+
bufsize = (hed->hBuffer ? LocalSize(hed->hBuffer) : 0);
-
+
switch(VkCode)
{
case VK_LEFT:
}
HEXEDIT_MoveCaret(hed, TRUE);
break;
-
+
case VK_RIGHT:
if(hed->Position < bufsize)
{
}
HEXEDIT_MoveCaret(hed, TRUE);
break;
-
+
case VK_UP:
if(hed->Position > 0)
{
}
HEXEDIT_MoveCaret(hed, TRUE);
break;
-
+
case VK_DOWN:
if(hed->Position <= bufsize)
{
HEXEDIT_MoveCaret(hed, TRUE);
break;
}
-
+
return FALSE;
}
HexEditWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
PHEXEDIT_DATA hed;
-
+
hed = (PHEXEDIT_DATA)GetWindowLongPtr(hWnd, (DWORD_PTR)0);
switch(uMsg)
{
case WM_ERASEBKGND:
return TRUE;
-
+
case WM_PAINT:
return HEXEDIT_WM_PAINT(hed);
-
+
case WM_KEYDOWN:
return HEXEDIT_WM_KEYDOWN(hed, (INT)wParam);
-
+
case WM_VSCROLL:
return HEXEDIT_WM_VSCROLL(hed, HIWORD(wParam), LOWORD(wParam));
-
+
case WM_SIZE:
return HEXEDIT_WM_SIZE(hed, (DWORD)wParam, LOWORD(lParam), HIWORD(lParam));
-
+
case WM_LBUTTONDOWN:
return HEXEDIT_WM_LBUTTONDOWN(hed, (INT)wParam, MAKEPOINTS(lParam));
-
+
case WM_MOUSEWHEEL:
{
UINT nScrollLines = 3;
int delta = 0;
-
+
SystemParametersInfoW(SPI_GETWHEELSCROLLLINES, 0, &nScrollLines, 0);
delta -= (SHORT)HIWORD(wParam);
if(abs(delta) >= WHEEL_DELTA && nScrollLines != 0)
}
break;
}
-
+
case HEM_LOADBUFFER:
return HEXEDIT_HEM_LOADBUFFER(hed, (PVOID)wParam, (DWORD)lParam);
-
+
case HEM_COPYBUFFER:
return HEXEDIT_HEM_COPYBUFFER(hed, (PVOID)wParam, (DWORD)lParam);
-
+
case HEM_SETMAXBUFFERSIZE:
return HEXEDIT_HEM_SETMAXBUFFERSIZE(hed, (DWORD)lParam);
-
+
case WM_SETFOCUS:
return HEXEDIT_WM_SETFOCUS(hed);
-
+
case WM_KILLFOCUS:
return HEXEDIT_WM_KILLFOCUS(hed);
-
+
case WM_GETDLGCODE:
return HEXEDIT_WM_GETDLGCODE((LPMSG)lParam);
-
+
case WM_SETFONT:
return HEXEDIT_WM_SETFONT(hed, (HFONT)wParam, (BOOL)LOWORD(lParam));
-
+
case WM_GETFONT:
return HEXEDIT_WM_GETFONT(hed);
-
+
case WM_CREATE:
return HEXEDIT_WM_CREATE(hed);
-
+
case WM_NCCREATE:
if(!hed)
{
return HEXEDIT_WM_NCCREATE(hWnd, (CREATESTRUCT*)lParam);
}
break;
-
+
case WM_NCDESTROY:
if(hed)
{
}
break;
}
-
+
return CallWindowProc(DefWindowProc, hWnd, uMsg, wParam, lParam);
}
{
PLINE_INFO lineinfo;
LVITEM Item;
-
+
Item.mask = LVIF_PARAM;
Item.iItem = i;
if(ListView_GetItem(hwndLV, &Item))
hico = LoadIcon(hInst, MAKEINTRESOURCE(IDI_BIN));
Image_Bin = ImageList_AddIcon(himl, hico);
-
+
hico = LoadIcon(hInst, MAKEINTRESOURCE(IDI_STRING));
Image_String = ImageList_AddIcon(himl, hico);
-
+
/* Fail if not all of the images were added. */
if (ImageList_GetImageCount(himl) < NUM_ICONS)
LINE_INFO*l, *r;
l = (LINE_INFO*)lParam1;
r = (LINE_INFO*)lParam2;
-
- if (g_columnToSort == ~0UL)
+
+ if (g_columnToSort == ~0UL)
g_columnToSort = 0;
-
+
if (g_columnToSort == 1 && l->dwValType != r->dwValType)
return g_invertSort ? (int)r->dwValType - (int)l->dwValType : (int)l->dwValType - (int)r->dwValType;
if (g_columnToSort == 2) {
g_columnToSort = ((LPNMLISTVIEW)lParam)->iSubItem;
g_invertSort = FALSE;
}
-
+
ListView_SortItems(hWnd, CompareFunc, (WPARAM)hWnd);
return TRUE;
case NM_DBLCLK:
//if((ret = RenameValue(lineinfo->name, Info->item.pszText)) != ERROR_SUCCESS)
{
TCHAR msg[128], caption[128];
-
+
LoadString(hInst, IDS_ERR_RENVAL_CAPTION, caption, sizeof(caption)/sizeof(TCHAR));
if(_tcslen(Info->item.pszText) == 0)
{
0, 0, rcClient.right, rcClient.bottom,
hwndParent, (HMENU)id, hInst, NULL);
if (!hwndLV) return NULL;
-
+
/* Initialize the image list, and add items to the control. */
if (!CreateListColumns(hwndLV)) goto fail;
if (!InitListViewImageLists(hwndLV)) goto fail;
BOOL AddedDefault = FALSE;
if (!hwndLV) return FALSE;
-
+
ListView_EditLabel(hwndLV, -1);
-
+
SendMessage(hwndLV, WM_SETREDRAW, FALSE, 0);
count = ListView_GetItemCount(hwndLV);
for (i = 0; i < count; i++) {
}
g_columnToSort = ~0UL;
ListView_DeleteAllItems(hwndLV);
-
+
if(!hKey) return FALSE;
errCode = RegOpenKeyEx(hKey, keyPath, 0, KEY_READ, &hNewKey);
if (errCode != ERROR_SUCCESS) return FALSE;
/* get size information and resize the buffers if necessary */
- errCode = RegQueryInfoKey(hNewKey, NULL, NULL, NULL, NULL, &max_sub_key_len, NULL,
+ errCode = RegQueryInfoKey(hNewKey, NULL, NULL, NULL, NULL, &max_sub_key_len, NULL,
&val_count, &max_val_name_len, &max_val_size, NULL, NULL);
#define BUF_HEAD_SPACE 2 /* FIXME: check why this is required with ROS ??? */
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
BOOL AclUiAvailable;
-
+
WNDCLASSEX wcFrame = {
sizeof(WNDCLASSEX),
CS_HREDRAW | CS_VREDRAW/*style*/,
};
ATOM hChildWndClass = RegisterClassEx(&wcChild); /* register child windows class */
hChildWndClass = hChildWndClass; /* warning eater */
-
+
RegisterHexEditorClass(hInstance);
hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDIT_MENU));
/* Initialize the Windows Common Controls DLL */
InitCommonControls();
-
+
AclUiAvailable = InitializeAclUiDll();
if(!AclUiAvailable)
{
hf = _fdopen(hCrt, "w");
*stdout = *hf;
setvbuf(stdout, NULL, _IONBF, 0);
-
+
wprintf(L"command line exit, hInstance = %d\n", hInstance);
getch();
FreeConsole();
/* Main message loop */
while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
- if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)
+ if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)
&& !TranslateChildTabMessage(&msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);