Skip to content

Commit 0a72ccf

Browse files
mamoreau-devolutionsawakecoding
authored andcommitted
add RecordingSessionId setting
1 parent b834439 commit 0a72ccf

File tree

4 files changed

+64
-2
lines changed

4 files changed

+64
-2
lines changed

dll/ApiHooks.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,10 @@ bool WINAPI MsRdpEx_CaptureBlt(
489489
free(recordingPipeName);
490490
}
491491

492-
const char* sessionId = pExtendedSettings->GetSessionId();
492+
const char* sessionId = pExtendedSettings->GetRecordingSessionId();
493+
if (!sessionId) {
494+
sessionId = pExtendedSettings->GetSessionId();
495+
}
493496
MsRdpEx_OutputMirror_SetSessionId(outputMirror, sessionId);
494497

495498
instance->SetOutputMirrorObject((LPVOID) outputMirror);

dll/RdpSettings.cpp

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ CMsRdpExtendedSettings::~CMsRdpExtendedSettings()
654654
{
655655
this->SetKdcProxyUrl(NULL);
656656
this->SetRecordingPath(NULL);
657+
this->SetRecordingSessionId(NULL);
657658
this->SetRecordingPipeName(NULL);
658659

659660
if (m_pMsRdpExtendedSettings)
@@ -831,6 +832,20 @@ HRESULT __stdcall CMsRdpExtendedSettings::put_Property(BSTR bstrPropertyName, VA
831832
free(propValue);
832833
hr = S_OK;
833834
}
835+
else if (MsRdpEx_StringEquals(propName, "RecordingSessionId"))
836+
{
837+
if (pValue->vt != VT_BSTR)
838+
goto end;
839+
840+
char* propValue = _com_util::ConvertBSTRToString(pValue->bstrVal);
841+
842+
if (propValue) {
843+
hr = this->SetRecordingSessionId(propValue);
844+
}
845+
846+
free(propValue);
847+
hr = S_OK;
848+
}
834849
else if (MsRdpEx_StringEquals(propName, "RecordingPipeName"))
835850
{
836851
if (pValue->vt != VT_BSTR)
@@ -844,7 +859,7 @@ HRESULT __stdcall CMsRdpExtendedSettings::put_Property(BSTR bstrPropertyName, VA
844859

845860
free(propValue);
846861
hr = S_OK;
847-
}
862+
}
848863
else if (MsRdpEx_StringEquals(propName, "DumpBitmapUpdates"))
849864
{
850865
if (pValue->vt != VT_BOOL)
@@ -1076,6 +1091,16 @@ HRESULT __stdcall CMsRdpExtendedSettings::SetRecordingPath(const char* recording
10761091
return S_OK;
10771092
}
10781093

1094+
HRESULT __stdcall CMsRdpExtendedSettings::SetRecordingSessionId(const char* sessionId) {
1095+
free(m_RecordingSessionId);
1096+
m_RecordingSessionId = NULL;
1097+
1098+
if (sessionId) {
1099+
m_RecordingSessionId = _strdup(sessionId);
1100+
}
1101+
return S_OK;
1102+
}
1103+
10791104
HRESULT __stdcall CMsRdpExtendedSettings::SetRecordingPipeName(const char* recordingPipeName) {
10801105
free(m_RecordingPipeName);
10811106
m_RecordingPipeName = NULL;
@@ -1370,6 +1395,13 @@ HRESULT CMsRdpExtendedSettings::ApplyRdpFile(void* rdpFilePtr)
13701395
value.vt = VT_BSTR;
13711396
pMsRdpExtendedSettings->put_Property(propName, &value);
13721397
}
1398+
else if (MsRdpEx_RdpFileEntry_IsMatch(entry, 's', "RecordingSessionId")) {
1399+
bstr_t propName = _com_util::ConvertStringToBSTR(entry->name);
1400+
bstr_t propValue = _com_util::ConvertStringToBSTR(entry->value);
1401+
value.bstrVal = propValue;
1402+
value.vt = VT_BSTR;
1403+
pMsRdpExtendedSettings->put_Property(propName, &value);
1404+
}
13731405
else if (MsRdpEx_RdpFileEntry_IsMatch(entry, 's', "RecordingPipeName")) {
13741406
bstr_t propName = _com_util::ConvertStringToBSTR(entry->name);
13751407
bstr_t propValue = _com_util::ConvertStringToBSTR(entry->value);
@@ -1615,6 +1647,14 @@ char* CMsRdpExtendedSettings::GetRecordingPath()
16151647
return NULL;
16161648
}
16171649

1650+
char* CMsRdpExtendedSettings::GetRecordingSessionId()
1651+
{
1652+
if (m_RecordingSessionId)
1653+
return _strdup(m_RecordingSessionId);
1654+
1655+
return NULL;
1656+
}
1657+
16181658
char* CMsRdpExtendedSettings::GetRecordingPipeName()
16191659
{
16201660
if (m_RecordingPipeName)

dotnet/MsRdpEx_App/MainDlg.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,14 @@ private void ParseRdpFile(string filename, AxMSTSCLib.AxMsRdpClient9NotSafeForSc
307307
transportSettings.GatewayEncryptedAuthCookieSize = (uint)encryptedAuthCookie.Length;
308308
}
309309
break;
310+
311+
case "recordingpath":
312+
extendedSettings.set_Property("RecordingPath", value);
313+
break;
314+
315+
case "recordingsessionid":
316+
extendedSettings.set_Property("RecordingSessionId", value);
317+
break;
310318
}
311319
}
312320
else if (type == 'i')
@@ -367,6 +375,14 @@ private void ParseRdpFile(string filename, AxMSTSCLib.AxMsRdpClient9NotSafeForSc
367375
case "mousejigglermethod":
368376
extendedSettings.set_Property("MouseJigglerMethod", iValue);
369377
break;
378+
379+
case "videorecordingenabled":
380+
extendedSettings.set_Property("VideoRecordingEnabled", bValue);
381+
break;
382+
383+
case "videorecordingquality":
384+
extendedSettings.set_Property("VideoRecordingQuality", iValue);
385+
break;
370386
}
371387
}
372388
}

