1
0
This commit is contained in:
Scott E. Graves
2017-05-10 23:28:59 -05:00
parent 36530ac39d
commit a0813802c9
13 changed files with 7735 additions and 7660 deletions

View File

@@ -1,7 +1,6 @@
@echo off
set ROOT=%~dp0%
set MODE=%1
set CEF_BRANCH=3029
set PATH=%ROOT%depot_tools;%PATH%
pushd "%ROOT%"
@@ -19,7 +18,7 @@ if not exist "%MODE%.complete" (
set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*
pushd chromium_git
call python ..\automate\automate-git.py --download-dir=%ROOT%chromium_git --depot-tools-dir=%ROOT%depot_tools --no-distrib --no-build --branch=%CEF_BRANCH% || goto :ERROR
call python ..\automate\automate-git.py --download-dir=%ROOT%chromium_git --depot-tools-dir=%ROOT%depot_tools --no-distrib --no-build --branch=3029 || goto :ERROR
popd
pushd chromium_git\chromium\src\cef

View File

@@ -92,7 +92,7 @@
</div>
</div>
<div class="box" id="receive_info">
<h1>Receive Address&nbsp;<a href="javascript:void(0)" id="ID_Wallet_History">history</a>&nbsp;<a href="javascript:void(0)" id="ID_Wallet_Send">send</a></h1>
<h1>Receive Address <a href="javascript:void(0)" id="ID_Wallet_Send">send</a></h1>
<label class="address" id="ID_WalletReceiveAddress" style="width: 80%;margin: 0 2%;">...</label>
<img src="./images/copy.png" style="float: right; margin-right: 1%; cursor: pointer;" id="ID_WalletReceiveAddressCopy">
</div>
@@ -215,23 +215,13 @@
<div class="hidden-element" id="upload_progress_window" style="height: inherit;">
<div style="display: flex; flex-direction: column; height: inherit;">
<div class="box" style="flex-grow: 1; display: flex; flex-direction: column;">
<h1 style="flex-grow: 0;">Upload Progress&nbsp;<a href="javascript:void(0)" id="ID_RenterUploadsOk">back</a></h1>
<h1 style="flex-grow: 0;">Upload Progress <a href="javascript:void(0)" id="ID_RenterUploadsOk">back</a></h1>
<div style="padding: 0; margin: 0; flex-grow: 1; display: flex; overflow-x: hidden; overflow-y: scroll;">
<table style="flex-grow: 1;white-space: nowrap;" id="ID_UploadProgressTable"></table>
</div>
</div>
</div>
</div>
<div class="hidden-element" id="trans_history_window" style="height: inherit;">
<div style="display: flex; flex-direction: column; height: inherit;">
<div class="box" style="flex-grow: 1; display: flex; flex-direction: column;">
<h1 style="flex-grow: 0;">Transaction History&nbsp;<a href="javascript:void(0)" id="ID_TransHistoryOk">back</a></h1>
<div style="padding: 0; margin: 0; flex-grow: 1; display: flex; overflow-x: hidden; overflow-y: scroll;">
<table style="flex-grow: 1;white-space: nowrap;" id="ID_TransHistoryTable"></table>
</div>
</div>
</div>
</div>
<div class="hidden-element" id="send_window">
<div class="box">
<h1>Available</h1>

View File

@@ -157,28 +157,6 @@
if (document.getElementById('sia_settings_window').classList.contains('hidden-element')) {
setChecked('ID_SettingsLockWalletOnExit', lock);
}
},
setTransHistory: (items) => {
items = items || [];
const table = document.getElementById('ID_TransHistoryTable');
while (table.rows.length > items.length) {
table.deleteRow(table.rows.length - 1);
}
for (const item of items) {
const date = item['Date'];
const amount = item['Amount'];
const txid = item['TxId'];
const rid = window.btoa('history_' + txid);
const row = document.getElementById(rid);
if (!row) {
const r = table.insertRow(table.rows.length);
r.insertCell(0).innerHTML = date;
r.insertCell(1).innerHTML = amount;
r.insertCell(3).innerHTML = txid;
r.id = rid;
}
}
}
};
})();
@@ -436,15 +414,6 @@
setMainWindow('sia_settings_window');
}
function handleWalletHistory() {
const backButton = document.getElementById('ID_TransHistoryOk');
backButton.onclick = () => {
backButton.onclick = null;
beginMainApplication(false);
};
setMainWindow('trans_history_window');
}
function handleWalletSend() {
const saveButton = document.getElementById('ID_SendOK');
const cancelButton = document.getElementById('ID_SendCancel');
@@ -485,12 +454,6 @@
copyToClipboard(address);
};
const historyLink = document.getElementById('ID_Wallet_History');
historyLink.onclick = () => {
historyLink.onclick = null;
handleWalletHistory();
};
const sendLink = document.getElementById('ID_Wallet_Send');
sendLink.onclick = () => {
sendLink.onclick = null;

File diff suppressed because it is too large Load Diff

View File

@@ -8,12 +8,7 @@
NS_BEGIN(Sia)
NS_BEGIN(Api)
class CSiaTransaction;
typedef std::shared_ptr<CSiaTransaction> CSiaTransactionPtr;
typedef std::vector<CSiaTransactionPtr> CSiaTransactionList;
typedef std::shared_ptr<CSiaTransactionList> CSiaTransactionListPtr;
class CSiaDriveConfig;
class SIADRIVE_EXPORTABLE CSiaBase
{
public:
@@ -130,9 +125,6 @@ public:
Property(SiaCurrency, UnconfirmedBalance, public, private)
Property(SString, ReceiveAddress, public, private)
private:
CSiaTransactionListPtr _transList;
private:
virtual void Refresh(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig);
@@ -142,7 +134,6 @@ public:
CSiaError<_SiaApiErrorCode> Lock();
CSiaError<_SiaApiErrorCode> Unlock(const SString& password);
CSiaError<_SiaApiErrorCode> Send(const SString& address, const SiaCurrency& amount);
CSiaTransactionListPtr GetTransactionHistory() const;
};
class SIADRIVE_EXPORTABLE _CSiaRenter :

View File

@@ -85,7 +85,7 @@ public:
}
};
typedef ttmath::UInt<32> Hastings;
typedef ttmath::UInt<256> Hastings;
typedef ttmath::Big<1, 30> SiaCurrency;
const std::uint8_t SIA_BLOCK_TIME_MINS = 10;
@@ -113,15 +113,7 @@ get_access:\
set_access:\
type Set##name(const type& value) { json_doc[#name] = value; return value; }\
protected:\
bool Check##name() { return json_doc.find(#name) != json_doc.end(); }
#define JProperty2(type, name, json_name, get_access, set_access, json_doc) \
get_access:\
type Get##name() const { return json_doc[#json_name].get<type>();}\
set_access:\
type Set##name(const type& value) { json_doc[#json_name] = value; return value; }\
protected:\
bool Check##name() { return json_doc.find(#json_name) != json_doc.end(); }
bool Check##name() { return json_doc.find(#name) != json_doc.end(); }
#define JPropertyCb(type, name, get_access, set_access, json_doc, cb) \
get_access:\
@@ -173,13 +165,6 @@ inline bool ApiSuccess(const T& t) {
return static_cast<bool>(t);
}
inline static SiaCurrency HastingsToSiaCurrency(const Hastings& value)
{
ttmath::Parser<SiaCurrency> parser;
parser.Parse((value.ToString() + " / (10 ^ 24)"));
return parser.stack[0].value;
}
inline static SiaCurrency HastingsStringToSiaCurrency(const SString& value)
{
ttmath::Parser<SiaCurrency> parser;

View File

@@ -1,63 +0,0 @@
#ifndef _SIATRANSACTION_H
#define _SIATRANSACTION_H
#include <siacommon.h>
NS_BEGIN(Sia)
NS_BEGIN(Api)
class SIADRIVE_EXPORTABLE CSiaTransaction
{
public:
class CSiaInput
{
public:
CSiaInput(const json& json);
private:
json _json;
JProperty2(std::string, FundType, fundtype, public, private, _json)
JProperty2(bool, WalletAddress, walletaddress, public, private, _json)
JProperty2(std::string, RelatedAddress, relatedaddress, public, private, _json)
JProperty2(std::string, Value, value, public, private, _json)
};
typedef std::shared_ptr<CSiaInput> CSiaInputPtr;
public:
class CSiaOutput
{
public:
CSiaOutput(const json& json);
private:
json _json;
JProperty2(std::string, FundType, fundtype, public, private, _json)
JProperty2(std::uint64_t, MaturityHeight, maturityheight, public, private, _json)
JProperty2(bool, WalletAddress, walletaddress, public, private, _json)
JProperty2(std::string, RelatedAddress, relatedaddress, public, private, _json)
JProperty2(std::string, Value, value, public, private, _json)
};
typedef std::shared_ptr<CSiaOutput> CSiaOutputPtr;
public:
CSiaTransaction(const json& json);
private:
json _json;
JProperty2(std::uint64_t, ConfirmationTimeStamp, confirmationtimestamp, public, private, _json)
JProperty2(std::uint64_t, ConfirmationHeight, confirmationheight, public, private, _json)
JProperty2(std::string, TransactionId, transactionid, public, private, _json)
Property(std::vector<CSiaInputPtr>, Inputs, public, private)
Property(std::vector<CSiaOutputPtr>, Outputs, public, private)
public:
SString GetDate() const;
SiaCurrency GetAmount() const;
};
NS_END(2)
#endif

View File

@@ -63,7 +63,7 @@ public:
#ifdef _UNICODE
static std::wstring ActiveString(const std::string& str)
{
return FromUtf8(str);
return std::move(FromUtf8(str));
}
static inline std::wstring ActiveString(const std::wstring& str)
@@ -73,7 +73,7 @@ public:
#else
static inline std::string ActiveString(const std::wstring& str)
{
return ToUtf8(str);
return std::move(ToUtf8(str));
}
static inline std::string ActiveString(const std::string& str)
@@ -84,22 +84,14 @@ public:
static inline std::string ToUtf8(const std::wstring &str)
{
if (str.length())
{
std::wstring_convert<deletable_facet<std::codecvt<wchar_t, char, std::mbstate_t>>, wchar_t> conv;
return conv.to_bytes(str);
}
return "";
std::wstring_convert<deletable_facet<std::codecvt<wchar_t, char, std::mbstate_t>>, wchar_t> conv;
return conv.to_bytes(str);
}
static inline std::wstring FromUtf8(const std::string &str)
{
if (str.length())
{
std::wstring_convert<deletable_facet<std::codecvt<wchar_t, char, std::mbstate_t>>, wchar_t> conv;
return conv.from_bytes(str);
}
return L"";
std::wstring_convert<deletable_facet<std::codecvt<wchar_t, char, std::mbstate_t>>, wchar_t> conv;
return conv.from_bytes(str);
}
static inline String &LeftTrim(String &s)
@@ -126,7 +118,7 @@ public:
static inline SString FromInt32(const std::int32_t &value)
{
return SString(std::to_string(value));
return std::move(SString(std::to_string(value)));
}
static inline std::uint32_t ToUInt32(const SString &str)
@@ -136,7 +128,7 @@ public:
static inline SString FromUInt32(const std::uint32_t &value)
{
return SString(std::to_string(value));
return std::move(SString(std::to_string(value)));
}
static inline std::int64_t ToInt64(const SString &str)
@@ -146,12 +138,12 @@ public:
static inline SString FromInt64(const std::int64_t &value)
{
return SString(std::to_string(value));
return std::move(SString(std::to_string(value)));
}
static inline SString FromUInt64(const std::uint64_t &value)
{
return SString(std::to_string(value));
return std::move(SString(std::to_string(value)));
}
static inline std::uint64_t ToUInt64(const SString &str)
@@ -166,7 +158,7 @@ public:
static inline SString FromUInt8(const std::uint8_t &value)
{
return SString(std::to_string(value));
return std::move(SString(std::to_string(value)));
}
static inline float ToFloat(const SString &str)
@@ -176,7 +168,7 @@ public:
static inline SString FromFloat(const float &value)
{
return SString(std::to_string(value));
return std::move(SString(std::to_string(value)));
}
static inline long ToLong(const SString &str)
@@ -186,7 +178,7 @@ public:
static inline SString FromLong(const long &value)
{
return SString(std::to_string(value));
return std::move(SString(std::to_string(value)));
}
static inline double ToDouble(const SString &str)
@@ -196,7 +188,7 @@ public:
static inline SString FromDouble(const double &value)
{
return SString(std::to_string(value));
return std::move(SString(std::to_string(value)));
}
static bool ToBool(const SString& value)
@@ -221,7 +213,7 @@ public:
{
ret.push_back(&s[0]);
}
return ret;
return std::move(ret);
}
#ifdef _UNICODE
@@ -232,7 +224,7 @@ public:
{
ret.push_back(ToUtf8(s.str()));
}
return ret;
return std::move(ret);
}
#else
static std::vector<std::string> ToUtf8Array(const SStringVector& v)
@@ -242,7 +234,7 @@ public:
{
ret.push_back(s.str());
}
return ret;
return std::move(ret);
}
#endif
@@ -253,7 +245,7 @@ public:
SString(const std::string &str) :
#ifdef _UNICODE
_str(SString::FromUtf8(str))
_str(std::move(SString::FromUtf8(str)))
#else
_str(str)
#endif
@@ -262,7 +254,7 @@ public:
SString(const char *str) :
#ifdef _UNICODE
_str(SString::FromUtf8(str))
_str(std::move(SString::FromUtf8(str)))
#else
_str(str)
#endif
@@ -273,7 +265,7 @@ public:
#ifdef _UNICODE
_str(str)
#else
_str(SString::ToUtf8(str))
_str(std::move(SString::ToUtf8(str)))
#endif
{
}
@@ -282,7 +274,7 @@ public:
#ifdef _UNICODE
_str(str)
#else
_str(SString::ToUtf8(str))
_str(std::move(SString::ToUtf8(str)))
#endif
{
}
@@ -375,7 +367,7 @@ public:
{
String str = _str;
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
return str;
return std::move(str);
}
SString &ToUpper()
@@ -388,7 +380,7 @@ public:
{
String str = _str;
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
return str;
return std::move(str);
}
bool IsEmpty() const
@@ -463,7 +455,7 @@ public:
SString ReplaceCopy(const char &character, const char &with) const
{
SString copy = _str;
return copy.Replace((SChar) character, (SChar) with);
return std::move(copy.Replace((SChar) character, (SChar) with));
}
#endif
@@ -471,7 +463,7 @@ public:
SString ReplaceCopy(const SChar &character, const SChar &with) const
{
SString copy = _str;
return copy.Replace(character, with);
return std::move(copy.Replace(character, with));
}
SString& Replace(const SString& str, const SString& with, size_t startPos = 0)
@@ -490,7 +482,7 @@ public:
SString ReplaceCopy(const SString& str, const SString& with, size_t startPos = 0) const
{
return SString(_str).Replace(str, with, startPos);
return std::move(SString(_str).Replace(str, with, startPos));
}
inline void Resize(const String::size_type& size)
@@ -516,7 +508,7 @@ public:
elems.push_back(trim ? Trim(item) : item);
}
return elems;
return std::move(elems);
}
SString& TrimLeft()
@@ -528,7 +520,7 @@ public:
SString TrimLeftCopy() const
{
String copy(_str);
return LeftTrim(copy);
return std::move(LeftTrim(copy));
}
SString& TrimRight()
@@ -540,7 +532,7 @@ public:
SString TrimRightCopy() const
{
String copy(_str);
return RightTrim(copy);
return std::move(RightTrim(copy));
}
SString& Trim()
@@ -552,7 +544,7 @@ public:
SString TrimCopy() const
{
String copy(_str);
return Trim(copy);
return std::move(Trim(copy));
}
SString SubString(const size_t &start, const size_t &count) const
@@ -670,7 +662,7 @@ public:
operator std::string() const
{
#ifdef _UNICODE
return SString::ToUtf8(_str);
return std::move(SString::ToUtf8(_str));
#else
return _str;
#endif
@@ -681,7 +673,7 @@ public:
#ifdef _UNICODE
return _str;
#else
return SString::FromUtf8(_str);
return std::move(SString::FromUtf8(_str));
#endif
}

