• R/O
  • SSH
  • HTTPS

netoffice: Commit


Commit MetaInfo

Revision191 (tree)
Time2018-07-19 20:59:31
Authorsebastiandotnet

Log Message

- fix shim register path

Change Summary

Incremental Difference

--- NetOfficeShimLoader/ShimLoader/CustomRegisterValue.cpp (revision 190)
+++ NetOfficeShimLoader/ShimLoader/CustomRegisterValue.cpp (revision 191)
@@ -51,4 +51,12 @@
5151 {
5252 return _value;
5353 }
54+
55+ DWORD CustomRegisterValue::RegKind()
56+ {
57+ if (0 == wcscmp(_kind, L"REG_DWORD"))
58+ return REG_DWORD;
59+ else
60+ return REG_SZ;
61+ }
5462 }
--- NetOfficeShimLoader/ShimLoader/CustomRegisterValue.h (revision 190)
+++ NetOfficeShimLoader/ShimLoader/CustomRegisterValue.h (revision 191)
@@ -16,6 +16,7 @@
1616 _bstr_t Name();
1717 _bstr_t Kind();
1818 _bstr_t Value();
19+ DWORD RegKind();
1920
2021 private:
2122
--- NetOfficeShimLoader/ShimLoader/DllRegister32.cpp (revision 190)
+++ NetOfficeShimLoader/ShimLoader/DllRegister32.cpp (revision 191)
@@ -1,5 +1,6 @@
11 #include "stdafx.h"
22 #include "DllRegister32.h"
3+#include "Vars.h"
34
45 using namespace NetOffice_ShimLoader;
56
@@ -15,6 +16,7 @@
1516 HKEY TargetRootKey(RegisterMode mode);
1617 void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey, int maxLen);
1718 void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey, int maxLen);
19+ HRESULT SetCustomValue(HKEY hKey, PCustomRegisterValue value);
1820 BOOL SetKeyAndValue(HKEY hKeyRoot, LPCWSTR pszPath, LPCWSTR pszSubkey1, LPCWSTR pszSubkey2, LPCWSTR pszSubkey3, LPCWSTR pszvalueName, LPCWSTR pszValue);
1921 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild);
2022 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild, LPCWSTR pszKeyChild2);
@@ -209,6 +211,17 @@
209211 IfFailGo(RegSetValueEx(hKey, L"Description", 0, REG_SZ, (BYTE*)pszDescription, dwTemp));
210212 }
211213
214+ if (NULL != Custom_Register_Values)
215+ {
216+ size_t arraySize = (sizeof(Custom_Register_Values) / sizeof(*Custom_Register_Values));
217+ for (size_t i = 0; i < arraySize; i++)
218+ {
219+ auto value = Custom_Register_Values[i];
220+ if (value->SeemsToBeValid())
221+ SetCustomValue(hKey, value);
222+ }
223+ }
224+
212225 RegCloseKey(hKey);
213226
214227 return hr;
@@ -241,6 +254,17 @@
241254 return result;
242255 }
243256
257+ HRESULT SetCustomValue(HKEY hKey, PCustomRegisterValue value)
258+ {
259+ DWORD dwTemp = 0;
260+#if UNICODE
261+ dwTemp = lstrlen(value->Name()) * 2 + 2;
262+#else
263+ dwTemp = lstrlen(value->Name) + 1;
264+#endif
265+ return RegSetValueEx(hKey, value->Name(), 0, value->RegKind(), (BYTE*)value->Value().copy(), dwTemp);
266+ }
267+
244268 HKEY TargetRootKey(RegisterMode mode)
245269 {
246270 HKEY hKeyRoot = HKEY_CURRENT_USER;
--- NetOfficeShimLoader/ShimLoader/DllRegister32On64.cpp (revision 190)
+++ NetOfficeShimLoader/ShimLoader/DllRegister32On64.cpp (revision 191)
@@ -1,5 +1,6 @@
11 #include "stdafx.h"
22 #include "DllRegisterMode.hpp"
3+#include "Vars.h"
34
45 using namespace NetOffice_ShimLoader;
56
@@ -15,6 +16,7 @@
1516 HKEY TargetRootKey(RegisterMode mode);
1617 void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey, int maxLen);
1718 void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey, int maxLen);
19+ HRESULT SetCustomValue(HKEY hKey, PCustomRegisterValue value);
1820 BOOL SetKeyAndValue(HKEY hKeyRoot, LPCWSTR pszPath, LPCWSTR pszSubkey1, LPCWSTR pszSubkey2, LPCWSTR pszSubkey3, LPCWSTR pszvalueName, LPCWSTR pszValue);
1921 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild);
2022 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild, LPCWSTR pszKeyChild2);
@@ -209,6 +211,17 @@
209211 IfFailGo(RegSetValueEx(hKey, L"Description", 0, REG_SZ, (BYTE*)pszDescription, dwTemp));
210212 }
211213
214+ if (NULL != Custom_Register_Values)
215+ {
216+ size_t arraySize = (sizeof(Custom_Register_Values) / sizeof(*Custom_Register_Values));
217+ for (size_t i = 0; i < arraySize; i++)
218+ {
219+ auto value = Custom_Register_Values[i];
220+ if(value->SeemsToBeValid())
221+ SetCustomValue(hKey, value);
222+ }
223+ }
224+
212225 RegCloseKey(hKey);
213226
214227 return hr;
@@ -241,6 +254,18 @@
241254 return result;
242255 }
243256
257+ HRESULT SetCustomValue(HKEY hKey, PCustomRegisterValue value)
258+ {
259+ DWORD dwTemp = 0;
260+#if UNICODE
261+ dwTemp = lstrlen(value->Value()) * 2 + 2;
262+#else
263+ dwTemp = lstrlen(value->Value()) + 1;
264+#endif
265+
266+ return RegSetValueEx(hKey, value->Name(), 0, value->RegKind(), (BYTE*)value->Value().copy(), dwTemp);
267+ }
268+
244269 HKEY TargetRootKey(RegisterMode mode)
245270 {
246271 HKEY hKeyRoot = HKEY_CURRENT_USER;
--- NetOfficeShimLoader/ShimLoader/DllRegister64.cpp (revision 190)
+++ NetOfficeShimLoader/ShimLoader/DllRegister64.cpp (revision 191)
@@ -1,5 +1,6 @@
11 #include "stdafx.h"
22 #include "DllRegister64.h"
3+#include "Vars.h"
34
45 using namespace NetOffice_ShimLoader;
56
@@ -15,6 +16,7 @@
1516 HKEY TargetRootKey(RegisterMode mode);
1617 void ProgIdSubKey(LPCWSTR progId, RegisterMode mode, WCHAR* progIdKey, int maxLen);
1718 void ClassIdSubKey(LPCWSTR classId, RegisterMode mode, WCHAR* classIdKey, int maxLen);
19+ HRESULT SetCustomValue(HKEY hKey, PCustomRegisterValue value);
1820 BOOL SetKeyAndValue(HKEY hKeyRoot, LPCWSTR pszPath, LPCWSTR pszSubkey1, LPCWSTR pszSubkey2, LPCWSTR pszSubkey3, LPCWSTR pszvalueName, LPCWSTR pszValue);
1921 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild);
2022 LONG RecursiveDeleteKey(HKEY hKeyParent, LPCWSTR pszKeyChild, LPCWSTR pszKeyChild2);
@@ -209,6 +211,17 @@
209211 IfFailGo(RegSetValueEx(hKey, L"Description", 0, REG_SZ, (BYTE*)pszDescription, dwTemp));
210212 }
211213
214+ if (NULL != Custom_Register_Values)
215+ {
216+ size_t arraySize = (sizeof(Custom_Register_Values) / sizeof(*Custom_Register_Values));
217+ for (size_t i = 0; i < arraySize; i++)
218+ {
219+ auto value = Custom_Register_Values[i];
220+ if (value->SeemsToBeValid())
221+ SetCustomValue(hKey, value);
222+ }
223+ }
224+
212225 RegCloseKey(hKey);
213226
214227 return hr;
@@ -241,6 +254,17 @@
241254 return result;
242255 }
243256
257+ HRESULT SetCustomValue(HKEY hKey, PCustomRegisterValue value)
258+ {
259+ DWORD dwTemp = 0;
260+#if UNICODE
261+ dwTemp = lstrlen(value->Name()) * 2 + 2;
262+#else
263+ dwTemp = lstrlen(value->Name()) + 1;
264+#endif
265+ return RegSetValueEx(hKey, value->Name(), 0, value->RegKind(), (BYTE*)value->Value().copy(), dwTemp);
266+ }
267+
244268 HKEY TargetRootKey(RegisterMode mode)
245269 {
246270 HKEY hKeyRoot = HKEY_CURRENT_USER;
--- NetOfficeShimLoader/ShimLoader/ShimArguments.cpp (revision 190)
+++ NetOfficeShimLoader/ShimLoader/ShimArguments.cpp (revision 191)
@@ -177,8 +177,8 @@
177177 MSXML::IXMLDOMNode* domNode = nullptr;
178178 if (SUCCEEDED(addins->get_item(i, &domNode)))
179179 {
180- _bstr_t foo = domNode->GetnodeName();
181- ShimProxy_Host_Application[i] = foo;
180+ _bstr_t appName = domNode->GetnodeName();
181+ ShimProxy_Host_Application[i] = appName.copy(TRUE);
182182 domNode->Release();
183183 }
184184 }
@@ -188,8 +188,8 @@
188188 ENABLE_ADDIN_REGISTRATION = ToBool(registerAddin->text);
189189 lstrcpyn(ShimProxy_CLSID, registerClsId->text, MAX_PATH + 1);
190190 lstrcpyn(ShimProxy_ProgID, registerProgId->text, MAX_PATH + 1);
191- lstrcpyn(ShimProxy_FriendlyName, registerProgId->text, MAX_PATH + 1);
192- lstrcpyn(ShimProxy_Description, registerProgId->text, MAX_PATH + 1);
191+ lstrcpyn(ShimProxy_FriendlyName, friendlyName->text, MAX_PATH + 1);
192+ lstrcpyn(ShimProxy_Description, description->text, MAX_PATH + 1);
193193
194194 auto mode = parser.Parse(registerMode->text);
195195 SELF_REGISTER_MODE = mode;
Show on old repository browser