[KOE-178] Fix for invalid account id in message service configuration

This commit is contained in:
Patrick Simpson 2018-11-13 14:51:18 +02:00
parent d423ddc1c4
commit 8d72f50e10
3 changed files with 18 additions and 10 deletions

View File

@ -57,12 +57,14 @@ Global
{222C4DA5-FA31-471A-B127-5E0C6AD2CB3C}.Release|x64.Build.0 = Release|Any CPU
{222C4DA5-FA31-471A-B127-5E0C6AD2CB3C}.Release|x86.ActiveCfg = Release|Any CPU
{222C4DA5-FA31-471A-B127-5E0C6AD2CB3C}.Release|x86.Build.0 = Release|Any CPU
{437F3764-1E65-4AED-88FA-7C5B2F2FAF15}.Debug|Any CPU.ActiveCfg = Debug|Win32
{437F3764-1E65-4AED-88FA-7C5B2F2FAF15}.Debug|Any CPU.ActiveCfg = Debug|x64
{437F3764-1E65-4AED-88FA-7C5B2F2FAF15}.Debug|Any CPU.Build.0 = Debug|x64
{437F3764-1E65-4AED-88FA-7C5B2F2FAF15}.Debug|x64.ActiveCfg = Debug|x64
{437F3764-1E65-4AED-88FA-7C5B2F2FAF15}.Debug|x64.Build.0 = Debug|x64
{437F3764-1E65-4AED-88FA-7C5B2F2FAF15}.Debug|x86.ActiveCfg = Debug|Win32
{437F3764-1E65-4AED-88FA-7C5B2F2FAF15}.Debug|x86.Build.0 = Debug|Win32
{437F3764-1E65-4AED-88FA-7C5B2F2FAF15}.Release|Any CPU.ActiveCfg = Release|Win32
{437F3764-1E65-4AED-88FA-7C5B2F2FAF15}.Release|Any CPU.ActiveCfg = Release|x64
{437F3764-1E65-4AED-88FA-7C5B2F2FAF15}.Release|Any CPU.Build.0 = Release|x64
{437F3764-1E65-4AED-88FA-7C5B2F2FAF15}.Release|x64.ActiveCfg = Release|x64
{437F3764-1E65-4AED-88FA-7C5B2F2FAF15}.Release|x64.Build.0 = Release|x64
{437F3764-1E65-4AED-88FA-7C5B2F2FAF15}.Release|x86.ActiveCfg = Release|Win32

View File

@ -173,6 +173,7 @@ public:
// Set up the account
OpenProfileAdmin();
EncryptPassword();
FetchAccountKey();
CreateMessageService();
GetEntryId();
CreateAccount();
@ -306,10 +307,10 @@ private:
msprops[3].Value.bin.lpb = &encryptedPassword[0];
msprops[4].ulPropTag = PR_RESOURCE_FLAGS;
msprops[4].Value.l = SERVICE_NO_PRIMARY_IDENTITY | SERVICE_CREATE_WITH_STORE;
msprops[4].Value.l = SERVICE_NO_PRIMARY_IDENTITY | SERVICE_CREATE_WITH_STORE | SERVICE_SINGLE_COPY;
msprops[5].ulPropTag = 0x67060003;
msprops[5].Value.l = 4;
msprops[5].Value.l = accountId;
VERBOSE(L"CreateMessageService: 2\n");
CHECK_H(lpServiceAdmin2->ConfigureMsgService(&service, 0, SERVICE_UI_ALLOWED, 6, msprops), "ConfigureMSGService");
@ -372,16 +373,21 @@ private:
CHECK_L(RegOpenKey(hKeyAccounts, accountId.c_str(), &hKeyNewAccount), "OpenAccountKey");
}
void AllocateAccountKey()
void FetchAccountKey()
{
OpenAccountsKey();
wchar_t keyPath[MAX_PATH];
// Get the NextAccountID value
DWORD size = sizeof(accountId);
CHECK_L(RegQueryValueEx(hKeyAccounts, VALUE_NEXT_ACCOUNT_ID, nullptr, nullptr, (LPBYTE)&accountId, &size), "GetNextAccountId");
}
void AllocateAccountKey()
{
FetchAccountKey();
wchar_t keyPath[MAX_PATH];
// Create the subkey
swprintf_s(keyPath, ARRAYSIZE(keyPath), L"%.8X", accountId);
CHECK_L(RegCreateKey(hKeyAccounts, keyPath, &hKeyNewAccount), "CreateAccountKey");

View File

@ -98,9 +98,9 @@ namespace OutlookRestarter
// Start the process
Process process = new Process();
process.StartInfo = new ProcessStartInfo(procPath, argsString);
Logger.Instance.Debug(typeof(OutlookRestarter), "Starting process: {0}", process);
Logger.Instance.Debug(typeof(OutlookRestarter), "Starting process: {0} - {1}", procPath, argsString);
process.Start();
Logger.Instance.Debug(typeof(OutlookRestarter), "Started process: {0}", process);
Logger.Instance.Debug(typeof(OutlookRestarter), "Started process: {0} - {1}", procPath, argsString);
}
}
catch(Exception e)