[DLLS] Fix 64 bit issues

This commit is contained in:
Timo Kreuzer 2018-04-23 11:42:32 +02:00
parent 6f13066647
commit 0f8439aa71
23 changed files with 88 additions and 81 deletions

View file

@ -567,7 +567,7 @@ GetProfile(
L"PreferenceOrder",
NULL,
NULL,
(LPBYTE)pProfile->dwPreferenceOrder,
(LPBYTE)&pProfile->dwPreferenceOrder,
&dwSize);
if (lError == ERROR_SUCCESS)
{

View file

@ -20,8 +20,8 @@ KsiCreateObjectType( HANDLE hHandle,
PHANDLE phHandle)
{
NTSTATUS Status;
ULONG Length;
ULONG TotalSize;
SIZE_T Length;
SIZE_T TotalSize;
LPWSTR pStr;
UNICODE_STRING ObjectName;
OBJECT_ATTRIBUTES ObjectAttributes;

View file

@ -557,7 +557,7 @@ HRESULT dxbc_add_section(struct dxbc *dxbc, DWORD tag, const char *data, DWORD d
return S_OK;
}
HRESULT dxbc_init(struct dxbc *dxbc, UINT size)
HRESULT dxbc_init(struct dxbc *dxbc, DWORD size)
{
TRACE("dxbc %p, size %u.\n", dxbc, size);

View file

@ -124,7 +124,7 @@ LdrUnlockLoaderLock(IN ULONG Flags,
/* Validate the cookie */
if ((Cookie & 0xF0000000) ||
((Cookie >> 16) ^ ((ULONG)(NtCurrentTeb()->RealClientId.UniqueThread) & 0xFFF)))
((Cookie >> 16) ^ (HandleToUlong(NtCurrentTeb()->RealClientId.UniqueThread) & 0xFFF)))
{
DPRINT1("LdrUnlockLoaderLock() called with an invalid cookie!\n");

View file

@ -136,7 +136,7 @@ LdrOpenImageFileOptionsKey(IN PUNICODE_STRING SubKey,
if (NT_SUCCESS(Status))
{
/* Write the key handle */
if (_InterlockedCompareExchange((LONG*)RootKeyLocation, (LONG)RootKey, 0) != 0)
if (InterlockedCompareExchangePointer(RootKeyLocation, RootKey, NULL) != NULL)
{
/* Someone already opened it, use it instead */
NtClose(RootKey);
@ -460,8 +460,8 @@ LdrpInitSecurityCookie(PLDR_DATA_TABLE_ENTRY LdrEntry)
NtQueryPerformanceCounter(&Counter, NULL);
NewCookie = Counter.LowPart ^ Counter.HighPart;
NewCookie ^= (ULONG)NtCurrentTeb()->ClientId.UniqueProcess;
NewCookie ^= (ULONG)NtCurrentTeb()->ClientId.UniqueThread;
NewCookie ^= (ULONG_PTR)NtCurrentTeb()->ClientId.UniqueProcess;
NewCookie ^= (ULONG_PTR)NtCurrentTeb()->ClientId.UniqueThread;
/* Loop like it's done in KeQueryTickCount(). We don't want to call it directly. */
while (SharedUserData->SystemTime.High1Time != SharedUserData->SystemTime.High2Time)

View file

@ -176,7 +176,7 @@ static LPITEMIDLIST _ILReadFromSharedMemory(PCWSTR strField)
if (*strField != L':')
return NULL;
HANDLE hData = (HANDLE) StrToIntW(strField + 1);
HANDLE hData = IntToPtr(StrToIntW(strField + 1));
PWSTR strSecond = StrChrW(strField + 1, L':');
if (strSecond)
@ -246,7 +246,7 @@ SHExplorerParseCmdLine(ExplorerCommandLineParseResults * pInfo)
PathStripToRootW(strDir);
pInfo->pidlPath = ILCreateFromPathW(strDir);
}
return (LONG) (pInfo->pidlPath);
return (LONG_PTR)(pInfo->pidlPath);
}
PCWSTR strNextArg = _FindFirstField(strFieldArray);

View file

@ -74,8 +74,8 @@ FilterLoadUnload(_In_z_ LPCWSTR lpFilterName,
{
PFILTER_NAME FilterName;
HANDLE hFltMgr;
DWORD StringLength;
DWORD BufferLength;
SIZE_T StringLength;
SIZE_T BufferLength;
DWORD dwError;
/* Get a handle to the filter manager */

View file

@ -35,8 +35,8 @@ FilterConnectCommunicationPort(_In_ LPCWSTR lpPortName,
UNICODE_STRING DeviceName;
UNICODE_STRING PortName;
HANDLE FileHandle;
ULONG PortNameSize;
ULONG BufferSize;
SIZE_T PortNameSize;
SIZE_T BufferSize;
PCHAR Ptr;
NTSTATUS Status;
HRESULT hr;

View file

@ -62,8 +62,8 @@ NTSTATUS tdiGetMibForIfEntity
NTSTATUS status = STATUS_SUCCESS;
DWORD returnSize;
WARN("TdiGetMibForIfEntity(tcpFile %x,entityId %x)\n",
(int)tcpFile, (int)ent->tei_instance);
WARN("TdiGetMibForIfEntity(tcpFile %p,entityId %p)\n",
tcpFile, ent->tei_instance);
req.ID.toi_class = INFO_CLASS_PROTOCOL;
req.ID.toi_type = INFO_TYPE_PROVIDER;

View file

@ -447,7 +447,7 @@ OpenFile(LPCSTR lpFileName,
default:
Sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
}
return (HFILE) CreateFileA (lpFileName,
return (HFILE)(ULONG_PTR) CreateFileA (lpFileName,
GENERIC_READ | GENERIC_WRITE,
Sharing,
NULL,
@ -476,7 +476,7 @@ OpenFile(LPCSTR lpFileName,
if (Len == 0 || Len > OFS_MAXPATHNAME)
{
lpReOpenBuff->nErrCode = (WORD)GetLastError();
return (HFILE)INVALID_HANDLE_VALUE;
return HFILE_ERROR;
}
if (uStyle & OF_DELETE)
@ -507,7 +507,7 @@ OpenFile(LPCSTR lpFileName,
NULL,
NULL))
{
return (HFILE)INVALID_HANDLE_VALUE;
return HFILE_ERROR;
}
// FILE_SHARE_READ
@ -534,7 +534,7 @@ OpenFile(LPCSTR lpFileName,
if (!NT_SUCCESS(errCode))
{
BaseSetLastNTError (errCode);
return (HFILE)INVALID_HANDLE_VALUE;
return HFILE_ERROR;
}
if (uStyle & OF_EXIST)
@ -543,7 +543,7 @@ OpenFile(LPCSTR lpFileName,
return (HFILE)1;
}
return (HFILE)FileHandle;
return (HFILE)(ULONG_PTR)FileHandle;
}
/*

View file

@ -44,7 +44,7 @@ _hwrite(HFILE hFile, LPCSTR lpBuffer, long lBytes)
if (lBytes == 0)
{
if (!SetEndOfFile((HANDLE) hFile))
if (!SetEndOfFile((HANDLE)(ULONG_PTR) hFile))
{
return HFILE_ERROR;
}
@ -98,7 +98,7 @@ _lopen(LPCSTR lpPathName, int iReadWrite)
default: dwSharing = FILE_SHARE_READ | FILE_SHARE_WRITE; break;
}
return (HFILE) CreateFileA(lpPathName,
return (HFILE)(ULONG_PTR) CreateFileA(lpPathName,
dwAccess,
dwSharing,
NULL,

View file

@ -176,6 +176,7 @@ CreateRemoteThread(IN HANDLE hProcess,
ACTIVATION_CONTEXT_BASIC_INFORMATION ActCtxInfo;
ULONG_PTR Cookie;
ULONG ReturnLength;
SIZE_T ReturnSize;
DPRINT("CreateRemoteThread: hProcess: %p dwStackSize: %lu lpStartAddress"
": %p lpParameter: %p, dwCreationFlags: %lx\n", hProcess,
dwStackSize, lpStartAddress, lpParameter, dwCreationFlags);
@ -267,7 +268,7 @@ CreateRemoteThread(IN HANDLE hProcess,
ActivationContextBasicInformation,
&ActCtxInfo,
sizeof(ActCtxInfo),
&ReturnLength);
&ReturnSize);
if (!NT_SUCCESS(Status))
{
/* Fail */

View file

@ -386,7 +386,7 @@ LsapAllocateClientBuffer(IN PLSA_CLIENT_REQUEST ClientRequest,
OUT PVOID *ClientBaseAddress)
{
PLSAP_LOGON_CONTEXT LogonContext;
ULONG Length;
SIZE_T Length;
*ClientBaseAddress = NULL;
@ -409,7 +409,7 @@ LsapFreeClientBuffer(IN PLSA_CLIENT_REQUEST ClientRequest,
IN PVOID ClientBaseAddress)
{
PLSAP_LOGON_CONTEXT LogonContext;
ULONG Length;
SIZE_T Length;
if (ClientBaseAddress == NULL)
return STATUS_SUCCESS;

View file

@ -258,7 +258,8 @@ LsapEnumLogonSessions(IN OUT PLSA_API_MSG RequestMsg)
PLIST_ENTRY SessionEntry;
PLSAP_LOGON_SESSION CurrentSession;
PLUID SessionList;
ULONG i, Length, MemSize;
ULONG i, Length;
SIZE_T MemSize;
PVOID ClientBaseAddress = NULL;
NTSTATUS Status;
@ -353,7 +354,8 @@ LsapGetLogonSessionData(IN OUT PLSA_API_MSG RequestMsg)
PLSAP_LOGON_SESSION Session;
PSECURITY_LOGON_SESSION_DATA LocalSessionData;
PVOID ClientBaseAddress = NULL;
ULONG TotalLength, MemSize, SidLength = 0;
ULONG TotalLength, SidLength = 0;
SIZE_T MemSize;
PUCHAR Ptr;
NTSTATUS Status;

View file

@ -75,17 +75,17 @@ WSPSocket(int AddressFamily,
if (lpProtocolInfo && lpProtocolInfo->dwServiceFlags3 != 0 && lpProtocolInfo->dwServiceFlags4 != 0)
{
/* Duplpicating socket from different process */
if ((HANDLE)lpProtocolInfo->dwServiceFlags3 == INVALID_HANDLE_VALUE)
if (UlongToPtr(lpProtocolInfo->dwServiceFlags3) == INVALID_HANDLE_VALUE)
{
Status = WSAEINVAL;
goto error;
}
if ((HANDLE)lpProtocolInfo->dwServiceFlags4 == INVALID_HANDLE_VALUE)
if (UlongToPtr(lpProtocolInfo->dwServiceFlags4) == INVALID_HANDLE_VALUE)
{
Status = WSAEINVAL;
goto error;
}
SharedData = MapViewOfFile((HANDLE)lpProtocolInfo->dwServiceFlags3,
SharedData = MapViewOfFile(UlongToPtr(lpProtocolInfo->dwServiceFlags3),
FILE_MAP_ALL_ACCESS,
0,
0,
@ -183,8 +183,8 @@ WSPSocket(int AddressFamily,
if (SharedData)
{
Socket->SharedData = SharedData;
Socket->SharedDataHandle = (HANDLE)lpProtocolInfo->dwServiceFlags3;
Sock = (HANDLE)lpProtocolInfo->dwServiceFlags4;
Socket->SharedDataHandle = UlongToHandle(lpProtocolInfo->dwServiceFlags3);
Sock = UlongToHandle(lpProtocolInfo->dwServiceFlags4);
Socket->Handle = (SOCKET)lpProtocolInfo->dwServiceFlags4;
}
else
@ -422,7 +422,7 @@ error:
if( SharedData )
{
UnmapViewOfFile(SharedData);
NtClose((HANDLE)lpProtocolInfo->dwServiceFlags3);
NtClose(UlongToHandle(lpProtocolInfo->dwServiceFlags3));
}
else
{
@ -523,8 +523,8 @@ WSPDuplicateSocket(
lpProtocolInfo->iAddressFamily = Socket->SharedData->AddressFamily;
lpProtocolInfo->iProtocol = Socket->SharedData->Protocol;
lpProtocolInfo->iSocketType = Socket->SharedData->SocketType;
lpProtocolInfo->dwServiceFlags3 = (DWORD)hDuplicatedSharedData;
lpProtocolInfo->dwServiceFlags4 = (DWORD)hDuplicatedHandle;
lpProtocolInfo->dwServiceFlags3 = HandleToUlong(hDuplicatedSharedData);
lpProtocolInfo->dwServiceFlags4 = HandleToUlong(hDuplicatedHandle);
if( lpErrno )
*lpErrno = NO_ERROR;
@ -903,7 +903,7 @@ WSPBind(SOCKET Handle,
/* Set up Address in TDI Format */
BindData->Address.TAAddressCount = 1;
BindData->Address.Address[0].AddressLength = SocketAddressLength - sizeof(SocketAddress->sa_family);
BindData->Address.Address[0].AddressLength = (USHORT)(SocketAddressLength - sizeof(SocketAddress->sa_family));
BindData->Address.Address[0].AddressType = SocketAddress->sa_family;
RtlCopyMemory (BindData->Address.Address[0].Address,
SocketAddress->sa_data,
@ -1427,14 +1427,16 @@ GetCurrentTimeInSeconds(VOID)
return (DWORD)((Time.ll - u1970.ll) / 10000000ULL);
}
_Must_inspect_result_
SOCKET
WSPAPI
WSPAccept(SOCKET Handle,
struct sockaddr *SocketAddress,
int *SocketAddressLength,
LPCONDITIONPROC lpfnCondition,
DWORD dwCallbackData,
LPINT lpErrno)
WSPAccept(
_In_ SOCKET Handle,
_Out_writes_bytes_to_opt_(*addrlen, *addrlen) struct sockaddr FAR *SocketAddress,
_Inout_opt_ LPINT SocketAddressLength,
_In_opt_ LPCONDITIONPROC lpfnCondition,
_In_opt_ DWORD_PTR dwCallbackData,
_Out_ LPINT lpErrno)
{
IO_STATUS_BLOCK IOSB;
PAFD_RECEIVED_ACCEPT_DATA ListenReceiveData;
@ -2885,14 +2887,15 @@ SendToHelper:
* RETURNS:
* Status of operation
*/
INT
_Must_inspect_result_
int
WSPAPI
WSPStartup(IN WORD wVersionRequested,
OUT LPWSPDATA lpWSPData,
IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
IN WSPUPCALLTABLE UpcallTable,
OUT LPWSPPROC_TABLE lpProcTable)
WSPStartup(
_In_ WORD wVersionRequested,
_In_ LPWSPDATA lpWSPData,
_In_ LPWSAPROTOCOL_INFOW lpProtocolInfo,
_In_ WSPUPCALLTABLE UpcallTable,
_Out_ LPWSPPROC_TABLE lpProcTable)
{
NTSTATUS Status;
@ -2959,7 +2962,7 @@ WSPAddressToString(IN LPSOCKADDR lpsaAddress,
IN OUT LPDWORD lpdwAddressStringLength,
OUT LPINT lpErrno)
{
DWORD size;
SIZE_T size;
WCHAR buffer[54]; /* 32 digits + 7':' + '[' + '%" + 5 digits + ']:' + 5 digits + '\0' */
WCHAR *p;

View file

@ -140,15 +140,16 @@ typedef struct _AFDAPCCONTEXT
PSOCKET_INFORMATION lpSocket;
} AFDAPCCONTEXT, *PAFDAPCCONTEXT;
_Must_inspect_result_
SOCKET
WSPAPI
WSPAccept(
IN SOCKET s,
OUT LPSOCKADDR addr,
IN OUT LPINT addrlen,
IN LPCONDITIONPROC lpfnCondition,
IN DWORD dwCallbackData,
OUT LPINT lpErrno);
_In_ SOCKET s,
_Out_writes_bytes_to_opt_(*addrlen, *addrlen) struct sockaddr FAR * addr,
_Inout_opt_ LPINT addrlen,
_In_opt_ LPCONDITIONPROC lpfnCondition,
_In_opt_ DWORD_PTR dwCallbackData,
_Out_ LPINT lpErrno);
INT
WSPAPI

View file

@ -398,7 +398,7 @@ ShutdownOnOk(
}
}
static BOOL
static INT_PTR
CALLBACK
ShutdownDialogProc(
HWND hDlg,

View file

@ -108,7 +108,7 @@ mswBufferAppendLst(_Inout_ PMSW_BUFFER mswBuf,
{
DWORD lstItemCount;
DWORD lstByteSize;
DWORD lstDataPos;
DWORD_PTR lstDataPos;
DWORD i1;
UINT_PTR *ptrSrcLstPos;
@ -129,7 +129,7 @@ mswBufferAppendLst(_Inout_ PMSW_BUFFER mswBuf,
/* calculate position for the data of the first item */
lstDataPos = ((lstItemCount + 1) * sizeof(UINT_PTR)) +
(DWORD)mswBufferEndPtr(mswBuf);
(DWORD_PTR)mswBufferEndPtr(mswBuf);
/* add ptrofs */
lstDataPos += ptrofs;
@ -164,7 +164,7 @@ mswBufferAppendStrLstA(_Inout_ PMSW_BUFFER mswBuf,
DWORD lstItemLen[MAX_ARRAY_SIZE];
DWORD lstItemCount;
DWORD lstByteSize;
DWORD lstDataPos;
DWORD_PTR lstDataPos;
DWORD lstDataSize;
DWORD i1;
UINT_PTR *ptrSrcLstPos;
@ -194,7 +194,7 @@ mswBufferAppendStrLstA(_Inout_ PMSW_BUFFER mswBuf,
/* calculate position for the data of the first item */
lstDataPos = ((lstItemCount + 1) * sizeof(UINT_PTR)) +
(DWORD)mswBufferEndPtr(mswBuf);
(DWORD_PTR)mswBufferEndPtr(mswBuf);
/* add ptrofs */
lstDataPos += ptrofs;
@ -261,7 +261,7 @@ mswBufferAppendBlob_Hostent(_Inout_ PMSW_BUFFER mswBuf,
{
if (!mswBufferAppendStrLstA(mswBuf,
(void**)hostAliasesA,
-(DWORD)bytesOfs))
-(LONG_PTR)bytesOfs))
return FALSE;
}
else
@ -277,7 +277,7 @@ mswBufferAppendBlob_Hostent(_Inout_ PMSW_BUFFER mswBuf,
phe->h_addr_list = (char**)(mswBufferEndPtr(mswBuf) - bytesOfs);
if (!mswBufferAppendLst(mswBuf, lst, 4, -(DWORD)bytesOfs))
if (!mswBufferAppendLst(mswBuf, lst, 4, -(LONG_PTR)bytesOfs))
return FALSE;
/* name */
@ -323,7 +323,7 @@ mswBufferAppendBlob_Servent(_Inout_ PMSW_BUFFER mswBuf,
{
if (!mswBufferAppendStrLstA(mswBuf,
(void**)serviceAliasesA,
-(DWORD)bytesOfs))
-(LONG_PTR)bytesOfs))
return FALSE;
}
else
@ -484,8 +484,8 @@ WCHAR*
StrCpyHeapAllocW(_In_opt_ HANDLE hHeap,
_In_ WCHAR* wStr)
{
int chLen;
int bLen;
size_t chLen;
size_t bLen;
WCHAR* resW;
if (wStr == NULL)
@ -507,8 +507,8 @@ char*
StrCpyHeapAllocA(_In_opt_ HANDLE hHeap,
_In_ char* aStr)
{
int chLen;
int bLen;
size_t chLen;
size_t bLen;
char* resA;
if (aStr == NULL)
@ -534,8 +534,8 @@ StrAryCpyHeapAllocA(_In_opt_ HANDLE hHeap,
char** aDstPtr;
char* aDstNextStr;
DWORD aStrByteLen[MAX_ARRAY_SIZE];
int bLen;
int bItmLen;
size_t bLen;
size_t bItmLen;
int aCount;
int i1;
char** resA;
@ -581,7 +581,7 @@ StrAryCpyHeapAllocA(_In_opt_ HANDLE hHeap,
*aDstPtr = aDstNextStr;
RtlCopyMemory(*aDstPtr, *aSrcPtr, bItmLen);
aDstNextStr = (char*)((DWORD)aDstNextStr + (DWORD)bItmLen);
aDstNextStr = (char*)((DWORD_PTR)aDstNextStr + (DWORD)bItmLen);
aDstPtr++;
aSrcPtr++;
}
@ -671,7 +671,7 @@ StrAryCpyHeapAllocWToA(_In_opt_ HANDLE hHeap,
RtlCopyMemory(*aDstPtr, aStr, bItmLen);
HeapFree(hHeap, 0, aStr);
aDstNextStr = (char*)((DWORD)aDstNextStr + (DWORD)bItmLen);
aDstNextStr = (char*)((DWORD_PTR)aDstNextStr + (DWORD)bItmLen);
aDstPtr++;
wSrcPtr++;
}

View file

@ -506,7 +506,7 @@ EnumProcesses(DWORD *lpidProcess,
*/
if (Count < cb / sizeof(DWORD))
{
lpidProcess[Count] = (DWORD)ProcInfo->UniqueProcessId;
lpidProcess[Count] = HandleToUlong(ProcInfo->UniqueProcessId);
Count++;
}
@ -840,7 +840,7 @@ GetMappedFileNameW(HANDLE hProcess,
DWORD nSize)
{
DWORD Len;
DWORD OutSize;
SIZE_T OutSize;
NTSTATUS Status;
struct
{

View file

@ -188,7 +188,7 @@ static void pSaveImageAs(HWND hwnd)
GUID rawFormat;
UINT num;
UINT size;
UINT sizeRemain;
size_t sizeRemain;
UINT j;
WCHAR *c;

View file

@ -68,10 +68,10 @@ UserGetWindowIcon(PDRAW_CONTEXT pcontext)
SendMessageTimeout(pcontext->hWnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon);
if (!hIcon)
hIcon = (HICON)GetClassLong(pcontext->hWnd, GCL_HICONSM);
hIcon = (HICON)GetClassLongPtr(pcontext->hWnd, GCLP_HICONSM);
if (!hIcon)
hIcon = (HICON)GetClassLong(pcontext->hWnd, GCL_HICON);
hIcon = (HICON)GetClassLongPtr(pcontext->hWnd, GCLP_HICON);
// See also win32ss/user/ntuser/nonclient.c!NC_IconForWindow
if (!hIcon && !(pcontext->wi.dwExStyle & WS_EX_DLGMODALFRAME))

View file

@ -95,7 +95,7 @@ BOOL AllocAndGetEntityArray(
*idCount = (outBufLenNeeded / sizeof(TDIEntityID));
*ppEntities = (TDIEntityID*)outBuf;
DPRINT("TcpFile %lx\n", (DWORD)TcpFile);
DPRINT("TcpFile %p\n", TcpFile);
DPRINT("idCount %lx\n", *idCount);// 0x24;
@ -247,7 +247,7 @@ WSHIoctl_GetInterfaceList(
goto cleanup;
}
DPRINT("TcpFile %lx\n",(DWORD)TcpFile);
DPRINT("TcpFile %p\n", TcpFile);
if (!AllocAndGetEntityArray(TcpFile,hHeap,&outEntityID,&outIDCount))
{

View file

@ -136,7 +136,7 @@ typedef struct tagENHMETAFILE
#define UMPDEV_SUPPORT_ESCAPE 0x0004
typedef struct _UMPDEV
{
DWORD_PTR Sig; // Init with PDEV_UMPD_ID
DWORD_PTR Sig; // Init with PDEV_UMPD_ID
struct _UMPDEV *pumpdNext;
PDRIVER_INFO_5W pdi5Info;
HMODULE hModule;