}
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);
/******************************************************************************
Implementation of the CRegKeySecurity interface
******************************************************************************/
-
+
SI_ACCESS RegAccess[] = {
{&GUID_NULL, KEY_ALL_ACCESS, (LPWSTR)MAKEINTRESOURCE(IDS_ACCESS_FULLCONTROL), SI_ACCESS_GENERAL | SI_ACCESS_SPECIFIC},
{&GUID_NULL, KEY_READ, (LPWSTR)MAKEINTRESOURCE(IDS_ACCESS_READ), SI_ACCESS_GENERAL},
LPREGKEYSECURITY CRegKeySecurity_fnConstructor(HANDLE Handle, SE_OBJECT_TYPE ObjectType, SI_OBJECT_INFO *ObjectInfo, BOOL *Btn)
{
LPREGKEYSECURITY obj;
-
+
obj = (LPREGKEYSECURITY)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(REGKEYSECURITY));
if(obj != NULL)
{
obj->ObjectInfo = *ObjectInfo;
obj->Btn = Btn;
}
-
+
return obj;
}
HRESULT STDMETHODCALLTYPE
-CRegKeySecurity_fnQueryInterface(LPREGKEYSECURITY this,
- REFIID iid,
+CRegKeySecurity_fnQueryInterface(LPREGKEYSECURITY this,
+ REFIID iid,
PVOID *pvObject)
{
if(IsEqualGUID(iid, &IID_IUnknown) ||
*pvObject = this;
return S_OK;
}
-
+
*pvObject = NULL;
return E_NOINTERFACE;
}
CRegKeySecurity_fnRelease(LPREGKEYSECURITY this)
{
ULONG rfc;
-
+
rfc = (ULONG)InterlockedDecrement(&this->ref);
if(rfc == 0)
{
}
HRESULT STDMETHODCALLTYPE
-CRegKeySecurity_fnGetObjectInformation(LPREGKEYSECURITY this,
+CRegKeySecurity_fnGetObjectInformation(LPREGKEYSECURITY this,
PSI_OBJECT_INFO pObjectInfo)
{
*pObjectInfo = this->ObjectInfo;
}
HRESULT STDMETHODCALLTYPE
-CRegKeySecurity_fnGetSecurity(LPREGKEYSECURITY this,
+CRegKeySecurity_fnGetSecurity(LPREGKEYSECURITY this,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR* ppSecurityDescriptor,
BOOL fDefault)
}
HRESULT STDMETHODCALLTYPE
-CRegKeySecurity_fnSetSecurity(LPREGKEYSECURITY this,
+CRegKeySecurity_fnSetSecurity(LPREGKEYSECURITY this,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor)
{
}
HRESULT STDMETHODCALLTYPE
-CRegKeySecurity_fnGetAccessRights(LPREGKEYSECURITY this,
+CRegKeySecurity_fnGetAccessRights(LPREGKEYSECURITY this,
const GUID* pguidObjectType,
DWORD dwFlags,
PSI_ACCESS* ppAccess,
}
HRESULT STDMETHODCALLTYPE
-CRegKeySecurity_fnMapGeneric(LPREGKEYSECURITY this,
+CRegKeySecurity_fnMapGeneric(LPREGKEYSECURITY this,
const GUID* pguidObjectType,
UCHAR* pAceFlags,
ACCESS_MASK* pMask)
}
HRESULT STDMETHODCALLTYPE
-CRegKeySecurity_fnGetInheritTypes(LPREGKEYSECURITY this,
+CRegKeySecurity_fnGetInheritTypes(LPREGKEYSECURITY this,
PSI_INHERIT_TYPE* ppInheritTypes,
ULONG* pcInheritTypes)
{
}
HRESULT STDMETHODCALLTYPE
-CRegKeySecurity_fnPropertySheetPageCallback(LPREGKEYSECURITY this,
+CRegKeySecurity_fnPropertySheetPageCallback(LPREGKEYSECURITY this,
HWND hwnd,
UINT uMsg,
SI_PAGE_TYPE uPage)
hAclUiDll = NULL;
return FALSE;
}
-
+
return TRUE;
}
HKEY hInfoKey;
LPREGKEYSECURITY RegKeySecurity;
SI_OBJECT_INFO ObjectInfo;
-
+
if(pfnEditSecurity == NULL)
{
return FALSE;
}
-
+
#ifndef UNICODE
/* aclui.dll only accepts unicode strings, convert them */
if(lpMachine != NULL)
}
else
Machine = NULL;
-
+
if(lpKeyName != NULL)
{
int lnKeyName = lstrlen(lpKeyName);
Machine = (LPWSTR)lpMachine;
KeyName = (LPWSTR)lpKeyName;
#endif
-
+
/* try to open the key again with more access rights */
if(RegOpenKeyEx(hKey, NULL, 0, READ_CONTROL, &hInfoKey) != ERROR_SUCCESS)
{
/* FIXME - print error with FormatMessage */
return FALSE;
}
-
+
ObjectInfo.dwFlags = SI_EDIT_ALL | SI_ADVANCED | SI_CONTAINER | SI_OWNER_RECURSE | SI_EDIT_PERMS;
ObjectInfo.hInstance = hInst;
ObjectInfo.pszServerName = Machine;
ObjectInfo.pszObjectName = KeyName;
ObjectInfo.pszPageTitle = KeyName;
-
+
if(!(RegKeySecurity = CRegKeySecurity_fnConstructor(hInfoKey, SE_REGISTRY_KEY, &ObjectInfo, &Result)))
{
/* FIXME - print error with FormatMessage */
/* display the security editor dialog */
pfnEditSecurity(hWndOwner, RegKeySecurity);
-
+
/* dereference the interface, it should be destroyed here */
CRegKeySecurity_fnRelease(RegKeySecurity);
RegCloseKey(hInfoKey);
-
+
#ifndef UNICODE
if(Machine != NULL)
{
HeapFree(GetProcessHeap(), 0, KeyName);
}
#endif
-
+
return Result;
}
struct ifaceCRegKeySecurityVbtl
{
/* IUnknown */
- HRESULT (STDMETHODCALLTYPE *QueryInterface)(LPREGKEYSECURITY this,
- REFIID iid,
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(LPREGKEYSECURITY this,
+ REFIID iid,
PVOID *pvObject);
ULONG (STDMETHODCALLTYPE *AddRef)(LPREGKEYSECURITY this);
ULONG (STDMETHODCALLTYPE *Release)(LPREGKEYSECURITY this);
-
+
/* CRegKeySecurity */
- HRESULT (STDMETHODCALLTYPE *GetObjectInformation)(LPREGKEYSECURITY this,
+ HRESULT (STDMETHODCALLTYPE *GetObjectInformation)(LPREGKEYSECURITY this,
PSI_OBJECT_INFO pObjectInfo);
- HRESULT (STDMETHODCALLTYPE *GetSecurity)(LPREGKEYSECURITY this,
+ HRESULT (STDMETHODCALLTYPE *GetSecurity)(LPREGKEYSECURITY this,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR* ppSecurityDescriptor,
BOOL fDefault);
- HRESULT (STDMETHODCALLTYPE *SetSecurity)(LPREGKEYSECURITY this,
+ HRESULT (STDMETHODCALLTYPE *SetSecurity)(LPREGKEYSECURITY this,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor);
- HRESULT (STDMETHODCALLTYPE *GetAccessRights)(LPREGKEYSECURITY this,
+ HRESULT (STDMETHODCALLTYPE *GetAccessRights)(LPREGKEYSECURITY this,
const GUID* pguidObjectType,
DWORD dwFlags,
PSI_ACCESS* ppAccess,
ULONG* pcAccesses,
ULONG* piDefaultAccess);
- HRESULT (STDMETHODCALLTYPE *MapGeneric)(LPREGKEYSECURITY this,
+ HRESULT (STDMETHODCALLTYPE *MapGeneric)(LPREGKEYSECURITY this,
const GUID* pguidObjectType,
UCHAR* pAceFlags,
ACCESS_MASK* pMask);
- HRESULT (STDMETHODCALLTYPE *GetInheritTypes)(LPREGKEYSECURITY this,
+ HRESULT (STDMETHODCALLTYPE *GetInheritTypes)(LPREGKEYSECURITY this,
PSI_INHERIT_TYPE* ppInheritTypes,
ULONG* pcInheritTypes);
- HRESULT (STDMETHODCALLTYPE *PropertySheetPageCallback)(LPREGKEYSECURITY this,
+ HRESULT (STDMETHODCALLTYPE *PropertySheetPageCallback)(LPREGKEYSECURITY this,
HWND hwnd,
UINT uMsg,
SI_PAGE_TYPE uPage);
ULONG STDMETHODCALLTYPE CRegKeySecurity_fnRelease(LPREGKEYSECURITY this);
HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnGetObjectInformation(LPREGKEYSECURITY this,
PSI_OBJECT_INFO pObjectInfo);
-HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnGetSecurity(LPREGKEYSECURITY this,
+HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnGetSecurity(LPREGKEYSECURITY this,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR* ppSecurityDescriptor,
BOOL fDefault);
-HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnSetSecurity(LPREGKEYSECURITY this,
+HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnSetSecurity(LPREGKEYSECURITY this,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor);
-HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnGetAccessRights(LPREGKEYSECURITY this,
+HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnGetAccessRights(LPREGKEYSECURITY this,
const GUID* pguidObjectType,
DWORD dwFlags,
PSI_ACCESS* ppAccess,
ULONG* pcAccesses,
ULONG* piDefaultAccess);
-HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnMapGeneric(LPREGKEYSECURITY this,
+HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnMapGeneric(LPREGKEYSECURITY this,
const GUID* pguidObjectType,
UCHAR* pAceFlags,
ACCESS_MASK* pMask);
-HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnGetInheritTypes(LPREGKEYSECURITY this,
+HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnGetInheritTypes(LPREGKEYSECURITY this,
PSI_INHERIT_TYPE* ppInheritTypes,
ULONG* pcInheritTypes);
-HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnPropertySheetPageCallback(LPREGKEYSECURITY this,
+HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnPropertySheetPageCallback(LPREGKEYSECURITY this,
HWND hwnd,
UINT uMsg,
SI_PAGE_TYPE uPage);
CRegKeySecurity_fnQueryInterface,
CRegKeySecurity_fnAddRef,
CRegKeySecurity_fnRelease,
-
+
/* CRegKeySecurity methods */
CRegKeySecurity_fnGetObjectInformation,
CRegKeySecurity_fnGetSecurity,
if (!AddEntryToTree(hwndTV, hRoot, _T("HKEY_LOCAL_MACHINE"), HKEY_LOCAL_MACHINE, 1, TVI_LAST)) return FALSE;
if (!AddEntryToTree(hwndTV, hRoot, _T("HKEY_USERS"), HKEY_USERS, 1, TVI_LAST)) return FALSE;
if (!AddEntryToTree(hwndTV, hRoot, _T("HKEY_CURRENT_CONFIG"), HKEY_CURRENT_CONFIG, 1, TVI_LAST)) return FALSE;
-
+
/* expand and select host name */
TreeView_Expand(hwndTV, hRoot, TVE_EXPAND);
TreeView_Select(hwndTV, hRoot, TVGN_CARET);
printf("dwSubCount=%ld, Name=%s\n", dwSubCount, Name);
AddEntryToTree(hwndTV, pnmtv->itemNew.hItem, Name, NULL, dwSubCount, TVI_FIRST);
}
-
+
SendMessage(hwndTV, TVM_SORTCHILDREN, 0, (LPARAM)pnmtv->itemNew.hItem);
-
+
RegCloseKey(hNewKey);
HeapFree(GetProcessHeap(), 0, Name);
{
WNDCLASSEX wcex;
- wcex.cbSize = sizeof(WNDCLASSEX);
+ wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = 0;
wcex.lpfnWndProc = EmptyWindowProc;
/*
*
* service control manager
- *
+ *
* ReactOS Operating System
- *
+ *
* --------------------------------------------------------------------
*
* This software is free software; you can redistribute it and/or
Group->TagCount = 0;
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlCopyMemory(Group->TagArray,
- (PULONG)ValueData + 1,
+ RtlCopyMemory(Group->TagArray,
+ (PULONG)ValueData + 1,
Group->TagCount * sizeof(DWORD));
}
else
}
}
- /* Start all services which have an invalid tag or which do not have a tag */
+ /* Start all services which have an invalid tag or which do not have a tag */
ServiceEntry = ServiceListHead.Flink;
while (ServiceEntry != &ServiceListHead)
{
/* $Id$
*
* service control 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.
*
*/
VOID FASTCALL
AcquireLoadDriverPrivilege(VOID)
{
- HANDLE hToken;
- TOKEN_PRIVILEGES tkp;
+ HANDLE hToken;
+ TOKEN_PRIVILEGES tkp;
/* Get a token for this process */
if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
/* One privilege to set */
tkp.PrivilegeCount = 1;
- tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+ tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
/* Get the debug privilege for this process */
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
{
PSND_MIXER_DESTINATION Line, NextLine;
PSND_MIXER_CONNECTION Con, NextCon;
-
+
for(Line = Mixer->Lines; Line != NULL; Line = NextLine)
{
if(Line->Controls != NULL)
{
HeapFree(GetProcessHeap(), 0, Line->Controls);
}
-
+
for(Con = Line->Connections; Con != NULL; Con = NextCon)
{
if(Con->Controls != NULL)
{
HeapFree(GetProcessHeap(), 0, Con->Controls);
}
-
+
NextCon = Con->Next;
HeapFree(GetProcessHeap(), 0, Con);
}
-
+
NextLine = Line->Next;
HeapFree(GetProcessHeap(), 0, Line);
}
Mixer->hWndNotification = hWndNotification;
Mixer->MixersCount = mixerGetNumDevs();
Mixer->MixerId = NO_MIXER_SELECTED;
-
+
if(Mixer->MixersCount > 0)
{
/* select the first mixer by default */
{
DBG("Line control: %ws", (*Controls)[j].szName);
}
-
+
return TRUE;
}
else
{
DBG("Failed to allocate memory for %d line controls!\n", LineInfo->cControls);
}
-
+
return FALSE;
}
else
UINT i;
MIXERLINE LineInfo;
BOOL Ret = TRUE;
-
+
LineInfo.cbStruct = sizeof(LineInfo);
LineInfo.dwDestination = Line->Info.dwDestination;
for(i = Line->Info.cConnections; i > 0; i--)
{
LPMIXERCONTROL Controls;
PSND_MIXER_CONNECTION Con;
-
+
if(!SndMixerQueryControls(Mixer, &LineInfo, &Controls))
{
DBG("Failed to query connection controls\n");
Ret = FALSE;
break;
}
-
+
Con = HeapAlloc(GetProcessHeap(), 0, sizeof(SND_MIXER_CONNECTION));
if(Con != NULL)
{
break;
}
}
-
+
return Ret;
}
{
UINT i;
BOOL Ret = TRUE;
-
+
for(i = Mixer->Caps.cDestinations; i > 0; i--)
{
PSND_MIXER_DESTINATION Line;
Ret = FALSE;
break;
}
-
+
Line->Next = Mixer->Lines;
Mixer->Lines = Line;
}
break;
}
}
-
+
return Ret;
}
{
return FALSE;
}
-
+
SndMixerClose(Mixer);
-
+
if(mixerOpen(&Mixer->hmx, MixerId, (DWORD_PTR)Mixer->hWndNotification, 0, CALLBACK_WINDOW | MIXER_OBJECTF_MIXER) == MMSYSERR_NOERROR ||
mixerOpen(&Mixer->hmx, MixerId, (DWORD_PTR)Mixer->hWndNotification, 0, CALLBACK_WINDOW) == MMSYSERR_NOERROR ||
mixerOpen(&Mixer->hmx, MixerId, 0, 0, 0) == MMSYSERR_NOERROR)
ClearMixerCache(Mixer);
Ret = SndMixerQueryDestinations(Mixer);
-
+
if(!Ret)
{
ClearMixerCache(Mixer);
mixerClose(Mixer->hmx);
}
}
-
+
Mixer->hmx = NULL;
Mixer->MixerId = NO_MIXER_SELECTED;
return FALSE;
return lnsz;
}
}
-
+
return -1;
}
HMIXER hMixer;
UINT i;
BOOL Ret = TRUE;
-
+
for(i = 0; i < Mixer->MixersCount; i++)
{
if(mixerOpen(&hMixer, i, 0, 0, 0) == MMSYSERR_NOERROR)
if(Mixer->hmx)
{
PSND_MIXER_DESTINATION Line;
-
+
for(Line = Mixer->Lines; Line != NULL; Line = Line->Next)
{
if(!EnumProc(Mixer, &Line->Info, Context))
return FALSE;
}
}
-
+
return TRUE;
}
-
+
return FALSE;
}
{
LRESULT lres;
PPREFERENCES_FILL_DEVICES FillContext = (PPREFERENCES_FILL_DEVICES)Context;
-
+
lres = SendMessage(FillContext->hComboBox, CB_ADDSTRING, 0, (LPARAM)ProductName);
if(lres != CB_ERR)
{
SendMessage(FillContext->hComboBox, CB_SETCURSEL, (WPARAM)lres, 0);
}
}
-
+
return TRUE;
}
DlgPreferencesProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
PPREFERENCES_CONTEXT Context;
-
+
switch(uMsg)
{
case WM_COMMAND:
}
break;
}
-
+
case MM_MIXM_LINE_CHANGE:
{
DBG("MM_MIXM_LINE_CHANGE\n");
DBG("MM_MIXM_CONTROL_CHANGE\n");
break;
}
-
+
case WM_INITDIALOG:
{
PREFERENCES_FILL_DEVICES FillDevContext;
-
+
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)lParam);
Context = (PPREFERENCES_CONTEXT)((LONG_PTR)lParam);
Context->hwndDlg = hwndDlg;
Context->Mixer = SndMixerCreate(hwndDlg);
-
+
FillDevContext.PrefContext = Context;
FillDevContext.hComboBox = GetDlgItem(hwndDlg, IDC_MIXERDEVICE);
FillDevContext.Selected = SndMixerGetSelection(Context->Mixer);
&FillDevContext);
return TRUE;
}
-
+
case WM_DESTROY:
{
Context = GetDialogData(hwndDlg, PREFERENCES_CONTEXT);
break;
}
}
-
+
return 0;
}
RebuildMixerWindowControls(PMIXER_WINDOW MixerWindow)
{
DeleteMixerWindowControls(MixerWindow);
-
+
return TRUE;
}
{
PMIXER_WINDOW MixerWindow;
LRESULT Result = 0;
-
+
switch(uMsg)
{
case WM_COMMAND:
{
MixerWindow = GetWindowData(hwnd, MIXER_WINDOW);
-
+
switch(LOWORD(wParam))
{
case IDC_PROPERTIES:
Preferences.MixerWindow = MixerWindow;
Preferences.Mixer = NULL;
-
+
if(DialogBoxParam(hAppInstance,
MAKEINTRESOURCE(IDD_PREFERENCES),
hwnd,
}
break;
}
-
+
case IDC_EXIT:
{
PostQuitMessage(0);
}
break;
}
-
+
case MM_MIXM_LINE_CHANGE:
{
DBG("MM_MIXM_LINE_CHANGE\n");
break;
}
-
+
case MM_MIXM_CONTROL_CHANGE:
{
DBG("MM_MIXM_CONTROL_CHANGE\n");
break;
}
-
+
case WM_CREATE:
{
MixerWindow = ((LPCREATESTRUCT)lParam)->lpCreateParams;
{
SendMessage(MixerWindow->hStatusBar, WM_SETTEXT, 0, (LPARAM)szProduct);
}
-
+
if(!RebuildMixerWindowControls(MixerWindow))
{
DBG("Rebuilding mixer window controls failed!\n");
}
break;
}
-
+
case WM_DESTROY:
{
MixerWindow = GetWindowData(hwnd, MIXER_WINDOW);
}
break;
}
-
+
case WM_CLOSE:
{
PostQuitMessage(0);
break;
}
-
+
default:
{
Result = DefWindowProc(hwnd, uMsg, wParam, lParam);
RegisterApplicationClasses(VOID)
{
WNDCLASSEX wc;
-
+
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = MainWindowProc;
wc.lpszClassName = SZ_APP_CLASS;
wc.hIconSm = NULL;
MainWindowClass = RegisterClassEx(&wc);
-
+
return MainWindowClass != 0;
}
{
LPTSTR lpAppTitle;
HWND hWnd;
-
+
PMIXER_WINDOW MixerWindow = HeapAlloc(hAppHeap, 0, sizeof(MIXER_WINDOW));
if(MixerWindow == NULL)
{
return NULL;
}
-
+
/* load the application title */
if(RosAllocAndLoadString(&lpAppTitle,
hAppInstance,
else
{
LPTSTR lpErrMessage;
-
+
/*
* no mixer devices are available!
*/
MessageBox(NULL, lpErrMessage, lpAppTitle, MB_ICONINFORMATION);
LocalFree(lpErrMessage);
}
-
+
if(lpAppTitle != NULL)
{
LocalFree(lpAppTitle);
}
-
+
if(hWnd == NULL)
{
HeapFree(hAppHeap, 0, MixerWindow);
}
-
+
return hWnd;
}
-int WINAPI
+int WINAPI
WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow)
{
MSG Msg;
-
+
hAppInstance = hInstance;
hAppHeap = GetProcessHeap();
-
+
InitCommonControls();
if(!RegisterApplicationClasses())
DBG("Failed to register application classes (LastError: %d)!\n", GetLastError());
return 1;
}
-
+
hMainWnd = CreateApplicationWindow();
if(hMainWnd == NULL)
{
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include "precomp.h"
INT_PTR CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#ifndef __ABOUT_H
#define __ABOUT_H
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include "precomp.h"
HANDLE hProcessAffinityHandle;
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#ifndef __AFFINITY_H
#define __AFFINITY_H
LV_COLUMN column;
TCHAR szTemp[256];
int cx, cy;
-
+
switch (message) {
case WM_INITDIALOG:
cy = (rc.bottom - rc.top) + nYDifference;
SetWindowPos(hApplicationPageListCtrl, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER);
InvalidateRect(hApplicationPageListCtrl, NULL, TRUE);
-
+
GetClientRect(hApplicationPageEndTaskButton, &rc);
MapWindowPoints(hApplicationPageEndTaskButton, hDlg, (LPPOINT)(PRECT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
cx = rc.left + nXDifference;
cy = rc.top + nYDifference;
SetWindowPos(hApplicationPageEndTaskButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
InvalidateRect(hApplicationPageEndTaskButton, NULL, TRUE);
-
+
GetClientRect(hApplicationPageSwitchToButton, &rc);
MapWindowPoints(hApplicationPageSwitchToButton, hDlg, (LPPOINT)(PRECT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
cx = rc.left + nXDifference;
cy = rc.top + nYDifference;
SetWindowPos(hApplicationPageSwitchToButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
InvalidateRect(hApplicationPageSwitchToButton, NULL, TRUE);
-
+
GetClientRect(hApplicationPageNewTaskButton, &rc);
MapWindowPoints(hApplicationPageNewTaskButton, hDlg, (LPPOINT)(PRECT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
cx = rc.left + nXDifference;
case WM_NOTIFY:
ApplicationPageOnNotify(wParam, lParam);
break;
-
+
}
return 0;
case LVN_ITEMCHANGED:
ApplicationPageUpdate();
break;
-
+
case LVN_GETDISPINFO:
pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)pnmdi->item.lParam;
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#ifndef __APPLICATIONPAGE_H
#define __APPLICATIONPAGE_H
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#ifndef __COLUMN_H
#define __COLUMN_H
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include "precomp.h"
/* TODO:
* Here it gets ugly :-(
* This is quick hack to get the address of first_dll in a running process
* We make the following assumptions:
- * - libwine (lib) is loaded in all processes at the same address (or
+ * - libwine (lib) is loaded in all processes at the same address (or
* at least at the same address at this process)
* - we load the same libwine.so version in this process and in the
* examined process
- * Final address is gotten by: 1/ querying the address of a known exported
+ * Final address is gotten by: 1/ querying the address of a known exported
* symbol out of libwine.so with dlsym, 2/ then querying nm on libwine.so to
* get the offset from the data segment of this known symbol and of first_dll,
* 3/ computing the actual address of first_dll by adding the result of 1/ and
* the delta of 2/.
- * Ugly, yes, but it somehow works. We should replace that with debughlp
+ * Ugly, yes, but it somehow works. We should replace that with debughlp
* library, that'd be way better. Exporting first_dll from libwine.so would make
* this code simpler, but still ugly.
*/
if (stat(buffer + 3, &s) == 0) break;
}
free(env);
- if (!ptr)
+ if (!ptr)
{
printf("Couldn't find %s in LD_LIBRARY_PATH\n", lib);
return NULL;
{
if (unique)
{
- /* since some channels are defined in multiple compilation units,
+ /* since some channels are defined in multiple compilation units,
* they will appear several times...
* so cache the channel's names we already reported and don't report
* them again
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#ifndef __DEBUG_H
#define __DEBUG_H
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include "precomp.h"
TCHAR szTemp[256];
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#ifndef __ENDPROC_H
#define __ENDPROC_H
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include "precomp.h"
void Font_DrawText(HDC hDC, LPCTSTR lpszText, int x, int y)
HBITMAP hFontBitmap;
HBITMAP hOldBitmap;
int i;
-
+
hFontDC = CreateCompatibleDC(hDC);
hFontBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_FONT));
hOldBitmap = (HBITMAP)SelectObject(hFontDC, hFontBitmap);
-
+
for (i = 0; i < (int)_tcslen(lpszText); i++) {
if ((lpszText[i] >= '0') && (lpszText[i] <= '9')) {
BitBlt(hDC, x + (i * 8), y, 8, 11, hFontDC, (lpszText[i] - '0') * 8, 0, SRCCOPY);
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#ifndef __FONT_H
#define __FONT_H
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include "precomp.h"
LONG OldGraphWndProc;
HDC hdc;
PAINTSTRUCT ps;
LONG WindowId;
-
+
switch (message)
{
case WM_ERASEBKGND:
case WM_SYSDEADCHAR:
case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
-
+
case WM_NCCALCSIZE:
return 0;
case WM_PAINT:
-
+
hdc = BeginPaint(hWnd, &ps);
WindowId = GetWindowLong(hWnd, GWL_ID);
Graph_DrawMemUsageHistoryGraph(hdc, hWnd);
break;
}
-
+
EndPaint(hWnd, &ps);
-
+
return 0;
-
+
}
-
+
/*
* We pass on all non-handled messages
*/
ULONG CpuUsage;
ULONG CpuKernelUsage;
int nBars;
- int nBarsUsed;
+ int nBarsUsed;
/* Bottom bars that are "used", i.e. are bright green, representing used cpu time */
- int nBarsUsedKernel;
+ int nBarsUsedKernel;
/* Bottom bars that are "used", i.e. are bright green, representing used cpu kernel time */
- int nBarsFree;
+ int nBarsFree;
/* Top bars that are "unused", i.e. are dark green, representing free cpu time */
int i;
-
+
/*
* Get the client area rectangle
*/
GetClientRect(hWnd, &rcClient);
-
+
/*
* Fill it with blackness
*/
FillSolidRect(hDC, &rcClient, RGB(0, 0, 0));
-
+
/*
* Get the CPU usage
*/
{
_stprintf(Text, _T(" %d%%"), (int)CpuUsage);
}
-
+
/*
* Draw the font text onto the graph
* The bottom 20 pixels are reserved for the text
{
FillSolidRect(hDC, &rcBarLeft, DARK_GREEN);
FillSolidRect(hDC, &rcBarRight, DARK_GREEN);
-
+
rcBarLeft.top += 3;
rcBarLeft.bottom += 3;
-
+
rcBarRight.top += 3;
rcBarRight.bottom += 3;
}
-
+
/*
* Draw the "used" bars
*/
FillSolidRect(hDC, &rcBarLeft, BRIGHT_GREEN);
FillSolidRect(hDC, &rcBarRight, BRIGHT_GREEN);
-
+
rcBarLeft.top += 3;
rcBarLeft.bottom += 3;
-
+
rcBarRight.top += 3;
rcBarRight.bottom += 3;
}
-
+
/*
* Draw the "used" kernel bars
*/
{
rcBarLeft.top -= 2;
rcBarLeft.bottom -= 2;
-
+
rcBarRight.top -= 2;
rcBarRight.bottom -= 2;
FillSolidRect(hDC, &rcBarLeft, RED);
FillSolidRect(hDC, &rcBarRight, RED);
-
+
rcBarLeft.top += 2;
rcBarLeft.bottom += 2;
-
+
rcBarRight.top += 2;
rcBarRight.bottom += 2;
FillSolidRect(hDC, &rcBarLeft, RED);
FillSolidRect(hDC, &rcBarRight, RED);
-
+
rcBarLeft.top++;
rcBarLeft.bottom++;
-
+
rcBarRight.top++;
rcBarRight.bottom++;
{
rcBarLeft.top++;
rcBarLeft.bottom++;
-
+
rcBarRight.top++;
rcBarRight.bottom++;
}
ULONGLONG CommitChargeTotal;
ULONGLONG CommitChargeLimit;
int nBars;
- int nBarsUsed = 0;
+ int nBarsUsed = 0;
/* Bottom bars that are "used", i.e. are bright green, representing used memory */
- int nBarsFree;
+ int nBarsFree;
/* Top bars that are "unused", i.e. are dark green, representing free memory */
int i;
-
+
/*
* Get the client area rectangle
*/
GetClientRect(hWnd, &rcClient);
-
+
/*
* Fill it with blackness
*/
FillSolidRect(hDC, &rcClient, RGB(0, 0, 0));
-
+
/*
* Get the memory usage
*/
CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
_stprintf(Text, _T("%dK"), (int)CommitChargeTotal);
-
+
/*
* Draw the font text onto the graph
* The bottom 20 pixels are reserved for the text
rcBarRight.right = rcBarLeft.right + 17;
rcBarLeft.top = rcBarRight.top = 5;
rcBarLeft.bottom = rcBarRight.bottom = 7;
-
+
/*
* Draw the "free" bars
*/
{
FillSolidRect(hDC, &rcBarLeft, DARK_GREEN);
FillSolidRect(hDC, &rcBarRight, DARK_GREEN);
-
+
rcBarLeft.top += 3;
rcBarLeft.bottom += 3;
-
+
rcBarRight.top += 3;
rcBarRight.bottom += 3;
}
-
+
/*
* Draw the "used" bars
*/
{
FillSolidRect(hDC, &rcBarLeft, BRIGHT_GREEN);
FillSolidRect(hDC, &rcBarRight, BRIGHT_GREEN);
-
+
rcBarLeft.top += 3;
rcBarLeft.bottom += 3;
-
+
rcBarRight.top += 3;
rcBarRight.bottom += 3;
}
ULONGLONG CommitChargeLimit;
int i;
static int offset = 0;
-
+
if (offset++ >= 10)
offset = 0;
-
+
/*
* Get the client area rectangle
*/
GetClientRect(hWnd, &rcClient);
-
+
/*
* Fill it with blackness
*/
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#ifndef __GRAPH_H
#define __GRAPH_H
this->m_hWnd = 0;
this->m_hParentWnd = 0;
this->m_dcGrid = 0;
- this->m_dcPlot = 0;
+ this->m_dcPlot = 0;
this->m_bitmapOldGrid = 0;
this->m_bitmapOldPlot = 0;
this->m_bitmapGrid = 0;
this->m_bitmapPlot = 0;
this->m_brushBack = 0;
-
+
this->m_penPlot[0] = 0;
this->m_penPlot[1] = 0;
this->m_penPlot[2] = 0;
this->m_penPlot[3] = 0;
-
+
/* since plotting is based on a LineTo for each new point
* we need a starting point (i.e. a "previous" point)
* use 0.0 as the default first point.
/* set some initial values for the scaling until "SetRange" is called.
* these are protected varaibles and must be set with SetRange
- * in order to ensure that m_dRange is updated accordingly
+ * in order to ensure that m_dRange is updated accordingly
*/
/* m_dLowerLimit = -10.0; */
/* m_dUpperLimit = 10.0; */
this->m_crPlotColor[3] = RGB(255, 255, 100); /* see also SetPlotColor */
/* protected variables */
- for (i = 0; i < MAX_PLOTS; i++)
+ for (i = 0; i < MAX_PLOTS; i++)
{
this->m_penPlot[i] = CreatePen(PS_SOLID, 0, this->m_crPlotColor[i]);
}
{
/* just to be picky restore the bitmaps for the two memory dc's */
/* (these dc's are being destroyed so there shouldn't be any leaks) */
- if (m_bitmapOldGrid != NULL) SelectObject(m_dcGrid, m_bitmapOldGrid);
- if (m_bitmapOldPlot != NULL) SelectObject(m_dcPlot, m_bitmapOldPlot);
+ if (m_bitmapOldGrid != NULL) SelectObject(m_dcGrid, m_bitmapOldGrid);
+ if (m_bitmapOldPlot != NULL) SelectObject(m_dcPlot, m_bitmapOldPlot);
if (m_bitmapGrid != NULL) DeleteObject(m_bitmapGrid);
if (m_bitmapPlot != NULL) DeleteObject(m_bitmapPlot);
if (m_dcGrid != NULL) DeleteDC(m_dcGrid);
}
#endif
-BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, UINT nID)
+BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, UINT nID)
{
BOOL result = 0;
this->m_dUpperLimit = dUpper;
this->m_nYDecimals = nDecimalPlaces;
this->m_dRange = this->m_dUpperLimit - this->m_dLowerLimit;
- this->m_dVerticalFactor = (double)this->m_nPlotHeight / this->m_dRange;
+ this->m_dVerticalFactor = (double)this->m_nPlotHeight / this->m_dRange;
/* clear out the existing garbage, re-start with a clean plot */
GraphCtrl_InvalidateCtrl(this);
}
this->m_bitmapGrid = CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight);
this->m_bitmapOldGrid = (HBITMAP)SelectObject(this->m_dcGrid, this->m_bitmapGrid);
}
-
+
SetBkColor(this->m_dcGrid, this->m_crBackColor);
/* fill the grid background */
/* add the units digit, decimal point and a minus sign, and an extra space */
/* as well as the number of decimal places to display */
- nCharacters = nCharacters + 4 + this->m_nYDecimals;
+ nCharacters = nCharacters + 4 + this->m_nYDecimals;
/* adjust the plot rectangle dimensions */
/* assume 6 pixels per character (this may need to be adjusted) */
this->m_nPlotWidth = this->m_rectPlot.right - this->m_rectPlot.left;/* m_rectPlot.Width(); */
/* draw the plot rectangle */
- oldPen = (HPEN)SelectObject(this->m_dcGrid, solidPen);
+ oldPen = (HPEN)SelectObject(this->m_dcGrid, solidPen);
MoveToEx(this->m_dcGrid, this->m_rectPlot.left, this->m_rectPlot.top, NULL);
LineTo(this->m_dcGrid, this->m_rectPlot.right+1, this->m_rectPlot.top);
LineTo(this->m_dcGrid, this->m_rectPlot.right+1, this->m_rectPlot.bottom+1);
LineTo(this->m_dcGrid, this->m_rectPlot.left, this->m_rectPlot.bottom+1);
/* LineTo(m_dcGrid, m_rectPlot.left, m_rectPlot.top); */
- SelectObject(this->m_dcGrid, oldPen);
+ SelectObject(this->m_dcGrid, oldPen);
DeleteObject(solidPen);
- /* draw the dotted lines,
- * use SetPixel instead of a dotted pen - this allows for a
+ /* draw the dotted lines,
+ * use SetPixel instead of a dotted pen - this allows for a
* finer dotted line and a more "technical" look
*/
nMidGridPix = (this->m_rectPlot.top + this->m_rectPlot.bottom)/2;
nTopGridPix = nMidGridPix - this->m_nPlotHeight/4;
nBottomGridPix = nMidGridPix + this->m_nPlotHeight/4;
- for (i=this->m_rectPlot.left; i<this->m_rectPlot.right; i+=2)
+ for (i=this->m_rectPlot.left; i<this->m_rectPlot.right; i+=2)
{
SetPixel(this->m_dcGrid, i, nTopGridPix, this->m_crGridColor);
SetPixel(this->m_dcGrid, i, nMidGridPix, this->m_crGridColor);
/* (these may need to be adjusted depending on the display) */
axisFont = CreateFont (14, 0, 0, 0, 300,
FALSE, FALSE, 0, ANSI_CHARSET,
- OUT_DEFAULT_PRECIS,
+ OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
- DEFAULT_QUALITY,
+ DEFAULT_QUALITY,
DEFAULT_PITCH|FF_SWISS, "Arial");
yUnitFont = CreateFont (14, 0, 900, 0, 300,
FALSE, FALSE, 0, ANSI_CHARSET,
- OUT_DEFAULT_PRECIS,
+ OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
- DEFAULT_QUALITY,
+ DEFAULT_QUALITY,
DEFAULT_PITCH|FF_SWISS, "Arial");
-
+
/* grab the horizontal font */
oldFont = (HFONT)SelectObject(m_dcGrid, axisFont);
-
+
/* y max */
SetTextColor(m_dcGrid, m_crGridColor);
SetTextAlign(m_dcGrid, TA_RIGHT|TA_TOP);
/* x max */
SetTextAlign(m_dcGrid, TA_RIGHT|TA_TOP);
- sprintf(strTemp, "%d", m_nPlotWidth/m_nShiftPixels);
+ sprintf(strTemp, "%d", m_nPlotWidth/m_nShiftPixels);
TextOut(m_dcGrid, m_rectPlot.right, m_rectPlot.bottom+4, strTemp, _tcslen(strTemp));
/* x units */
SetTextAlign(m_dcGrid, TA_CENTER|TA_TOP);
- TextOut(m_dcGrid, (m_rectPlot.left+m_rectPlot.right)/2,
+ TextOut(m_dcGrid, (m_rectPlot.left+m_rectPlot.right)/2,
m_rectPlot.bottom+4, m_strXUnitsString, _tcslen(m_strXUnitsString));
/* restore the font */
/* y units */
oldFont = (HFONT)SelectObject(m_dcGrid, yUnitFont);
SetTextAlign(m_dcGrid, TA_CENTER|TA_BASELINE);
- TextOut(m_dcGrid, (m_rectClient.left+m_rectPlot.left)/2,
+ TextOut(m_dcGrid, (m_rectClient.left+m_rectPlot.left)/2,
(m_rectPlot.bottom+m_rectPlot.top)/2, m_strYUnitsString, _tcslen(m_strYUnitsString));
SelectObject(m_dcGrid, oldFont);
#endif
/* at this point we are done filling the the grid bitmap, */
/* no more drawing to this bitmap is needed until the setting are changed */
-
+
/* if we don't have one yet, set up a memory dc for the plot */
- if (this->m_dcPlot == NULL)
+ if (this->m_dcPlot == NULL)
{
this->m_dcPlot = CreateCompatibleDC(dc);
this->m_bitmapPlot = CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight);
ReleaseDC(this->m_hParentWnd, dc);
}
-double GraphCtrl_AppendPoint(TGraphCtrl* this,
+double GraphCtrl_AppendPoint(TGraphCtrl* this,
double dNewPoint0, double dNewPoint1,
double dNewPoint2, double dNewPoint3)
{
/* append a data point to the plot & return the previous point */
double dPrevious;
-
+
dPrevious = this->m_dCurrentPosition[0];
this->m_dCurrentPosition[0] = dNewPoint0;
this->m_dCurrentPosition[1] = dNewPoint1;
return dPrevious;
}
-void GraphCtrl_Paint(TGraphCtrl* this, HWND hWnd, HDC dc)
+void GraphCtrl_Paint(TGraphCtrl* this, HWND hWnd, HDC dc)
{
HDC memDC;
HBITMAP memBitmap;
/* no real plotting work is performed here, */
/* just putting the existing bitmaps on the client */
-
+
/* to avoid flicker, establish a memory dc, draw to it */
/* and then BitBlt it to the client */
memDC = CreateCompatibleDC(dc);
memBitmap = (HBITMAP)CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight);
oldBitmap = (HBITMAP)SelectObject(memDC, memBitmap);
- if (memDC != NULL)
+ if (memDC != NULL)
{
/* first drop the grid on the memory dc */
BitBlt(memDC, 0, 0, this->m_nClientWidth, this->m_nClientHeight, this->m_dcGrid, 0, 0, SRCCOPY);
HPEN oldPen;
RECT rectCleanUp;
int i;
-
- if (this->m_dcPlot != NULL)
+
+ if (this->m_dcPlot != NULL)
{
- /* shift the plot by BitBlt'ing it to itself
+ /* shift the plot by BitBlt'ing it to itself
* note: the m_dcPlot covers the entire client
- * but we only shift bitmap that is the size
+ * but we only shift bitmap that is the size
* of the plot rectangle
* grab the right side of the plot (exluding m_nShiftPixels on the left)
* move this grabbed bitmap to the left by m_nShiftPixels
*/
- BitBlt(this->m_dcPlot, this->m_rectPlot.left, this->m_rectPlot.top+1,
- this->m_nPlotWidth, this->m_nPlotHeight, this->m_dcPlot,
- this->m_rectPlot.left+this->m_nShiftPixels, this->m_rectPlot.top+1,
+ BitBlt(this->m_dcPlot, this->m_rectPlot.left, this->m_rectPlot.top+1,
+ this->m_nPlotWidth, this->m_nPlotHeight, this->m_dcPlot,
+ this->m_rectPlot.left+this->m_nShiftPixels, this->m_rectPlot.top+1,
SRCCOPY);
/* establish a rectangle over the right side of plot */
FillRect(this->m_dcPlot, &rectCleanUp, this->m_brushBack);
/* draw the next line segement */
- for (i = 0; i < MAX_PLOTS; i++)
+ for (i = 0; i < MAX_PLOTS; i++)
{
/* grab the plotting pen */
oldPen = (HPEN)SelectObject(this->m_dcPlot, this->m_penPlot[i]);
/* move to the previous point */
prevX = this->m_rectPlot.right-this->m_nPlotShiftPixels;
- prevY = this->m_rectPlot.bottom -
+ prevY = this->m_rectPlot.bottom -
(long)((this->m_dPreviousPosition[i] - this->m_dLowerLimit) * this->m_dVerticalFactor);
MoveToEx(this->m_dcPlot, prevX, prevY, NULL);
* this will facilitate clipping on an as needed basis
* as opposed to always calling IntersectClipRect
*/
- if ((prevY <= this->m_rectPlot.top) || (currY <= this->m_rectPlot.top))
+ if ((prevY <= this->m_rectPlot.top) || (currY <= this->m_rectPlot.top))
{
RECT rc;
rc.bottom = this->m_rectPlot.top+1;
rc.top = this->m_rectClient.top;
FillRect(this->m_dcPlot, &rc, this->m_brushBack);
}
- if ((prevY >= this->m_rectPlot.bottom) || (currY >= this->m_rectPlot.bottom))
+ if ((prevY >= this->m_rectPlot.bottom) || (currY >= this->m_rectPlot.bottom))
{
RECT rc;
rc.bottom = this->m_rectClient.bottom+1;
}
}
-void GraphCtrl_Resize(TGraphCtrl* this)
+void GraphCtrl_Resize(TGraphCtrl* this)
{
/* NOTE: Resize automatically gets called during the setup of the control */
GetClientRect(this->m_hWnd, &this->m_rectClient);
/* the "left" coordinate and "width" will be modified in */
/* InvalidateCtrl to be based on the width of the y axis scaling */
#if 0
- this->m_rectPlot.left = 20;
+ this->m_rectPlot.left = 20;
this->m_rectPlot.top = 10;
this->m_rectPlot.right = this->m_rectClient.right-10;
this->m_rectPlot.bottom = this->m_rectClient.bottom-25;
#else
- this->m_rectPlot.left = 0;
+ this->m_rectPlot.left = 0;
this->m_rectPlot.top = -1;
this->m_rectPlot.right = this->m_rectClient.right-0;
this->m_rectPlot.bottom = this->m_rectClient.bottom-0;
/* set the scaling factor for now, this can be adjusted */
/* in the SetRange functions */
- this->m_dVerticalFactor = (double)this->m_nPlotHeight / this->m_dRange;
+ this->m_dVerticalFactor = (double)this->m_nPlotHeight / this->m_dRange;
}
#if 0
RECT rcClient;
HDC hdc;
PAINTSTRUCT ps;
-
- switch (message)
+
+ switch (message)
{
case WM_ERASEBKGND:
return TRUE;
- /*
+ /*
* Filter out mouse & keyboard messages
- */
+ */
/* case WM_APPCOMMAND: */
case WM_CAPTURECHANGED:
case WM_LBUTTONDBLCLK:
return 0;
case WM_SIZE:
- if (hWnd == hPerformancePageMemUsageHistoryGraph)
+ if (hWnd == hPerformancePageMemUsageHistoryGraph)
{
GraphCtrl_Resize(&PerformancePageMemUsageHistoryGraph);
GraphCtrl_InvalidateCtrl(&PerformancePageMemUsageHistoryGraph);
}
- if (hWnd == hPerformancePageCpuUsageHistoryGraph)
+ if (hWnd == hPerformancePageCpuUsageHistoryGraph)
{
GraphCtrl_Resize(&PerformancePageCpuUsageHistoryGraph);
GraphCtrl_InvalidateCtrl(&PerformancePageCpuUsageHistoryGraph);
EndPaint(hWnd, &ps);
return 0;
}
-
- /*
+
+ /*
* We pass on all non-handled messages
- */
+ */
return CallWindowProc((WNDPROC)OldGraphCtrlWndProc, hWnd, message, wParam, lParam);
}
COLORREF m_crBackColor; /* background color */
COLORREF m_crGridColor; /* grid color */
COLORREF m_crPlotColor[MAX_PLOTS]; /* data color */
-
+
double m_dCurrentPosition[MAX_PLOTS]; /* current position */
double m_dPreviousPosition[MAX_PLOTS]; /* previous position */
} TGraphCtrl;
extern LONG OldGraphCtrlWndProc;
-double GraphCtrl_AppendPoint(TGraphCtrl* this,
+double GraphCtrl_AppendPoint(TGraphCtrl* this,
double dNewPoint0, double dNewPoint1,
double dNewPoint2, double dNewPoint3);
-BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd,
+BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd,
UINT nID);
void GraphCtrl_DrawPoint(TGraphCtrl* this);
void GraphCtrl_InvalidateCtrl(TGraphCtrl* this);
void GraphCtrl_Paint(TGraphCtrl* this, HWND hWnd, HDC dc);
void GraphCtrl_Reset(TGraphCtrl* this);
-void GraphCtrl_Resize(TGraphCtrl* this);
-void GraphCtrl_SetBackgroundColor(TGraphCtrl* this, COLORREF
+void GraphCtrl_Resize(TGraphCtrl* this);
+void GraphCtrl_SetBackgroundColor(TGraphCtrl* this, COLORREF
color);
void GraphCtrl_SetGridColor(TGraphCtrl* this, COLORREF color);
-void GraphCtrl_SetPlotColor(TGraphCtrl* this, int plot, COLORREF
+void GraphCtrl_SetPlotColor(TGraphCtrl* this, int plot, COLORREF
color);
-void GraphCtrl_SetRange(TGraphCtrl* this, double dLower, double
+void GraphCtrl_SetRange(TGraphCtrl* this, double dLower, double
dUpper, int nDecimalPlaces);
INT_PTR CALLBACK GraphCtrl_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
/*
* options.c
*
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
/*
* Menu item handlers for the options menu.
*/
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include "precomp.h"
CRITICAL_SECTION PerfDataCriticalSection;
BOOL PerfDataInitialize(void)
{
NTSTATUS status;
-
+
InitializeCriticalSection(&PerfDataCriticalSection);
-
+
/*
* Get number of processors in the system
*/
status = NtQuerySystemInformation(SystemBasicInformation, &SystemBasicInfo, sizeof(SystemBasicInfo), NULL);
if (status != NO_ERROR)
return FALSE;
-
+
return TRUE;
}
* Save system cache info
*/
memcpy(&SystemCacheInfo, &SysCacheInfo, sizeof(SYSTEM_CACHE_INFORMATION));
-
+
/*
* Save system processor time info
*/
HeapFree(GetProcessHeap(), 0, SystemProcessorTimeInfo);
}
SystemProcessorTimeInfo = SysProcessorTimeInfo;
-
+
/*
* Save system handle info
*/
memcpy(&SystemHandleInfo, SysHandleInfoData, sizeof(SYSTEM_HANDLE_INFORMATION));
HeapFree(GetProcessHeap(), 0, SysHandleInfoData);
-
+
for (CurrentKernelTime=0, Idx=0; Idx<SystemBasicInfo.NumberProcessors; Idx++) {
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].KernelTime);
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].DpcTime);
/* CurrentCpuIdle = IdleTime / SystemTime */
dbIdleTime = dbIdleTime / dbSystemTime;
dbKernelTime = dbKernelTime / dbSystemTime;
-
+
/* CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessors */
dbIdleTime = 100.0 - dbIdleTime * 100.0 / (double)SystemBasicInfo.NumberProcessors; /* + 0.5; */
dbKernelTime = 100.0 - dbKernelTime * 100.0 / (double)SystemBasicInfo.NumberProcessors; /* + 0.5; */
pPerfData[Idx].HandleCount = pSPI->HandleCount;
pPerfData[Idx].ThreadCount = pSPI->NumberOfThreads;
pPerfData[Idx].SessionId = pSPI->SessionId;
-
+
if (pSPI->UniqueProcessId != NULL) {
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, (DWORD)pSPI->UniqueProcessId);
if (hProcess) {
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#ifndef __PERFDATA_H
#define __PERFDATA_H
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include "precomp.h"
TGraphCtrl PerformancePageCpuUsageHistoryGraph;
}
InvalidateRect(hCntrl, NULL, TRUE);
}
-
+
void AdjustControlPostion(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference)
{
AdjustFrameSize(hCntrl, hDlg, nXDifference, nYDifference, 0);
}
-
+
void AdjustCntrlPos(int ctrl_id, HWND hDlg, int nXDifference, int nYDifference)
{
AdjustFrameSize(GetDlgItem(hDlg, ctrl_id), hDlg, nXDifference, nYDifference, 0);
}
-
+
INT_PTR CALLBACK
PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_INITDIALOG:
-
+
/* Save the width and height */
GetClientRect(hDlg, &rc);
nPerformancePageWidth = rc.right;
/* Update window position */
SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
- /*
+ /*
* Get handles to all the controls
- */
+ */
hPerformancePageTotalsFrame = GetDlgItem(hDlg, IDC_TOTALS_FRAME);
hPerformancePageCommitChargeFrame = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_FRAME);
hPerformancePageKernelMemoryFrame = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_FRAME);
hPerformancePageMemUsageGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_GRAPH);
hPerformancePageMemUsageHistoryGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_HISTORY_GRAPH);
hPerformancePageCpuUsageHistoryGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
-
+
GetClientRect(hPerformancePageCpuUsageHistoryGraph, &rc);
/* create the control */
/* PerformancePageCpuUsageHistoryGraph.Create(0, rc, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); */
CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, NULL);
#endif
- /*
+ /*
* Subclass graph buttons
- */
+ */
OldGraphWndProc = SetWindowLongPtr(hPerformancePageCpuUsageGraph, GWL_WNDPROC, (DWORD_PTR)Graph_WndProc);
SetWindowLongPtr(hPerformancePageMemUsageGraph, GWL_WNDPROC, (DWORD_PTR)Graph_WndProc);
OldGraphCtrlWndProc = SetWindowLongPtr(hPerformancePageMemUsageHistoryGraph, GWL_WNDPROC, (DWORD_PTR)GraphCtrl_WndProc);
AdjustControlPostion(hPerformancePageTotalsProcessCountEdit, hDlg, 0, nYDifference);
AdjustControlPostion(hPerformancePageTotalsThreadCountEdit, hDlg, 0, nYDifference);
- nXDifference += lastX;
- nYDifference += lastY;
- lastX = lastY = 0;
+ nXDifference += lastX;
+ nYDifference += lastY;
+ lastX = lastY = 0;
if (nXDifference % 2) {
if (nXDifference > 0) {
nXDifference--;
/* Reset our event */
ResetEvent(hPerformancePageEvent);
- /*
+ /*
* Update the commit charge info
- */
+ */
CommitChargeTotal = PerfDataGetCommitChargeTotalK();
CommitChargeLimit = PerfDataGetCommitChargeLimitK();
CommitChargePeak = PerfDataGetCommitChargePeakK();
wsprintf(Text, szMemUsage, CommitChargeTotal, CommitChargeLimit);
SendMessage(hStatusWnd, SB_SETTEXT, 2, (LPARAM)Text);
- /*
+ /*
* Update the kernel memory info
- */
+ */
KernelMemoryTotal = PerfDataGetKernelMemoryTotalK();
KernelMemoryPaged = PerfDataGetKernelMemoryPagedK();
KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK();
_ultot(KernelMemoryNonPaged, Text, 10);
SetWindowText(hPerformancePageKernelMemoryNonPagedEdit, Text);
- /*
+ /*
* Update the physical memory info
- */
+ */
PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK();
_ultot(PhysicalMemorySystemCache, Text, 10);
SetWindowText(hPerformancePagePhysicalMemorySystemCacheEdit, Text);
- /*
+ /*
* Update the totals info
- */
+ */
TotalHandles = PerfDataGetSystemHandleCount();
TotalThreads = PerfDataGetTotalThreadCount();
TotalProcesses = PerfDataGetProcessCount();
_ultot(TotalProcesses, Text, 10);
SetWindowText(hPerformancePageTotalsProcessCountEdit, Text);
- /*
+ /*
* Redraw the graphs
- */
+ */
InvalidateRect(hPerformancePageCpuUsageGraph, NULL, FALSE);
InvalidateRect(hPerformancePageMemUsageGraph, NULL, FALSE);
- /*
+ /*
* Get the CPU usage
- */
+ */
CpuUsage = PerfDataGetProcessorUsage();
CpuKernelUsage = PerfDataGetProcessorSystemUsage();
if (CpuUsage < 0 ) CpuUsage = 0;
if (CpuKernelUsage < 0) CpuKernelUsage = 0;
if (CpuKernelUsage > 100) CpuKernelUsage = 100;
- /*
+ /*
* Get the memory usage
- */
+ */
CommitChargeTotal = (ULONGLONG)PerfDataGetCommitChargeTotalK();
CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
nBarsUsed1 = CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0;
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#ifndef __PERFORMANCEPAGE_H
#define __PERFORMANCEPAGE_H
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include "precomp.h"
TCHAR szTemp[256];
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#ifndef __PRIORITY_H
#define __PRIORITY_H
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include "precomp.h"
* saved earlier
*/
RestoreDC(hDC, DcSave);
-
+
return TRUE;
}
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#ifndef __PROCLIST_H
#define __PROCLIST_H
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include "precomp.h"
HWND hProcessPage; /* Process List Property Page */
cy = (rc.bottom - rc.top) + nYDifference;
SetWindowPos(hProcessPageListCtrl, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER);
InvalidateRect(hProcessPageListCtrl, NULL, TRUE);
-
+
GetClientRect(hProcessPageEndProcessButton, &rc);
MapWindowPoints(hProcessPageEndProcessButton, hDlg, (LPPOINT)(PRECT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
cx = rc.left + nXDifference;
cy = rc.top + nYDifference;
SetWindowPos(hProcessPageEndProcessButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
InvalidateRect(hProcessPageEndProcessButton, NULL, TRUE);
-
+
GetClientRect(hProcessPageShowAllProcessesButton, &rc);
MapWindowPoints(hProcessPageShowAllProcessesButton, hDlg, (LPPOINT)(PRECT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
cx = rc.left;
ProcessPageUpdate();
break;
#endif
-
+
case LVN_GETDISPINFO:
if (!(pnmdi->item.mask & LVIF_TEXT))
break;
-
+
ColumnIndex = pnmdi->item.iSubItem;
Index = pnmdi->item.iItem;
if (si.dwNumberOfProcessors < 2)
RemoveMenu(hSubMenu, ID_PROCESS_PAGE_SETAFFINITY, MF_BYCOMMAND);
-
+
if (!DebugChannelsAreSupported())
RemoveMenu(hSubMenu, ID_PROCESS_PAGE_DEBUGCHANNELS, MF_BYCOMMAND);
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#ifndef __PROCESSPAGE_H
#define __PROCESSPAGE_H
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 157
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include "precomp.h"
void TaskManager_OnFileNew(void)
{
WCHAR wTitle[40];
WCHAR wText[256];
-
+
/* RunFileDlg is always unicode on NT systems, convert the ansi
strings to unicode */
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTitle, -1, wTitle, sizeof(szTitle) / sizeof(szTitle[0]));
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szText, -1, wText, sizeof(szText) / sizeof(szText[0]));
-
+
RunFileDlg(hMainWnd, 0, NULL, wTitle, wText, RFF_CALCDIRECTORY);
}
else
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ *
* run.h - definitions necessary to use Microsoft's "Run" dialog
* Undocumented Windows call
* use the type below to declare a function pointer
void TaskManager_OnFileNew(void);
typedef void (WINAPI *RUNFILEDLG)(
-HWND hwndOwner,
-HICON hIcon,
+HWND hwndOwner,
+HICON hIcon,
LPCWSTR lpstrDirectory,
LPCWSTR lpstrTitle,
LPCWSTR lpstrDescription,
-UINT uFlags);
+UINT uFlags);
/*
* Flags for RunFileDlg
int nCmdShow)
{
HANDLE hProcess;
- HANDLE hToken;
- TOKEN_PRIVILEGES tkp;
+ HANDLE hToken;
+ TOKEN_PRIVILEGES tkp;
/* Initialize global variables */
hInst = hInstance;
CloseHandle(hProcess);
/* Now lets get the SE_DEBUG_NAME privilege
- * so that we can debug processes
+ * so that we can debug processes
*/
/* Get a token for this process. */
if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) {
/* Get the LUID for the debug privilege. */
- LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tkp.Privileges[0].Luid);
+ LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1; /* one privilege to set */
- tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+ tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
/* Get the debug privilege for this process. */
- AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
+ AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
}
/* Load our settings from the registry */
}
DialogBox(hInst, (LPCTSTR)IDD_TASKMGR_DIALOG, NULL, TaskManagerWndProc);
-
+
/* Save our settings to the registry */
SaveSettings();
PerfDataUninitialize();
case ID_FILE_EXIT:
EndDialog(hDlg, IDOK);
break;
- }
+ }
break;
case WM_ONTRAYICON:
POINT pt;
BOOL OnTop;
HMENU hMenu, hPopupMenu;
-
+
GetCursorPos(&pt);
-
+
OnTop = ((GetWindowLong(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0);
-
+
hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_TRAY_POPUP));
hPopupMenu = GetSubMenu(hMenu, 0);
-
+
if(IsWindowVisible(hMainWnd))
{
DeleteMenu(hPopupMenu, ID_RESTORE, MF_BYCOMMAND);
{
SetMenuDefaultItem(hPopupMenu, ID_RESTORE, FALSE);
}
-
+
if(OnTop)
{
CheckMenuItem(hPopupMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND | MF_CHECKED);
}
-
+
SetForegroundWindow(hMainWnd);
TrackPopupMenuEx(hPopupMenu, 0, pt.x, pt.y, hMainWnd, NULL);
-
+
DestroyMenu(hMenu);
break;
}
else
TaskManagerSettings.Maximized = FALSE;
return DefWindowProc(hDlg, message, wParam, lParam);
-
+
case WM_TIMER:
/* Refresh the performance data */
PerfDataRefresh();
cx = (rc.right - rc.left) + nXDifference;
cy = (rc.bottom - rc.top) + nYDifference;
SetWindowPos(hApplicationPage, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER);
-
+
/* Resize the process page */
GetWindowRect(hProcessPage, &rc);
cx = (rc.right - rc.left) + nXDifference;
cy = (rc.bottom - rc.top) + nYDifference;
SetWindowPos(hProcessPage, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER);
-
+
/* Resize the performance page */
GetWindowRect(hPerformancePage, &rc);
cx = (rc.right - rc.left) + nXDifference;
hMenu = GetMenu(hMainWnd);
hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
OnTop = ((GetWindowLong(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0);
-
+
OpenIcon(hMainWnd);
SetForegroundWindow(hMainWnd);
SetWindowPos(hMainWnd, (OnTop ? HWND_TOPMOST : HWND_TOP), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
/* Update speed settings */
/* How many half-seconds in between updates (i.e. 0 - Paused, 1 - High, 2 - Normal, 4 - Low) */
- int UpdateSpeed;
+ int UpdateSpeed;
/* Applications page settings */
BOOL View_LargeIcons;
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include "precomp.h"
HICON TrayIcon_GetProcessorUsageIcon(void)
hScreenDC = GetDC(NULL);
if (!hScreenDC)
goto done;
-
+
/*
* Create our own DC from it
*/
hBitmapBrush = CreateSolidBrush(RGB(0, 255, 0));
if (!hBitmapBrush)
goto done;
-
+
/*
* Select the bitmap into our device context
* so we can draw on it.
*/
SelectObject(hDC, hOldBitmap);
hOldBitmap = NULL;
-
+
iconInfo.fIcon = TRUE;
iconInfo.xHotspot = 0;
iconInfo.yHotspot = 0;
DeleteObject(hBitmap);
if (hBitmapMask)
DeleteObject(hBitmapMask);
-
+
/*
* Return the newly created tray icon (if successful)
*/
{
NOTIFYICONDATA nid;
BOOL bRetVal;
-
+
memset(&nid, 0, sizeof(NOTIFYICONDATA));
-
+
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hMainWnd;
nid.uID = 0;
nid.uFlags = 0;
nid.uCallbackMessage = WM_ONTRAYICON;
-
+
bRetVal = Shell_NotifyIcon(NIM_DELETE, &nid);
-
+
return bRetVal;
}
HICON hIcon = NULL;
BOOL bRetVal;
TCHAR szTemp[256];
-
+
memset(&nid, 0, sizeof(NOTIFYICONDATA));
-
+
hIcon = TrayIcon_GetProcessorUsageIcon();
-
+
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hMainWnd;
nid.uID = 0;
nid.hIcon = hIcon;
LoadString(hInst, IDS_MSG_TRAYICONCPUUSAGE, szTemp, 256);
wsprintf(nid.szTip, szTemp, PerfDataGetProcessorUsage());
-
+
bRetVal = Shell_NotifyIcon(NIM_MODIFY, &nid);
-
+
if (hIcon)
DestroyIcon(hIcon);
-
+
return bRetVal;
}
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#ifndef __TRAYICON_H
#define __TRAYICON_H
DWORD Type, Size;
WCHAR Shell[MAX_PATH];
BOOL Ret = FALSE;
-
- if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- L"SOFTWARE\\ReactOS\\Windows NT\\CurrentVersion\\Winlogon",
+
+ if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ L"SOFTWARE\\ReactOS\\Windows NT\\CurrentVersion\\Winlogon",
0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
Size = MAX_PATH * sizeof(WCHAR);
}
RegCloseKey(hKey);
}
-
+
if(!Ret)
{
if(GetWindowsDirectory(CommandLine, MAX_PATH - 13))
else
wcscpy(CommandLine, L"explorer.exe");
}
-
+
return Ret;
}
WCHAR Shell[MAX_PATH];
WCHAR ExpandedShell[MAX_PATH];
TCHAR szMsg[RC_STRING_MAX_SIZE];
-
+
GetShell(Shell);
-
+
ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
-
+
ExpandEnvironmentStrings(Shell, ExpandedShell, MAX_PATH);
-
+
if(CreateProcess(NULL,
ExpandedShell,
NULL,
HKEY hKey;
DWORD Type, Size;
WCHAR szWallpaper[MAX_PATH + 1];
-
+
if(RegOpenKeyEx(HKEY_CURRENT_USER,
L"Control Panel\\Desktop",
0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
INSERT_LAST,
L"SelectedColor",
L"Gray");
-
+
/* TimeOut=5 */
IniCacheInsertKey(IniSection,
NULL,
DPRINT("Bad MSZIP block header magic (0x%X)\n", Magic);
return CS_BADSTREAM;
}
-
+
ZStream.next_in = (PUCHAR)((ULONG)InputBuffer + 2);
ZStream.avail_in = InputLength - 2;
ZStream.next_out = (PUCHAR)OutputBuffer;
NTSTATUS errCode;
IO_STATUS_BLOCK IoStatusBlock;
LARGE_INTEGER Distance;
-
+
DPRINT("SeekInFile(hFile %x, lDistanceToMove %d, dwMoveMethod %d)\n",
hFile,lDistanceToMove,dwMoveMethod);
-
+
Distance.u.LowPart = lDistanceToMove;
if (lpDistanceToMoveHigh)
{
{
Distance.u.HighPart = -1;
}
-
+
if (dwMoveMethod == SEEK_CURRENT)
{
NtQueryInformationFile(hFile,
{
FilePosition.CurrentByteOffset.QuadPart = Distance.QuadPart;
}
-
+
// DPRINT1("GOTO FILE OFFSET: %I64d\n", FilePosition.CurrentByteOffset.QuadPart);
errCode = NtSetInformationFile(hFile,
}
return -1;
}
-
+
if (lpDistanceToMoveHigh != NULL)
{
*lpDistanceToMoveHigh = FilePosition.CurrentByteOffset.u.HighPart;
static BOOL
ConvertSystemTimeToFileTime(
- CONST SYSTEMTIME * lpSystemTime,
+ CONST SYSTEMTIME * lpSystemTime,
LPFILETIME lpFileTime)
{
TIME_FIELDS TimeFields;
LARGE_INTEGER liTime;
-
+
TimeFields.Year = lpSystemTime->wYear;
TimeFields.Month = lpSystemTime->wMonth;
TimeFields.Day = lpSystemTime->wDay;
TimeFields.Minute = lpSystemTime->wMinute;
TimeFields.Second = lpSystemTime->wSecond;
TimeFields.Milliseconds = lpSystemTime->wMilliseconds;
-
+
if (RtlTimeFieldsToTime(&TimeFields, &liTime))
{
lpFileTime->dwLowDateTime = liTime.u.LowPart;
PDOSTIME pdtime = (PDOSTIME) &wFatTime;
PDOSDATE pddate = (PDOSDATE) &wFatDate;
SYSTEMTIME SystemTime;
-
+
if (lpFileTime == NULL)
return FALSE;
-
+
SystemTime.wMilliseconds = 0;
SystemTime.wSecond = pdtime->Second;
SystemTime.wMinute = pdtime->Minute;
SystemTime.wHour = pdtime->Hour;
-
+
SystemTime.wDay = pddate->Day;
SystemTime.wMonth = pddate->Month;
SystemTime.wYear = 1980 + pddate->Year;
-
+
ConvertSystemTimeToFileTime(&SystemTime,lpFileTime);
-
+
return TRUE;
}
*/
{
ULONG i, j;
-
+
j = i = 0;
-
+
while (Path [i++])
{
if (Path[i - 1] == L'\\') j = i;
{
PWCHAR FileName;
DWORD i;
-
+
i = 0;
FileName = GetFileName(Path + i);
-
+
if ((FileName != (Path + i)) && (FileName [-1] == L'\\'))
FileName--;
if ((FileName == (Path + i)) && (FileName [0] == L'\\'))
Node = (PCFFOLDER_NODE)RtlAllocateHeap (ProcessHeap, 0, sizeof(CFFOLDER_NODE));
if (!Node)
return NULL;
-
+
RtlZeroMemory(Node, sizeof(CFFOLDER_NODE));
-
+
Node->Folder.CompressionType = CAB_COMP_NONE;
-
+
Node->Prev = FolderListTail;
-
+
if (FolderListTail != NULL)
{
FolderListTail->Next = Node;
FolderListHead = Node;
}
FolderListTail = Node;
-
+
return Node;
}
*/
{
PCFFOLDER_NODE Node;
-
+
switch (Index)
{
case CAB_FILE_SPLIT:
case CAB_FILE_PREV_NEXT:
return FolderListHead;
}
-
+
Node = FolderListHead;
while (Node != NULL)
{
*/
{
DestroyFileNodes();
-
+
DestroyFolderNodes();
-
+
if (InputBuffer)
{
RtlFreeHeap(ProcessHeap, 0, InputBuffer);
InputBuffer = NULL;
}
-
+
if (OutputBuffer)
{
RtlFreeHeap(ProcessHeap, 0, OutputBuffer);
FileOpen = FALSE;
wcscpy(DestPath, L"");
-
+
FolderListHead = NULL;
FolderListTail = NULL;
FileListHead = NULL;
FileListTail = NULL;
-
+
CodecId = CAB_CODEC_RAW;
CodecSelected = TRUE;
-
+
OutputBuffer = NULL;
CurrentOBuffer = NULL;
CurrentOBufferSize = 0;
{
ULONG n;
BOOL OK = TRUE;
-
+
if ((n = wcslen(Path)) &&
(Path[n - 1] != L'\\') &&
(OK = ((n + 1) < Length)))
PCFFOLDER_NODE FolderNode;
ULONG Status;
ULONG Index;
-
+
if (!FileOpen)
{
OBJECT_ATTRIBUTES ObjectAttributes;
NTSTATUS NtStatus;
ULONG BytesRead;
ULONG Size;
-
+
OutputBuffer = RtlAllocateHeap(ProcessHeap, 0, CAB_BLOCKSIZE + 12); // This should be enough
if (!OutputBuffer)
return CAB_STATUS_NOMEMORY;
DPRINT("Cannot open file (%S) (%x).\n", CabinetName, NtStatus);
return CAB_STATUS_CANNOT_OPEN;
}
-
+
FileOpen = TRUE;
-
+
/* Load CAB header */
if ((Status = ReadBlock(&CABHeader, sizeof(CFHEADER), &BytesRead)) != CAB_STATUS_SUCCESS)
{
DPRINT("Cannot read from file (%d).\n", (UINT)Status);
return CAB_STATUS_INVALID_CAB;
}
-
+
/* Check header */
if ((BytesRead != sizeof(CFHEADER)) ||
(CABHeader.Signature != CAB_SIGNATURE ) ||
DPRINT("File has invalid header.\n");
return CAB_STATUS_INVALID_CAB;
}
-
+
Size = 0;
-
+
/* Read/skip any reserved bytes */
if (CABHeader.Flags & CAB_FLAG_RESERVE)
{
}
#endif
}
-
+
if ((CABHeader.Flags & CAB_FLAG_HASPREV) > 0)
{
/* Read name of previous cabinet */
wcscpy(CabinetPrev, L"");
wcscpy(DiskPrev, L"");
}
-
+
if ((CABHeader.Flags & CAB_FLAG_HASNEXT) > 0)
{
/* Read name of next cabinet */
wcscpy(CabinetNext, L"");
wcscpy(DiskNext, L"");
}
-
+
/* Read all folders */
for (Index = 0; Index < CABHeader.FolderCount; Index++)
{
DPRINT("Insufficient resources.\n");
return CAB_STATUS_NOMEMORY;
}
-
+
if (Index == 0)
FolderNode->UncompOffset = FolderUncompSize;
-
+
FolderNode->Index = Index;
-
+
if ((Status = ReadBlock(&FolderNode->Folder,
sizeof(CFFOLDER), &BytesRead)) != CAB_STATUS_SUCCESS)
{
return CAB_STATUS_INVALID_CAB;
}
}
-
+
/* Read file entries */
Status = ReadFileTable();
if (Status != CAB_STATUS_SUCCESS)
DPRINT("ReadFileTable() failed (%d).\n", (UINT)Status);
return Status;
}
-
+
/* Read data blocks for all folders */
FolderNode = FolderListHead;
while (FolderNode != NULL)
}
Status = CabinetOpen();
- if (Status != CAB_STATUS_SUCCESS)
+ if (Status != CAB_STATUS_SUCCESS)
return Status;
Search->Next = FileListHead;
}
LastFileOffset = File->File.FileOffset;
-
+
switch (CurrentFolderNode->Folder.CompressionType & CAB_COMP_MASK)
{
case CAB_COMP_NONE:
default:
return CAB_STATUS_UNSUPPCOMP;
}
-
+
DPRINT("Extracting file at uncompressed offset (0x%X) Size (%d bytes) AO (0x%X) UO (0x%X).\n",
(UINT)File->File.FileOffset,
(UINT)File->File.FileSize,
return CAB_STATUS_FILE_EXISTS;
}
}
-
+
if (!ConvertDosDateTimeToFileTime(File->File.FileDate, File->File.FileTime, &FileTime))
{
NtClose(DestFile);
}
SetAttributesOnFile(File, DestFile);
-
+
Buffer = RtlAllocateHeap(ProcessHeap, 0, CAB_BLOCKSIZE + 12); // This should be enough
if (!Buffer)
{
NtClose(DestFile);
DPRINT("Insufficient memory.\n");
- return CAB_STATUS_NOMEMORY;
+ return CAB_STATUS_NOMEMORY;
}
-
+
/* Call extract event handler */
if (ExtractHandler != NULL)
{
ExtractHandler(&File->File, FileName);
}
-
+
/* Search to start of file */
Offset = SeekInFile(FileHandle,
File->DataBlock->AbsoluteOffset,
DPRINT("SeekInFile() failed (%x).\n", NtStatus);
return CAB_STATUS_INVALID_CAB;
}
-
+
Size = File->File.FileSize;
Offset = File->File.FileOffset;
CurrentOffset = File->DataBlock->UncompOffset;
-
+
Skip = TRUE;
-
+
ReuseBlock = (CurrentDataNode == File->DataBlock);
if (Size > 0)
{
DPRINT("CO (0x%X) ReuseBlock (%d) Offset (0x%X) Size (%d) BytesLeftInBlock (%d)\n",
File->DataBlock->UncompOffset, (UINT)ReuseBlock, Offset, Size,
BytesLeftInBlock);
-
+
if (/*(CurrentDataNode != File->DataBlock) &&*/ (!ReuseBlock) || (BytesLeftInBlock <= 0))
{
DPRINT("Filling buffer. ReuseBlock (%d)\n", (UINT)ReuseBlock);
-
+
CurrentBuffer = Buffer;
TotalBytesRead = 0;
do
{
DPRINT("Size (%d bytes).\n", Size);
-
- if (((Status = ReadBlock(&CFData, sizeof(CFDATA), &BytesRead)) !=
+
+ if (((Status = ReadBlock(&CFData, sizeof(CFDATA), &BytesRead)) !=
CAB_STATUS_SUCCESS) || (BytesRead != sizeof(CFDATA)))
{
NtClose(DestFile);
DPRINT("Cannot read from file (%d).\n", (UINT)Status);
return CAB_STATUS_INVALID_CAB;
}
-
+
DPRINT("Data block: Checksum (0x%X) CompSize (%d bytes) UncompSize (%d bytes) Offset (0x%X).\n",
(UINT)CFData.Checksum,
(UINT)CFData.CompSize,
(UINT)CFData.UncompSize,
(UINT)SeekInFile(FileHandle, 0, NULL, SEEK_CURRENT, &NtStatus));
-
+
//ASSERT(CFData.CompSize <= CAB_BLOCKSIZE + 12);
-
+
BytesToRead = CFData.CompSize;
-
+
DPRINT("Read: (0x%X,0x%X).\n",
CurrentBuffer, Buffer);
- if (((Status = ReadBlock(CurrentBuffer, BytesToRead, &BytesRead)) !=
+ if (((Status = ReadBlock(CurrentBuffer, BytesToRead, &BytesRead)) !=
CAB_STATUS_SUCCESS) || (BytesToRead != BytesRead))
{
NtClose(DestFile);
}
*/
TotalBytesRead += BytesRead;
-
+
CurrentBuffer += BytesRead;
-
+
if (CFData.UncompSize == 0)
{
if (wcslen(DiskNext) == 0)
FileName refers to the FileName field of a CFFOLDER_NODE
structure, we have to save a copy of the filename */
wcscpy(TempName, FileName);
-
+
CloseCabinet();
-
+
CabinetSetCabinetName(CabinetNext);
-
+
if (DiskChangeHandler != NULL)
{
DiskChangeHandler(CabinetNext, DiskNext);
}
-
+
Status = CabinetOpen();
- if (Status != CAB_STATUS_SUCCESS)
+ if (Status != CAB_STATUS_SUCCESS)
return Status;
-
+
/* The first data block of the file will not be
found as it is located in the previous file */
Status = LocateFile(TempName, &File);
DPRINT("Cannot locate file (%d).\n", (UINT)Status);
return Status;
}
-
+
/* The file is continued in the first data block in the folder */
File->DataBlock = CurrentFolderNode->DataListHead;
-
+
/* Search to start of file */
SeekInFile(FileHandle,
File->DataBlock->AbsoluteOffset,
DPRINT("SeekInFile() failed (%x).\n", NtStatus);
return CAB_STATUS_INVALID_CAB;
}
-
+
DPRINT("Continuing extraction of file at uncompressed offset (0x%X) Size (%d bytes) AO (0x%X) UO (0x%X).\n",
(UINT)File->File.FileOffset,
(UINT)File->File.FileSize,
(UINT)File->DataBlock->AbsoluteOffset,
(UINT)File->DataBlock->UncompOffset);
-
+
CurrentDataNode = File->DataBlock;
ReuseBlock = TRUE;
} while (CFData.UncompSize == 0);
DPRINT("TotalBytesRead (%d).\n", TotalBytesRead);
-
+
Status = CodecUncompress(OutputBuffer, Buffer, TotalBytesRead, &BytesToWrite);
if (Status != CS_SUCCESS)
{
else
{
DPRINT("Using same buffer. ReuseBlock (%d)\n", (UINT)ReuseBlock);
-
+
BytesToWrite = BytesLeftInBlock;
-
+
DPRINT("Seeking to absolute offset 0x%X.\n",
CurrentDataNode->AbsoluteOffset + sizeof(CFDATA) +
CurrentDataNode->Data.CompSize);
-
- if (((Status = ReadBlock(&CFData, sizeof(CFDATA), &BytesRead)) !=
+
+ if (((Status = ReadBlock(&CFData, sizeof(CFDATA), &BytesRead)) !=
CAB_STATUS_SUCCESS) || (BytesRead != sizeof(CFDATA)))
{
NtClose(DestFile);
DPRINT("Cannot read from file (%d).\n", (UINT)Status);
return CAB_STATUS_INVALID_CAB;
}
-
+
DPRINT("CFData.CompSize 0x%X CFData.UncompSize 0x%X.\n",
CFData.CompSize, CFData.UncompSize);
-
+
/* Go to next data block */
SeekInFile(FileHandle,
CurrentDataNode->AbsoluteOffset + sizeof(CFDATA) +
BytesSkipped = (Offset - CurrentOffset);
else
BytesSkipped = 0;
-
+
BytesToWrite -= BytesSkipped;
-
+
if (Size < BytesToWrite)
BytesToWrite = Size;
(UINT)BytesToWrite,
(UINT)BytesSkipped, (UINT)Skip,
(UINT)Size);
-
+
// if (!WriteFile(DestFile, (PVOID)((ULONG)OutputBuffer + BytesSkipped),
// BytesToWrite, &BytesWritten, NULL) ||
// (BytesToWrite != BytesWritten))
NULL,
NULL,
&IoStatusBlock,
- (PVOID)((ULONG)OutputBuffer + BytesSkipped),
+ (PVOID)((ULONG)OutputBuffer + BytesSkipped),
BytesToWrite,
NULL,
NULL);
if (!NT_SUCCESS(NtStatus))
{
DPRINT("Status 0x%X.\n", NtStatus);
-
+
NtClose(DestFile);
RtlFreeHeap(ProcessHeap, 0, Buffer);
DPRINT("Cannot write to file.\n");
return CAB_STATUS_CANNOT_WRITE;
}
Size -= BytesToWrite;
-
+
CurrentOffset += BytesToWrite;
/* Don't skip any more bytes */
{
CONSOLE_MODE Buffer;
DWORD dwBytesReturned;
-
+
if (DeviceIoControl (hConsoleHandle,
IOCTL_CONSOLE_GET_MODE,
NULL,
)
{
DWORD dwBytesReturned;
-
+
if (DeviceIoControl (hConsoleOutput,
IOCTL_CONSOLE_GET_CURSOR_INFO,
NULL,
PathName.Length -= sizeof(WCHAR);
PathName.Buffer[PathName.Length / sizeof(WCHAR)] = 0;
}
-
- if (PathName.Length > sizeof(WCHAR) &&
+
+ if (PathName.Length > sizeof(WCHAR) &&
PathName.Buffer[PathName.Length / sizeof(WCHAR) - 1] == L'\\')
{
PathName.Length -= sizeof(WCHAR);
coPos.Y = List->Top + 1 + List->Line;
if (List->Line >= 0 && List->Line <= Height)
- {
+ {
FillConsoleOutputAttribute (0x17,
Width,
coPos,
Width,
coPos,
&Written);
-
+
FillConsoleOutputCharacter (' ',
Width,
coPos,
PartEntry = CONTAINING_RECORD (Entry2, PARTENTRY, ListEntry);
if (PartEntry == List->CurrentPartition)
{
- CurrentPartLineFound = TRUE;;
+ CurrentPartLineFound = TRUE;
}
Entry2 = Entry2->Flink;
if (CurrentPartLineFound == FALSE)
LastLine--;
}
}
-
- /* If it possible, make the disk name visible */
+
+ /* If it possible, make the disk name visible */
if (CurrentPartLine < List->Offset)
{
List->Offset = CurrentPartLine;
/* Merge previous, current and next unpartitioned entry */
/* Adjust the previous entries length */
- PrevPartEntry->UnpartitionedLength +=
+ PrevPartEntry->UnpartitionedLength +=
(PartEntry->PartInfo[0].PartitionLength.QuadPart + DiskEntry->TrackSize +
NextPartEntry->UnpartitionedLength);
/* Merge current and previous unpartitioned entry */
/* Adjust the previous entries length */
- PrevPartEntry->UnpartitionedLength +=
+ PrevPartEntry->UnpartitionedLength +=
(PartEntry->PartInfo[0].PartitionLength.QuadPart + DiskEntry->TrackSize);
/* Remove the current entry */
/* Merge current and next unpartitioned entry */
/* Adjust the next entries offset and length */
- NextPartEntry->UnpartitionedOffset =
+ NextPartEntry->UnpartitionedOffset =
PartEntry->PartInfo[0].StartingOffset.QuadPart - DiskEntry->TrackSize;
- NextPartEntry->UnpartitionedLength +=
+ NextPartEntry->UnpartitionedLength +=
(PartEntry->PartInfo[0].PartitionLength.QuadPart + DiskEntry->TrackSize);
/* Remove the current entry */
/* Nothing to merge but change current entry */
PartEntry->New = FALSE;
PartEntry->Unpartitioned = TRUE;
- PartEntry->UnpartitionedOffset =
+ PartEntry->UnpartitionedOffset =
PartEntry->PartInfo[0].StartingOffset.QuadPart - DiskEntry->TrackSize;
- PartEntry->UnpartitionedLength =
+ PartEntry->UnpartitionedLength =
PartEntry->PartInfo[0].PartitionLength.QuadPart + DiskEntry->TrackSize;
/* Wipe the partition table */
{
PGENERIC_LIST_ENTRY Entry;
static WCHAR SectionName[128];
-
+
DPRINT("ProcessComputerFiles() called\n");
-
+
Entry = GetGenericListEntry(List);
if (Entry == NULL)
{
DPRINT("GetGenericListEntry() failed\n");
return FALSE;
}
-
+
wcscpy(SectionName, L"Files.");
wcscat(SectionName, Entry->UserData);
*AdditionalSectionName = SectionName;
-
+
return TRUE;
}
SetTextXY(8, 22, "If for some reason you did not receive a copy of the");
SetTextXY(8, 23, "GNU General Public License with ReactOS please visit");
SetHighlightedTextXY(8, 25, "http://www.gnu.org/licenses/licenses.html");
-
+
SetStatusText("ENTER = Continue F3 = Quit");
while (TRUE)
PWCHAR FileKeyValue;
PWCHAR DirKeyValue;
PWCHAR TargetFileName;
-
+
/* Search for the SectionName section */
if (!InfFindFirstLine (InfFile, SectionName, NULL, &FilesContext))
{
}
}
while (InfFindNextLine(&FilesContext, &FilesContext));
-
+
return TRUE;
}
/* Add common files */
if (!AddSectionToCopyQueue(InfFile, L"SourceFiles", SourceCabinet, Ir))
return FALSE;
-
+
/* Add specific files depending of computer type */
if (SourceCabinet == NULL)
{
return FALSE;
}
}
-
+
/* Create directories */
/*
DetectVMware(int *Version)
{
int magic, ver;
-
+
magic = 0;
ver = 0;
-
+
/* Try using a VMware I/O port. If not running in VMware this'll throw an
exception! */
__asm__ __volatile__("inl %%dx, %%eax"
*Version = ver;
return TRUE;
}
-
+
return FALSE;
}
{
WCHAR FileName[MAX_PATH + 1];
HANDLE FileHandle;
-
+
FileName[0] = L'\0';
wcscat(FileName, Path);
wcscat(FileName, File);
FileHandle = CreateFile(FileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-
+
if(FileHandle == INVALID_HANDLE_VALUE)
{
return FALSE;
CloseHandle(FileHandle);
return FALSE;
}
-
+
CloseHandle(FileHandle);
return TRUE;
}
WCHAR DestFileName[MAX_PATH + 1];
HANDLE SourceFileHandle, DestFileHandle;
DWORD DataRead, DataWritten;
-
+
SourceFileName[0] = L'\0';
DestFileName[0] = L'\0';
wcscat(SourceFileName, SrcPath);
wcscat(SourceFileName, File);
wcscat(DestFileName, Destination);
wcscat(DestFileName, File);
-
+
SourceFileHandle = CreateFile(SourceFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(SourceFileHandle == INVALID_HANDLE_VALUE)
{
CloseHandle(SourceFileHandle);
return FALSE;
}
-
+
while(ReadFile(SourceFileHandle, Buffer, sizeof(Buffer), &DataRead, NULL) && DataRead > 0)
{
if(!WriteFile(DestFileHandle, Buffer, DataRead, &DataWritten, NULL) ||
return FALSE;
}
}
-
+
CloseHandle(SourceFileHandle);
CloseHandle(DestFileHandle);
return TRUE;
{
static WCHAR Drive[4] = L"X:\\";
WCHAR Current;
-
+
*Drv = L'\0';
for(Current = 'C'; Current <= 'Z'; Current++)
{
SetCurrentDirectory(DestinationPath);
continue;
}
-
+
if(FileExists(SrcPath, vmx_fb) &&
FileExists(SrcPath, vmx_mode) &&
FileExists(SrcPath, vmx_svga))
}
#endif
}
-
+
return FALSE;
}
{
HKEY hReg;
DWORD Type, Size;
-
- if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- L"SYSTEM\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\vmx_svga\\Device0",
+
+ if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ L"SYSTEM\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\vmx_svga\\Device0",
0, KEY_QUERY_VALUE, &hReg) != ERROR_SUCCESS)
{
return FALSE;
RegCloseKey(hReg);
return FALSE;
}
-
+
if(RegQueryValueEx(hReg, L"DefaultSettings.XResolution", 0, &Type, (BYTE*)ResX, &Size) != ERROR_SUCCESS ||
Type != REG_DWORD)
{
RegCloseKey(hReg);
return FALSE;
}
-
+
if(RegQueryValueEx(hReg, L"DefaultSettings.YResolution", 0, &Type, (BYTE*)ResY, &Size) != ERROR_SUCCESS ||
Type != REG_DWORD)
{
RegCloseKey(hReg);
return FALSE;
}
-
+
RegCloseKey(hReg);
return TRUE;
}
{
HKEY hReg;
DWORD Type, Size, Value;
-
- if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- L"SYSTEM\\CurrentControlSet\\Services\\vmx_svga",
+
+ if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ L"SYSTEM\\CurrentControlSet\\Services\\vmx_svga",
0, KEY_QUERY_VALUE, &hReg) != ERROR_SUCCESS)
{
return FALSE;
RegCloseKey(hReg);
return FALSE;
}
-
+
RegCloseKey(hReg);
return (Value == 1);
}
SaveResolutionSettings(DWORD ResX, DWORD ResY, DWORD ColDepth)
{
HKEY hReg;
-
- if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- L"SYSTEM\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\vmx_svga\\Device0",
+
+ if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ L"SYSTEM\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\vmx_svga\\Device0",
0, KEY_QUERY_VALUE, &hReg) != ERROR_SUCCESS)
{
return FALSE;
RegCloseKey(hReg);
return FALSE;
}
-
+
if(RegSetValueEx(hReg, L"DefaultSettings.XResolution", 0, REG_DWORD, (BYTE*)&ResX, sizeof(DWORD)) != ERROR_SUCCESS)
{
RegCloseKey(hReg);
return FALSE;
}
-
+
if(RegSetValueEx(hReg, L"DefaultSettings.YResolution", 0, REG_DWORD, (BYTE*)&ResY, sizeof(DWORD)) != ERROR_SUCCESS)
{
RegCloseKey(hReg);
return FALSE;
}
-
+
RegCloseKey(hReg);
return TRUE;
}
{
DWORD Value;
HKEY hReg;
-
+
Value = (Enable ? 1 : 4);
-
+
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, Key, 0, KEY_SET_VALUE, &hReg) != ERROR_SUCCESS)
{
return FALSE;
RegCloseKey(hReg);
return FALSE;
}
-
+
RegCloseKey(hReg);
return TRUE;
}
{
return FALSE;
}
-
+
return TRUE;
}
HWND hwndControl;
/* Center the wizard window */
- hwndControl = GetParent(hwndDlg);
+ hwndControl = GetParent(hwndDlg);
CenterWindow (hwndControl);
LPNMHDR pnmh = (LPNMHDR)lParam;
HANDLE hThread;
BOOL DriveAvailable;
int DrivesTested = 0;
-
+
if(AbortInstall != 0) goto done;
PostMessage(hInstallationNotifyWnd, WM_INSTSTATUSUPDATE, IDS_SEARCHINGFORCDROM, 0);
-
+
while(AbortInstall == 0)
{
Sleep(500);
if(AbortInstall != 0) goto done;
PostMessage(hInstallationNotifyWnd, WM_INSTSTATUSUPDATE, IDS_COPYINGFILES, 0);
-
+
if(AbortInstall != 0) goto done;
if(!InstallFile(DestinationPath, vmx_fb))
{
PostMessage(hInstallationNotifyWnd, WM_INSTABORT, IDS_FAILEDTOCOPYFILES, 0);
goto cleanup;
}
-
+
Sleep(250);
-
+
if(AbortInstall != 0) goto done;
if(!InstallFile(DestinationPath, vmx_mode))
{
PostMessage(hInstallationNotifyWnd, WM_INSTABORT, IDS_FAILEDTOCOPYFILES, 0);
goto cleanup;
}
-
+
Sleep(250);
-
+
if(AbortInstall != 0) goto done;
if(!InstallFile(DestinationDriversPath, vmx_svga))
{
PostMessage(hInstallationNotifyWnd, WM_INSTABORT, IDS_FAILEDTOCOPYFILES, 0);
goto cleanup;
}
-
+
Sleep(250);
if(AbortInstall != 0) goto done;
SendMessage(hInstallationNotifyWnd, WM_INSTABORT, 0, 0);
break;
}
-
+
cleanup:
hThread = (HANDLE)InterlockedExchange((LONG*)&hInstallationThread, 0);
if(hThread != NULL)
{
int i;
WCHAR Text[256];
-
+
for(i = From; i <= To; i++)
{
if(LoadString(hAppInstance, i, Text, 255) > 0)
{
DWORD ResX = 0, ResY = 0, ColDepth = 0;
int cbSel;
-
+
FillComboBox(hwndDlg, IDC_COLORQUALITY, 10001, 10003);
if(LoadResolutionSettings(&ResX, &ResY, &ColDepth))
{
HWND hwndControl;
/* Center the wizard window */
- hwndControl = GetParent(hwndDlg);
+ hwndControl = GetParent(hwndDlg);
CenterWindow (hwndControl);
LPNMHDR pnmh = (LPNMHDR)lParam;
break;
}
}
-
+
switch(SendDlgItemMessage(hwndDlg, IDC_COLORQUALITY, CB_GETCURSEL, 0, 0))
{
case 0:
cd = 32;
break;
}
-
+
SaveResolutionSettings(rx, ry, cd);
break;
}
{
static ULONG SelPage[4] = {IDD_CONFIG, IDD_SELECTDRIVER, IDD_SELECTDRIVER, IDD_CHOOSEACTION};
int i;
-
+
for(i = IDC_CONFIGSETTINGS; i <= IDC_UNINSTALL; i++)
{
if(SendDlgItemMessage(hwndDlg, i, BM_GETCHECK, 0, 0) == BST_CHECKED)
break;
}
}
-
+
UninstallDriver = (i == IDC_UNINSTALL);
-
+
SetWindowLong(hwndDlg, DWL_MSGRESULT, SelPage[i - IDC_CONFIGSETTINGS]);
return TRUE;
}
HPROPSHEETPAGE ahpsp[8];
PROPSHEETPAGE psp;
WCHAR Caption[1024];
-
+
LoadString(hAppInstance, IDS_WIZARD_NAME, Caption, sizeof(Caption) / sizeof(TCHAR));
/* Create the Welcome page */
psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDD_SELECTDRIVERSUBTITLE);
psp.pfnDlgProc = PageSelectDriverProc;
psp.pszTemplate = MAKEINTRESOURCE(IDD_SELECTDRIVER);
- ahpsp[6] = CreatePropertySheetPage(&psp);
+ ahpsp[6] = CreatePropertySheetPage(&psp);
/* Create the DOUNINSTALL page */
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDD_DOUNINSTALLSUBTITLE);
psp.pfnDlgProc = PageDoUninstallProc;
psp.pszTemplate = MAKEINTRESOURCE(IDD_DOUNINSTALL);
- ahpsp[7] = CreatePropertySheetPage(&psp);
+ ahpsp[7] = CreatePropertySheetPage(&psp);
/* Create the property sheet */
psh.dwSize = sizeof(PROPSHEETHEADER);
return (LONG)(PropertySheet(&psh) != -1);
}
-int WINAPI
+int WINAPI
WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow)
{
-
+
LPTOP_LEVEL_EXCEPTION_FILTER OldHandler;
int Version;
WCHAR *lc;
-
+
hAppInstance = hInstance;
/* Setup our exception "handler" ;-) */
/* restore the exception handler */
SetUnhandledExceptionFilter(OldHandler);
-
+
lc = DestinationPath;
lc += GetSystemDirectory(DestinationPath, MAX_PATH) - 1;
if(lc >= DestinationPath && *lc != L'\\')
DestinationDriversPath[0] = L'\0';
wcscat(DestinationDriversPath, DestinationPath);
wcscat(DestinationDriversPath, L"drivers\\");
-
+
SetCurrentDirectory(DestinationPath);
-
+
DriverFilesFound = FileExists(DestinationPath, vmx_fb) &&
FileExists(DestinationPath, vmx_mode) &&
FileExists(DestinationDriversPath, vmx_svga);
-
+
StartVMwConfigWizard = DriverFilesFound && IsVmwSVGAEnabled();
-
+
/* Show the wizard */
CreateWizard();
-
+
return 2;
}
RECT rcWindow;
HICON hMainIcon;
HMENU hSystemMenu;
- DWORD dwStyle = WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS |
+ DWORD dwStyle = WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS |
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
BITMAP BitmapInfo;
0,
hInstance,
NULL);
-
+
hSystemMenu = GetSystemMenu(hwndMain, FALSE);
if(hSystemMenu)
{
RemoveMenu(hSystemMenu, SC_SIZE, MF_BYCOMMAND);
RemoveMenu(hSystemMenu, SC_MAXIMIZE, MF_BYCOMMAND);
}
-
+
ShowWindow(hwndMain, nCmdShow);
UpdateWindow(hwndMain);
{
hTopicBitmap[i] = LoadBitmap (hInstance, MAKEINTRESOURCE(IDB_TOPICBITMAP0+i));
}
-
+
ScreenDC = GetWindowDC(hWnd);
hdcMem = CreateCompatibleDC (ScreenDC);
ReleaseDC(hWnd, ScreenDC);
if (activate_fs_window(RS(b1,IDS_UNIXFS)))
break;
-
+
#ifdef UNICODE
call_getcwd(cpath, MAX_PATH);
MultiByteToWideChar(CP_UNIXCP, 0, cpath, -1, path, MAX_PATH);
/* $Id$
- *
+ *
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/winlogon/sas.c
- * PURPOSE: Secure Attention Sequence
+ * PURPOSE: Secure Attention Sequence
* PROGRAMMER: Thomas Weidenmueller (w3seek@users.sourceforge.net)
* UPDATE HISTORY:
* Created 28/03/2004
DispatchSAS(PWLSESSION Session, DWORD dwSasType)
{
Session->SASAction = dwSasType;
-
+
}
void
DPRINT1("WL-SAS: Unable to register Ctrl+Alt+Del hotkey!\n");
return FALSE;
}
-
+
/* Register Ctrl+Shift+Esc */
Session->TaskManHotkey = RegisterHotKey(hwndSAS, HK_CTRL_SHIFT_ESC, MOD_CONTROL | MOD_SHIFT, VK_ESCAPE);
if(!Session->TaskManHotkey)
DestroySAS(PWLSESSION Session, HWND hwndSAS)
{
/* Unregister hotkeys */
-
+
UnregisterHotKey(hwndSAS, HK_CTRL_ALT_DEL);
-
+
if(Session->TaskManHotkey)
{
UnregisterHotKey(hwndSAS, HK_CTRL_SHIFT_ESC);
}
-
+
return TRUE;
}
InitializeSAS(PWLSESSION Session)
{
WNDCLASSEX swc;
-
+
/* register SAS window class.
WARNING! MAKE SURE WE ARE IN THE WINLOGON DESKTOP! */
swc.cbSize = sizeof(WNDCLASSEXW);
swc.lpszClassName = WINLOGON_SAS_CLASS;
swc.hIconSm = NULL;
RegisterClassEx(&swc);
-
+
/* create invisible SAS window */
Session->SASWindow = CreateWindowEx(0, WINLOGON_SAS_CLASS, WINLOGON_SAS_TITLE, WS_POPUP,
0, 0, 0, 0, 0, 0, hAppInstance, NULL);
DPRINT1("WL: Failed to create SAS window\n");
return FALSE;
}
-
+
/* Save the Session pointer so the window proc can access it */
SetWindowLongPtr(Session->SASWindow, GWL_USERDATA, (DWORD_PTR)Session);
-
+
/* Register SAS window to receive SAS notifications */
if(!SetLogonNotifyWindow(Session->SASWindow, Session->InteractiveWindowStation))
{
DPRINT1("WL: Failed to register SAS window\n");
return FALSE;
}
-
+
return TRUE;
}
/* $Id$
- *
+ *
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/winlogon/winlogon.c
- * PURPOSE: Logon
+ * PURPOSE: Logon
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* Created 22/05/98
PROCESS_INFORMATION ProcessInformation;
DWORD Count;
- /* Start the service control manager (services.exe) */
-
+ /* Start the service control manager (services.exe) */
+
StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.lpReserved = NULL;
StartupInfo.lpDesktop = NULL;
StartupInfo.cbReserved2 = 0;
StartupInfo.lpReserved2 = 0;
-#if 0
+#if 0
PrintString(L"WL: Creating new process - \"services.exe\".\n");
#endif
PrintString(L"WL: Failed to execute services\n");
return FALSE;
}
-
+
/* wait for event creation (by SCM) for max. 20 seconds */
for (Count = 0; Count < 20; Count++)
{
Sleep(1000);
-
+
//DbgPrint("WL: Attempting to open event \"SvcctrlStartEvent_A3725DX\"\n");
ServicesInitEvent = OpenEvent(EVENT_ALL_ACCESS, //SYNCHRONIZE,
FALSE,
break;
}
}
-
+
if (ServicesInitEvent == NULL)
{
DbgPrint("WL: Failed to open event \"SvcctrlStartEvent_A3725DX\"\n");
//DbgPrint("WL: Closing event object \"SvcctrlStartEvent_A3725DX\"\n");
CloseHandle(ServicesInitEvent);
//DbgPrint("WL: StartServices() Done.\n");
-
+
return TRUE;
}
BOOLEAN Result;
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInformation;
-
+
LsassInitEvent = CreateEvent(NULL,
TRUE,
FALSE,
L"\\LsassInitDone");
-
+
if (LsassInitEvent == NULL)
{
DbgPrint("WL: Failed to create lsass notification event\n");
return(FALSE);
}
-
+
/* Start the local security authority subsystem (lsass.exe) */
-
+
StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.lpReserved = NULL;
StartupInfo.lpDesktop = NULL;
StartupInfo.dwFlags = 0;
StartupInfo.cbReserved2 = 0;
StartupInfo.lpReserved2 = 0;
-
+
Result = CreateProcess(L"lsass.exe",
NULL,
NULL,
DbgPrint("WL: Failed to execute lsass\n");
return(FALSE);
}
-
+
DPRINT("WL: Waiting for lsass\n");
WaitForSingleObject(LsassInitEvent, INFINITE);
CloseHandle(LsassInitEvent);
-
+
return(TRUE);
}
#endif
{
HKEY WinLogonKey;
DWORD Type, Size, Value;
-
+
if(OpenRegistryKey(&WinLogonKey))
{
Size = sizeof(DWORD);
}
}
RegCloseKey(WinLogonKey);
- }
+ }
return FALSE;
}
*/
{
HKEY WinLogonKey;
DWORD Type, Size, Value;
-
+
if(OpenRegistryKey(&WinLogonKey))
{
Size = sizeof(DWORD);
}
}
RegCloseKey(WinLogonKey);
- }
+ }
return FALSE;
}
#endif
hAppInstance = hInstance;
-
+
if(!RegisterLogonProcess(GetCurrentProcessId(), TRUE))
{
DbgPrint("WL: Could not register logon process\n");
ExitProcess(0);
return 0;
}
-
+
#if START_LSASS
if (StartProcess(L"StartLsass"))
{
}
}
#endif
-
+
if(!(WLSession = MsGinaInit()))
{
DbgPrint("WL: Failed to initialize msgina.dll\n");
ExitProcess(0);
return 0;
}
-
+
WLSession->LogonStatus = LOGON_INITIALIZING;
-
+
if(!WlxCreateWindowStationAndDesktops(WLSession))
{
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, 0, 0, 0);
ExitProcess(1);
return 1;
}
-
+
/*
* Switch to winlogon desktop
*/
{
DbgPrint("WL: Cannot switch to Winlogon desktop (0x%X)\n", GetLastError());
}
-
+
/* Check for pending setup */
if (GetSetupType () != 0)
{
DPRINT ("Winlogon: CheckForSetup() in setup mode\n");
-
+
/* Run setup and reboot when done */
RunSetup();
-
+
NtShutdownSystem(ShutdownReboot);
ExitProcess(0);
return 0;
}
-
+
#if SUPPORT_CONSOLESTART
StartConsole = !StartIntoGUI();
#endif
ExitProcess(2);
return 2;
}
-
+
InitServices();
-
+
#if 0
/* real winlogon uses "Winlogon" */
RtlInitUnicodeString((PUNICODE_STRING)&ProcessName, L"Winlogon");
}
return(1);
}
-
+
RtlInitUnicodeString((PUNICODE_STRING)&PackageName, L"Kerberos");
Status = LsaLookupAuthenticationPackage(LsaHandle, &PackageName, &AuthenticationPackage);
if (!NT_SUCCESS(Status))
return(1);
}
#endif
-
+
/* FIXME: Create a window class and associate a Winlogon
* window procedure with it.
* Register SAS with the window.
* Register for logoff notification
*/
-
+
/* Main loop */
#if 0
/* Display login prompt */
i++;
} while (LoginName[i - 1] != '\n');
LoginName[i - 1] = 0;
-
+
/* Display password prompt */
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),
PasswordPrompt,
if (! DoLogonUser(L"Administrator", L"Secret"))
{
}
-
+
NtShutdownSystem(ShutdownNoReboot);
ExitProcess(0);
}
#endif
RegisterHotKeys();
-
+
SessionLoop(WLSession);
-
+
UnregisterHotKeys();
/* FIXME - Flush disks and registry, ... */
-
+
if(WLSession->LogonStatus == LOGON_SHUTDOWN)
{
/* FIXME - only show this dialog if it's a shutdown and the computer doesn't support APM */
#if SUPPORT_CONSOLESTART
}
#endif
-
+
return 0;
}
{
return TRUE;
}
-
+
#if SUPPORT_CONSOLESTART
if(StartConsole)
{
return TRUE;
}
#endif
-
+
return Session->MsGina.Functions.WlxDisplayStatusMessage(Session->MsGina.Context, hDesktop, dwOptions, pTitle, pMessage);
}
DbgPrint("WL: Failed to start Services (0x%X)\n", GetLastError());
}
}
-
+
return TRUE;
}
PWLX_PROFILE_V2_0 Profile;
PSID LogonSid = NULL;
HANDLE Token;
-
+
/* FIXME - Create a Logon Sid
if(!(LogonSid = CreateUserLogonSid(NULL)))
{
return WLX_SAS_ACTION_NONE;
}
*/
-
+
Options = 0;
WlxAction = Session->MsGina.Functions.WlxLoggedOutSAS(Session->MsGina.Context,
Session->SASAction,
&Token,
&MprNotifyInfo,
(PVOID*)&Profile);
-
+
return WlxAction;
}
// HANDLE hShutdownEvent;
DWORD WlxAction;
MSG Msg;
-
+
WlxAction = WLX_SAS_ACTION_NONE;
Session->LogonStatus = LOGON_NONE;
while(WlxAction == WLX_SAS_ACTION_NONE)
#endif
DisplaySASNotice(Session);
Session->SuppressStatus = FALSE;
-
+
if(Session->SASAction == WLX_SAS_ACTION_LOGOFF)
{
/* the system wants to log off here */
break;
}
}
-
+
WlxAction = DoLogin(Session);
if(WlxAction == WLX_SAS_ACTION_LOGOFF)
{
Session->LogonStatus = LOGON_NONE;
continue;
}
-
+
/* FIXME - don't leave the loop when suspending the computer */
if(WLX_SUSPENDING(WlxAction))
{
/* don't leave the loop */
continue;
}
-
+
if(WLX_SHUTTINGDOWN(WlxAction))
{
Session->LogonStatus = LOGON_SHUTDOWN;
/* leave the loop here */
break;
}
-
+
/* Message loop for the SAS window */
while(GetMessage(&Msg, 0, 0, 0))
{
0,
NULL,
StatusMsg);
-
+
Sleep(150);
-
+
LoadString(hAppInstance, IDS_APPLYINGCOMPUTERSETTINGS, StatusMsg, 256 * sizeof(WCHAR));
MsGinaInst->Functions->WlxDisplayStatusMessage(MsGinaInst->Context,
ApplicationDesktop,
0,
NULL,
StatusMsg);
-
+
Sleep(150);
MsGinaInst->Functions->WlxRemoveStatusMessage(MsGinaInst->Context);
MsGinaInst->Functions->WlxRemoveStatusMessage(MsGinaInst->Context);
MsGinaInst->Functions->WlxRemoveStatusMessage(MsGinaInst->Context);
-
+
Sleep(250);
-
+
LoadString(hAppInstance, IDS_LOADINGYOURPERSONALSETTINGS, StatusMsg, 256 * sizeof(WCHAR));
MsGinaInst->Functions->WlxDisplayStatusMessage(MsGinaInst->Context,
ApplicationDesktop,
StatusMsg);
Sleep(150);
-
+
LoadString(hAppInstance, IDS_APPLYINGYOURPERSONALSETTINGS, StatusMsg, 256 * sizeof(WCHAR));
MsGinaInst->Functions->WlxDisplayStatusMessage(MsGinaInst->Context,
ApplicationDesktop,
0,
NULL,
StatusMsg);
-
+
Sleep(150);
-
+
MsGinaInst->Functions->WlxRemoveStatusMessage(MsGinaInst->Context);
MsGinaInst->Functions->WlxRemoveStatusMessage(MsGinaInst->Context);
-
+
if(!MsGinaInst->Functions->WlxActivateUserShell(MsGinaInst->Context,
L"WinSta0\\Default",
NULL,
MessageBox(0, StatusMsg, NULL, MB_ICONERROR);
SetEvent(hShutdownEvent);
}
-
-
+
+
WaitForSingleObject(hShutdownEvent, INFINITE);
CloseHandle(hShutdownEvent);
0,
NULL,
StatusMsg);
-
+
Sleep(150);
-
+
MsGinaInst->Functions->WlxShutdown(MsGinaInst->Context, WLX_SAS_ACTION_SHUTDOWN);
-
+
LoadString(hAppInstance, IDS_REACTOSISSHUTTINGDOWN, StatusMsg, 256 * sizeof(WCHAR));
MsGinaInst->Functions->WlxDisplayStatusMessage(MsGinaInst->Context,
ApplicationDesktop,
0,
NULL,
StatusMsg);
-
+
Sleep(250);
-
+
MsGinaInst->Functions->WlxRemoveStatusMessage(MsGinaInst->Context);
MsGinaInst->Functions->WlxRemoveStatusMessage(MsGinaInst->Context);
*/
* PROJECT: ReactOS winlogon
* FILE: subsys/system/winlogon/winlogon.h
* PURPOSE: Winlogon
- * PROGRAMMER:
+ * PROGRAMMER:
*/
#ifndef __WINLOGON_MAIN_H__
typedef BOOL (WINAPI * PFWLXINITIALIZE) (LPWSTR, HANDLE, PVOID, PVOID, PVOID *);
typedef VOID (WINAPI * PFWLXDISPLAYSASNOTICE) (PVOID);
typedef int (WINAPI * PFWLXLOGGEDOUTSAS) (PVOID, DWORD, PLUID, PSID, PDWORD,
- PHANDLE, PWLX_MPR_NOTIFY_INFO,
+ PHANDLE, PWLX_MPR_NOTIFY_INFO,
PVOID *);
typedef BOOL (WINAPI * PFWLXACTIVATEUSERSHELL) (PVOID, PWSTR, PWSTR, PVOID);
typedef int (WINAPI * PFWLXLOGGEDONSAS) (PVOID, DWORD, PVOID);
PFWLXISLOGOFFOK WlxIsLogoffOk;
PFWLXLOGOFF WlxLogoff;
PFWLXSHUTDOWN WlxShutdown;
-
+
PFWLXSCREENSAVERNOTIFY WlxScreenSaverNotify;
PFWLXSTARTAPPLICATION WlxStartApplication;
-
+
PFWLXNETWORKPROVIDERLOAD WlxNetworkProviderLoad;
PFWLXDISPLAYSTATUSMESSAGE WlxDisplayStatusMessage;
PFWLXGETSTATUSMESSAGE WlxGetStatusMessage;
/* $Id$
- *
+ *
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/winlogon/winlogon.c
- * PURPOSE: Logon
+ * PURPOSE: Logon
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* Created 22/05/98
)
{
PWLSESSION Session = (PWLSESSION)hWlx;
-
+
if(Session || !Value)
{
switch(Option)
*OldValue = (ULONG_PTR)Session->MsGina.Context;
Session->MsGina.Context = (PVOID)Value;
return TRUE;
- }
+ }
case WLX_OPTION_USE_SMART_CARD:
return FALSE;
}
}
-
+
return FALSE;
}
}
}
}
-
+
return FALSE;
}
{
DWORD Status, Type, Size;
HKEY hKey;
-
+
Status = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
0,
wcscpy(path, L"msgina.dll");
return;
}
-
+
Size = MAX_PATH * sizeof(WCHAR);
Status = RegQueryValueEx(hKey,
L"GinaDLL",
{
int len;
WCHAR str[MAX_PATH], str2[MAX_PATH];
-
+
if(lParam)
{
len = GetDlgItemText(hwndDlg, IDC_GINALOADFAILED, str, MAX_PATH);
-
+
if(len)
{
wsprintf(str2, str, (LPWSTR)lParam);
{
HMODULE hGina;
WCHAR GinaDll[MAX_PATH + 1];
-
+
GetMsGinaPath(GinaDll);
-
+
if(!(hGina = LoadLibrary(GinaDll)))
{
DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_GINALOADFAILED), 0, GinaLoadFailedProc, (LPARAM)&GinaDll);
return FALSE;
}
*GinaInstance = hGina;
-
+
Functions->WlxNegotiate = (PFWLXNEGOTIATE)GetProcAddress(hGina, "WlxNegotiate");
Functions->WlxInitialize = (PFWLXINITIALIZE)GetProcAddress(hGina, "WlxInitialize");
-
+
if(Functions->WlxNegotiate)
{
if(!Functions->WlxNegotiate(WLX_VERSION_1_3, DllVersion))
{
return FALSE;
}
-
+
if(*DllVersion >= WLX_VERSION_1_0)
{
Functions->WlxActivateUserShell = (PFWLXACTIVATEUSERSHELL)GetProcAddress(hGina, "WlxActivateUserShell");
Functions->WlxShutdown = (PFWLXSHUTDOWN)GetProcAddress(hGina, "WlxShutdown");
Functions->WlxWkstaLockedSAS = (PFWLXWKSTALOCKEDSAS)GetProcAddress(hGina, "WlxWkstaLockedSAS");
}
-
+
if(*DllVersion >= WLX_VERSION_1_1)
{
Functions->WlxScreenSaverNotify = (PFWLXSCREENSAVERNOTIFY)GetProcAddress(hGina, "WlxScreenSaverNotify");
Functions->WlxStartApplication = (PFWLXSTARTAPPLICATION)GetProcAddress(hGina, "WlxStartApplication");
}
-
+
if(*DllVersion >= WLX_VERSION_1_3)
{
Functions->WlxDisplayStatusMessage = (PFWLXDISPLAYSTATUSMESSAGE)GetProcAddress(hGina, "WlxDisplayStatusMessage");
Functions->WlxNetworkProviderLoad = (PFWLXNETWORKPROVIDERLOAD)GetProcAddress(hGina, "WlxNetworkProviderLoad");
Functions->WlxRemoveStatusMessage = (PFWLXREMOVESTATUSMESSAGE)GetProcAddress(hGina, "WlxRemoveStatusMessage");
}
-
+
if(*DllVersion >= WLX_VERSION_1_4)
{
-
+
}
}
-
+
return (Functions->WlxNegotiate != NULL) && (Functions->WlxInitialize != NULL);
}
{
PWLSESSION WLSession;
DWORD GinaDllVersion;
-
+
WLSession = (PWLSESSION)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WLSESSION));
if(!WLSession)
{
return NULL;
}
-
+
if(!LoadGina(&WLSession->MsGina.Functions, &GinaDllVersion, &WLSession->MsGina.hDllInstance))
{
HeapFree(GetProcessHeap(), 0, WLSession);
return NULL;
}
-
+
WLSession->MsGina.Context = NULL;
WLSession->MsGina.Version = GinaDllVersion;
WLSession->SuppressStatus = FALSE;
-
+
if(!WLSession->MsGina.Functions.WlxInitialize(WLSession->InteractiveWindowStationName,
(HANDLE)WLSession,
NULL,
return FALSE;
}
SetProcessWindowStation(Session->InteractiveWindowStation);
-
+
/*
* Create the application desktop
*/
DbgPrint("WL: Failed to create Default desktop (0x%X)\n", GetLastError());
return FALSE;
}
-
+
/*
* Create the winlogon desktop
*/
DbgPrint("WL: Failed to create Winlogon desktop (0x%X)\n", GetLastError());
return FALSE;
}
-
+
/*
* Create the screen saver desktop
*/
DbgPrint("WL: Failed to create Screen-Saver desktop (0x%X)\n", GetLastError());
return FALSE;
}
-
+
return TRUE;
}