Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add todo smartview parser #431

Merged
merged 4 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UnitTest/SmartViewTestData/In/38-SWAPTODO1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
01000000F90000000100000046006F006C006C006F007700200075007000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080652B0D80652B0DA86A2B0D01000000
1 change: 1 addition & 0 deletions UnitTest/SmartViewTestData/In/38-SWAPTODO2.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
01000000F9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E080E95AE080E95AE080E95A00000000
9 changes: 9 additions & 0 deletions UnitTest/SmartViewTestData/Out/38-SWAPTODO-out1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Swapped ToDo Data
ulVersion = 0x00000001
dwFlags = 0xF9 = TDP_ITEM_FLAGS | TDP_START_DATE | TDP_DUE_DATE | TDP_TITLE | TDP_REMINDER_FLAG | TDP_REMINDER_TIME
dwToDoItem = 0x00000001
wszFlagTo = Follow up......................................................................................................................................................................................................................................................
rtmStartDate = 0x0D2B6580 = 12:00:00.000 AM 2/4/2021
rtmDueDate = 0x0D2B6580 = 12:00:00.000 AM 2/4/2021
rtmReminder = 0x0D2B6AA8 = 10:00:00.000 PM 2/4/2021
fReminderSet: true
9 changes: 9 additions & 0 deletions UnitTest/SmartViewTestData/Out/38-SWAPTODO-out2.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Swapped ToDo Data
ulVersion = 0x00000001
dwFlags = 0xF9 = TDP_ITEM_FLAGS | TDP_START_DATE | TDP_DUE_DATE | TDP_TITLE | TDP_REMINDER_FLAG | TDP_REMINDER_TIME
dwToDoItem = 0x00000000
wszFlagTo = ...............................................................................................................................................................................................................................................................
rtmStartDate = 0x5AE980E0 = 12:00:00.000 AM 1/1/4501
rtmDueDate = 0x5AE980E0 = 12:00:00.000 AM 1/1/4501
rtmReminder = 0x5AE980E0 = 12:00:00.000 AM 1/1/4501
fReminderSet: false
Binary file modified UnitTest/res/UnitTest.rc
Binary file not shown.
4 changes: 4 additions & 0 deletions UnitTest/res/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@
#define IDR_SV34EXRULEACTION1IN 34001
#define IDR_SV34EXRULEACTION2IN 34002
#define IDR_SV34EXRULEACTION3IN 34003
#define IDR_SV38SWAPTODO1IN 38001
#define IDR_SV38SWAPTODO2IN 38002

#define IDR_LOADTESTJAPANESE 50001
#define IDR_LOADTESTENGLISH 50002
Expand Down Expand Up @@ -318,6 +320,8 @@
#define IDR_SV34EXRULEACTION1OUT 1034001
#define IDR_SV34EXRULEACTION2OUT 1034002
#define IDR_SV34EXRULEACTION3OUT 1034003
#define IDR_SV38SWAPTODO1OUT 1038001
#define IDR_SV38SWAPTODO2OUT 1038002

// Next default values for new objects
//
Expand Down
5 changes: 4 additions & 1 deletion UnitTest/tests/smartViewTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace SmartViewTest
std::wstring(L"SmartViewAddInTest1"),
parserType::END,
std::vector<BYTE>{1, 2, 3, 4},
std::wstring(L"Unknown Parser 38\r\n"
std::wstring(L"Unknown Parser 39\r\n"
L"\tcb: 4 lpb: 01020304"));
}

Expand Down Expand Up @@ -251,5 +251,8 @@ namespace SmartViewTest
TEST(EXTENDEDRULEACTION, 34EXRULEACTION, 1) // OP_MOVE, OP_TAG
TEST(EXTENDEDRULEACTION, 34EXRULEACTION, 2) // OP_DEFER_ACTION
TEST(EXTENDEDRULEACTION, 34EXRULEACTION, 3) // OP_TAG, OP_MARK_AS_READ, OP_FORWARD, OP_COPY

TEST(SWAPPEDTODO, 38SWAPTODO, 1)
TEST(SWAPPEDTODO, 38SWAPTODO, 2)
};
} // namespace SmartViewTest
1 change: 1 addition & 0 deletions core/addin/mfcmapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ enum class parserType
LONGRTIME,
PTI8,
SFIDMID,
SWAPPEDTODO,
END // This must be the end of the enum
};

