Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: chrome/installer/gcapi/gcapi.cc

Issue 151085: FixIt: initalize values. (Closed)
Patch Set: temp Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/installer/gcapi/gcapi.h" 5 #include "chrome/installer/gcapi/gcapi.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlcom.h> 8 #include <atlcom.h>
9 #include <windows.h> 9 #include <windows.h>
10 #include <sddl.h> 10 #include <sddl.h>
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 ::CoUninitialize(); 360 ::CoUninitialize();
361 return false; 361 return false;
362 } 362 }
363 363
364 wchar_t* exp_proc_sid; 364 wchar_t* exp_proc_sid;
365 if (GetUserIdForProcess(pid, &exp_proc_sid)) { 365 if (GetUserIdForProcess(pid, &exp_proc_sid)) {
366 if (_wcsicmp(curr_proc_sid, exp_proc_sid) == 0) { 366 if (_wcsicmp(curr_proc_sid, exp_proc_sid) == 0) {
367 HANDLE process_handle = ::OpenProcess( 367 HANDLE process_handle = ::OpenProcess(
368 PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION, TRUE, pid); 368 PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION, TRUE, pid);
369 if (process_handle != NULL) { 369 if (process_handle != NULL) {
370 HANDLE process_token; 370 HANDLE process_token = NULL;
371 HANDLE user_token; 371 HANDLE user_token = NULL;
372 if (::OpenProcessToken(process_handle, TOKEN_DUPLICATE | TOKEN_QUERY, 372 if (::OpenProcessToken(process_handle, TOKEN_DUPLICATE | TOKEN_QUERY,
373 &process_token) && 373 &process_token) &&
374 ::DuplicateTokenEx(process_token, 374 ::DuplicateTokenEx(process_token,
375 TOKEN_IMPERSONATE | TOKEN_QUERY | 375 TOKEN_IMPERSONATE | TOKEN_QUERY |
376 TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE, 376 TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE,
377 NULL, SecurityImpersonation, 377 NULL, SecurityImpersonation,
378 TokenPrimary, &user_token) && 378 TokenPrimary, &user_token) &&
379 (::ImpersonateLoggedOnUser(user_token) != 0)) { 379 (::ImpersonateLoggedOnUser(user_token) != 0)) {
380 impersonation_success = true; 380 impersonation_success = true;
381 } 381 }
382 ::CloseHandle(user_token); 382 if (user_token)
383 ::CloseHandle(process_token); 383 ::CloseHandle(user_token);
384 if (process_token)
385 ::CloseHandle(process_token);
384 ::CloseHandle(process_handle); 386 ::CloseHandle(process_handle);
385 } 387 }
386 } 388 }
387 ::LocalFree(exp_proc_sid); 389 ::LocalFree(exp_proc_sid);
388 } 390 }
389 391
390 ::LocalFree(curr_proc_sid); 392 ::LocalFree(curr_proc_sid);
391 if (!impersonation_success) { 393 if (!impersonation_success) {
392 ::CoUninitialize(); 394 ::CoUninitialize();
393 return false; 395 return false;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 // This loop iterates through all of the top-level Windows named 442 // This loop iterates through all of the top-level Windows named
441 // Chrome_WidgetWin_0, and looks for the first one with any children. 443 // Chrome_WidgetWin_0, and looks for the first one with any children.
442 while (handle && !FindWindowEx(handle, NULL, L"Chrome_WidgetWin_0", NULL)) { 444 while (handle && !FindWindowEx(handle, NULL, L"Chrome_WidgetWin_0", NULL)) {
443 // Get the next top-level Chrome window. 445 // Get the next top-level Chrome window.
444 handle = FindWindowEx(NULL, handle, L"Chrome_WidgetWin_0", NULL); 446 handle = FindWindowEx(NULL, handle, L"Chrome_WidgetWin_0", NULL);
445 } 447 }
446 448
447 return (handle && 449 return (handle &&
448 SetWindowPos(handle, 0, x, y, width, height, SWP_NOZORDER)); 450 SetWindowPos(handle, 0, x, y, width, height, SWP_NOZORDER));
449 } 451 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698