News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Problem with x64 import

Started by Yuri, January 28, 2012, 07:32:55 AM

Previous topic - Next topic

Yuri

I want to use Get/SetWindowLongPtr in my 64-bit program, but GoLink doesn't find them in User32.dll. I guess that's because GoLink is a 32-bit process and the system (Win7/64) gives it a 32-bit version of the DLL, which does not export those functions.

I have tried putting the x64 DLL in the project folder, and this satisfied GoLink, but the program built this way crashes the system to the blue screen if I don't remove the DLL afterwards, and if I do, it still doesn't work because CreateWindowEx fails to create the window.

Is there any workaround for this problem? ::)

donkey

Hi Yuri,

I've found this problem too, I'll try to find a workaround.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

donkey

Hi Yuri,

Try adding the following workaround to your code:

SetWindowLongPtrA FRAME hWnd,nIndex,dwNewLong
LOCAL pFunc:Q
invoke GetModuleHandle,A"User32.dll"
invoke GetProcAddress,eax,A"SetWindowLongPtrA"
mov [pFunc],rax
invoke [pFunc],[hWnd],[nIndex],[dwNewLong]
ret
endf

SetWindowLongPtrW FRAME hWnd,nIndex,dwNewLong
LOCAL pFunc:Q
invoke GetModuleHandle,A"User32.dll"
invoke GetProcAddress,eax,A"SetWindowLongPtrW"
mov [pFunc],rax
invoke [pFunc],[hWnd],[nIndex],[dwNewLong]
ret
endf


Let me know if it works.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Yuri

Thanks, Edgar, it works great. :thumbu I can't believe I forgot of GetProcAddress. Those blue screens obviously confused my mind, I've never seen so many. :bdg