Expand Down
2 changes: 2 additions & 0 deletions core/core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@
<ClInclude Include="smartview\addinParser.h" />
<ClInclude Include="smartview\AdditionalRenEntryIDs.h" />
<ClInclude Include="smartview\AppointmentRecurrencePattern.h" />
<ClInclude Include="smartview\swappedToDo.h" />
<ClInclude Include="smartview\block\scratchBlock.h" />
<ClInclude Include="smartview\block\binaryParser.h" />
<ClInclude Include="smartview\block\block.h" />
Expand Down Expand Up @@ -682,6 +683,7 @@
<ClCompile Include="smartview\addinParser.cpp" />
<ClCompile Include="smartview\AdditionalRenEntryIDs.cpp" />
<ClCompile Include="smartview\AppointmentRecurrencePattern.cpp" />
<ClCompile Include="smartview\swappedToDo.cpp" />
<ClCompile Include="smartview\decodeEntryID.cpp" />
<ClCompile Include="smartview\encodeEntryID.cpp" />
<ClCompile Include="smartview\RuleAction.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions core/core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@
<ClInclude Include="model\mapiRowModel.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="smartview\swappedToDo.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="utility\strings.cpp">
Expand Down Expand Up @@ -578,6 +581,9 @@
<ClCompile Include="model\mapiRowModel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="smartview\swappedToDo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="res\MFCMapi.rc2">
Expand Down
8 changes: 8 additions & 0 deletions core/interpret/flagArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,14 @@ FLAG_ARRAY_ENTRY g_FlagArray[] = {
NON_PROP_FLAG_ENTRY(flagEidVersion, MDB_STORE_EID_V2_VERSION, flagVALUE)
NON_PROP_FLAG_ENTRY(flagEidVersion, MDB_STORE_EID_V3_VERSION, flagVALUE)

NON_PROP_FLAG_ENTRY(flagToDoSwapFlag, TDP_NONE, flagVALUE) // NULL Value
NON_PROP_FLAG_ENTRY(flagToDoSwapFlag, TDP_ITEM_FLAGS, flagFLAG)
NON_PROP_FLAG_ENTRY(flagToDoSwapFlag, TDP_START_DATE, flagFLAG)
NON_PROP_FLAG_ENTRY(flagToDoSwapFlag, TDP_DUE_DATE, flagFLAG)
NON_PROP_FLAG_ENTRY(flagToDoSwapFlag, TDP_TITLE, flagFLAG)
NON_PROP_FLAG_ENTRY(flagToDoSwapFlag, TDP_REMINDER_FLAG, flagFLAG)
NON_PROP_FLAG_ENTRY(flagToDoSwapFlag, TDP_REMINDER_TIME, flagFLAG)

NAMEDPROP_FLAG_ENTRY(dispidClientIntent, PSETID_Common, ciNone, flagVALUE) // NULL Value
NAMEDPROP_FLAG_ENTRY(dispidClientIntent, PSETID_Common, ciManager, flagVALUE)
NAMEDPROP_FLAG_ENTRY(dispidClientIntent, PSETID_Common, ciDelegate, flagVALUE)
Expand Down
2 changes: 2 additions & 0 deletions core/interpret/smartViewParsers.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace smartview
{parserType::XID, L"XID"}, // STRING_OK
{parserType::RULEACTION, L"Rule Action"}, // STRING_OK
{parserType::EXTENDEDRULEACTION, L"Extended Rule Action"}, // STRING_OK
{parserType::SWAPPEDTODO, L"Swapped ToDo"}, // STRING_OK
};

static SMARTVIEW_PARSER_ARRAY_ENTRY g_SmartViewParserArray[] = {
Expand Down Expand Up @@ -142,6 +143,7 @@ namespace smartview
BINARY_STRUCTURE_ENTRY(PR_SCHDINFO_APPT_TOMBSTONE, parserType::TOMBSTONE)
BINARY_STRUCTURE_ENTRY(PR_PREDECESSOR_CHANGE_LIST, parserType::PCL)
BINARY_STRUCTURE_ENTRY(PR_CHANGE_KEY, parserType::XID)
BINARY_STRUCTURE_ENTRY(PR_SWAPPED_TODO_DATA, parserType::SWAPPEDTODO)

NAMEDPROP_BINARY_STRUCTURE_ENTRY(LID_GLOBAL_OBJID, PSETID_Meeting, parserType::GLOBALOBJECTID)
NAMEDPROP_BINARY_STRUCTURE_ENTRY(LID_CLEAN_GLOBAL_OBJID, PSETID_Meeting, parserType::GLOBALOBJECTID)
Expand Down
14 changes: 13 additions & 1 deletion core/mapi/extraPropTags.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ enum __NonPropFlag
flagIet,
flagEidMagic,
flagEidVersion,
flagToDoSwapFlag,
};

