Changeset 86300 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- Sep 26, 2020 9:59:44 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 140580
- Location:
- trunk/src/VBox/Runtime/r3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/darwin/krnlmod-darwin.cpp
r82968 r86300 43 43 #include <CoreFoundation/CoreFoundation.h> 44 44 #include <IOKit/IOKitLib.h> 45 #include <libkern/OSReturn.h> 45 46 46 47 … … 49 50 /** OSKextCopyLoadedKextInfo in IOKit. */ 50 51 typedef CFDictionaryRef (* PFNOSKEXTCOPYLOADEDKEXTINFO)(CFArrayRef, CFArrayRef); 52 /** KextManagerLoadKextWithURL in IOKit. */ 53 typedef OSReturn (* PFNKEXTMANAGERLOADKEXTWITHURL)(CFURLRef, CFArrayRef); 54 /** KextManagerLoadKextWithIdentifier in IOKit */ 55 typedef OSReturn (* PFNKEXTMANAGERLOADKEXTWITHIDENTIFIER)(CFStringRef, CFArrayRef); 56 /** KextManagerUnloadKextWithIdentifier in IOKit */ 57 typedef OSReturn (* PFNKEXTMANAGERUNLOADKEXTWITHIDENTIFIER)(CFStringRef); 51 58 52 59 #ifndef kOSBundleRetainCountKey … … 84 91 * Global Variables * 85 92 *********************************************************************************************************************************/ 86 static RTONCE g_GetIoKitApisOnce = RTONCE_INITIALIZER; 87 static PFNOSKEXTCOPYLOADEDKEXTINFO g_pfnOSKextCopyLoadedKextInfo = NULL; 93 static RTONCE g_GetIoKitApisOnce = RTONCE_INITIALIZER; 94 static PFNOSKEXTCOPYLOADEDKEXTINFO g_pfnOSKextCopyLoadedKextInfo = NULL; 95 static PFNKEXTMANAGERLOADKEXTWITHURL g_pfnKextManagerLoadKextWithUrl = NULL; 96 static PFNKEXTMANAGERLOADKEXTWITHIDENTIFIER g_pfnKextManagerLoadKextWithIdentifier = NULL; 97 static PFNKEXTMANAGERUNLOADKEXTWITHIDENTIFIER g_pfnKextManagerUnloadKextWithIdentifier = NULL; 88 98 89 99 /** Do-once callback for setting g_pfnOSKextCopyLoadedKextInfo. */ … … 94 104 int rc = RTLdrLoadEx("/System/Library/Frameworks/IOKit.framework/Versions/Current/IOKit", &hMod, RTLDRLOAD_FLAGS_NO_SUFFIX, NULL); 95 105 if (RT_SUCCESS(rc)) 106 { 96 107 RTLdrGetSymbol(hMod, "OSKextCopyLoadedKextInfo", (void **)&g_pfnOSKextCopyLoadedKextInfo); 108 RTLdrGetSymbol(hMod, "KextManagerLoadKextWithURL", (void **)&g_pfnKextManagerLoadKextWithUrl); 109 RTLdrGetSymbol(hMod, "KextManagerLoadKextWithIdentifier", (void **)&g_pfnKextManagerLoadKextWithIdentifier); 110 RTLdrGetSymbol(hMod, "KextManagerUnloadKextWithIdentifier", (void **)&g_pfnKextManagerUnloadKextWithIdentifier); 111 } 97 112 98 113 RT_NOREF(pvUser); … … 390 405 return VERR_NOT_IMPLEMENTED; 391 406 } 407 408 409 RTDECL(int) RTKrnlModLoadByName(const char *pszName) 410 { 411 AssertPtrReturn(pszName, VERR_INVALID_PARAMETER); 412 413 RTOnce(&g_GetIoKitApisOnce, rtKrnlModDarwinResolveIoKitApis, NULL); 414 if (!g_pfnKextManagerLoadKextWithIdentifier) return VERR_NOT_SUPPORTED; 415 416 int rc = VINF_SUCCESS; 417 CFStringRef hKextName = CFStringCreateWithCString(kCFAllocatorDefault, pszName, kCFStringEncodingUTF8); 418 if (hKextName) 419 { 420 OSReturn rcOsx = g_pfnKextManagerLoadKextWithIdentifier(hKextName, NULL /*dependencyKextAndFolderURLs*/); 421 if (rcOsx != kOSReturnSuccess) 422 rc = VERR_NOT_SUPPORTED; /** @todo Convert OSReturn values. */ 423 CFRelease(hKextName); 424 } 425 else 426 rc = VERR_NO_MEMORY; 427 428 return rc; 429 } 430 431 432 RTDECL(int) RTKrnlModLoadByPath(const char *pszPath) 433 { 434 AssertPtrReturn(pszPath, VERR_INVALID_PARAMETER); 435 436 return VERR_NOT_SUPPORTED; 437 } 438 439 440 RTDECL(int) RTKrnlModUnloadByName(const char *pszName) 441 { 442 AssertPtrReturn(pszName, VERR_INVALID_PARAMETER); 443 444 RTOnce(&g_GetIoKitApisOnce, rtKrnlModDarwinResolveIoKitApis, NULL); 445 if (!g_pfnKextManagerUnloadKextWithIdentifier) return VERR_NOT_SUPPORTED; 446 447 int rc = VINF_SUCCESS; 448 CFStringRef hKextName = CFStringCreateWithCString(kCFAllocatorDefault, pszName, kCFStringEncodingUTF8); 449 if (hKextName) 450 { 451 OSReturn rcOsx = g_pfnKextManagerUnloadKextWithIdentifier(hKextName); 452 if (rcOsx != kOSReturnSuccess) 453 rc = VERR_NOT_SUPPORTED; /** @todo Convert OSReturn values. */ 454 CFRelease(hKextName); 455 } 456 else 457 rc = VERR_NO_MEMORY; 458 459 return rc; 460 } -
trunk/src/VBox/Runtime/r3/linux/krnlmod-linux.cpp
r82968 r86300 323 323 return VERR_NOT_IMPLEMENTED; 324 324 } 325 326 327 RTDECL(int) RTKrnlModLoadByName(const char *pszName) 328 { 329 AssertPtrReturn(pszName, VERR_INVALID_PARAMETER); 330 331 return VERR_NOT_SUPPORTED; 332 } 333 334 335 RTDECL(int) RTKrnlModLoadByPath(const char *pszPath) 336 { 337 AssertPtrReturn(pszName, VERR_INVALID_PARAMETER); 338 339 return VERR_NOT_SUPPORTED; 340 } 341 342 343 RTDECL(int) RTKrnlModUnloadByName(const char *pszName) 344 { 345 AssertPtrReturn(pszName, VERR_INVALID_PARAMETER); 346 347 return VERR_NOT_SUPPORTED; 348 } -
trunk/src/VBox/Runtime/r3/solaris/krnlmod-solaris.cpp
r82968 r86300 323 323 return VERR_NOT_IMPLEMENTED; 324 324 } 325 326 327 RTDECL(int) RTKrnlModLoadByName(const char *pszName) 328 { 329 AssertPtrReturn(pszName, VERR_INVALID_PARAMETER); 330 331 return VERR_NOT_SUPPORTED; 332 } 333 334 335 RTDECL(int) RTKrnlModLoadByPath(const char *pszPath) 336 { 337 AssertPtrReturn(pszName, VERR_INVALID_PARAMETER); 338 339 return VERR_NOT_SUPPORTED; 340 } 341 342 343 RTDECL(int) RTKrnlModUnloadByName(const char *pszName) 344 { 345 AssertPtrReturn(pszName, VERR_INVALID_PARAMETER); 346 347 return VERR_NOT_SUPPORTED; 348 } -
trunk/src/VBox/Runtime/r3/win/krnlmod-win.cpp
r82968 r86300 296 296 return VERR_NOT_SUPPORTED; 297 297 } 298 299 300 RTDECL(int) RTKrnlModLoadByName(const char *pszName) 301 { 302 AssertPtrReturn(pszName, VERR_INVALID_PARAMETER); 303 304 return VERR_NOT_SUPPORTED; 305 } 306 307 308 RTDECL(int) RTKrnlModLoadByPath(const char *pszPath) 309 { 310 AssertPtrReturn(pszName, VERR_INVALID_PARAMETER); 311 312 return VERR_NOT_SUPPORTED; 313 } 314 315 316 RTDECL(int) RTKrnlModUnloadByName(const char *pszName) 317 { 318 AssertPtrReturn(pszName, VERR_INVALID_PARAMETER); 319 320 return VERR_NOT_SUPPORTED; 321 }
Note:
See TracChangeset
for help on using the changeset viewer.