Changeset 29248 in vbox
- Timestamp:
- May 9, 2010 5:18:13 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r29227 r29248 105 105 # include "IOKit/IOKitLib.h" 106 106 107 int DarwinSmcKey(char*aKey, uint32_t iKeySize)107 static int DarwinSmcKey(char *aKey, uint32_t iKeySize) 108 108 { 109 109 /* … … 122 122 } AppleSMCBuffer; 123 123 124 125 if (iKeySize < 65) 126 return VERR_INTERNAL_ERROR; 124 AssertReturn(iKeySize >= 65, VERR_INTERNAL_ERROR; 127 125 128 126 io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, … … 131 129 return VERR_INTERNAL_ERROR; 132 130 133 io_connect_t port = (io_connect_t)0;134 kern_return_t kr= IOServiceOpen(service, mach_task_self(), 0, &port);131 io_connect_t port = (io_connect_t)0; 132 kern_return_t kr = IOServiceOpen(service, mach_task_self(), 0, &port); 135 133 IOObjectRelease(service); 136 134 … … 138 136 return VERR_INTERNAL_ERROR; 139 137 140 AppleSMCBuffer inputStruct = { 0, {0}, 32, {0}, 5, }, outputStruct; 141 size_t outputStructCnt = sizeof(outputStruct); 138 AppleSMCBuffer inputStruct = { 0, {0}, 32, {0}, 5, }; 139 AppleSMCBuffer outputStruct; 140 size_t cbOutputStruct = sizeof(outputStruct); 142 141 143 142 for (int i = 0; i < 2; i++) … … 146 145 kr = IOConnectCallStructMethod((mach_port_t)port, 147 146 (uint32_t)2, 148 (const void *)&inputStruct,147 (const void *)&inputStruct, 149 148 sizeof(inputStruct), 150 (void *)&outputStruct,151 & outputStructCnt);149 (void *)&outputStruct, 150 &cbOutputStruct); 152 151 if (kr != kIOReturnSuccess) 153 152 { … … 156 155 } 157 156 158 for (int j =0; j<32; j++)157 for (int j = 0; j < 32; j++) 159 158 aKey[j + i*32] = outputStruct.data[j]; 160 159 }
Note:
See TracChangeset
for help on using the changeset viewer.