#define PR_FREEBUSY_NT_SECURITY_DESCRIPTOR (PROP_TAG(PT_BINARY, 0x0F00))
Expand Down Expand Up @@ -1200,4 +1201,15 @@ STDAPI STDAPICALLTYPE LaunchWizard(

#define FWD_AS_SMS_ALERT 8

#define PR_BODY_HTML_W CHANGE_PROP_TYPE(PR_BODY_HTML, PT_UNICODE)
#define PR_BODY_HTML_W CHANGE_PROP_TYPE(PR_BODY_HTML, PT_UNICODE)

// https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxprops/951b479a-dcdb-46fb-a293-9177baa0a4b9
#define PR_SWAPPED_TODO_DATA PROP_TAG(PT_BINARY, 0x0E2D)

#define TDP_NONE 0x00000000
#define TDP_ITEM_FLAGS 0x00000001
#define TDP_START_DATE 0x00000008
#define TDP_DUE_DATE 0x00000010
#define TDP_TITLE 0x00000020
#define TDP_REMINDER_FLAG 0x00000040
#define TDP_REMINDER_TIME 0x00000080
2 changes: 1 addition & 1 deletion core/smartview/ExtendedFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace smartview

void ExtendedFlag::parseBlocks()
{
auto szFlags = flags::InterpretFlags(flagExtendedFolderFlagType, *Id);
const auto szFlags = flags::InterpretFlags(flagExtendedFolderFlagType, *Id);
addChild(Id, L"Id = 0x%1!02X! = %2!ws!", Id->getData(), szFlags.c_str());
Id->addChild(Cb, L"Cb = 0x%1!02X! = %1!d!", Cb->getData());

Expand Down
3 changes: 3 additions & 0 deletions core/smartview/SmartView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <core/smartview/decodeEntryID.h>
#include <core/smartview/encodeEntryID.h>
#include <core/smartview/addinParser.h>
#include <core/smartview/swappedToDo.h>

namespace smartview
{
Expand Down Expand Up @@ -139,6 +140,8 @@ namespace smartview
return std::make_shared<SDBin>(lpMAPIProp, true);
case parserType::XID:
return std::make_shared<XID>();
case parserType::SWAPPEDTODO:
return std::make_shared<swappedToDo>();
default:
// Any other case is either handled by an add-in or not at all
return std::make_shared<addinParser>(type);
Expand Down
43 changes: 43 additions & 0 deletions core/smartview/swappedToDo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include <core/stdafx.h>
#include <core/smartview/swappedToDo.h>
#include <core/interpret/flags.h>
#include <core/mapi/extraPropTags.h>
#include <core/smartview/SmartView.h>

namespace smartview
{
void swappedToDo::parse()
{
ulVersion = blockT<DWORD>::parse(parser);
dwFlags = blockT<DWORD>::parse(parser);
dwToDoItem = blockT<DWORD>::parse(parser);
wszFlagTo = blockStringW::parse(parser, 256); // 512 bytes is 256 characters
rtmStartDate = blockT<DWORD>::parse(parser);
rtmDueDate = blockT<DWORD>::parse(parser);
rtmReminder = blockT<DWORD>::parse(parser);
fReminderSet = blockT<DWORD>::parse(parser);
}

void swappedToDo::parseBlocks()
{
setText(L"Swapped ToDo Data");
addChild(ulVersion, L"ulVersion = 0x%1!08X!", ulVersion->getData());
const auto szFlags = flags::InterpretFlags(flagToDoSwapFlag, *dwFlags);
addChild(dwFlags, L"dwFlags = 0x%1!02X! = %2!ws!", dwFlags->getData(), szFlags.c_str());
addChild(dwToDoItem, L"dwToDoItem = 0x%1!08X!", dwToDoItem->getData());
addChild(wszFlagTo, L"wszFlagTo = %1!ws!", wszFlagTo->c_str());
addChild(
rtmStartDate,
L"rtmStartDate = 0x%1!08X! = %2!ws!",
rtmStartDate->getData(),
RTimeToString(*rtmStartDate).c_str());
addChild(
rtmDueDate, L"rtmDueDate = 0x%1!08X! = %2!ws!", rtmDueDate->getData(), RTimeToString(*rtmDueDate).c_str());
addChild(
rtmReminder,
L"rtmReminder = 0x%1!08X! = %2!ws!",
rtmReminder->getData(),
RTimeToString(*rtmReminder).c_str());
addChild(fReminderSet, L"fReminderSet: %1!ws!", *fReminderSet ? L"true" : L"false");
}
} // namespace smartview
27 changes: 27 additions & 0 deletions core/smartview/swappedToDo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once
#include <core/smartview/block/block.h>
#include <core/smartview/block/blockT.h>
#include <core/smartview/block/blockStringW.h>

namespace smartview
{
// https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxoflag/74057397-a90e-4454-bd48-3923e09c50b0
class swappedToDo : public block
{
public:
bool bBadData{};

private:
void parse() override;
void parseBlocks() override;

std::shared_ptr<blockT<DWORD>> ulVersion = emptyT<DWORD>();
std::shared_ptr<blockT<DWORD>> dwFlags = emptyT<DWORD>();
std::shared_ptr<blockT<DWORD>> dwToDoItem = emptyT<DWORD>();
std::shared_ptr<blockStringW> wszFlagTo = emptySW();
std::shared_ptr<blockT<DWORD>> rtmStartDate = emptyT<DWORD>();
std::shared_ptr<blockT<DWORD>> rtmDueDate = emptyT<DWORD>();
std::shared_ptr<blockT<DWORD>> rtmReminder = emptyT<DWORD>();
std::shared_ptr<blockT<DWORD>> fReminderSet = emptyT<DWORD>();
};
} // namespace smartview