Support compile with Win64

This commit is contained in:
yuanyuanxiang
2025-02-06 04:15:34 +08:00
parent 80f277aa7f
commit 2b9ef8e935
21 changed files with 81 additions and 67 deletions

View File

@@ -345,7 +345,7 @@ VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName
CString strCPU, CString strVideo, CString strPing, CString ver, CString st, CString tp, CONTEXT_OBJECT* ContextObject)
{
EnterCriticalSection(&m_cs);
if (IsExitItem(m_CList_Online, (DWORD)ContextObject)) {
if (IsExitItem(m_CList_Online, (ULONG_PTR)ContextObject)) {
LeaveCriticalSection(&m_cs);
OutputDebugStringA(CString("===> '") + strIP + CString("' already exist!!\n"));
return;
@@ -978,7 +978,7 @@ VOID CALLBACK CMy2015RemoteDlg::OfflineProc(CONTEXT_OBJECT* ContextObject)
{
dlgInfo* dlg = ContextObject->v1 > 0 ? new dlgInfo(ContextObject->hDlg, ContextObject->v1) : NULL;
int nSocket = ContextObject->sClientSocket;
SOCKET nSocket = ContextObject->sClientSocket;
g_2015RemoteDlg->PostMessage(WM_USEROFFLINEMSG, (WPARAM)dlg, (LPARAM)nSocket);

View File

@@ -79,8 +79,8 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath)</IncludePath>
<LibraryPath>$(VLDPATH)\lib\Win64\;$(LibraryPath)</LibraryPath>
<IncludePath>$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath)</IncludePath>
<LibraryPath>$(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
@@ -89,8 +89,8 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(VLDPATH)\lib\Win32\;$(LibraryPath)</LibraryPath>
<IncludePath>$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath)</IncludePath>
<LibraryPath>$(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath)</LibraryPath>
<IncludePath>$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@@ -132,7 +132,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>zlib\zlib_x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>LIBCMT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
<Midl>
@@ -193,7 +193,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>zlib.lib</AdditionalDependencies>
<AdditionalDependencies>zlib\zlib_x64.lib</AdditionalDependencies>
<AdditionalOptions> /SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
</Link>
<Midl>

View File

@@ -85,7 +85,7 @@ DWORD CAudioDlg::WorkThread(LPVOID lParam)
{
if (!This->m_bSend)
{
WAIT(This->m_bIsWorking, 1, 50);
WAIT_n(This->m_bIsWorking, 1, 50);
continue;
}
DWORD dwBufferSize = 0;

View File

@@ -40,9 +40,9 @@ ULONG CBuffer::RemoveCompletedBuffer(ULONG ulLength)
LeaveCriticalSection(&m_cs);
return 0;
}
if (ulLength > ((ULONG)m_Ptr - (ULONG)m_Base)) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD> <20><><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3>Ȼ<EFBFBD><C8BB><EFBFBD>
if (ulLength > (m_Ptr - m_Base)) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD> <20><><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3>Ȼ<EFBFBD><C8BB><EFBFBD>
{
ulLength = (ULONG)m_Ptr - (ULONG)m_Base;
ulLength = m_Ptr - m_Base;
}
if (ulLength)
@@ -52,7 +52,7 @@ ULONG CBuffer::RemoveCompletedBuffer(ULONG ulLength)
m_Ptr -= ulLength;
}
DeAllocateBuffer((ULONG)m_Ptr - (ULONG)m_Base);
DeAllocateBuffer(m_Ptr - m_Base);
LeaveCriticalSection(&m_cs);
return ulLength;
@@ -68,9 +68,9 @@ ULONG CBuffer::ReadBuffer(PBYTE Buffer, ULONG ulLength)
return 0;
}
if (ulLength > ((ULONG)m_Ptr - (ULONG)m_Base))
if (ulLength > (m_Ptr - m_Base))
{
ulLength = (ULONG)m_Ptr - (ULONG)m_Base;
ulLength = m_Ptr - m_Base;
}
if (ulLength)
@@ -81,7 +81,7 @@ ULONG CBuffer::ReadBuffer(PBYTE Buffer, ULONG ulLength)
m_Ptr -= ulLength;
}
DeAllocateBuffer((ULONG)m_Ptr - (ULONG)m_Base);
DeAllocateBuffer(m_Ptr - m_Base);
LeaveCriticalSection(&m_cs);
return ulLength;
@@ -90,7 +90,7 @@ ULONG CBuffer::ReadBuffer(PBYTE Buffer, ULONG ulLength)
// ˽<><CBBD>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ULONG CBuffer::DeAllocateBuffer(ULONG ulLength)
{
if (ulLength < ((ULONG)m_Ptr - (ULONG)m_Base))
if (ulLength < (m_Ptr - m_Base))
return 0;
ULONG ulNewMaxLength = (ULONG)ceil(ulLength / F_PAGE_ALIGNMENT) * U_PAGE_ALIGNMENT;
@@ -101,7 +101,7 @@ ULONG CBuffer::DeAllocateBuffer(ULONG ulLength)
}
PBYTE NewBase = (PBYTE) VirtualAlloc(NULL,ulNewMaxLength,MEM_COMMIT,PAGE_READWRITE);
ULONG ulv1 = (ULONG)m_Ptr - (ULONG)m_Base; //<2F><>ԭ<EFBFBD><D4AD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
ULONG ulv1 = m_Ptr - m_Base; //<2F><>ԭ<EFBFBD><D4AD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
CopyMemory(NewBase,m_Base,ulv1);
VirtualFree(m_Base,0,MEM_RELEASE);
@@ -120,7 +120,7 @@ BOOL CBuffer::WriteBuffer(PBYTE Buffer, ULONG ulLength)
{
EnterCriticalSection(&m_cs);
if (ReAllocateBuffer(ulLength + ((ULONG)m_Ptr - (ULONG)m_Base)) == -1)//10 +1 1024
if (ReAllocateBuffer(ulLength + (m_Ptr - m_Base)) == -1)//10 +1 1024
{
LeaveCriticalSection(&m_cs);
return false;
@@ -147,7 +147,7 @@ ULONG CBuffer::ReAllocateBuffer(ULONG ulLength)
}
ULONG ulv1 = (ULONG)m_Ptr - (ULONG)m_Base; //ԭ<>ȵ<EFBFBD><C8B5><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
ULONG ulv1 = m_Ptr - m_Base; //ԭ<>ȵ<EFBFBD><C8B5><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
CopyMemory(NewBase,m_Base,ulv1);
@@ -180,7 +180,7 @@ ULONG CBuffer::GetBufferLength() //
LeaveCriticalSection(&m_cs);
return 0;
}
ULONG len = (ULONG)m_Ptr - (ULONG)m_Base;
ULONG len = m_Ptr - m_Base;
LeaveCriticalSection(&m_cs);
return len;
@@ -190,7 +190,7 @@ ULONG CBuffer::GetBufferLength() //
LPBYTE CBuffer::GetBuffer(ULONG ulPos)
{
EnterCriticalSection(&m_cs);
if (m_Base==NULL || ulPos >= ((ULONG)m_Ptr - (ULONG)m_Base))
if (m_Base==NULL || ulPos >= (m_Ptr - m_Base))
{
LeaveCriticalSection(&m_cs);
return NULL;
@@ -205,7 +205,7 @@ LPBYTE CBuffer::GetBuffer(ULONG ulPos)
Buffer CBuffer::GetMyBuffer(ULONG ulPos)
{
EnterCriticalSection(&m_cs);
ULONG len = (ULONG)m_Ptr - (ULONG)m_Base;
ULONG len = m_Ptr - m_Base;
if (m_Base == NULL || ulPos >= len)
{
LeaveCriticalSection(&m_cs);
@@ -220,7 +220,7 @@ Buffer CBuffer::GetMyBuffer(ULONG ulPos)
// <20>˺<EFBFBD><CBBA><EFBFBD><EFBFBD>Ƕ<EFBFBD><C7B6>̰߳<DFB3>ȫ<EFBFBD><C8AB>. <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>λ<EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>ֵ.
BYTE CBuffer::GetBYTE(ULONG ulPos) {
EnterCriticalSection(&m_cs);
if (m_Base == NULL || ulPos >= ((ULONG)m_Ptr - (ULONG)m_Base))
if (m_Base == NULL || ulPos >= (m_Ptr - m_Base))
{
LeaveCriticalSection(&m_cs);
return NULL;
@@ -234,7 +234,7 @@ BYTE CBuffer::GetBYTE(ULONG ulPos) {
// <20>˺<EFBFBD><CBBA><EFBFBD><EFBFBD>Ƕ<EFBFBD><C7B6>̰߳<DFB3>ȫ<EFBFBD><C8AB>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6BFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>.
BOOL CBuffer::CopyBuffer(PVOID pDst, ULONG nLen, ULONG ulPos) {
EnterCriticalSection(&m_cs);
ULONG len = (ULONG)m_Ptr - (ULONG)m_Base;
ULONG len = m_Ptr - m_Base;
if (m_Base == NULL || len - ulPos < nLen)
{
LeaveCriticalSection(&m_cs);

View File

@@ -26,7 +26,7 @@ BOOL CCpuUsage::Init()
//ͳ<>Ƹ<EFBFBD><C6B8><EFBFBD>Ȥ<EFBFBD><C8A4>ϵͳ<CFB5><CDB3>Ϣʱ<CFA2><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD><EFBFBD>Ӧ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD>
PDH_STATUS pdh_status = PdhAddCounter(m_hQuery, (LPCSTR)szCounterName,
(DWORD) m_pCounterStruct, &(m_pCounterStruct->hCounter));
(DWORD_PTR) m_pCounterStruct, &(m_pCounterStruct->hCounter));
if (ERROR_SUCCESS != pdh_status)
{
return FALSE;

View File

@@ -1175,7 +1175,7 @@ BOOL CFileManagerDlg::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
TCHAR szFullText[256];
CString strTipText;
UINT nID = pNMHDR->idFrom;
UINT_PTR nID = pNMHDR->idFrom;
//<2F><><EFBFBD><EFBFBD>idFrom<6F><6D>һ<EFBFBD><D2BB><EFBFBD>Ӵ<EFBFBD><D3B4>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ID<49><44>

View File

@@ -18,7 +18,11 @@
#define uncompress(dest, destLen, source, sourceLen) LZ4_decompress_safe((const char*)source, (char*)dest, sourceLen, *(destLen))
#else
#include "zstd/zstd.h"
#ifdef _WIN64
#pragma comment(lib, "zstd/zstd_x64.lib")
#else
#pragma comment(lib, "zstd/zstd.lib")
#endif
#define Z_FAILED(p) ZSTD_isError(p)
#define Z_SUCCESS(p) (!Z_FAILED(p))
#define compress(dest, destLen, source, sourceLen) ZSTD_compress(dest, *(destLen), source, sourceLen, ZSTD_CLEVEL_DEFAULT)
@@ -482,7 +486,7 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans
ContextObject->InCompressedBuffer.ReadBuffer(CompressedBuffer, ulCompressedLength);
#if USING_COMPRESS
PBYTE DeCompressedBuffer = new BYTE[ulOriginalLength]; //<2F><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD> 436
int iRet = uncompress(DeCompressedBuffer, &ulOriginalLength, CompressedBuffer, ulCompressedLength);
size_t iRet = uncompress(DeCompressedBuffer, &ulOriginalLength, CompressedBuffer, ulCompressedLength);
#else
PBYTE DeCompressedBuffer = CompressedBuffer;
int iRet = 0;
@@ -521,7 +525,7 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans
return TRUE;
}
VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffer, ULONG ulOriginalLength)
VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffer, size_t ulOriginalLength)
{
assert (ContextObject);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD>
@@ -547,7 +551,7 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe
unsigned long ulCompressedLength = ZSTD_compressBound(ulOriginalLength);
#endif
LPBYTE CompressedBuffer = new BYTE[ulCompressedLength];
int iRet = compress(CompressedBuffer, &ulCompressedLength, (LPBYTE)szBuffer, ulOriginalLength);
size_t iRet = compress(CompressedBuffer, &ulCompressedLength, (LPBYTE)szBuffer, ulOriginalLength);
if (Z_FAILED(iRet))
{
@@ -567,7 +571,7 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe
}
OVERLAPPEDPLUS* OverlappedPlus = new OVERLAPPEDPLUS(IOWrite);
BOOL bOk = PostQueuedCompletionStatus(m_hCompletionPort, 0, (DWORD)ContextObject, &OverlappedPlus->m_ol);
BOOL bOk = PostQueuedCompletionStatus(m_hCompletionPort, 0, (ULONG_PTR)ContextObject, &OverlappedPlus->m_ol);
if ( (!bOk && GetLastError() != ERROR_IO_PENDING) ) //<2F><><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6>ʧ<EFBFBD><CAA7>
{
int a = GetLastError();
@@ -681,7 +685,7 @@ void IOCPServer::OnAccept()
ContextObject->wsaInBuf.buf = (char*)ContextObject->szBuffer;
ContextObject->wsaInBuf.len = sizeof(ContextObject->szBuffer);
HANDLE Handle = CreateIoCompletionPort((HANDLE)sClientSocket, m_hCompletionPort, (DWORD)ContextObject, 0);
HANDLE Handle = CreateIoCompletionPort((HANDLE)sClientSocket, m_hCompletionPort, (ULONG_PTR)ContextObject, 0);
if (Handle!=m_hCompletionPort)
{
@@ -719,7 +723,7 @@ void IOCPServer::OnAccept()
OVERLAPPEDPLUS *OverlappedPlus = new OVERLAPPEDPLUS(IOInitialize); //ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>IO<49><4F><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BOOL bOk = PostQueuedCompletionStatus(m_hCompletionPort, 0, (DWORD)ContextObject, &OverlappedPlus->m_ol); // <20><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
BOOL bOk = PostQueuedCompletionStatus(m_hCompletionPort, 0, (ULONG_PTR)ContextObject, &OverlappedPlus->m_ol); // <20><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
//<2F><>Ϊ<EFBFBD><CEAA><EFBFBD>ǽ<EFBFBD><C7BD>ܵ<EFBFBD><DCB5><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>Ǿͽ<C7BE><CDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD><CDB8><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD>ɶ˿<C9B6> <20><><EFBFBD><EFBFBD><EFBFBD>ǵĹ<C7B5><C4B9><EFBFBD><EFBFBD>̴߳<DFB3><CCB4><EFBFBD><EFBFBD><EFBFBD>
if ( (!bOk && GetLastError() != ERROR_IO_PENDING)) //<2F><><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6>ʧ<EFBFBD><CAA7>
{

View File

@@ -112,7 +112,7 @@ public:
BOOL HandleIO(IOType PacketFlags,PCONTEXT_OBJECT ContextObject, DWORD dwTrans);
BOOL OnClientInitializing(PCONTEXT_OBJECT ContextObject, DWORD dwTrans);
BOOL OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans);
VOID OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffer , ULONG ulOriginalLength);
VOID OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffer , size_t ulOriginalLength);
BOOL OnClientPostSending(CONTEXT_OBJECT* ContextObject,ULONG ulCompressedLength);
void UpdateMaxConnection(int maxConn);
IOCPServer(void);

View File

@@ -132,7 +132,7 @@ WORD* CDlgTemplateBuilder::AddText(WORD* buf, LPCTSTR text)
// Create string dialog. If no icon specified, use IDI_QUESTION. Note that
// the order in which the controls are added is the TAB order.
//
BOOL CInputDialog::Init(LPCTSTR caption, LPCTSTR prompt, CWnd* pParent, WORD nIDIcon)
BOOL CInputDialog::Init(LPCTSTR caption, LPCTSTR prompt, CWnd* pParent, INT_PTR nIDIcon)
{
const int CXDIALOG = 200; // dialog width
const int DLGMARGIN = 7; // margins all around
@@ -155,7 +155,7 @@ BOOL CInputDialog::Init(LPCTSTR caption, LPCTSTR prompt, CWnd* pParent, WORD nID
// create icon if needed
if (nIDIcon) {
if (nIDIcon >= (WORD)IDI_APPLICATION) {
if (nIDIcon >= (INT_PTR)IDI_APPLICATION) {
// if using a system icon, I load it here and set it in OnInitDialog
// because can't specify system icon in template, only icons from
// application resource file.

View File

@@ -66,7 +66,7 @@ public:
// Call this to create the template with given caption and prompt.
BOOL Init(LPCTSTR caption, LPCTSTR prompt, CWnd* pParent=NULL,
WORD nIDIcon=(WORD)IDI_QUESTION);
INT_PTR nIDIcon=(INT_PTR)IDI_QUESTION);
protected:
CDlgTemplateBuilder m_dtb; // place to build/hold the dialog template

View File

@@ -293,8 +293,8 @@ void CRegisterDlg::AddKey(char* szBuffer)
{
// <20><>ע<EFBFBD><D7A2><EFBFBD><EFBFBD> REG_DWORD <20><><EFBFBD>͵Ĵ<CDB5><C4B4><EFBFBD>
char ValueDate[256] = {0};
DWORD d=(DWORD)szValueDate;
memcpy((void*)&d,szValueDate,sizeof(DWORD));
INT_PTR d=(INT_PTR)szValueDate;
memcpy((void*)&d,szValueDate,sizeof(INT_PTR));
CString strValue;
strValue.Format("0x%x",d);
sprintf(ValueDate," (%d)",d);