Changeset 66279 in vbox for trunk/src/VBox/Main/src-all
- Timestamp:
- Mar 28, 2017 7:23:33 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 114203
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-all/win/VBoxProxyStub.c
r66274 r66279 1016 1016 * @returns Windows error code (errors are rememberd in the state). 1017 1017 * @param pState The registry modifier state. 1018 * @param pszModuleName The module name. 1018 1019 * @param pszAppId The application UUID string. 1019 1020 * @param pszDescription The description string. 1020 * @param bIsService The application is windows service 1021 */ 1022 LSTATUS VbpsRegisterAppId( 1023 VBPSREGSTATE *pState, 1024 const char *pszModuleName, 1025 const char *pszAppId, 1026 const char *pszDescription, 1027 bool bIsService) 1021 * @param fIsService The application is windows service 1022 */ 1023 LSTATUS VbpsRegisterAppId(VBPSREGSTATE *pState, const char *pszModuleName, const char *pszAppId, 1024 const char *pszDescription, bool fIsService) 1028 1025 { 1029 1026 LSTATUS rc; … … 1052 1049 rc = RegCreateKeyExW(pState->hkeyClassesRootDst, L"AppID", 0 /*Reserved*/, NULL /*pszClass*/, 0 /*fOptions*/, 1053 1050 pState->fSamBoth, NULL /*pSecAttr*/, &hkeyAppIds, NULL /*pdwDisposition*/); 1054 1055 1051 else 1056 1052 { … … 1067 1063 } 1068 1064 1069 if (pState->fUpdate) 1065 if (pState->fUpdate) 1066 { 1067 vbpsCreateRegKeyWithDefaultValueAA(pState, hkeyAppIds, pszAppId, pszDescription, __LINE__); 1068 1069 if (fIsService) 1070 1070 { 1071 //HKEY hkeyApp; 1072 HKEY hkeyServiceExe; 1073 1074 vbpsCreateRegKeyWithDefaultValueAA(pState, hkeyAppIds, pszAppId, pszDescription, __LINE__); 1075 1076 if (bIsService) 1077 { 1078 HKEY hkeyApp; 1079 1080 char szModule[MAX_PATH + 2]; 1081 size_t len = RTStrNLen(pszModuleName, MAX_PATH); 1082 Assert(len); 1083 Assert(len < MAX_PATH); 1084 rc = RTStrCopy(szModule, sizeof(szModule), pszModuleName); 1085 AssertRC(rc); 1086 szModule[len - 4] = '\0'; 1087 1088 rc = RegOpenKeyExA(hkeyAppIds, pszAppId, 0 /*fOptions*/, pState->fSamBoth, &hkeyApp); 1089 if (rc == ERROR_FILE_NOT_FOUND) 1090 return ERROR_SUCCESS; 1091 // create the value "Service" with the service name 1092 vbpsSetRegValueAA(pState, hkeyApp, "LocalService", szModule, __LINE__); 1093 vbpsCloseKey(pState, hkeyApp, __LINE__); 1094 } 1095 1096 vbpsCreateRegKeyWithDefaultValueAA(pState, hkeyAppIds, pszModuleName, "", __LINE__); 1097 rc = RegOpenKeyExA(hkeyAppIds, pszModuleName, 0 /*fOptions*/, pState->fSamBoth, &hkeyServiceExe); 1071 char szModule[MAX_PATH + 2]; 1072 size_t len = RTStrNLen(pszModuleName, MAX_PATH); 1073 Assert(len); 1074 Assert(len < MAX_PATH); 1075 rc = RTStrCopy(szModule, sizeof(szModule), pszModuleName); 1076 AssertRC(rc); 1077 szModule[len - 4] = '\0'; 1078 1079 HKEY hkeyApp; 1080 rc = RegOpenKeyExA(hkeyAppIds, pszAppId, 0 /*fOptions*/, pState->fSamBoth, &hkeyApp); 1098 1081 if (rc == ERROR_FILE_NOT_FOUND) 1099 1082 return ERROR_SUCCESS; 1100 vbpsSetRegValueAA(pState, hkeyServiceExe, "AppID", pszAppId, __LINE__); 1101 vbpsCloseKey(pState, hkeyServiceExe, __LINE__); 1083 // create the value "Service" with the service name 1084 vbpsSetRegValueAA(pState, hkeyApp, "LocalService", szModule, __LINE__); 1085 vbpsCloseKey(pState, hkeyApp, __LINE__); 1102 1086 } 1087 1088 vbpsCreateRegKeyWithDefaultValueAA(pState, hkeyAppIds, pszModuleName, "", __LINE__); 1089 1090 HKEY hkeyServiceExe; 1091 rc = RegOpenKeyExA(hkeyAppIds, pszModuleName, 0 /*fOptions*/, pState->fSamBoth, &hkeyServiceExe); 1092 if (rc == ERROR_FILE_NOT_FOUND) 1093 return ERROR_SUCCESS; 1094 vbpsSetRegValueAA(pState, hkeyServiceExe, "AppID", pszAppId, __LINE__); 1095 vbpsCloseKey(pState, hkeyServiceExe, __LINE__); 1096 } 1103 1097 1104 1098 vbpsCloseKey(pState, hkeyAppIds, __LINE__); … … 1288 1282 1289 1283 /* AppID = pszAppId */ 1290 if (pszAppId && fQuoteIt)1284 if (pszAppId && fQuoteIt) 1291 1285 vbpsSetRegValueAA(pState, hkeyClass, "AppID", pszAppId, __LINE__); 1292 1286 … … 1339 1333 const char *pszInprocDll = !fIs32On64 ? "VBoxC.dll" : "x86\\VBoxClient-x86.dll"; 1340 1334 const char *pszLocalServer = "VBoxSVC.exe"; 1341 1335 1342 1336 VbpsRegisterAppId(pState, pszLocalServer, pszAppId, "VirtualBox Application", false); 1343 1337
Note:
See TracChangeset
for help on using the changeset viewer.