[PSDK][REACTOS] Fix definitions and usage of DWLP_MSGRESULT, DWLP_DLGPROC, and DWLP_USER

- Make sure the DWLP_* values are correct on _WIN64
- Don't use the DWL_* constants, they are not portable. Enforce this by removing them entirely from winuser.h
- Make sure Get/SetWindowLong*Ptr* is used and pointers are not truncated to LONG
This commit is contained in:
Timo Kreuzer 2018-02-27 22:48:32 +01:00
parent 6cdd1357d6
commit 0182dcd71b
35 changed files with 142 additions and 131 deletions

View file

@ -102,7 +102,7 @@ int DesktopSettingsDlg::Notify(int id, NMHDR* pnmh)
{
switch(pnmh->code) {
case PSN_QUERYINITIALFOCUS:
SetWindowLongPtr(_hwnd, DWL_MSGRESULT, (LPARAM)GetDlgItem(_hwnd, IDC_ICON_ALIGN_0+_alignment_cur));
SetWindowLongPtr(_hwnd, DWLP_MSGRESULT, (LPARAM)GetDlgItem(_hwnd, IDC_ICON_ALIGN_0+_alignment_cur));
break;
case PSN_APPLY:

View file

@ -288,12 +288,12 @@ void DestroyMatrix(MATRIX *matrix)
MATRIX *GetMatrix(HWND hwnd)
{
return (MATRIX *)GetWindowLong(hwnd, 0);
return (MATRIX *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
}
void SetMatrix(HWND hwnd, MATRIX *matrix)
{
SetWindowLong(hwnd, 0, (LONG)matrix);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)matrix);
}
//

View file

@ -10,6 +10,10 @@
#ifndef _VFDLIB_H_
#define _VFDLIB_H_
#ifdef __REACTOS__
#define DWL_USER DWLP_USER
#endif
#define VFD_LIBRARY_FILENAME "vfd.dll"
#ifdef VFD_EMBED_DRIVER

View file

@ -35,7 +35,11 @@
//
// local functions
//
#ifndef __REACTOS__
static BOOL CALLBACK VfdPageDlgProc(
#else
static INT_PTR CALLBACK VfdPageDlgProc(
#endif
HWND hDlg,
UINT uMessage,
WPARAM wParam,
@ -76,7 +80,11 @@ UINT CALLBACK VfdPageCallback(
//
// property page dialog procedure
//
#ifndef __REACTOS__
BOOL CALLBACK VfdPageDlgProc(
#else
INT_PTR CALLBACK VfdPageDlgProc(
#endif
HWND hDlg,
UINT uMessage,
WPARAM wParam,
@ -87,7 +95,11 @@ BOOL CALLBACK VfdPageDlgProc(
switch (uMessage) {
case WM_INITDIALOG:
#ifndef __REACTOS__
SetWindowLong(hDlg, DWL_USER, lParam);
#else
SetWindowLongPtr(hDlg, DWLP_USER, lParam);
#endif
if (lParam) {
lpcs = (LPCVFDSHEXT)((LPPROPSHEETPAGE)lParam)->lParam;
@ -98,7 +110,11 @@ BOOL CALLBACK VfdPageDlgProc(
return TRUE;
case WM_COMMAND:
#ifndef __REACTOS__
psp = (LPPROPSHEETPAGE)GetWindowLong(hDlg, DWL_USER);
#else
psp = (LPPROPSHEETPAGE)GetWindowLongPtr(hDlg, DWLP_USER);
#endif
if (!psp) {
break;
@ -165,7 +181,11 @@ BOOL CALLBACK VfdPageDlgProc(
default:
if (uMessage == g_nNotifyMsg) {
#ifndef __REACTOS__
psp = (LPPROPSHEETPAGE)GetWindowLong(hDlg, DWL_USER);
#else
psp = (LPPROPSHEETPAGE)GetWindowLongPtr(hDlg, DWLP_USER);
#endif
if (!psp) {
break;

View file

@ -123,7 +123,7 @@ LRESULT CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
LPNMHDR pnmh;
LPCREATESTRUCT lpCS;
LONG nThisApp = 0;
DialogData* pData = (DialogData*)GetWindowLong(hDlg, DWL_USER);
DialogData* pData = (DialogData*)GetWindowLongPtr(hDlg, DWLP_USER);
if (pData) nThisApp = pData->lData;
switch (message) {
@ -136,7 +136,7 @@ LRESULT CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
case WM_INITDIALOG:
pData = (DialogData*)lParam;
SetWindowLong(hDlg, DWL_USER, (LONG)pData);
SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)pData);
if (pData) nThisApp = pData->lData;
return OnCreate(hDlg, nThisApp);