Skip to content

Commit

Permalink
Fix whitespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
barnson committed Jan 3, 2015
1 parent be430c1 commit c8b1483
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
5 changes: 2 additions & 3 deletions src/ext/ca/wixca/dll/RestartManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ extern "C" UINT __stdcall WixRegisterRestartResources(
__in MSIHANDLE hInstall
)
{

HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;

Expand Down Expand Up @@ -153,10 +152,10 @@ extern "C" UINT __stdcall WixRegisterRestartResources(
{
// ERROR_ACCESS_DENIED was returned when trying to register this process.
// Since other instances may have been registered, log a message and continue the setup rather than failing.
WcaLog(LOGMSG_STANDARD, "The process, %ls, could not be registered with the Restart Manager (probably because the setup is not elevated and the process is in another user context. A reboot may be requested later.", wzResource);
WcaLog(LOGMSG_STANDARD, "The process, %ls, could not be registered with the Restart Manager (probably because the setup is not elevated and the process is in another user context). A reboot may be requested later.", wzResource);
hr = S_OK;
}
else
else
{
ExitOnFailure(hr, "Failed to register the process name with the Restart Manager session.");
}
Expand Down
27 changes: 14 additions & 13 deletions src/libs/dutil/rmutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,16 @@ extern "C" HRESULT DAPI RmuAddProcessById(
ExitWithLastError(hr, "Failed to get debug privilege LUID.");
}
}

fAdjustedPrivileges = TRUE;
}

hProcess = ::OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dwProcessId);
if (NULL != hProcess)
if (hProcess)
{
if (!::GetProcessTimes(hProcess, &CreationTime, &ExitTime, &KernelTime, &UserTime))
{
ExitWithLastError(hr, "Failed to get the process times for process ID %d.", dwProcessId);
ExitWithLastError(hr, "Failed to get the process times for process ID %d.", dwProcessId);
}

::EnterCriticalSection(&pSession->cs);
Expand All @@ -220,7 +220,7 @@ extern "C" HRESULT DAPI RmuAddProcessById(
if (ERROR_ACCESS_DENIED == er)
{
// OpenProcess will fail when not elevated and the target process is in another user context. Let the caller log and continue.
hr = E_NOTFOUND;
hr = E_NOTFOUND;
}
else
{
Expand All @@ -238,6 +238,7 @@ extern "C" HRESULT DAPI RmuAddProcessById(
{
::AdjustTokenPrivileges(hToken, FALSE, pPrevPriv, 0, NULL, NULL);
}

ReleaseMem(pPrevPriv);
ReleaseHandle(hToken);

Expand Down Expand Up @@ -273,15 +274,15 @@ extern "C" HRESULT DAPI RmuAddProcessesByName(
for (DWORD i = 0; i < cProcessIds; ++i)
{
hr = RmuAddProcessById(pSession, pdwProcessIds[i]);
if (E_NOTFOUND == hr)
{
// RmuAddProcessById returns E_NOTFOUND when this setup is not elevated and OpenProcess returned access denied (target process running under another user account).
fNotFound = TRUE;
}
else
{
ExitOnFailure(hr, "Failed to add process %ls (%d) to the Restart Manager session.", wzProcessName, pdwProcessIds[i]);
}
if (E_NOTFOUND == hr)
{
// RmuAddProcessById returns E_NOTFOUND when this setup is not elevated and OpenProcess returned access denied (target process running under another user account).
fNotFound = TRUE;
}
else
{
ExitOnFailure(hr, "Failed to add process %ls (%d) to the Restart Manager session.", wzProcessName, pdwProcessIds[i]);
}
}

// If one or more calls to RmuAddProcessById returned E_NOTFOUND, then return E_NOTFOUND even if other calls succeeded, so that caller can log the issue.
Expand Down

0 comments on commit c8b1483

Please sign in to comment.