[APPLICATIONS] Fix 64 bit issues

This commit is contained in:
Timo Kreuzer 2018-03-04 16:12:18 +01:00
parent 807331436e
commit 6f13066647
16 changed files with 31 additions and 28 deletions

View file

@ -17,9 +17,9 @@
int _tmain(int argc, TCHAR ** argv) int _tmain(int argc, TCHAR ** argv)
{ {
TCHAR * buf; TCHAR * buf;
int bufsize; size_t bufsize;
int i; int i;
int offset; size_t offset;
bufsize = 0; bufsize = 0;
for(i = 1; i < argc; i++) for(i = 1; i < argc; i++)
@ -106,7 +106,7 @@ int _tmain(int argc, TCHAR ** argv)
offset = 0; offset = 0;
for(i = 1; i < argc; i++) for(i = 1; i < argc; i++)
{ {
int length = _tcslen(argv[i]); size_t length = _tcslen(argv[i]);
_tcsncpy(&buf[offset], argv[i], length); _tcsncpy(&buf[offset], argv[i], length);
offset += length; offset += length;
if (i + 1 < argc) if (i + 1 < argc)

View file

@ -285,7 +285,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR cmdLine, INT)
{ {
if (n + 1 < argc) if (n + 1 < argc)
{ {
data.Event = (HANDLE)wcstoul(argv[n+1], NULL, 10); data.Event = (HANDLE)(ULONG_PTR)_wcstoui64(argv[n+1], NULL, 10);
n++; n++;
} }
} }

View file

@ -97,7 +97,7 @@ CreateNewMDIChild(PCONSOLE_MAINFRAME_WND Info,
mcs.y = mcs.cy = CW_USEDEFAULT; mcs.y = mcs.cy = CW_USEDEFAULT;
mcs.style = MDIS_ALLCHILDSTYLES; mcs.style = MDIS_ALLCHILDSTYLES;
hChild = (HWND)SendMessage(hwndMDIClient, WM_MDICREATE, 0, (LONG)&mcs); hChild = (HWND)SendMessage(hwndMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs);
if (hChild) if (hChild)
{ {
Info->nConsoleCount++; Info->nConsoleCount++;

View file

@ -963,8 +963,8 @@ BuildFileFilterAndDeviceMenu(VOID)
DWORD dwPosition = 0; DWORD dwPosition = 0;
DWORD i; DWORD i;
DWORD j; DWORD j;
UINT uSizeRemain; size_t uSizeRemain;
UINT uMaskRemain; size_t uMaskRemain;
HKEY hKey = NULL; HKEY hKey = NULL;
/* Always load the default (all files) filter */ /* Always load the default (all files) filter */

View file

@ -142,10 +142,12 @@ RunCommand(IN LPCWSTR lpszCommand,
lpszExpandedCommand = (LPWSTR)MemAlloc(0, dwNumOfChars * sizeof(WCHAR)); lpszExpandedCommand = (LPWSTR)MemAlloc(0, dwNumOfChars * sizeof(WCHAR));
ExpandEnvironmentStringsW(lpszCommand, lpszExpandedCommand, dwNumOfChars); ExpandEnvironmentStringsW(lpszCommand, lpszExpandedCommand, dwNumOfChars);
dwRes = (DWORD)ShellExecuteW(NULL, NULL /* and not L"open" !! */, dwRes = (DWORD_PTR)ShellExecuteW(NULL,
lpszExpandedCommand, NULL /* and not L"open" !! */,
lpszParameters, lpszExpandedCommand,
NULL, nShowCmd); lpszParameters,
NULL,
nShowCmd);
MemFree(lpszExpandedCommand); MemFree(lpszExpandedCommand);
return dwRes; return dwRes;

View file

@ -29,7 +29,7 @@ EnumerateUsers(VOID)
PSERVER_INFO_100 pServer = NULL; PSERVER_INFO_100 pServer = NULL;
DWORD dwRead = 0, dwTotal = 0; DWORD dwRead = 0, dwTotal = 0;
DWORD i; DWORD i;
DWORD_PTR ResumeHandle = 0; DWORD ResumeHandle = 0;
NET_API_STATUS Status; NET_API_STATUS Status;
Status = NetServerGetInfo(NULL, Status = NetServerGetInfo(NULL,

View file

@ -348,7 +348,7 @@ public:
return FALSE; return FALSE;
} }
ImageList_Destroy((HIMAGELIST) SetImageList(hImageList)); ImageList_Destroy(SetImageList(hImageList));
AddButtons(_countof(Buttons), Buttons); AddButtons(_countof(Buttons), Buttons);

View file

@ -6,10 +6,10 @@ class CRichEdit :
{ {
HMODULE m_LoadedLibrary; HMODULE m_LoadedLibrary;
VOID GenericInsertText(LPCWSTR lpszText, LONG InsertedTextLen, DWORD dwEffects) VOID GenericInsertText(LPCWSTR lpszText, SIZE_T InsertedTextLen, DWORD dwEffects)
{ {
SETTEXTEX SetText; SETTEXTEX SetText;
LONG Len = GetTextLen(); SIZE_T Len = GetTextLen();
if (InsertedTextLen) if (InsertedTextLen)
{ {
@ -34,7 +34,7 @@ class CRichEdit :
public: public:
CRichEdit() : CWindow(), m_LoadedLibrary(NULL) {} CRichEdit() : CWindow(), m_LoadedLibrary(NULL) {}
VOID SetRangeFormatting(LONG Start, LONG End, DWORD dwEffects) VOID SetRangeFormatting(SIZE_T Start, SIZE_T End, DWORD dwEffects)
{ {
CHARFORMAT2W CharFormat; CHARFORMAT2W CharFormat;

View file

@ -47,7 +47,7 @@ public:
virtual INT OnCompareItems(T * p1, T * p2) virtual INT OnCompareItems(T * p1, T * p2)
{ {
INT t = (reinterpret_cast<INT>(p2) - reinterpret_cast<INT>(p1)); INT_PTR t = (reinterpret_cast<INT_PTR>(p2) - reinterpret_cast<INT_PTR>(p1));
if (t > 0) if (t > 0)
return 1; return 1;
if (t < 0) if (t < 0)

View file

@ -190,11 +190,12 @@ public:
Item = GetDlgItem(m_hDialog, IDC_DOWNLOAD_STATUS); Item = GetDlgItem(m_hDialog, IDC_DOWNLOAD_STATUS);
if (Item && szStatusText && wcslen(szStatusText) > 0 && m_UrlHasBeenCopied == FALSE) if (Item && szStatusText && wcslen(szStatusText) > 0 && m_UrlHasBeenCopied == FALSE)
{ {
DWORD len = wcslen(szStatusText) + 1; SIZE_T len = wcslen(szStatusText) + 1;
ATL::CStringW buf; ATL::CStringW buf;
DWORD dummyLen;
/* beautify our url for display purposes */ /* beautify our url for display purposes */
if (!InternetCanonicalizeUrlW(szStatusText, buf.GetBuffer(len), &len, ICU_DECODE | ICU_NO_ENCODE)) if (!InternetCanonicalizeUrlW(szStatusText, buf.GetBuffer(len), &dummyLen, ICU_DECODE | ICU_NO_ENCODE))
{ {
/* just use the original */ /* just use the original */
buf.ReleaseBuffer(); buf.ReleaseBuffer();
@ -405,8 +406,8 @@ INT_PTR CALLBACK CDownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM w
HICON hIconSm, hIconBg; HICON hIconSm, hIconBg;
ATL::CStringW szTempCaption; ATL::CStringW szTempCaption;
hIconBg = (HICON) GetClassLongW(hMainWnd, GCLP_HICON); hIconBg = (HICON) GetClassLongPtrW(hMainWnd, GCLP_HICON);
hIconSm = (HICON) GetClassLongW(hMainWnd, GCLP_HICONSM); hIconSm = (HICON) GetClassLongPtrW(hMainWnd, GCLP_HICONSM);
if (hIconBg && hIconSm) if (hIconBg && hIconSm)
{ {

View file

@ -17,7 +17,7 @@ BOOL QueryConfig(LPCTSTR ServiceName)
DWORD cbBytesNeeded = 0; DWORD cbBytesNeeded = 0;
LPQUERY_SERVICE_CONFIG pServiceConfig = NULL; LPQUERY_SERVICE_CONFIG pServiceConfig = NULL;
LPWSTR lpPtr; LPWSTR lpPtr;
INT nLen, i; SSIZE_T nLen, i;
#ifdef SCDBG #ifdef SCDBG
_tprintf(_T("service to show configuration - %s\n\n"), ServiceName); _tprintf(_T("service to show configuration - %s\n\n"), ServiceName);

View file

@ -169,7 +169,7 @@ ParseFailureActions(
SC_ACTION *pActions = NULL; SC_ACTION *pActions = NULL;
LPTSTR pStringBuffer = NULL; LPTSTR pStringBuffer = NULL;
LPTSTR p; LPTSTR p;
INT nLength; INT_PTR nLength;
INT nCount = 0; INT nCount = 0;
*pcActions = 0; *pcActions = 0;

View file

@ -8,7 +8,7 @@
#include "precomp.h" #include "precomp.h"
BOOL CALLBACK ShutdownGuiProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) INT_PTR CALLBACK ShutdownGuiProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{ {
switch(msg) switch(msg)
{ {

View file

@ -484,7 +484,7 @@ WndProc(HWND hWnd,
BUTTONS_W, BUTTONS_W,
BUTTONS_H, BUTTONS_H,
hWnd, hWnd,
(HMENU)i, (HMENU)UlongToPtr(i),
hInst, hInst,
0); 0);
if (!buttons[i]) if (!buttons[i])

View file

@ -157,7 +157,7 @@ AddDialogControl(
rect.right - rect.left, rect.right - rect.left,
rect.bottom - rect.top, rect.bottom - rect.top,
hwndDialog, hwndDialog,
(HMENU)(wID), UlongToPtr(wID),
hAppInstance, hAppInstance,
NULL); NULL);

View file

@ -395,9 +395,9 @@ public: // Layout management methods
} }
public: // Image list management methods public: // Image list management methods
DWORD SetImageList(HIMAGELIST himl) HIMAGELIST SetImageList(HIMAGELIST himl)
{ {
return SendMessageW(TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(himl)); return (HIMAGELIST)SendMessageW(TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(himl));
} }
public: // Other methods public: // Other methods