May 02, 2024, 05:43:46 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Entry point _ftol2 could not be located - Help

Started by Andy, April 02, 2012, 01:02:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

Hi,

Was just testing my project on XP home 32 bit and I get this error when I try to run it:

The procedure entry point _ftol2 could not be located in the dynamic link library msvcrt.dll

It works fine on Win 7 32 bit.

This copy of XP is from my old disk, updated XP to Service pack 3 - still the same problem

Installed IWB on the XP disk, re-compiled and still the problem persists.

Installed latest headers etc for IWB, problem is still there.

Thought it might be my project so I tried to compile the Browser_Test2 example - it too has the problem.

Help, Help, Help!!!!
:-[

Attached is the Browser_Test2 example - does this compile and run on any XP machines?
If so, what's the difference?

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

Just been searching the web, it seems Vista and 7's version of the DLL file have this function included  -  XP's version does not? - is that correct and what can we do about it?

Thanks,
Andy
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

ZeroDog

Sounds like you are going to have to manually load the library using the LoadLibrary API, and then determine the function addresses using the  GetProcAddress API, and then call the function using the CallWindowProc API.

You will have to check the GetProcAddress return value to see if it's a valid address in the DLL, if it isn't, it will return NULL, in which case you should not try and use the function or it will fail like it has been doing.

Andy


Commented out:

'const OLECMDID_SAVEAS = 4
'const OLECMDEXECOPT_DODEFAULT = 0

and

'CASE idSave
'   IDispatch browser = GETBROWSERINTERFACE(.cont)
'   browser.ExecWB(OLECMDID_SAVEAS, OLECMDEXECOPT_DODEFAULT)
'   browser->Release()

and the SUB DoEnum

and it compiles and works

I can do without the option to save a page, but I do need the DoEnum sub routine as it reads the web page source code.

In the sub routine there are lines:

BSTR bstrHtml = browser.Document.documentElement.outerHTML
and
references to wcstok - these also seem to cause the problem.

Thats as far as i've got so far.

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

I'd try to help but that's all over my head.

I did some searching for ftol2 and it's obvious that quite a few people have run into the problem.
But I didn't find any solution.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Larry,

Thanks anyway for trying!

Thanks very much,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy


The MSVCRT.dll file is a C run time file, so I downloaded the Visual C++ 2010 run time package from Microsoft.

This didn't fix the problem.

I can only suggest that if anyone compiles in Win 7 or Vista then you try your software on an XP machine and vice versa!

I always used to do this in EB, but not since I started to use IWB - the problem lies with XP not EB / IWB of which i'm very happy with.

Will keep trying,

Andy.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Ficko

"_ftol" is in reality just this:


_asm
_ftol2:
push 0
fistp dword [esp]
pop eax
ret
_endasm


Just put it in your code and you have "_ftol2".  ;D

Andy

Ficko,

Thanks for that, it's a great try but the program is still trying to load the msvcrt.dll file and so the problem persists.

Thanks,
Andy.

:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

Quote from: andy1966 on April 07, 2012, 11:23:49 PM
Ficko,

Thanks for that, it's a great try but the program is still trying to load the msvcrt.dll file and so the problem persists.

Thanks,
Andy.

:)
That suggest to me that you are using a lib that was built that called the routine in that dll.
I suggest you try to determine what is calling that routine and then seeing if you can get a different version of it.

That's my WAG (wild ass guess)

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ZeroDog

April 08, 2012, 12:50:11 AM #10 Last Edit: April 08, 2012, 12:59:27 AM by ZeroDog
DECLARE IMPORT,LoadLibraryA(lpLibFileName:STRING),INT
DECLARE IMPORT,FreeLibrary(hLibModule:INT),INT
DECLARE IMPORT,GetProcAddress(hModule:INT, lpProcName:STRING),INT
DECLARE IMPORT,CallWindowProcA(lpPrevWndFunc:INT, hwnd:INT, msg:INT, wParam:INT, lParam:INT),INT

DEF Library:INT
DEF ProcAddress,ProcAddress2:INT

Library=LoadLibraryA(getstartpath+"msvcrt.dll")
ProcAddress=GetProcAddress(Library, "_ftol")
ProcAddress2=GetProcAddress(Library, "_ftol2")

If ProcAddress=NULL
messagebox 0,"_ftol entry not found, do not attempt to call this function.","Warning"
else
messagebox 0,"_ftol entry found at address"+str$(ProcAddress)+"."+CHR$(13)+CHR$(13)_
+"It is safe to call this function."+CHR$(13)_
+"Use the following to call this function:"+CHR$(13)+CHR$(13)_
+"CallWindowProc(ProcAddress, winhandle, message, wParam, lParam)"_
,"Info"
endif

If ProcAddress2=NULL
messagebox 0,"_ftol2 entry not found, do not attempt to call this function.","Warning"
else
messagebox 0,"_ftol2 entry found at address"+str$(ProcAddress2)+"."+CHR$(13)+CHR$(13)_
+"It is safe to call this function."+CHR$(13)_
+"Use the following to call this function:"+CHR$(13)+CHR$(13)_
+"CallWindowProc(ProcAddress, winhandle, message, wParam, lParam)"_
,"Info"
endif

FreeLibrary(Library)

End


Don't DECLARE the "msvcrt.dll", instead, use the LoadLibraryA, and manually get the entry points for the functions in the dll that you plan to use with GetProcAddress.  If GetProcAddress returns NULL for any of the function entry points, then that function does not exist in the dll, and you should use an alternative function.  If GetProcAddress does not return NULL, then you can access that function using CallWindowProcA and the entrypoint address returned from the GetProcAddress.

Andy


Hi guys,

ZeroDog,

That's a great little program and works - thank you!

Larry - Any guess is a good guess for me - the only lib file I use is the "wininet.lib" file.

This is a portion of the debug code:

Starting debug session...
Loading DLL: ntdll.dll
Loading DLL: C:\Windows\system32\kernel32.dll
Loading DLL: C:\Windows\system32\KERNELBASE.dll
Loading DLL: C:\Program Files\AVAST Software\Avast\snxhk.dll
Loading DLL: C:\Windows\system32\USER32.DLL
Loading DLL: C:\Windows\system32\GDI32.dll
Loading DLL: C:\Windows\system32\LPK.dll
Loading DLL: C:\Windows\system32\USP10.dll
Loading DLL: C:\Windows\system32\msvcrt.dll

But is there a way to 'trap' which piece of code is invoking msvcrt.dll?

I may have to 'pull to bits' the code to find out?

Will do some more research.

Thanks,
Andy.

:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.