Changeset 4466 in vbox for trunk/src/VBox
- Timestamp:
- Aug 31, 2007 11:04:11 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxService/VBoxService.cpp
r4463 r4466 27 27 #include "helpers.h" 28 28 29 #undef _WIN32_WINNT 30 #define _WIN32_WINNT 0x500 31 #include <sddl.h> 32 29 33 /* global variables */ 30 34 HANDLE gVBoxDriver; … … 292 296 return; 293 297 } 294 ghSeamlessNotifyEvent = CreateEvent(NULL, FALSE, FALSE, VBOXHOOK_GLOBAL_EVENT_NAME); 298 299 /* We need to setup a security descriptor to allow other processes modify access to the seamless notification event semaphore */ 300 SECURITY_ATTRIBUTES SecAttr; 301 PSECURITY_DESCRIPTOR pSD; 302 OSVERSIONINFO info; 303 char secDesc[SECURITY_DESCRIPTOR_MIN_LENGTH]; 304 DWORD dwMajorVersion = 5; /* default XP */ 305 BOOL ret; 306 307 SecAttr.nLength = sizeof(SecAttr); 308 SecAttr.bInheritHandle = FALSE; 309 SecAttr.lpSecurityDescriptor = &secDesc; 310 InitializeSecurityDescriptor(SecAttr.lpSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION); 311 ret = SetSecurityDescriptorDacl(SecAttr.lpSecurityDescriptor, TRUE, 0, FALSE); 312 if (!ret) 313 dprintf(("SetSecurityDescriptorDacl failed with %d\n", GetLastError())); 314 315 info.dwOSVersionInfoSize = sizeof(info); 316 if (GetVersionEx(&info)) 317 { 318 dprintf(("VBoxService: Windows version major %d minor %d\n", info.dwMajorVersion, info.dwMinorVersion)); 319 dwMajorVersion = info.dwMajorVersion; 320 } 321 322 if (dwMajorVersion >= 6) /* Vista and up only */ 323 { 324 PACL pSacl = NULL; 325 BOOL fSaclPresent = FALSE; 326 BOOL fSaclDefaulted = FALSE; 327 HMODULE hModule; 328 329 BOOL (WINAPI * pfnConvertStringSecurityDescriptorToSecurityDescriptorA)(LPCSTR StringSecurityDescriptor, DWORD StringSDRevision, PSECURITY_DESCRIPTOR *SecurityDescriptor, PULONG SecurityDescriptorSize); 330 331 hModule = LoadLibrary("ADVAPI32.DLL"); 332 333 if (hModule) 334 { 335 *(uintptr_t *)&pfnConvertStringSecurityDescriptorToSecurityDescriptorA = (uintptr_t)GetProcAddress(hModule, "ConvertStringSecurityDescriptorToSecurityDescriptorA"); 336 337 dprintf(("pfnConvertStringSecurityDescriptorToSecurityDescriptorA = %x\n", pfnConvertStringSecurityDescriptorToSecurityDescriptorA)); 338 if (pfnConvertStringSecurityDescriptorToSecurityDescriptorA) 339 { 340 ret = pfnConvertStringSecurityDescriptorToSecurityDescriptorA("S:(ML;;NW;;;LW)", // this means "low integrity" 341 SDDL_REVISION_1, 342 &pSD, 343 NULL); 344 if (!ret) 345 dprintf(("ConvertStringSecurityDescriptorToSecurityDescriptorA failed with %d\n", GetLastError())); 346 ret = GetSecurityDescriptorSacl(pSD, &fSaclPresent, &pSacl, &fSaclDefaulted); 347 if (!ret) 348 dprintf(("GetSecurityDescriptorSacl failed with %d\n", GetLastError())); 349 ret = SetSecurityDescriptorSacl(SecAttr.lpSecurityDescriptor, TRUE, pSacl, FALSE); 350 if (!ret) 351 dprintf(("SetSecurityDescriptorSacl failed with %d\n", GetLastError())); 352 } 353 } 354 } 355 356 ghSeamlessNotifyEvent = CreateEvent(&SecAttr, FALSE, FALSE, VBOXHOOK_GLOBAL_EVENT_NAME); 295 357 if (ghSeamlessNotifyEvent == NULL) 296 358 { … … 338 400 dprintf(("VBoxService: ndata.hWnd %08X, ndata.hIcon = %p\n", ndata.hWnd, ndata.hIcon)); 339 401 402 /* Boost thread priority to make sure we wake up early for seamless window notifications (not sure if it actually makes any difference though) */ 403 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); 404 340 405 /* 341 406 * Main execution loop
Note:
See TracChangeset
for help on using the changeset viewer.