View File

@@ -11,7 +11,7 @@
#include <eventsystem.h>
#include <siadrivehandler.h>
#include <threadpool.h>
#include <siatransaction.h>
#include <algorithm>
using namespace Sia;
using namespace Sia::Api;
@@ -692,34 +692,16 @@ void CSiaDriveApp::SiaApiRefreshCallback(CefRefPtr<CefV8Context> context, const
{
auto list = CefV8Value::CreateArray(uploadFileList->size());
int idx = 0;
for (auto file : *uploadFileList)
for (const auto& file : *uploadFileList)
{
auto f = CefV8Value::CreateObject(nullptr, nullptr);
f->SetValue("SiaPath", CefV8Value::CreateString(file->GetSiaPath().str()), V8_PROPERTY_ATTRIBUTE_NONE);
f->SetValue("Progress", CefV8Value::CreateUInt(min(100u, file->GetUploadProgress())), V8_PROPERTY_ATTRIBUTE_NONE);
f->SetValue("Progress", CefV8Value::CreateUInt(std::min(100u, file->GetUploadProgress())), V8_PROPERTY_ATTRIBUTE_NONE);
list->SetValue(idx++, f);
}
ExecuteSetter(context, renterActions, "setUploadProgress", list);
}
// Transaction history
auto txHistory = _siaApi->GetWallet()->GetTransactionHistory();
if (txHistory)
{
auto list = CefV8Value::CreateArray(txHistory->size());
int idx = 0;
for (auto hist : *txHistory)
{
auto h = CefV8Value::CreateObject(nullptr, nullptr);
h->SetValue("Date", CefV8Value::CreateString(hist->GetDate().str()), V8_PROPERTY_ATTRIBUTE_NONE);
h->SetValue("Amount", CefV8Value::CreateString(SiaCurrencyToString(hist->GetAmount()).str()), V8_PROPERTY_ATTRIBUTE_NONE);
h->SetValue("TxId", CefV8Value::CreateString(hist->GetTransactionId()), V8_PROPERTY_ATTRIBUTE_NONE);
list->SetValue(idx++, h);
}
ExecuteSetter(context, walletActions, "setTransHistory", list);
}
if (!_siaDrive)
{
#ifdef _WIN32

View File

@@ -1,5 +1,6 @@
#include <siaapi.h>
#include <SQLiteCpp/Database.h>
#include <algorithm>
using namespace Sia::Api;
/*{
@@ -111,7 +112,7 @@ void CSiaApi::_CSiaRenter::Refresh(const CSiaCurl& siaCurl, CSiaDriveConfig* sia
std::uint32_t totalProgress = std::accumulate(std::next(fileList->begin()), fileList->end(), fileList->at(0)->GetUploadProgress(), [](const std::uint32_t& progress, const CSiaFilePtr& file)
{
return progress + min(100, file->GetUploadProgress());
return progress + std::min(100u, file->GetUploadProgress());
}) / static_cast<std::uint32_t>(fileList->size());
SetTotalUsedBytes(total);

View File

@@ -1,62 +0,0 @@
#include <siatransaction.h>
using namespace Sia::Api;
CSiaTransaction::CSiaInput::CSiaInput(const json& json) :
_json(json)
{
}
CSiaTransaction::CSiaOutput::CSiaOutput(const json& json) :
_json(json)
{
}
CSiaTransaction::CSiaTransaction(const json& json) :
_json(json)
{
OutputDebugStringA(json.dump().c_str());
if (json.find("inputs") != json.end())
{
for (const auto tx : json["inputs"])
{
_Inputs.push_back(std::make_shared<CSiaInput>(tx));
}
}
if (json.find("outputs") != json.end())
{
for (const auto tx : json["outputs"])
{
_Outputs.push_back(std::make_shared<CSiaOutput>(tx));
}
}
}
SString CSiaTransaction::GetDate() const
{
return "";
}
SiaCurrency CSiaTransaction::GetAmount() const
{
Hastings spent = _Inputs.size() ? std::accumulate(std::next(_Inputs.begin()), _Inputs.end(), Hastings(_Inputs[0]->GetValue()), [](Hastings hast, auto tx)->Hastings
{
if (tx->GetWalletAddress())
{
return hast + tx->GetValue();
}
return hast;
}) : "0";
Hastings recv = _Outputs.size() ? std::accumulate(std::next(_Outputs.begin()), _Outputs.end(), Hastings(_Outputs[0]->GetValue()), [](Hastings hast, auto tx)->Hastings
{
if (tx->GetWalletAddress())
{
return hast + tx->GetValue();
}
return hast;
}) : "0";
return HastingsToSiaCurrency(recv - spent);
}

View File

@@ -1,5 +1,4 @@
#include <siaapi.h>
#include <siatransaction.h>
using namespace Sia::Api;
@@ -80,36 +79,35 @@ void CSiaApi::_CSiaWallet::Refresh(const CSiaCurl& siaCurl, CSiaDriveConfig* sia
SetConfirmedBalance(confirmed);
SetUnconfirmedBalance(unconfirmed);
SetReceiveAddress(address);
// Update connected status last so all properties are current
SetConnected(connected);
}
CSiaTransactionListPtr transList(new CSiaTransactionList);
if (connected)
{
json result;
SiaCurlError cerror = GetSiaCurl().Get(L"/wallet/transactions", { { "startheight", "1" },{ "endheight", "99999999" } }, result);
if (ApiSuccess(cerror))
if (connected)
{
if (result.find("unconfirmedtransactions") != result.end())
json result;
SiaCurlError cerror = GetSiaCurl().Get(L"/wallet/transactions", { { "startheight", "1" },{ "endheight", "99999999" } }, result);
if (ApiSuccess(cerror))
{
for (const auto& tx : result["unconfirmedtransactions"])
if (result.find("unconfirmedtransactions") != result.end())
{
transList->push_back(std::make_shared<CSiaTransaction>(tx));
for (auto tx : result["unconfirmedtransactions"])
{
}
}
}
if (result.find("confirmedtransactions") != result.end())
{
for (const auto& tx : result["confirmedtransactions"])
if (result.find("confirmedtransactions") != result.end())
{
transList->push_back(std::make_shared<CSiaTransaction>(tx));
for (auto tx : result["confirmedtransactions"])
{
json j(tx);
}
}
}
}
}
_transList = transList;
// Update connected status last so all properties are current
SetConnected(connected);
}
SiaApiError CSiaApi::_CSiaWallet::Create(const SString& password, const SiaSeedLanguage& seedLanguage, SString& seed)
@@ -205,9 +203,4 @@ SiaApiError CSiaApi::_CSiaWallet::Send(const SString& address, const SiaCurrency
}
return error;
}
CSiaTransactionListPtr CSiaApi::_CSiaWallet::GetTransactionHistory() const
{
return _transList;
}
}

View File

@@ -1453,7 +1453,7 @@ private:
// Probably not going to happen, but just in case
if (FilePath(fileName).IsUNC())
{
ret = DokanNtStatusFromWin32(ERROR_FILE_NOT_FOUND);
ret = STATUS_ILLEGAL_ELEMENT_ADDRESS;
CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanCreateFile(fileName, fileAttributesAndFlags, creationDisposition, genericDesiredAccess, ret)));
}
else
@@ -1500,7 +1500,7 @@ private:
{
if (!cacheFilePath.IsDirectory())
{
ret = DokanNtStatusFromWin32(ERROR_FILE_NOT_FOUND);;
ret = STATUS_NOT_FOUND;
}
}
@@ -1627,7 +1627,7 @@ private:
{
if (!ApiSuccess(_uploadManager->Remove(siaPath)))
{
ret = STATUS_INTERNAL_ERROR;
ret = STATUS_INVALID_SERVER_STATE;
}
}
else
@@ -1650,12 +1650,12 @@ private:
isDummy = AddDummyFileToCache(siaPath);
if (!isDummy)
{
ret = STATUS_INTERNAL_ERROR;
ret = STATUS_ACCESS_DENIED;
}
}
else
{
ret = DokanNtStatusFromWin32(ERROR_FILE_NOT_FOUND);
ret = STATUS_NOT_FOUND;
}
}
@@ -1707,14 +1707,14 @@ private:
}
else
{
ret = STATUS_INTERNAL_ERROR;
ret = STATUS_INVALID_SERVER_STATE;
}
}
}
}
else
{
ret = STATUS_INTERNAL_ERROR;
ret = STATUS_OBJECT_NAME_INVALID;
}
}
@@ -1726,7 +1726,7 @@ private:
static NTSTATUS DOKAN_CALLBACK Sia_FindFiles(LPCWSTR fileName, PFillFindData fillFindData, PDOKAN_FILE_INFO dokanFileInfo)
{
NTSTATUS ret = STATUS_INTERNAL_ERROR;
NTSTATUS ret = STATUS_INVALID_SERVER_STATE;
auto siaFileTree = GetFileTree();
if (siaFileTree)
{
@@ -1779,7 +1779,7 @@ private:
if (!ApiSuccess(_siaApi->GetRenter()->FileExists(CSiaApi::FormatToSiaPath(FilePath(fileName, findData.cFileName)), exists)))
{
::FindClose(findHandle);
return STATUS_INTERNAL_ERROR;
return STATUS_INVALID_DEVICE_STATE;
}
if (findData.nFileSizeHigh || findData.nFileSizeLow || !exists)
@@ -2004,7 +2004,7 @@ private:
{
if (!AddFileToCache(*openFileInfo, dokanFileInfo))
{
ret = STATUS_INTERNAL_ERROR;
ret = STATUS_INVALID_DEVICE_STATE;
}
}
@@ -2017,7 +2017,7 @@ private:
{
if (!AddFileToCache(*openFileInfo, dokanFileInfo))
{
ret = STATUS_INTERNAL_ERROR;
ret = STATUS_INVALID_DEVICE_STATE;
}
}
@@ -2072,7 +2072,7 @@ private:
{
if (!AddFileToCache(*openFileInfo, dokanFileInfo))
{
ret = STATUS_INTERNAL_ERROR;
ret = STATUS_INVALID_DEVICE_STATE;
}
}
@@ -2084,7 +2084,7 @@ private:
{
if (!AddFileToCache(*openFileInfo, dokanFileInfo))
{
ret = STATUS_INTERNAL_ERROR;
ret = STATUS_INVALID_DEVICE_STATE;
}
}
@@ -2213,7 +2213,7 @@ private:
{
if (!AddFileToCache(*openFileInfo, dokanFileInfo))
{
ret = STATUS_INTERNAL_ERROR;
ret = STATUS_INVALID_DEVICE_STATE;
}
}
@@ -2368,7 +2368,7 @@ private:
DWORD dwAttrib = ::GetFileAttributes(&filePath[0]);
if ((dwAttrib != INVALID_FILE_ATTRIBUTES) && (dwAttrib & FILE_ATTRIBUTE_DIRECTORY))
{
ret = DokanNtStatusFromWin32(ERROR_ACCESS_DENIED);
ret = STATUS_ACCESS_DENIED;
}
else if (openFileInfo && openFileInfo->FileHandle && (openFileInfo->FileHandle != INVALID_HANDLE_VALUE))
{
@@ -2413,6 +2413,8 @@ private:
wcscpy_s(renameInfo->FileName, len + 1, &newFilePath[0]);
BOOL result = ::SetFileInformationByHandle(openFileInfo->FileHandle, FileRenameInfo, renameInfo, bufferSize);
free(renameInfo);
if (result)
{
if (!dokanFileInfo->IsDirectory && !ApiSuccess(_siaApi->GetRenter()->RenameFile(openFileInfo->SiaPath, CSiaApi::FormatToSiaPath(NewFileName))))
@@ -2423,8 +2425,7 @@ private:
else
{
ret = DokanNtStatusFromWin32(::GetLastError());
}
free(renameInfo);
}
}
else
{
@@ -2688,7 +2689,7 @@ public:
return uploadManager->GetUploadFileList();
}
return std::make_shared<UploadFileList>();
return UploadFileListPtr(new UploadFileList());
}
};