This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned short ChkSum(unsigned int CheckSum, void *FileBase, int Length) | |
{ | |
int *Data; | |
int sum; | |
if ( Length && FileBase != NULL) | |
{ | |
Data = (int *)FileBase; | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BOOL TerminateProcessByPid(DWORD Pid) | |
{ | |
BOOL Result = FALSE; | |
HANDLE ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, Pid); | |
if (ProcessHandle != NULL) | |
{ | |
Result = TerminateProcess(ProcessHandle, 0); | |
CloseHandle(ProcessHandle); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CNetworkListManagerEvent : public INetworkListManagerEvents | |
{ | |
public: | |
CNetworkListManagerEvent() : m_ref(1) | |
{ | |
} | |
~CNetworkListManagerEvent() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void WaitForNetworkChnages() | |
{ | |
WSAQUERYSET querySet = {0}; | |
querySet.dwSize = sizeof(WSAQUERYSET); | |
querySet.dwNameSpace = NS_NLA; | |
HANDLE LookupHandle = NULL; | |
WSALookupServiceBegin(&querySet, LUP_RETURN_ALL, &LookupHandle); | |
DWORD BytesReturned = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool SaveImageListToFile(HIMAGELIST hImageList, const TCHAR* FilePath) | |
{ | |
if (hImageList != NULL) | |
{ | |
::DeleteFile(FilePath); | |
IStorage *pStorage = NULL; | |
HRESULT hr = StgCreateStorageEx(FilePath, | |
STGM_CREATE|STGM_WRITE|STGM_SHARE_EXCLUSIVE, | |
STGFMT_DOCFILE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "task_thread_pool.hpp" | |
#include <assert.h> | |
#include <ustd/thread/guard.h> | |
namespace wx { | |
namespace utility { | |
task_thread_pool_t::task_thread_pool_t() : current_task_thread_(0) {} | |
task_thread_pool_t::~task_thread_pool_t() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef ASYNC_EXTEND_HPP_ | |
#define ASYNC_EXTEND_HPP_ | |
#include <future> | |
namespace base { | |
namespace detail { | |
template<typename future_t, typename handler_t> | |
struct async_helper { | |
static auto async_impl(std::launch::launch policy, future_t f, handler_t&& handler, std::true_type)->std::future<decltype(handler(f))> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef ERROR_CODE_HPP_ | |
#define ERROR_CODE_HPP_ | |
// define self error code | |
namespace base { | |
enum system_error_t { | |
kAccessDenied = ERROR_ACCESS_DENIED, | |
}; | |
class system_category_t : public std::error_category { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef SCOPE_EXIT_HPP_ | |
#define SCOPE_EXIT_HPP_ | |
#include <functional> | |
namespace base { | |
template <typename handler_t> | |
class scope_exit { | |
private: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "task_thread_pool.hpp" | |
#include <set> | |
#include <vector> | |
#include <tuple> | |
#include <algorithm> | |
#include <Windows.h> | |
#include <assert.h> | |
#include <mutex> | |
namespace base { |
OlderNewer