- Timestamp:
- Apr 6, 2012 4:36:44 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxLA.cpp
r40664 r40797 28 28 #include <iprt/list.h> 29 29 30 #define LALOG Log 30 #define LALOG(a) do { if (gCtx.fLogEnabled) LogRel(a); } while(0) 31 #define LALOGFORCE(a) do { LogRel(a); } while(0) 31 32 32 33 #define REG_KEY_LEN 1024 … … 42 43 { 43 44 const VBOXSERVICEENV *pEnv; 45 46 bool fLogEnabled; 44 47 45 48 uint32_t u32GuestPropHandle; /* The client identifier of the guest property system. */ … … 103 106 104 107 const char g_szCommandPrefix[] = "Command"; 108 109 static BOOL laGetRegistryDWORD(WCHAR *pwszRegKey, WCHAR *pwszName, DWORD *pdwValue) 110 { 111 LONG lErr; 112 113 HKEY hKey; 114 lErr = RegOpenKeyExW(HKEY_LOCAL_MACHINE, 115 pwszRegKey, 116 0, 117 KEY_QUERY_VALUE, 118 &hKey); 119 120 if (lErr != ERROR_SUCCESS) 121 { 122 LALOGFORCE(("LA: RegOpenKeyExW: failed [%ls]\n", 123 pwszRegKey)); 124 return FALSE; 125 } 126 127 DWORD nRegData = sizeof(DWORD); 128 DWORD dwType = 0; 129 lErr = RegQueryValueExW(hKey, 130 pwszName, 131 NULL, 132 &dwType, 133 (BYTE *)pdwValue, 134 &nRegData); 135 136 if (lErr != ERROR_SUCCESS) 137 { 138 LALOGFORCE(("LA: RegQueryValueExW: failed [%ls/%ls]\n", 139 pwszRegKey, pwszName)); 140 RegCloseKey(hKey); 141 return FALSE; 142 } 143 144 if (nRegData != sizeof(DWORD)) 145 { 146 LALOGFORCE(("LA: buffer overflow reg %d, [%ls]\n", 147 nRegData, pwszRegKey)); 148 RegCloseKey(hKey); 149 return FALSE; 150 } 151 152 if (dwType != REG_DWORD) 153 { 154 LALOGFORCE(("LA: wrong type %d, [%ls/%ls]\n", 155 dwType, pwszRegKey, pwszName)); 156 RegCloseKey(hKey); 157 return FALSE; 158 } 159 160 RegCloseKey(hKey); 161 162 if (lErr != ERROR_SUCCESS) 163 { 164 return FALSE; 165 } 166 167 return TRUE; 168 } 105 169 106 170 static void ActionExecutorDeleteActions(RTLISTANCHOR *listActions) … … 265 329 } 266 330 331 LALOG(("LA: action enum %d\n", 332 bRet)); 333 267 334 return bRet; 268 335 } … … 676 743 else if (rc == VERR_NOT_FOUND) 677 744 { 678 LALOG(("LA: laGetProperty: not found [%s]\n" ));745 LALOG(("LA: laGetProperty: not found [%s]\n", pszName)); 679 746 } 680 747 else … … 1006 1073 * That is two or more LA_DO_ATTACH will do just one LA_DO_ATTACH. 1007 1074 */ 1008 LALOG(("LA: laDoActions: action %d \n",1009 pCtx->u32Action ));1075 LALOG(("LA: laDoActions: action %d, prev %d\n", 1076 pCtx->u32Action, pCtx->u32PrevAction)); 1010 1077 1011 1078 switch(pCtx->u32Action) … … 1063 1130 int VBoxLAInit(const VBOXSERVICEENV *pEnv, void **ppInstance, bool *pfStartThread) 1064 1131 { 1132 gCtx.pEnv = pEnv; 1133 1134 DWORD dwValue = 0; 1135 if ( laGetRegistryDWORD(L"SOFTWARE\\Oracle\\VirtualBox Guest Additions", L"VBoxTrayLog", &dwValue) 1136 && (dwValue & 0x10) != 0) 1137 { 1138 gCtx.fLogEnabled = true; 1139 } 1140 else 1141 { 1142 gCtx.fLogEnabled = false; 1143 } 1144 1065 1145 LALOG(("VBoxTray: VBoxLAInit\n")); 1066 1067 gCtx.pEnv = pEnv;1068 1146 1069 1147 int rc = VbglR3GuestPropConnect(&gCtx.u32GuestPropHandle);
Note:
See TracChangeset
for help on using the changeset viewer.