I am not a 64 bit expert but i do not think this is going to work.
ddk/imm.h is a Microsoft header so IMEs and programs compiled with the original header will not have the expanded space.
To fix this properly (I assume you are trying to support 64 bit) is that we will probibly have to store a handle instead of a pointer in the LONG value. The IME is expecting a HIMC in that value.
Which leads to a more general question. What is the suggested way to generate handles like that? Working toward 64 bit means that everywhere that we are using pointers as LONG handles is going to have problems.
-aric
Michael Stefaniuc wrote:
Next try at fixing this problem. I didn't find any other place where IMMGWL_IMC is used and the window classes are not my area of expertise.
dlls/imm32/imm.c | 2 +- dlls/winex11.drv/ime.c | 2 +- include/ddk/imm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 14178c3..bb50e5e 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -2291,7 +2291,7 @@ BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen) data->imeWnd = CreateWindowExW( WS_EX_TOOLWINDOW, data->immKbd->imeClassName, NULL, WS_POPUP, 0, 0, 1, 1, 0, 0, data->immKbd->hIME, 0);
SetWindowLongW(data->imeWnd, IMMGWL_IMC, (LONG)data);
}SetWindowLongPtrW(data->imeWnd, IMMGWL_IMC, (LONG_PTR)data); IMM_GetThreadData()->hwndDefault = data->imeWnd;
diff --git a/dlls/winex11.drv/ime.c b/dlls/winex11.drv/ime.c index 87d4faa..6d083d1 100644 --- a/dlls/winex11.drv/ime.c +++ b/dlls/winex11.drv/ime.c @@ -1326,7 +1326,7 @@ static LRESULT WINAPI IME_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, * messages. */
- hIMC = (HIMC)GetWindowLongW(hwnd,IMMGWL_IMC);
- hIMC = (HIMC)GetWindowLongPtrW(hwnd,IMMGWL_IMC); if (!hIMC) hIMC = RealIMC(FROM_X11);
diff --git a/include/ddk/imm.h b/include/ddk/imm.h index 6e4d42f..bc9617e 100644 --- a/include/ddk/imm.h +++ b/include/ddk/imm.h @@ -114,7 +114,7 @@ HIMCC WINAPI ImmReSizeIMCC(HIMCC, DWORD); DWORD WINAPI ImmGetIMCCSize(HIMCC);
#define IMMGWL_IMC 0 -#define IMMGWL_PRIVATE (sizeof(LONG)) +#define IMMGWL_PRIVATE (sizeof(LONG_PTR))
/* IME Property bits */ #define IME_PROP_END_UNLOAD 0x0001
Aric Stewart wrote:
I am not a 64 bit expert but i do not think this is going to work.
ddk/imm.h is a Microsoft header so IMEs and programs compiled with the original header will not have the expanded space.
They will as the Microsoft header has the exact same change as I did in this patch. It's not directly in imm.h but in immdev.h; our imm.h header would need to be split for "full compatibility" with the Microsoft DDK headers but that's something for an other patch.
bye michael
To fix this properly (I assume you are trying to support 64 bit) is that we will probibly have to store a handle instead of a pointer in the LONG value. The IME is expecting a HIMC in that value.
Which leads to a more general question. What is the suggested way to generate handles like that? Working toward 64 bit means that everywhere that we are using pointers as LONG handles is going to have problems.
-aric
Michael Stefaniuc wrote:
Next try at fixing this problem. I didn't find any other place where IMMGWL_IMC is used and the window classes are not my area of expertise.
dlls/imm32/imm.c | 2 +- dlls/winex11.drv/ime.c | 2 +- include/ddk/imm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 14178c3..bb50e5e 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -2291,7 +2291,7 @@ BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen) data->imeWnd = CreateWindowExW( WS_EX_TOOLWINDOW, data->immKbd->imeClassName, NULL, WS_POPUP, 0, 0, 1, 1, 0, 0, data->immKbd->hIME, 0);
SetWindowLongW(data->imeWnd, IMMGWL_IMC, (LONG)data);
}SetWindowLongPtrW(data->imeWnd, IMMGWL_IMC, (LONG_PTR)data); IMM_GetThreadData()->hwndDefault = data->imeWnd;
diff --git a/dlls/winex11.drv/ime.c b/dlls/winex11.drv/ime.c index 87d4faa..6d083d1 100644 --- a/dlls/winex11.drv/ime.c +++ b/dlls/winex11.drv/ime.c @@ -1326,7 +1326,7 @@ static LRESULT WINAPI IME_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, * messages. */
- hIMC = (HIMC)GetWindowLongW(hwnd,IMMGWL_IMC);
- hIMC = (HIMC)GetWindowLongPtrW(hwnd,IMMGWL_IMC); if (!hIMC) hIMC = RealIMC(FROM_X11);
diff --git a/include/ddk/imm.h b/include/ddk/imm.h index 6e4d42f..bc9617e 100644 --- a/include/ddk/imm.h +++ b/include/ddk/imm.h @@ -114,7 +114,7 @@ HIMCC WINAPI ImmReSizeIMCC(HIMCC, DWORD); DWORD WINAPI ImmGetIMCCSize(HIMCC);
#define IMMGWL_IMC 0 -#define IMMGWL_PRIVATE (sizeof(LONG)) +#define IMMGWL_PRIVATE (sizeof(LONG_PTR))
/* IME Property bits */ #define IME_PROP_END_UNLOAD 0x0001
Ok digging into my IME documentation I see this:
"The cbWndExtra of the UI class has to be 2 * sizeof(LONG). The purpose of this WndExtra is defined by the system (for example, IMMGWL_IMC and IMMGWL_PRIVATE)."
So any IME developer is properly reserving 64 bits already. Which means my concern is not valid.
-aric
Michael Stefaniuc wrote:
Aric Stewart wrote:
I am not a 64 bit expert but i do not think this is going to work.
ddk/imm.h is a Microsoft header so IMEs and programs compiled with the original header will not have the expanded space.
They will as the Microsoft header has the exact same change as I did in this patch. It's not directly in imm.h but in immdev.h; our imm.h header would need to be split for "full compatibility" with the Microsoft DDK headers but that's something for an other patch.
bye michael
To fix this properly (I assume you are trying to support 64 bit) is that we will probibly have to store a handle instead of a pointer in the LONG value. The IME is expecting a HIMC in that value.
Which leads to a more general question. What is the suggested way to generate handles like that? Working toward 64 bit means that everywhere that we are using pointers as LONG handles is going to have problems.
-aric
Michael Stefaniuc wrote:
Next try at fixing this problem. I didn't find any other place where IMMGWL_IMC is used and the window classes are not my area of expertise.
dlls/imm32/imm.c | 2 +- dlls/winex11.drv/ime.c | 2 +- include/ddk/imm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 14178c3..bb50e5e 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -2291,7 +2291,7 @@ BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen) data->imeWnd = CreateWindowExW( WS_EX_TOOLWINDOW, data->immKbd->imeClassName, NULL, WS_POPUP, 0, 0, 1, 1, 0, 0, data->immKbd->hIME, 0);
SetWindowLongW(data->imeWnd, IMMGWL_IMC, (LONG)data);
}SetWindowLongPtrW(data->imeWnd, IMMGWL_IMC, (LONG_PTR)data); IMM_GetThreadData()->hwndDefault = data->imeWnd;
diff --git a/dlls/winex11.drv/ime.c b/dlls/winex11.drv/ime.c index 87d4faa..6d083d1 100644 --- a/dlls/winex11.drv/ime.c +++ b/dlls/winex11.drv/ime.c @@ -1326,7 +1326,7 @@ static LRESULT WINAPI IME_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, * messages. */
- hIMC = (HIMC)GetWindowLongW(hwnd,IMMGWL_IMC);
- hIMC = (HIMC)GetWindowLongPtrW(hwnd,IMMGWL_IMC); if (!hIMC) hIMC = RealIMC(FROM_X11);
diff --git a/include/ddk/imm.h b/include/ddk/imm.h index 6e4d42f..bc9617e 100644 --- a/include/ddk/imm.h +++ b/include/ddk/imm.h @@ -114,7 +114,7 @@ HIMCC WINAPI ImmReSizeIMCC(HIMCC, DWORD); DWORD WINAPI ImmGetIMCCSize(HIMCC);
#define IMMGWL_IMC 0 -#define IMMGWL_PRIVATE (sizeof(LONG)) +#define IMMGWL_PRIVATE (sizeof(LONG_PTR))
/* IME Property bits */ #define IME_PROP_END_UNLOAD 0x0001