Update indentation.

svn path=/trunk/; revision=18686
This commit is contained in:
Eric Kohl 2005-10-22 19:46:00 +00:00
parent cf54e94b6e
commit 1060e47c32
3 changed files with 997 additions and 978 deletions

View file

@ -343,7 +343,6 @@ ScmCreateServiceDataBase(VOID)
{ {
if (KeyInfo->NameLength < MAX_PATH * sizeof(WCHAR)) if (KeyInfo->NameLength < MAX_PATH * sizeof(WCHAR))
{ {
SubKeyName.Length = KeyInfo->NameLength; SubKeyName.Length = KeyInfo->NameLength;
SubKeyName.MaximumLength = KeyInfo->NameLength + sizeof(WCHAR); SubKeyName.MaximumLength = KeyInfo->NameLength + sizeof(WCHAR);
SubKeyName.Buffer = KeyInfo->Name; SubKeyName.Buffer = KeyInfo->Name;
@ -446,7 +445,8 @@ ScmCheckDriver(PSERVICE Service)
if (_wcsicmp(Service->lpServiceName, DirInfo->ObjectName.Buffer) == 0) if (_wcsicmp(Service->lpServiceName, DirInfo->ObjectName.Buffer) == 0)
{ {
DPRINT("Found: '%S' '%wZ'\n", Service->lpServiceName, &DirInfo->ObjectName); DPRINT("Found: '%S' '%wZ'\n",
Service->lpServiceName, &DirInfo->ObjectName);
/* Mark service as 'running' */ /* Mark service as 'running' */
Service->Status.dwCurrentState = SERVICE_RUNNING; Service->Status.dwCurrentState = SERVICE_RUNNING;
@ -502,6 +502,7 @@ ScmGetBootAndSystemDriverState(VOID)
ScmCheckDriver(CurrentService); ScmCheckDriver(CurrentService);
} }
ServiceEntry = ServiceEntry->Flink; ServiceEntry = ServiceEntry->Flink;
} }

View file

@ -431,7 +431,9 @@ ScmrQueryServiceStatus(handle_t BindingHandle,
} }
/* Return service status information */ /* Return service status information */
RtlCopyMemory(lpServiceStatus, &lpService->Status, sizeof(SERVICE_STATUS)); RtlCopyMemory(lpServiceStatus,
&lpService->Status,
sizeof(SERVICE_STATUS));
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }

View file

