From d0de0da9aefc94dc388d5fcfe50111796946f613 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Thu, 6 Apr 2017 17:16:58 +0300 Subject: [PATCH] [win-nix] keep key for analysis of the portal registration --- win-linux/package/windows/common.iss | 44 ++++++++++++++++++++++++++++ win-linux/src/cmainpanel.cpp | 8 ++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/win-linux/package/windows/common.iss b/win-linux/package/windows/common.iss index a0c4ac52d..7576883d4 100644 --- a/win-linux/package/windows/common.iss +++ b/win-linux/package/windows/common.iss @@ -120,6 +120,11 @@ procedure GetSystemTimeAsFileTime(var lpFileTime: TFileTime); external 'GetSyste function SendTextMessageTimeout(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: PAnsiChar; fuFlags: UINT; uTimeout: UINT; out lpdwResult: DWORD): LRESULT; external 'SendMessageTimeoutA@user32.dll stdcall'; +function GetCommandlineParam(inParamName: String):String; forward; +function StartsWith(SubStr, S: String) : Boolean; forward; +function StringReplace(S, oldSubString, newSubString: String) : String; forward; + + //procedure checkArchitectureVersion; forward; function GetHKLM: Integer; forward; @@ -320,6 +325,7 @@ end; procedure CurStepChanged(CurStep: TSetupStep); var commonCachePath, userCachePath: string; + paramStore: string; begin if CurStep = ssPostInstall then begin @@ -334,6 +340,44 @@ begin DirectoryCopy(commonCachePath, userCachePath); end end; + + paramStore := GetCommandlineParam('/store'); + if Length(paramStore) > 0 then + begin + RegWriteStringValue(HKEY_LOCAL_MACHINE, ExpandConstant('{#APP_REG_PATH}'), 'Store', paramStore); + end; +end; + +function StartsWith(SubStr, S: String) : Boolean; +begin + Result := Pos(SubStr, S) = 1; +end; + +function StringReplace(S, oldSubString, newSubString: String) : String; +var + stringCopy : String; +begin + stringCopy := S; //Prevent modification to the original string + StringChange(stringCopy, oldSubString, newSubString); + Result := stringCopy; +end; + +function GetCommandlineParam(inParamName: String) : String; +var + paramNameAndValue: String; + i: Integer; +begin + Result := ''; + + for i:= 1 to ParamCount do + begin + paramNameAndValue := Lowercase(ParamStr(i)); + if StartsWith(inParamName, paramNameAndValue) then + begin + Result := StringReplace(paramNameAndValue, inParamName + ':', ''); + break; + end; + end; end; diff --git a/win-linux/src/cmainpanel.cpp b/win-linux/src/cmainpanel.cpp index b1a38098a..50fd92619 100644 --- a/win-linux/src/cmainpanel.cpp +++ b/win-linux/src/cmainpanel.cpp @@ -1205,7 +1205,13 @@ void CMainPanel::onPortalNew(QString in) void CMainPanel::onPortalCreate() { - int res = m_pTabs->newPortal(URL_SIGNUP, tr("Sign Up")); + QString _url = URL_SIGNUP; + + GET_REGISTRY_SYSTEM(reg_system) + if ( reg_system.contains("Store") ) + _url += "&store=" + reg_system.value("Store").toString(); + + int res = m_pTabs->newPortal(_url, tr("Sign Up")); if (res == 2) { RecalculatePlaces(); } QTimer::singleShot(200, this, [=]{