Changeset 50025 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Jan 6, 2014 4:17:58 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp
r48678 r50025 364 364 if (dwLength) 365 365 { 366 pProc->pSid = (PSID)RTMemAlloc(dwLength); 366 pProc->pSid = (PSID)HeapAlloc(GetProcessHeap(), 367 HEAP_ZERO_MEMORY, dwLength); 367 368 AssertPtr(pProc->pSid); 368 369 if (CopySid(dwLength, pProc->pSid, pUser->User.Sid)) … … 378 379 379 380 if (dwErr != ERROR_SUCCESS) 381 { 380 382 VBoxServiceError("Error retrieving SID of process PID=%ld: %ld\n", 381 383 pProc->id, dwErr); 384 if (pProc->pSid) 385 { 386 HeapFree(GetProcessHeap(), 0 /* Flags */, pProc->pSid); 387 pProc->pSid = NULL; 388 } 389 } 382 390 break; 383 391 } … … 457 465 } 458 466 } while (cProcesses <= _32K); /* Should be enough; see: http://blogs.technet.com/markrussinovich/archive/2009/07/08/3261309.aspx */ 467 459 468 if (RT_SUCCESS(rc)) 460 469 { … … 495 504 } 496 505 else 497 RTMemFree(paProcs);506 VBoxServiceVMInfoWinProcessesFree(cProcesses, paProcs); 498 507 } 499 508 else … … 516 525 { 517 526 if (paProcs[i].pSid) 518 RTMemFree(paProcs[i].pSid); 527 { 528 HeapFree(GetProcessHeap(), 0 /* Flags */, paProcs[i].pSid); 529 paProcs[i].pSid = NULL; 530 } 531 519 532 } 520 533 RTMemFree(paProcs); … … 992 1005 AssertRC(rc2); 993 1006 1007 char *pszUserList = NULL; 1008 uint32_t cUsersInList = 0; 1009 994 1010 /* This function can report stale or orphaned interactive logon sessions 995 1011 of already logged off users (especially in Windows 2000). */ … … 1139 1155 cUniqueUsers); 1140 1156 1141 *pcUsersInList = 0;1142 1157 for (ULONG i = 0; i < cUniqueUsers; i++) 1143 1158 { … … 1159 1174 pUserInfo[i].wszUser, pUserInfo[i].ulNumProcs, pUserInfo[i].ulLastSession); 1160 1175 1161 if ( *pcUsersInList > 0)1176 if (cUsersInList > 0) 1162 1177 { 1163 rc = RTStrAAppend( ppszUserList, ",");1164 AssertRCBreakStmt(rc, RTStrFree( *ppszUserList));1178 rc = RTStrAAppend(&pszUserList, ","); 1179 AssertRCBreakStmt(rc, RTStrFree(pszUserList)); 1165 1180 } 1166 1181 1167 *pcUsersInList += 1;1182 cUsersInList += 1; 1168 1183 1169 1184 char *pszUser = NULL; … … 1176 1191 { 1177 1192 /* Append user to users list. */ 1178 rc = RTStrAAppend( ppszUserList, pszUser);1193 rc = RTStrAAppend(&pszUserList, pszUser); 1179 1194 1180 1195 /* Do idle detection. */ … … 1183 1198 } 1184 1199 else 1185 rc = RTStrAAppend( ppszUserList, "<string-conversion-error>");1200 rc = RTStrAAppend(&pszUserList, "<string-conversion-error>"); 1186 1201 1187 1202 RTStrFree(pszUser); 1188 1203 RTStrFree(pszDomain); 1189 1204 1190 AssertRCBreakStmt(rc, RTStrFree( *ppszUserList));1205 AssertRCBreakStmt(rc, RTStrFree(pszUserList)); 1191 1206 } 1192 1207 } … … 1198 1213 if (paSessions) 1199 1214 LsaFreeReturnBuffer(paSessions); 1215 1216 if (RT_SUCCESS(rc)) 1217 { 1218 *ppszUserList = pszUserList; 1219 *pcUsersInList = cUsersInList; 1220 } 1200 1221 1201 1222 s_uDebugIter++;
Note:
See TracChangeset
for help on using the changeset viewer.