• R/O
  • SSH
  • HTTPS

netoffice: Commit


Commit MetaInfo

Revision190 (tree)
Time2018-07-19 13:11:51
Authorsebastiandotnet

Log Message

- fix unsafe string cpy/cat methods

Change Summary

Incremental Difference

--- NetOfficeShimLoader/ShimLoader/CLRUpdateHost.cpp (revision 189)
+++ NetOfficeShimLoader/ShimLoader/CLRUpdateHost.cpp (revision 190)
@@ -66,8 +66,7 @@
6666 ICLRRuntimeInfo* runtimeInfo = nullptr;
6767 ICorRuntimeHost* runtimeHost = nullptr;
6868
69- WCHAR directoryPath[MAX_PATH + 1];
70- IfFailGo(GetDllDirectory(directoryPath, ARRAYSIZE(directoryPath)));
69+ auto directoryPath = UpdateManagedAggregator_Folder;
7170
7271 WCHAR fullInnerAddinFilePath[MAX_PATH + 1];
7372 IfFailGo(AppendPath(fullInnerAddinFilePath, directoryPath));
--- NetOfficeShimLoader/ShimLoader/ClrHost.cpp (revision 189)
+++ NetOfficeShimLoader/ShimLoader/ClrHost.cpp (revision 190)
@@ -59,8 +59,7 @@
5959 ICLRRuntimeInfo* runtimeInfo = nullptr;
6060 ICorRuntimeHost* runtimeHost = nullptr;
6161
62- WCHAR directoryPath[MAX_PATH + 1];
63- IfFailGo(GetDllDirectory(directoryPath, ARRAYSIZE(directoryPath)));
62+ auto directoryPath = TargetManagedAggregator_Folder;
6463
6564 WCHAR fullInnerAddinFilePath[MAX_PATH + 1];
6665 IfFailGo(AppendPath(fullInnerAddinFilePath, directoryPath));
@@ -85,7 +84,7 @@
8584
8685 IfFailGo(runtimeHost->CreateDomainSetup(&unkAppDomainSetup));
8786 IfFailGo(unkAppDomainSetup->QueryInterface(__uuidof(pDomainSetup), (LPVOID*)&pDomainSetup));
88- pDomainSetup->put_ApplicationBase(CComBSTR(directoryPath));
87+ pDomainSetup->put_ApplicationBase(CComBSTR(TargetManagedAggregator_AppDomain_BaseFolder));
8988
9089 if (PathFileExists(fullInnerAddinConfigFilePath))
9190 {
@@ -92,7 +91,8 @@
9291 IfFailGo(pDomainSetup->put_ConfigurationFile(fullInnerAddinConfigFilePath));
9392 }
9493
95- IfFailGo(runtimeHost->CreateDomainEx(T2W(directoryPath), pDomainSetup, 0, &unkAppDomain));
94+ auto appDomainFriendlyName = wcslen(TargetManagedAggregator_AppDomain_FriendlyName) > 0 ? T2W(TargetManagedAggregator_AppDomain_FriendlyName) : T2W(directoryPath);
95+ IfFailGo(runtimeHost->CreateDomainEx(appDomainFriendlyName, pDomainSetup, 0, &unkAppDomain));
9696 IfFailGo(unkAppDomain->QueryInterface(__uuidof(_appDomain), (LPVOID*)&_appDomain));
9797 IfFailGo(_appDomain->CreateInstance(
9898 CComBSTR(TargetManagedAggregator_AssemblyName),
--- NetOfficeShimLoader/ShimLoader/DllRegister32.cpp (revision 189)
+++ NetOfficeShimLoader/ShimLoader/DllRegister32.cpp (revision 190)
@@ -13,8 +13,8 @@
1313 HRESULT UnRegisterCOMAddin(LPCWSTR pszOfficeApp, LPCWSTR pszProgID, bool registerPerMachine);
1414
1515 HKEY TargetRootKey(RegisterMode mode);
16- void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey);
17- void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey);
16+ void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey, int maxLen);
17+ void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey, int maxLen);
1818 BOOL SetKeyAndValue(HKEY hKeyRoot, LPCWSTR pszPath, LPCWSTR pszSubkey1, LPCWSTR pszSubkey2, LPCWSTR pszSubkey3, LPCWSTR pszvalueName, LPCWSTR pszValue);
1919 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild);
2020 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild, LPCWSTR pszKeyChild2);
@@ -95,10 +95,10 @@
9595 HKEY targetRootKey = TargetRootKey(mode);
9696
9797 WCHAR classIdKey[512];
98- ClassIdSubKey(classId, mode, classIdKey);
98+ ClassIdSubKey(classId, mode, classIdKey, 512);
9999
100100 WCHAR progIdKey[512];
101- ProgIdSubKey(progId, mode, progIdKey);
101+ ProgIdSubKey(progId, mode, progIdKey, 512);
102102
103103 // Target Key ProgId
104104 if (!SetKeyAndValue(targetRootKey, progIdKey, NULL, NULL, NULL, NULL, progId))
@@ -152,9 +152,9 @@
152152
153153 HKEY hKeyRoot = TargetRootKey(mode);
154154 WCHAR classIdKey[512];
155- ClassIdSubKey(classId, mode, classIdKey);
155+ ClassIdSubKey(classId, mode, classIdKey, 512);
156156 WCHAR progIdKey[512];
157- ProgIdSubKey(progId, mode, progIdKey);
157+ ProgIdSubKey(progId, mode, progIdKey, 512);
158158
159159 if (mode != User)
160160 {
@@ -181,10 +181,10 @@
181181 bool keyCreated = false;
182182 HKEY hKey;
183183
184- lstrcpy(szKeyBuf, L"Software\\Microsoft\\Office\\");
185- lstrcat(szKeyBuf, pszOfficeApp);
186- lstrcat(szKeyBuf, L"\\Addins\\");
187- lstrcat(szKeyBuf, pszProgID);
184+ StringCchCopy(szKeyBuf, 1024, L"Software\\Microsoft\\Office\\");
185+ StringCchCat(szKeyBuf, 1024, pszOfficeApp);
186+ StringCchCat(szKeyBuf, 1024, L"\\Addins\\");
187+ StringCchCat(szKeyBuf, 1024, pszProgID);
188188
189189 HKEY root = registerPerMachine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
190190 IfFailGo(RegCreateKeyEx(root, szKeyBuf, 0, NULL, REG_OPTION_NON_VOLATILE, _regKeyOptions, NULL, &hKey, NULL));
@@ -227,10 +227,10 @@
227227
228228 HKEY root = registerPerMachine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
229229 WCHAR szKeyBuf[1024];
230- lstrcpy(szKeyBuf, L"Software\\Microsoft\\Office\\");
231- lstrcat(szKeyBuf, pszOfficeApp);
232- lstrcat(szKeyBuf, L"\\Addins\\");
233- lstrcat(szKeyBuf, pszProgID);
230+ StringCchCopy(szKeyBuf, 1024, L"Software\\Microsoft\\Office\\");
231+ StringCchCat(szKeyBuf, 1024, pszOfficeApp);
232+ StringCchCat(szKeyBuf, 1024, L"\\Addins\\");
233+ StringCchCat(szKeyBuf, 1024, pszProgID);
234234
235235 HRESULT hr = RecursiveDeleteKey(root, szKeyBuf);
236236 if (E_ACCESSDENIED != hr) // if key is missing - we dont care
@@ -254,16 +254,16 @@
254254 return hKeyRoot;
255255 }
256256
257- void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey)
257+ void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey, int maxLen)
258258 {
259- lstrcpy(classIdKey, L"Software\\Classes\\CLSID\\");
260- lstrcat(classIdKey, classId);
259+ StringCchCopy(classIdKey, maxLen, L"Software\\Classes\\CLSID\\");
260+ StringCchCat(classIdKey, maxLen, classId);
261261 }
262262
263- void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey)
263+ void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey, int maxLen)
264264 {
265- lstrcpy(progIdKey, L"Software\\Classes\\");
266- lstrcat(progIdKey, progId);
265+ StringCchCopy(progIdKey, maxLen, L"Software\\Classes\\");
266+ StringCchCat(progIdKey, maxLen, progId);
267267 }
268268
269269 BOOL SetKeyAndValue(HKEY hKeyRoot, LPCWSTR pszPath, LPCWSTR pszSubkey1, LPCWSTR pszSubkey2, LPCWSTR pszSubkey3, LPCWSTR pszvalueName, LPCWSTR pszValue)
@@ -271,22 +271,22 @@
271271 HKEY hKey;
272272 WCHAR szKeyBuf[1024];
273273
274- lstrcpy(szKeyBuf, pszPath);
274+ StringCchCopy(szKeyBuf, 1024, pszPath);
275275
276276 if (pszSubkey1 != NULL)
277277 {
278- lstrcat(szKeyBuf, L"\\");
279- lstrcat(szKeyBuf, pszSubkey1);
278+ StringCchCat(szKeyBuf, 1024, L"\\");
279+ StringCchCat(szKeyBuf, 1024, pszSubkey1);
280280 }
281281 if (pszSubkey2 != NULL)
282282 {
283- lstrcat(szKeyBuf, L"\\");
284- lstrcat(szKeyBuf, pszSubkey2);
283+ StringCchCat(szKeyBuf, 1024, L"\\");
284+ StringCchCat(szKeyBuf, 1024, pszSubkey2);
285285 }
286286 if (pszSubkey3 != NULL)
287287 {
288- lstrcat(szKeyBuf, L"\\");
289- lstrcat(szKeyBuf, pszSubkey3);
288+ StringCchCat(szKeyBuf, 1024, L"\\");
289+ StringCchCat(szKeyBuf, 1024, pszSubkey3);
290290 }
291291
292292 // if its return 5 - E_ACCESS_DENIED
@@ -310,9 +310,9 @@
310310 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild, LPCWSTR pszKeyChild2)
311311 {
312312 WCHAR szKeyBuf[1024];
313- lstrcpy(szKeyBuf, pszKeyChild);
314- lstrcat(szKeyBuf, L"\\");
315- lstrcat(szKeyBuf, pszKeyChild2);
313+ StringCchCopy(szKeyBuf, 1024, pszKeyChild);
314+ StringCchCat(szKeyBuf, 1024, L"\\");
315+ StringCchCat(szKeyBuf, 1024, pszKeyChild2);
316316 return RecursiveDeleteKey(hKeyParent, szKeyBuf);
317317 }
318318
@@ -319,11 +319,11 @@
319319 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild, LPCWSTR pszKeyChild2, LPCWSTR pszKeyChild3)
320320 {
321321 WCHAR szKeyBuf[1024];
322- lstrcpy(szKeyBuf, pszKeyChild);
323- lstrcat(szKeyBuf, L"\\");
324- lstrcat(szKeyBuf, pszKeyChild2);
325- lstrcat(szKeyBuf, L"\\");
326- lstrcat(szKeyBuf, pszKeyChild3);
322+ StringCchCopy(szKeyBuf, 1024, pszKeyChild);
323+ StringCchCat(szKeyBuf, 1024, L"\\");
324+ StringCchCat(szKeyBuf, 1024, pszKeyChild2);
325+ StringCchCat(szKeyBuf, 1024, L"\\");
326+ StringCchCat(szKeyBuf, 1024, pszKeyChild3);
327327 return RecursiveDeleteKey(hKeyParent, szKeyBuf);
328328 }
329329
--- NetOfficeShimLoader/ShimLoader/DllRegister32On64.cpp (revision 189)
+++ NetOfficeShimLoader/ShimLoader/DllRegister32On64.cpp (revision 190)
@@ -13,8 +13,8 @@
1313 HRESULT UnRegisterCOMAddin(LPCWSTR pszOfficeApp, LPCWSTR pszProgID, bool registerPerMachine);
1414
1515 HKEY TargetRootKey(RegisterMode mode);
16- void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey);
17- void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey);
16+ void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey, int maxLen);
17+ void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey, int maxLen);
1818 BOOL SetKeyAndValue(HKEY hKeyRoot, LPCWSTR pszPath, LPCWSTR pszSubkey1, LPCWSTR pszSubkey2, LPCWSTR pszSubkey3, LPCWSTR pszvalueName, LPCWSTR pszValue);
1919 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild);
2020 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild, LPCWSTR pszKeyChild2);
@@ -95,10 +95,10 @@
9595 HKEY targetRootKey = TargetRootKey(mode);
9696
9797 WCHAR classIdKey[512];
98- ClassIdSubKey(classId, mode, classIdKey);
98+ ClassIdSubKey(classId, mode, classIdKey, 512);
9999
100100 WCHAR progIdKey[512];
101- ProgIdSubKey(progId, mode, progIdKey);
101+ ProgIdSubKey(progId, mode, progIdKey, 512);
102102
103103 // Target Key ProgId
104104 if (!SetKeyAndValue(targetRootKey, progIdKey, NULL, NULL, NULL, NULL, progId))
@@ -152,9 +152,9 @@
152152
153153 HKEY hKeyRoot = TargetRootKey(mode);
154154 WCHAR classIdKey[512];
155- ClassIdSubKey(classId, mode, classIdKey);
155+ ClassIdSubKey(classId, mode, classIdKey, 512);
156156 WCHAR progIdKey[512];
157- ProgIdSubKey(progId, mode, progIdKey);
157+ ProgIdSubKey(progId, mode, progIdKey, 512);
158158
159159 if (mode != User)
160160 {
@@ -181,10 +181,10 @@
181181 bool keyCreated = false;
182182 HKEY hKey;
183183
184- lstrcpy(szKeyBuf, L"Software\\Microsoft\\Office\\");
185- lstrcat(szKeyBuf, pszOfficeApp);
186- lstrcat(szKeyBuf, L"\\Addins\\");
187- lstrcat(szKeyBuf, pszProgID);
184+ StringCchCopy(szKeyBuf, 1024, L"Software\\Microsoft\\Office\\");
185+ StringCchCat(szKeyBuf, 1024, pszOfficeApp);
186+ StringCchCat(szKeyBuf, 1024, L"\\Addins\\");
187+ StringCchCat(szKeyBuf, 1024, pszProgID);
188188
189189 HKEY root = registerPerMachine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
190190 IfFailGo(RegCreateKeyEx(root, szKeyBuf, 0, NULL, REG_OPTION_NON_VOLATILE, _regKeyOptions, NULL, &hKey, NULL));
@@ -227,10 +227,10 @@
227227
228228 HKEY root = registerPerMachine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
229229 WCHAR szKeyBuf[1024];
230- lstrcpy(szKeyBuf, L"Software\\Microsoft\\Office\\");
231- lstrcat(szKeyBuf, pszOfficeApp);
232- lstrcat(szKeyBuf, L"\\Addins\\");
233- lstrcat(szKeyBuf, pszProgID);
230+ StringCchCopy(szKeyBuf, 1024, L"Software\\Microsoft\\Office\\");
231+ StringCchCat(szKeyBuf, 1024, pszOfficeApp);
232+ StringCchCat(szKeyBuf, 1024, L"\\Addins\\");
233+ StringCchCat(szKeyBuf, 1024, pszProgID);
234234
235235 HRESULT hr = RecursiveDeleteKey(root, szKeyBuf);
236236 if (E_ACCESSDENIED != hr) // if key is missing - we dont care
@@ -254,16 +254,16 @@
254254 return hKeyRoot;
255255 }
256256
257- void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey)
257+ void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey, int maxLen)
258258 {
259- lstrcpy(classIdKey, L"Software\\Classes\\CLSID\\");
260- lstrcat(classIdKey, classId);
259+ StringCchCopy(classIdKey, maxLen, L"Software\\Classes\\CLSID\\");
260+ StringCchCat(classIdKey, maxLen, classId);
261261 }
262262
263- void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey)
263+ void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey, int maxLen)
264264 {
265- lstrcpy(progIdKey, L"Software\\Classes\\");
266- lstrcat(progIdKey, progId);
265+ StringCchCopy(progIdKey, maxLen, L"Software\\Classes\\");
266+ StringCchCat(progIdKey, maxLen, progId);
267267 }
268268
269269 BOOL SetKeyAndValue(HKEY hKeyRoot, LPCWSTR pszPath, LPCWSTR pszSubkey1, LPCWSTR pszSubkey2, LPCWSTR pszSubkey3, LPCWSTR pszvalueName, LPCWSTR pszValue)
@@ -271,22 +271,22 @@
271271 HKEY hKey;
272272 WCHAR szKeyBuf[1024];
273273
274- lstrcpy(szKeyBuf, pszPath);
274+ StringCchCopy(szKeyBuf, 1024, pszPath);
275275
276276 if (pszSubkey1 != NULL)
277277 {
278- lstrcat(szKeyBuf, L"\\");
279- lstrcat(szKeyBuf, pszSubkey1);
278+ StringCchCat(szKeyBuf, 1024, L"\\");
279+ StringCchCat(szKeyBuf, 1024, pszSubkey1);
280280 }
281281 if (pszSubkey2 != NULL)
282282 {
283- lstrcat(szKeyBuf, L"\\");
284- lstrcat(szKeyBuf, pszSubkey2);
283+ StringCchCat(szKeyBuf, 1024, L"\\");
284+ StringCchCat(szKeyBuf, 1024, pszSubkey2);
285285 }
286286 if (pszSubkey3 != NULL)
287287 {
288- lstrcat(szKeyBuf, L"\\");
289- lstrcat(szKeyBuf, pszSubkey3);
288+ StringCchCat(szKeyBuf, 1024, L"\\");
289+ StringCchCat(szKeyBuf, 1024, pszSubkey3);
290290 }
291291
292292 // if its return 5 - E_ACCESS_DENIED
@@ -310,9 +310,9 @@
310310 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild, LPCWSTR pszKeyChild2)
311311 {
312312 WCHAR szKeyBuf[1024];
313- lstrcpy(szKeyBuf, pszKeyChild);
314- lstrcat(szKeyBuf, L"\\");
315- lstrcat(szKeyBuf, pszKeyChild2);
313+ StringCchCopy(szKeyBuf, 1024, pszKeyChild);
314+ StringCchCat(szKeyBuf, 1024, L"\\");
315+ StringCchCat(szKeyBuf, 1024, pszKeyChild2);
316316 return RecursiveDeleteKey(hKeyParent, szKeyBuf);
317317 }
318318
@@ -319,11 +319,11 @@
319319 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild, LPCWSTR pszKeyChild2, LPCWSTR pszKeyChild3)
320320 {
321321 WCHAR szKeyBuf[1024];
322- lstrcpy(szKeyBuf, pszKeyChild);
323- lstrcat(szKeyBuf, L"\\");
324- lstrcat(szKeyBuf, pszKeyChild2);
325- lstrcat(szKeyBuf, L"\\");
326- lstrcat(szKeyBuf, pszKeyChild3);
322+ StringCchCopy(szKeyBuf, 1024, pszKeyChild);
323+ StringCchCat(szKeyBuf, 1024, L"\\");
324+ StringCchCat(szKeyBuf, 1024, pszKeyChild2);
325+ StringCchCat(szKeyBuf, 1024, L"\\");
326+ StringCchCat(szKeyBuf, 1024, pszKeyChild3);
327327 return RecursiveDeleteKey(hKeyParent, szKeyBuf);
328328 }
329329
--- NetOfficeShimLoader/ShimLoader/DllRegister64.cpp (revision 189)
+++ NetOfficeShimLoader/ShimLoader/DllRegister64.cpp (revision 190)
@@ -13,8 +13,8 @@
1313 HRESULT UnRegisterCOMAddin(LPCWSTR pszOfficeApp, LPCWSTR pszProgID, bool registerPerMachine);
1414
1515 HKEY TargetRootKey(RegisterMode mode);
16- void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey);
17- void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey);
16+ void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey, int maxLen);
17+ void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey, int maxLen);
1818 BOOL SetKeyAndValue(HKEY hKeyRoot, LPCWSTR pszPath, LPCWSTR pszSubkey1, LPCWSTR pszSubkey2, LPCWSTR pszSubkey3, LPCWSTR pszvalueName, LPCWSTR pszValue);
1919 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild);
2020 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild, LPCWSTR pszKeyChild2);
@@ -95,10 +95,10 @@
9595 HKEY targetRootKey = TargetRootKey(mode);
9696
9797 WCHAR classIdKey[512];
98- ClassIdSubKey(classId, mode, classIdKey);
98+ ClassIdSubKey(classId, mode, classIdKey, 512);
9999
100100 WCHAR progIdKey[512];
101- ProgIdSubKey(progId, mode, progIdKey);
101+ ProgIdSubKey(progId, mode, progIdKey, 512);
102102
103103 // Target Key ProgId
104104 if (!SetKeyAndValue(targetRootKey, progIdKey, NULL, NULL, NULL, NULL, progId))
@@ -152,9 +152,9 @@
152152
153153 HKEY hKeyRoot = TargetRootKey(mode);
154154 WCHAR classIdKey[512];
155- ClassIdSubKey(classId, mode, classIdKey);
155+ ClassIdSubKey(classId, mode, classIdKey, 512);
156156 WCHAR progIdKey[512];
157- ProgIdSubKey(progId, mode, progIdKey);
157+ ProgIdSubKey(progId, mode, progIdKey, 512);
158158
159159 if (mode != User)
160160 {
@@ -181,10 +181,10 @@
181181 bool keyCreated = false;
182182 HKEY hKey;
183183
184- lstrcpy(szKeyBuf, L"Software\\Microsoft\\Office\\");
185- lstrcat(szKeyBuf, pszOfficeApp);
186- lstrcat(szKeyBuf, L"\\Addins\\");
187- lstrcat(szKeyBuf, pszProgID);
184+ StringCchCopy(szKeyBuf, 1024, L"Software\\Microsoft\\Office\\");
185+ StringCchCat(szKeyBuf, 1024, pszOfficeApp);
186+ StringCchCat(szKeyBuf, 1024, L"\\Addins\\");
187+ StringCchCat(szKeyBuf, 1024, pszProgID);
188188
189189 HKEY root = registerPerMachine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
190190 IfFailGo(RegCreateKeyEx(root, szKeyBuf, 0, NULL, REG_OPTION_NON_VOLATILE, _regKeyOptions, NULL, &hKey, NULL));
@@ -227,10 +227,10 @@
227227
228228 HKEY root = registerPerMachine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
229229 WCHAR szKeyBuf[1024];
230- lstrcpy(szKeyBuf, L"Software\\Microsoft\\Office\\");
231- lstrcat(szKeyBuf, pszOfficeApp);
232- lstrcat(szKeyBuf, L"\\Addins\\");
233- lstrcat(szKeyBuf, pszProgID);
230+ StringCchCopy(szKeyBuf, 1024, L"Software\\Microsoft\\Office\\");
231+ StringCchCat(szKeyBuf, 1024, pszOfficeApp);
232+ StringCchCat(szKeyBuf, 1024, L"\\Addins\\");
233+ StringCchCat(szKeyBuf, 1024, pszProgID);
234234
235235 HRESULT hr = RecursiveDeleteKey(root, szKeyBuf);
236236 if (E_ACCESSDENIED != hr) // if key is missing - we dont care
@@ -254,16 +254,16 @@
254254 return hKeyRoot;
255255 }
256256
257- void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey)
257+ void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey, int maxLen)
258258 {
259- lstrcpy(classIdKey, L"Software\\Classes\\CLSID\\");
260- lstrcat(classIdKey, classId);
259+ StringCchCopy(classIdKey, maxLen, L"Software\\Classes\\CLSID\\");
260+ StringCchCat(classIdKey, maxLen, classId);
261261 }
262262
263- void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey)
263+ void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey, int maxLen)
264264 {
265- lstrcpy(progIdKey, L"Software\\Classes\\");
266- lstrcat(progIdKey, progId);
265+ StringCchCopy(progIdKey, maxLen, L"Software\\Classes\\");
266+ StringCchCat(progIdKey, maxLen, progId);
267267 }
268268
269269 BOOL SetKeyAndValue(HKEY hKeyRoot, LPCWSTR pszPath, LPCWSTR pszSubkey1, LPCWSTR pszSubkey2, LPCWSTR pszSubkey3, LPCWSTR pszvalueName, LPCWSTR pszValue)
@@ -271,22 +271,22 @@
271271 HKEY hKey;
272272 WCHAR szKeyBuf[1024];
273273
274- lstrcpy(szKeyBuf, pszPath);
274+ StringCchCopy(szKeyBuf, 1024, pszPath);
275275
276276 if (pszSubkey1 != NULL)
277277 {
278- lstrcat(szKeyBuf, L"\\");
279- lstrcat(szKeyBuf, pszSubkey1);
278+ StringCchCat(szKeyBuf, 1024, L"\\");
279+ StringCchCat(szKeyBuf, 1024, pszSubkey1);
280280 }
281281 if (pszSubkey2 != NULL)
282282 {
283- lstrcat(szKeyBuf, L"\\");
284- lstrcat(szKeyBuf, pszSubkey2);
283+ StringCchCat(szKeyBuf, 1024, L"\\");
284+ StringCchCat(szKeyBuf, 1024, pszSubkey2);
285285 }
286286 if (pszSubkey3 != NULL)
287287 {
288- lstrcat(szKeyBuf, L"\\");
289- lstrcat(szKeyBuf, pszSubkey3);
288+ StringCchCat(szKeyBuf, 1024, L"\\");
289+ StringCchCat(szKeyBuf, 1024, pszSubkey3);
290290 }
291291
292292 // if its return 5 - E_ACCESS_DENIED
@@ -310,9 +310,9 @@
310310 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild, LPCWSTR pszKeyChild2)
311311 {
312312 WCHAR szKeyBuf[1024];
313- lstrcpy(szKeyBuf, pszKeyChild);
314- lstrcat(szKeyBuf, L"\\");
315- lstrcat(szKeyBuf, pszKeyChild2);
313+ StringCchCopy(szKeyBuf, 1024, pszKeyChild);
314+ StringCchCat(szKeyBuf, 1024, L"\\");
315+ StringCchCat(szKeyBuf, 1024, pszKeyChild2);
316316 return RecursiveDeleteKey(hKeyParent, szKeyBuf);
317317 }
318318
@@ -319,11 +319,11 @@
319319 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild, LPCWSTR pszKeyChild2, LPCWSTR pszKeyChild3)
320320 {
321321 WCHAR szKeyBuf[1024];
322- lstrcpy(szKeyBuf, pszKeyChild);
323- lstrcat(szKeyBuf, L"\\");
324- lstrcat(szKeyBuf, pszKeyChild2);
325- lstrcat(szKeyBuf, L"\\");
326- lstrcat(szKeyBuf, pszKeyChild3);
322+ StringCchCopy(szKeyBuf, 1024, pszKeyChild);
323+ StringCchCat(szKeyBuf, 1024, L"\\");
324+ StringCchCat(szKeyBuf, 1024, pszKeyChild2);
325+ StringCchCat(szKeyBuf, 1024, L"\\");
326+ StringCchCat(szKeyBuf, 1024, pszKeyChild3);
327327 return RecursiveDeleteKey(hKeyParent, szKeyBuf);
328328 }
329329
--- NetOfficeShimLoader/ShimLoader/Manifest.xml (revision 189)
+++ NetOfficeShimLoader/ShimLoader/Manifest.xml (revision 190)
@@ -40,8 +40,8 @@
4040 </Shim>
4141 <ManagedAddinAggregator>
4242 <Folder>
43- <Path>LocalAppData</Path>
44- <SubFolder>NetOffice\InnerAddin\1.0.0.0</SubFolder>
43+ <Path></Path>
44+ <SubFolder></SubFolder>
4545 </Folder>
4646 <AssemblyName>NetOffice, PublicKeyToken=82590859a0ddadaf</AssemblyName>
4747 <ClassName>NetOffice.Tools.Isolation.ManagedInnerComAggregator</ClassName>
@@ -48,8 +48,8 @@
4848 <AppDomain>
4949 <FriendlyName></FriendlyName>
5050 <Folder>
51- <Path>LocalAppData</Path>
52- <SubFolder>NetOffice\InnerAddin\1.0.0.0</SubFolder>
51+ <Path></Path>
52+ <SubFolder></SubFolder>
5353 </Folder>
5454 </AppDomain>
5555 <Target>
@@ -61,8 +61,8 @@
6161 </ManagedAddinAggregator>
6262 <ManagedUpdateAggregator>
6363 <Folder>
64- <Path>LocalAppData</Path>
65- <SubFolder>NetOffice\InnerAddin\1.0.0.0</SubFolder>
64+ <Path></Path>
65+ <SubFolder></SubFolder>
6666 </Folder>
6767 <AssemblyName>InnerUpdate, PublicKeyToken=e58b77e9e2189611</AssemblyName>
6868 <ClassName>NetOffice.Tools.Isolation.ManagedInnerUpdateAggregator</ClassName>
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Show on old repository browser