forked from igitur/QuantLibEE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quantlibee.cpp
33 lines (24 loc) · 924 Bytes
/
quantlibee.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <tchar.h>
#include <ql/time/date.hpp>
#include "custview.h"
#include "quantlibee.h"
using namespace QuantLib;
static HRESULT FormatQuantLibDate( QuantLib::Date *date, char *pResult, int result_size )
{
wsprintf(pResult, "%d-%d-%d", date->year(), int(date->month()), date->dayOfMonth());
return S_OK;
}
HRESULT ADDIN_API AddIn_quantlibdate( DWORD dwAddress, DEBUGHELPER *pHelper, int nBase, BOOL bUniStrings, char *pResult, size_t max, DWORD reserved )
{
QuantLib::Date date;
DWORD nGot;
// read date from debuggee memory space
if (pHelper->ReadDebuggeeMemoryEx(pHelper, pHelper->GetRealAddress(pHelper), sizeof(QuantLib::Date), &date, &nGot) != S_OK)
return E_FAIL;
if (nGot != sizeof(QuantLib::Date))
return E_FAIL;
return FormatQuantLibDate(&date, pResult, max);
}