diff -ruN --strip-trailing-cr BitcasaDLL-20140105/BitcasaDLL/BitcasaAPI.cpp BitcasaDLL-20140107/BitcasaDLL/BitcasaAPI.cpp
--- BitcasaDLL-20140105/BitcasaDLL/BitcasaAPI.cpp	2014-01-05 21:15:52.000000000 +0900
+++ BitcasaDLL-20140107/BitcasaDLL/BitcasaAPI.cpp	2014-01-07 08:08:40.000000000 +0900
@@ -12,6 +12,7 @@
 const std::string API_Granttoken(APIbase + "/oauth2/access_token");
 const std::string API_Folders(APIbase + "/folders");
 const std::string API_Files(APIbase + "/files");
+const std::string API_Profile(APIbase + "/user/profile");
 
 BitcasaAPI::BitcasaAPI()
 {
@@ -31,7 +32,7 @@
 bool BitcasaAPI::prepare()
 {
 	if (!access_token.empty()) {
-		auto root = ListFolder("/");
+		auto root = GetUserProfile();
 		if (root && (*root)["error"]->type == jsonitem::null) return true;
 	}
 	if (authenticate() == 0) return true;
@@ -282,6 +283,25 @@
 	return 0;
 }
 
+//User Operations
+// Get User Profile
+pjson BitcasaAPI::GetUserProfile()
+{
+	std::string URI = API_Profile;
+	bitcasa.Clear();
+	bitcasa.request.query["access_token"] = WideChartoUTF8(access_token);
+	bitcasa.GET(URI);
+
+	if (bitcasa.response.code != 200) {
+		std::cerr << "GetUserProfile failed" << std::endl;
+		std::cerr << std::string(bitcasa.response.body.begin(), bitcasa.response.body.end()) << std::endl;
+		return NULL;
+	}
+
+	return jsonitem::Create(&bitcasa.response.body[0]);
+}
+
+
 /*
 File and Folder name restrictions
 
@@ -472,10 +492,10 @@
 	std::string *access_token;
 	std::string *URI;
 public:
-	bool alive;
 	bool partial;
 	HANDLE readySlave;
 	HANDLE readyMaster;
+	HANDLE die;
 	INT64 offset;
 	INT64 len;
 	std::vector<char> *buf;
@@ -484,10 +504,10 @@
 		bitcasa = new HttpsClient();
 		readySlave = CreateEvent(NULL, false, false, NULL);
 		readyMaster = CreateEvent(NULL, false, false, NULL);
+		die = CreateMutex(NULL, false, NULL);
 		access_token = new std::string;
 		URI = new std::string;
 		buf = new std::vector<char>;
-		alive = true;
 		*URI = url;
 		*access_token = token;
 	}
@@ -500,8 +520,8 @@
 		delete bitcasa;
 	}
 	void DoWork(){
-		while (alive){
-			if ((WaitForSingleObject(readySlave, INFINITE) != WAIT_OBJECT_0) || !alive)
+		while (WaitForSingleObject(die, 0) == WAIT_TIMEOUT){
+			if ((WaitForSingleObject(readySlave, INFINITE) != WAIT_OBJECT_0) || (WaitForSingleObject(die, 0) != WAIT_TIMEOUT))
 				break;
 			std::cerr << "thread " << GetCurrentThreadId() << " wake." << std::endl;
 			std::cerr << "thread " << GetCurrentThreadId() << " offset:" << offset << std::endl;
@@ -584,6 +604,7 @@
 		data.Add(work);
 		HANDLE h = work->readyMaster;
 		waithandles.push_back(h);
+		WaitForSingleObject(work->die, INFINITE);
 		workThreads.Add(gcnew Thread(gcnew ThreadStart(work, &threadwork::DoWork)));
 	}
 	for (int i = 0; i < threadcount; i++){
@@ -599,7 +620,7 @@
 	}
 	try{
 		while (working > 0){
-			auto ret = WaitForMultipleObjects(waithandles.size(), &waithandles[0], false, INFINITE);
+			auto ret = WaitForMultipleObjects((DWORD)waithandles.size(), &waithandles[0], false, INFINITE);
 			int thread_no = -1;
 			if ((ret >= WAIT_OBJECT_0) && (ret < WAIT_OBJECT_0 + waithandles.size())) thread_no = ret - WAIT_OBJECT_0;
 			if ((ret >= WAIT_ABANDONED_0) && (ret < WAIT_ABANDONED_0 + waithandles.size())) thread_no = ret - WAIT_ABANDONED_0;
@@ -626,7 +647,7 @@
 						continue;
 					}
 					else {
-						work->alive = false;
+						ReleaseMutex(work->die);
 						working--;
 						continue;
 					}
@@ -654,7 +675,7 @@
 	}
 	finally{
 		for (int i = 0; i < threadcount; i++){
-			data[i]->alive = false;
+			ReleaseMutex(data[i]->die);
 			SetEvent(data[i]->readySlave);
 		}
 		for (int i = 0; i < threadcount; i++){
diff -ruN --strip-trailing-cr BitcasaDLL-20140105/BitcasaDLL/BitcasaAPI.h BitcasaDLL-20140107/BitcasaDLL/BitcasaAPI.h
--- BitcasaDLL-20140105/BitcasaDLL/BitcasaAPI.h	2014-01-05 18:49:24.000000000 +0900
+++ BitcasaDLL-20140107/BitcasaDLL/BitcasaAPI.h	2014-01-05 23:24:32.000000000 +0900
@@ -18,6 +18,8 @@
 	int authenticate();
 	int Grant_token(std::string auth_code);
 
+	pjson GetUserProfile();
+
 	///////////////////////////////////////
 	pjson ListFolder(std::string encoded_path = "/", bool deep = false);
 	inline pjson ListFolder(std::wstring encoded_path){
diff -ruN --strip-trailing-cr BitcasaDLL-20140105/BitcasaDLL/BitcasaWrapper.cpp BitcasaDLL-20140107/BitcasaDLL/BitcasaWrapper.cpp
--- BitcasaDLL-20140105/BitcasaDLL/BitcasaWrapper.cpp	2014-01-05 18:49:24.000000000 +0900
+++ BitcasaDLL-20140107/BitcasaDLL/BitcasaWrapper.cpp	2014-01-07 02:10:08.000000000 +0900
@@ -146,6 +146,10 @@
 	return false;
 }
 
+jsonitemWrapper^ BitcasaWrapper::GetUserProfile()
+{
+	return jsonitemWrapper::Create(obj->GetUserProfile());
+}
 
 jsonitemWrapper^ BitcasaWrapper::ListFolder(System::String^ encoded_path)
 {
@@ -181,6 +185,7 @@
 	return obj->CopyMoveFolder(SystemStringToStdString(encoded_path_old), SystemStringToStdString(encoded_path_new), SystemStringToStdWString(newfoldername), BitcasaAPI::move);
 }
 
+static System::Runtime::InteropServices::GCHandle gch;
 
 bool BitcasaWrapper::UploadFile(System::String^ encoded_path, System::String^ infilename)
 {
@@ -188,6 +193,11 @@
 }
 bool BitcasaWrapper::UploadFile(System::String^ encoded_path, System::String^ infilename, filetrans^ callback)
 {
+	try{
+		if (!gch.Equals(callback)) gch.Free();
+	}
+	catch (InvalidOperationException^){}
+	gch = System::Runtime::InteropServices::GCHandle::Alloc(callback);
 	IntPtr delegatePointer = System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(callback);
 	return obj->UploadFile(SystemStringToStdString(encoded_path), SystemStringToStdWString(infilename), (void(CALLBACK *)(INT64))delegatePointer.ToPointer());
 }
@@ -198,6 +208,11 @@
 }
 bool BitcasaWrapper::DownloadFile(System::String^ encoded_file_id, System::String^ filename, Int64 filesize, filetrans^ callback)
 {
+	try{
+		if (!gch.Equals(callback)) gch.Free();
+	}
+	catch (InvalidOperationException^){}
+	gch = System::Runtime::InteropServices::GCHandle::Alloc(callback);
 	IntPtr delegatePointer = System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(callback);
 	return obj->DownloadFile(SystemStringToStdString(encoded_file_id), SystemStringToStdWString(filename), filesize, (void(CALLBACK *)(INT64))delegatePointer.ToPointer());
 }
diff -ruN --strip-trailing-cr BitcasaDLL-20140105/BitcasaDLL/BitcasaWrapper.h BitcasaDLL-20140107/BitcasaDLL/BitcasaWrapper.h
--- BitcasaDLL-20140105/BitcasaDLL/BitcasaWrapper.h	2014-01-04 01:24:24.000000000 +0900
+++ BitcasaDLL-20140107/BitcasaDLL/BitcasaWrapper.h	2014-01-07 02:04:24.000000000 +0900
@@ -37,6 +37,7 @@
 		int Grant_token(std::string auth_code){
 			return obj->Grant_token(auth_code);
 		}
+		jsonitemWrapper^ GetUserProfile();
 		///////////////////////////////////////
 		jsonitemWrapper^ ListFolder(System::String^ encoded_path);
 		jsonitemWrapper^ ListFolder(System::String^ encoded_path, bool deep);
@@ -76,6 +77,9 @@
 
 		static jsonitemWrapper^ Create(pjson item);
 
+		property bool IsError{
+			bool get(){ return (this == nullptr) || (this["error"]->type != jsonitem::null); }
+		}
 		virtual property jsonitemWrapper^ default [System::String^]{
 			jsonitemWrapper^ get(System::String^){
 				return jsonitemWrapper::Create(null_json);
@@ -162,11 +166,11 @@
 			json_array *obj = dynamic_cast<json_array*>(org);
 			if (!obj) return;
 			for (size_t i = 0; i < obj->size(); i++){
-				array.Add(jsonitemWrapper::Create((*obj)[i]));
+				array.Add(jsonitemWrapper::Create((*obj)[(int)i]));
 			}
 		}
 		virtual inline jsonitemWrapper^ Items(size_t index) override{
-			auto p = array[index];
+			auto p = array[(int)index];
 			return (p) ? p : jsonitemWrapper::Create(null_json);
 		}
 		virtual property size_t size{
diff -ruN --strip-trailing-cr BitcasaDLL-20140105/BitcasaDLL/http_client.cpp BitcasaDLL-20140107/BitcasaDLL/http_client.cpp
--- BitcasaDLL-20140105/BitcasaDLL/http_client.cpp	2014-01-05 20:18:16.000000000 +0900
+++ BitcasaDLL-20140107/BitcasaDLL/http_client.cpp	2014-01-07 02:03:24.000000000 +0900
@@ -188,7 +188,7 @@
 		if (tempread) {
 			buffer.resize(4096);
 			response.body.resize(0);
-			while ((ContentLength < 0) || (len <= ContentLength)){
+			while ((ContentLength < 0) || ((INT64)len <= ContentLength)){
 				int p = BIO_read(bio, &buffer[0], (int)buffer.size());
 				if (p <= 0){
 					break;
@@ -294,7 +294,7 @@
 
 	// send body part
 	auto str = prebody.str();
-	BIO_write(bio, str.c_str(), str.size());
+	BIO_write(bio, str.c_str(), (int)str.size());
 	std::vector<char> sendbuf;
 	const INT64 bufsize = 32 * 1024 * 1024;
 	while (filesize > 0)
@@ -307,14 +307,14 @@
 			sendbuf.resize(filesize);
 		}
 		infile.read(&sendbuf[0], sendbuf.size());
-		if (BIO_write(bio, &sendbuf[0], sendbuf.size()) != sendbuf.size())
+		if (BIO_write(bio, &sendbuf[0], (int)sendbuf.size()) != sendbuf.size())
 			return 1;
 		filesize -= sendbuf.size();
 		std::cerr << '.';
 	}
 	if (callback) callback(-2);
 	str = postbody.str();
-	BIO_write(bio, str.c_str(), str.size());
+	BIO_write(bio, str.c_str(), (int)str.size());
 	BIO_flush(bio);
 	std::cerr << "transfer finished,";
 
@@ -359,7 +359,7 @@
 	if (tempread) {
 		buffer.resize(4096);
 		response.body.resize(0);
-		while ((ContentLength < 0) || (len <= ContentLength)){
+		while ((ContentLength < 0) || ((INT64)len <= ContentLength)){
 			int p = BIO_read(bio, &buffer[0], (int)buffer.size());
 			if (p <= 0) break;
 			response.body.resize(len + p);
diff -ruN --strip-trailing-cr BitcasaDLL-20140105/BitcasaDLL/Stdafx.h BitcasaDLL-20140107/BitcasaDLL/Stdafx.h
--- BitcasaDLL-20140105/BitcasaDLL/Stdafx.h	2014-01-05 08:24:28.000000000 +0900
+++ BitcasaDLL-20140107/BitcasaDLL/Stdafx.h	2014-01-05 23:26:22.000000000 +0900
@@ -32,7 +32,6 @@
 #include <functional>
 #include <iterator>
 #include <random>
-#include <queue>
 
 typedef std::basic_string<TCHAR> tstring;
 typedef std::basic_stringstream<TCHAR> tstringstream;
diff -ruN --strip-trailing-cr BitcasaDLL-20140105/BitcasaDLL/util.cpp BitcasaDLL-20140107/BitcasaDLL/util.cpp
--- BitcasaDLL-20140105/BitcasaDLL/util.cpp	2013-12-12 15:46:44.000000000 +0900
+++ BitcasaDLL-20140107/BitcasaDLL/util.cpp	2014-01-07 02:01:32.000000000 +0900
@@ -74,10 +74,10 @@
 {
 	std::string outstr;
 
-	int iBufferSize = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), str.length(), (char *)NULL, 0, NULL, NULL);
+	int iBufferSize = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length(), (char *)NULL, 0, NULL, NULL);
 	outstr.resize(iBufferSize);
 	// wstring->UTF8
-	WideCharToMultiByte(CP_UTF8, 0, str.c_str(), str.length(), &outstr[0], outstr.length(), NULL, NULL);
+	WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length(), &outstr[0], (int)outstr.length(), NULL, NULL);
 	return outstr;
 }
 
@@ -85,10 +85,10 @@
 {
 	std::wstring outstr;
 
-	int iBufferSize = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), (wchar_t *)NULL, 0);
+	int iBufferSize = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), (int)str.length(), (wchar_t *)NULL, 0);
 	outstr.resize(iBufferSize);
 	// UTF8->wstring
-	MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), &outstr[0], outstr.length());
+	MultiByteToWideChar(CP_UTF8, 0, str.c_str(), (int)str.length(), &outstr[0], (int)outstr.length());
 	return outstr;
 }
 
diff -ruN --strip-trailing-cr BitcasaDLL-20140105/bitcasaViewer/BitcasaServer.cs BitcasaDLL-20140107/bitcasaViewer/BitcasaServer.cs
--- BitcasaDLL-20140105/bitcasaViewer/BitcasaServer.cs	2014-01-04 17:35:56.000000000 +0900
+++ BitcasaDLL-20140107/bitcasaViewer/BitcasaServer.cs	2014-01-05 23:42:28.000000000 +0900
@@ -13,6 +13,9 @@
     {
         private BitcasaWrapper bitcasa = new BitcasaWrapper();
         public bool loadall_flag { get; protected set; }
+        public jsonitemWrapper GetUserProfile {
+            get { return bitcasa.GetUserProfile(); }
+        }
 
         public delegate void delegateProgressBar(int v);
 
diff -ruN --strip-trailing-cr BitcasaDLL-20140105/bitcasaViewer/FileInfo.cs BitcasaDLL-20140107/bitcasaViewer/FileInfo.cs
--- BitcasaDLL-20140105/bitcasaViewer/FileInfo.cs	2014-01-03 06:37:52.000000000 +0900
+++ BitcasaDLL-20140107/bitcasaViewer/FileInfo.cs	2014-01-07 02:04:48.000000000 +0900
@@ -11,7 +11,7 @@
     class LocalFileInfo
     {
         public string name;
-        public Int64 size;
+        public Int64 size = 0;
         public DateTime CreationTime;
         public DateTime LastWriteTime;
 
diff -ruN --strip-trailing-cr BitcasaDLL-20140105/bitcasaViewer/Form1.cs BitcasaDLL-20140107/bitcasaViewer/Form1.cs
--- BitcasaDLL-20140105/bitcasaViewer/Form1.cs	2014-01-03 17:16:38.000000000 +0900
+++ BitcasaDLL-20140107/bitcasaViewer/Form1.cs	2014-01-07 05:48:40.000000000 +0900
@@ -134,11 +134,6 @@
             {
                 lock (bitcasa)
                 {
-                    if (ongoing)
-                    {
-                        MessageBox.Show("now processing...");
-                        return;
-                    }
                     var Node = treeView1.SelectedNode;
                     if (Node == null) return;
                     var selectItem = Node.FullPath.Substring(4);
@@ -171,6 +166,10 @@
 
         private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
         {
+            if (ongoing)
+            {
+                return;
+            }
             reloadview();
         }
 
@@ -195,6 +194,7 @@
                     treeView1.Nodes.Add("root");
                     loginToolStripMenuItem.Enabled = false;
                     loginToolStripMenuItem.Text = "done.";
+                    profileToolStripMenuItem.Enabled = true;
                 }
             }
             finally {
@@ -204,6 +204,10 @@
 
         private void listView1_SelectedIndexChanged(object sender, EventArgs e)
         {
+            if (ongoing)
+            {
+                return;
+            }
             lock (typeof(BitcasaFileInfo))
             {
                 if (listView1.SelectedItems.Count > 1)
@@ -289,13 +293,13 @@
         {
             if (listView1.SelectedItems.Count == 1)
             {
+                if (ongoing)
+                {
+                    MessageBox.Show("now processing...");
+                    return;
+                }
                 lock (typeof(BitcasaFileInfo))
                 {
-                    if (ongoing)
-                    {
-                        MessageBox.Show("now processing...");
-                        return;
-                    }
                     try
                     {
                         var item = listView1.SelectedItems[0].SubItems[0].Text;
@@ -558,5 +562,29 @@
             }
         }
 
+        private void profileToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            if (ongoing)
+            {
+                MessageBox.Show("now processing...");
+                return;
+            }
+            lock (bitcasa)
+            {
+                jsonitemWrapper profile = bitcasa.GetUserProfile;
+                if (profile.IsError) return;
+           
+                MessageBox.Show("User Profile\n\n"+
+                    "total : " + profile["result"]["storage"]["total"].GetInteger().ToString() + "\n" +
+                    "display : " + profile["result"]["storage"]["display"].GetString() + "\n" +
+                    "used : " + profile["result"]["storage"]["used"].GetInteger().ToString() + "\n" +
+                    "\n" +
+                    "referral_link : " + profile["result"]["referral_link"].GetString() + "\n" +
+                    "display_name : " + profile["result"]["display_name"].GetString() + "\n" +
+                    "id : " + profile["result"]["id"].GetString()
+                    );
+            }
+        }
+
     }
 }
diff -ruN --strip-trailing-cr BitcasaDLL-20140105/bitcasaViewer/Form1.Designer.cs BitcasaDLL-20140107/bitcasaViewer/Form1.Designer.cs
--- BitcasaDLL-20140105/bitcasaViewer/Form1.Designer.cs	2014-01-01 20:03:34.000000000 +0900
+++ BitcasaDLL-20140107/bitcasaViewer/Form1.Designer.cs	2014-01-05 23:42:28.000000000 +0900
@@ -67,6 +67,7 @@
             this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
             this.listBox1 = new System.Windows.Forms.ListBox();
             this.checkBox_reload = new System.Windows.Forms.CheckBox();
+            this.profileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.menuStrip1.SuspendLayout();
             this.contextMenuStrip1.SuspendLayout();
             this.panel1.SuspendLayout();
@@ -88,7 +89,8 @@
             this.loginToolStripMenuItem,
             this.reloadToolStripMenuItem,
             this.scanAllToolStripMenuItem,
-            this.overlyToolStripMenuItem});
+            this.overlyToolStripMenuItem,
+            this.profileToolStripMenuItem});
             this.menuStrip1.Location = new System.Drawing.Point(0, 0);
             this.menuStrip1.Name = "menuStrip1";
             this.menuStrip1.Size = new System.Drawing.Size(807, 26);
@@ -392,6 +394,14 @@
             this.checkBox_reload.Text = "AutoReload";
             this.checkBox_reload.UseVisualStyleBackColor = true;
             // 
+            // profileToolStripMenuItem
+            // 
+            this.profileToolStripMenuItem.Enabled = false;
+            this.profileToolStripMenuItem.Name = "profileToolStripMenuItem";
+            this.profileToolStripMenuItem.Size = new System.Drawing.Size(56, 22);
+            this.profileToolStripMenuItem.Text = "Profile";
+            this.profileToolStripMenuItem.Click += new System.EventHandler(this.profileToolStripMenuItem_Click);
+            // 
             // Form1
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -466,6 +476,7 @@
         private System.Windows.Forms.ToolStripMenuItem overlyToolStripMenuItem;
         private System.Windows.Forms.ToolStripMenuItem biToolStripMenuItem;
         private System.Windows.Forms.ToolStripMenuItem otherToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem profileToolStripMenuItem;
     }
 }
 
diff -ruN --strip-trailing-cr BitcasaDLL-20140105/bitcasaViewer/Form1_popup.cs BitcasaDLL-20140107/bitcasaViewer/Form1_popup.cs
--- BitcasaDLL-20140105/bitcasaViewer/Form1_popup.cs	2014-01-05 00:28:04.000000000 +0900
+++ BitcasaDLL-20140107/bitcasaViewer/Form1_popup.cs	2014-01-07 05:39:42.000000000 +0900
@@ -227,7 +227,7 @@
                             {
                                 lock (typeof(BitcasaFileInfo))
                                 {
-                                    var item = SelectItemToFileinfo();
+                                    var item = SelectItemToFileinfo(); 
                                     return bitcasa.upload(
                                         item,
                                         filename,
@@ -235,15 +235,15 @@
                                             (BitcasaServer.delegateProgressBar)(
                                                 (int x) =>
                                                 {
-                                                    if (x < 0)
-                                                    {
-                                                        toolStripProgressBar1.Style = ProgressBarStyle.Marquee;
-                                                    }
-                                                    else
-                                                    {
-                                                        toolStripProgressBar1.Style = ProgressBarStyle.Continuous;
-                                                        progress(x);
-                                                    }
+                                                        if (x < 0)
+                                                        {
+                                                            toolStripProgressBar1.Style = ProgressBarStyle.Marquee;
+                                                        }
+                                                        else
+                                                        {
+                                                            toolStripProgressBar1.Style = ProgressBarStyle.Continuous;
+                                                            progress(x);
+                                                        }
                                                 }),
                                             new object[] { p }
                                         )