@ -113,38 +113,47 @@ ScmNamedPipeThread(LPVOID Context)
DWORD cbReplyBytes; DWORD cbReplyBytes;
DWORD cbBytesRead; DWORD cbBytesRead;
DWORD cbWritten; DWORD cbWritten;
BOOL fSuccess; BOOL bSuccess;
HANDLE hPipe; HANDLE hPipe;
hPipe = (HANDLE)Context; hPipe = (HANDLE)Context;
DPRINT("ScmNamedPipeThread(%x) - Accepting SCM commands through named pipe\n", hPipe); DPRINT("ScmNamedPipeThread(%x) - Accepting SCM commands through named pipe\n", hPipe);
for (;;) { for (;;)
fSuccess = ReadFile(hPipe, {
bSuccess = ReadFile(hPipe,
&chRequest, &chRequest,
PIPE_BUFSIZE, PIPE_BUFSIZE,
&cbBytesRead, &cbBytesRead,
NULL); NULL);
if (!fSuccess || cbBytesRead == 0) { if (!bSuccess || cbBytesRead == 0)
{
break; break;
} }
if (ScmNamedPipeHandleRequest(&chRequest, cbBytesRead, &chReply, &cbReplyBytes)) {
fSuccess = WriteFile(hPipe, if (ScmNamedPipeHandleRequest(&chRequest, cbBytesRead, &chReply, &cbReplyBytes))
{
bSuccess = WriteFile(hPipe,
&chReply, &chReply,
cbReplyBytes, cbReplyBytes,
&cbWritten, &cbWritten,
NULL); NULL);
if (!fSuccess || cbReplyBytes != cbWritten) { if (!bSuccess || cbReplyBytes != cbWritten)
{
break; break;
} }
} }
} }
DPRINT("ScmNamedPipeThread(%x) - Disconnecting named pipe connection\n", hPipe); DPRINT("ScmNamedPipeThread(%x) - Disconnecting named pipe connection\n", hPipe);
FlushFileBuffers(hPipe); FlushFileBuffers(hPipe);
DisconnectNamedPipe(hPipe); DisconnectNamedPipe(hPipe);
CloseHandle(hPipe); CloseHandle(hPipe);
DPRINT("ScmNamedPipeThread(%x) - Done.\n", hPipe); DPRINT("ScmNamedPipeThread(%x) - Done.\n", hPipe);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -153,7 +162,7 @@ BOOL
ScmCreateNamedPipe(VOID) ScmCreateNamedPipe(VOID)
{ {
DWORD dwThreadId; DWORD dwThreadId;
BOOL fConnected; BOOL bConnected;
HANDLE hThread; HANDLE hThread;
HANDLE hPipe; HANDLE hPipe;
@ -167,17 +176,19 @@ ScmCreateNamedPipe(VOID)
PIPE_BUFSIZE, PIPE_BUFSIZE,
PIPE_TIMEOUT, PIPE_TIMEOUT,
NULL); NULL);
if (hPipe == INVALID_HANDLE_VALUE) { if (hPipe == INVALID_HANDLE_VALUE)
{
DPRINT("CreateNamedPipe() failed (%d)\n", GetLastError()); DPRINT("CreateNamedPipe() failed (%d)\n", GetLastError());
return FALSE; return FALSE;
} }
DPRINT("CreateNamedPipe() - calling ConnectNamedPipe(%x)\n", hPipe); DPRINT("CreateNamedPipe() - calling ConnectNamedPipe(%x)\n", hPipe);
fConnected = ConnectNamedPipe(hPipe, bConnected = ConnectNamedPipe(hPipe,
NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED); NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED);
DPRINT("CreateNamedPipe() - ConnectNamedPipe() returned %d\n", fConnected); DPRINT("CreateNamedPipe() - ConnectNamedPipe() returned %d\n", bConnected);
if (fConnected) { if (bConnected)
{
DPRINT("Pipe connected\n"); DPRINT("Pipe connected\n");
hThread = CreateThread(NULL, hThread = CreateThread(NULL,
0, 0,
@ -185,14 +196,17 @@ ScmCreateNamedPipe(VOID)
(LPVOID)hPipe, (LPVOID)hPipe,
0, 0,
&dwThreadId); &dwThreadId);
if (!hThread) { if (!hThread)
{
DPRINT("Could not create thread (%d)\n", GetLastError()); DPRINT("Could not create thread (%d)\n", GetLastError());
DisconnectNamedPipe(hPipe); DisconnectNamedPipe(hPipe);
CloseHandle(hPipe); CloseHandle(hPipe);
DPRINT("CreateNamedPipe() - returning FALSE\n"); DPRINT("CreateNamedPipe() - returning FALSE\n");
return FALSE; return FALSE;
} }
} else { }
else
{
DPRINT("Pipe not connected\n"); DPRINT("Pipe not connected\n");
CloseHandle(hPipe); CloseHandle(hPipe);
DPRINT("CreateNamedPipe() - returning FALSE\n"); DPRINT("CreateNamedPipe() - returning FALSE\n");
@ -210,10 +224,12 @@ ScmNamedPipeListenerThread(LPVOID Context)
DPRINT("ScmNamedPipeListenerThread(%x) - aka SCM.\n", Context); DPRINT("ScmNamedPipeListenerThread(%x) - aka SCM.\n", Context);
// hPipe = (HANDLE)Context; // hPipe = (HANDLE)Context;
for (;;) { for (;;)
{
DPRINT("SCM: Waiting for new connection on named pipe...\n"); DPRINT("SCM: Waiting for new connection on named pipe...\n");
/* Create named pipe */ /* Create named pipe */
if (!ScmCreateNamedPipe()) { if (!ScmCreateNamedPipe())
{
DPRINT1("\nSCM: Failed to create named pipe\n"); DPRINT1("\nSCM: Failed to create named pipe\n");
break; break;
//ExitThread(0); //ExitThread(0);