include/MsRdpEx/RdpSettings.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class CMsRdpExtendedSettings : public IMsRdpExtendedSettings
4040
HRESULT __stdcall SetGatewayPassword(const char* password);
4141
HRESULT __stdcall SetKdcProxyUrl(const char* kdcProxyUrl);
4242
HRESULT __stdcall SetRecordingPath(const char* recordingPath);
43+
HRESULT __stdcall SetRecordingSessionId(const char* sessionId);
4344
HRESULT __stdcall SetRecordingPipeName(const char* recordingPipeName);
4445
HRESULT __stdcall AttachRdpClient(IMsTscAx* pMsTscAx);
4546
HRESULT __stdcall ApplyRdpFile(void* rdpFilePtr);
@@ -62,6 +63,7 @@ class CMsRdpExtendedSettings : public IMsRdpExtendedSettings
6263
bool GetVideoRecordingEnabled();
6364
uint32_t GetVideoRecordingQuality();
6465
char* GetRecordingPath();
66+
char* GetRecordingSessionId();
6567
char* GetRecordingPipeName();
6668
bool GetDumpBitmapUpdates();
6769
bool GetExtraSystemMenuEnabled();
@@ -87,6 +89,7 @@ class CMsRdpExtendedSettings : public IMsRdpExtendedSettings
8789
bool m_VideoRecordingEnabled = false;
8890
uint32_t m_VideoRecordingQuality = 5;
8991
char* m_RecordingPath = NULL;
92+
char* m_RecordingSessionId = NULL;
9093
char* m_RecordingPipeName = NULL;
9194
bool m_DumpBitmapUpdates = false;
9295
bool m_ExtraSystemMenuEnabled = true;

0 commit comments

Comments
 (0)