[Linker Fatal Error] Fatal: Unable to open file 'WINDOWS.OBJ

c++ / delphi package - dll injection and api hooking

[Linker Fatal Error] Fatal: Unable to open file 'WINDOWS.OBJ

Postby shadowstar » Wed Sep 01, 2004 10:49 am

C++Builder 6
Uncheck Build with rumtime packages.
shadowstar
 
Posts: 12
Joined: Fri Jul 09, 2004 2:09 pm
Location: China

Postby shadowstar » Wed Sep 01, 2004 11:07 am

Code: Select all
#include <madCodeHook.hpp>
#include <madRemote.hpp>

#pragma comment(lib, "madCodeHook_.lib")
#pragma comment(lib, "madRemote_.lib")

...
shadowstar
 
Posts: 12
Joined: Fri Jul 09, 2004 2:09 pm
Location: China

Postby madshi » Thu Sep 02, 2004 11:01 am

You don't need the pragma links. Using that #include is enough. Does the problem still occur when using #include only?
madshi
Site Admin
 
Posts: 9879
Joined: Sun Mar 21, 2004 5:25 pm

Postby shadowstar » Thu Sep 02, 2004 2:40 pm

madshi wrote:You don't need the pragma links. Using that #include is enough. Does the problem still occur when using #include only?

yes.

I find text "WINDOWS.OBJ" in file madCodeHook.obj, but can't find file "WINDOWS.OBJ" in any directory. I add $(BCB)\Source\Windows.pas to the project, OK, but another error occured:
Code: Select all
[Linker Fatal Error] Fatal: Unable to open file 'SYSTEM.OBJ'

Add System.pas
Code: Select all
[Pascal Error] pasall.tmp(4): Identifier redeclared: 'system'
shadowstar
 
Posts: 12
Joined: Fri Jul 09, 2004 2:09 pm
Location: China

Postby madshi » Thu Sep 02, 2004 4:08 pm

Very strange. Could you please try with a brand new project? Does the problem occur there, too?

Are you using the BCB evaluation version?
madshi
Site Admin
 
Posts: 9879
Joined: Sun Mar 21, 2004 5:25 pm

Postby shadowstar » Fri Sep 03, 2004 4:56 am

madshi wrote:Very strange. Could you please try with a brand new project? Does the problem occur there, too?

Are you using the BCB evaluation version?


Yes, the problem occur in the brand new project.

I'm using the BCB Enterprise Suite Version 6.0.
shadowstar
 
Posts: 12
Joined: Fri Jul 09, 2004 2:09 pm
Location: China

Postby shadowstar » Fri Sep 03, 2004 5:09 am

madshi wrote:You don't need the pragma links. Using that #include is enough. Does the problem still occur when using #include only?

Oh, when using #include only:
Code: Select all
[Linker Error] Unresolved external '__stdcall Madcodehook::AmSystemProcess()' referenced from D:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\UNIT1.OBJ
shadowstar
 
Posts: 12
Joined: Fri Jul 09, 2004 2:09 pm
Location: China

Postby madshi » Fri Sep 03, 2004 8:25 am

I've tested it again. With runtime packages you don't need the #pragma stuff. But not using runtime packages you need to add this:

#pragma link "madCodeHook.obj"
madshi
Site Admin
 
Posts: 9879
Joined: Sun Mar 21, 2004 5:25 pm

Postby shadowstar » Fri Sep 03, 2004 9:21 am

madshi wrote:I've tested it again. With runtime packages you don't need the #pragma stuff. But not using runtime packages you need to add this:

#pragma link "madCodeHook.obj"

Code: Select all
[Linker Fatal Error] Fatal: Unable to open file 'WINDOWS.OBJ'

Does the problem not occur in your project?
shadowstar
 
Posts: 12
Joined: Fri Jul 09, 2004 2:09 pm
Location: China

Postby madshi » Fri Sep 03, 2004 9:52 am

Which problem do you mean?

Have you noticed that my "pragma" call is different than yours? Please try my pragma call. Using that my BCB5 test project compiles&links just fine.
madshi
Site Admin
 
Posts: 9879
Joined: Sun Mar 21, 2004 5:25 pm

Postby shadowstar » Fri Sep 03, 2004 11:43 am

I have used #pragma comment and #pragme link, the error allways occured.

Sorry, I don't have BCB5, could you test it in BCB6?
shadowstar
 
Posts: 12
Joined: Fri Jul 09, 2004 2:09 pm
Location: China

Postby madshi » Mon Sep 06, 2004 4:53 pm

I'll test it in BCB6 as soon as possible. Right now I don't have access to BCB6, but I should get it soon. For now you can use the madCHook.h file together with the madCHook.dll. It's not as nice as the native Delphi/BCB stuff, but at least it should let you begin working.
madshi
Site Admin
 
Posts: 9879
Joined: Sun Mar 21, 2004 5:25 pm

Postby shadowstar » Wed Sep 08, 2004 11:15 am

Thank you.
:D
shadowstar
 
Posts: 12
Joined: Fri Jul 09, 2004 2:09 pm
Location: China

Postby madshi » Sun Sep 19, 2004 12:51 pm

Finally got BCB6 (enterprise edition) now. Created a new project, added a button to the main form. Double clicked it. Added this to the OnClick event:

Code: Select all
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  AmSystemProcess();
}


Got this error, of course:

[C++ Error] Unit1.cpp(23): E2268 Call to undefined function 'AmSystemProcess'

Added:

Code: Select all
#include <madCodeHook.hpp>


Compiled and linked fine. Unchecked "runtime packages" from the project options. Recompiled. Got the error:

[Linker Error] Unresolved external '__stdcall Madcodehook::AmSystemProcess()' referenced from C:\DESKTOP\BCB6TEST\UNIT1.OBJ

Added:

Code: Select all
#pragma link "madCodeHook"


Compiled, linked and run fine. So I can't see anything wrong.

Here's the final full code:

Code: Select all
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

#include <madCodeHook.hpp>
#pragma link "madCodeHook"

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  AmSystemProcess();
}
//---------------------------------------------------------------------------
madshi
Site Admin
 
Posts: 9879
Joined: Sun Mar 21, 2004 5:25 pm

Postby madshi » Sun Sep 19, 2004 12:52 pm

Maybe your library path is too long? Delphi/BCB has a hard limit on how long the library/search path may get. If you have too many components/packages installed with too long paths, Delphi/BCB usually can't find system.pas/obj, anymore. Try to clean up/shorten your library path.
madshi
Site Admin
 
Posts: 9879
Joined: Sun Mar 21, 2004 5:25 pm

Next

Return to madCodeHook

Who is online

Users browsing this forum: Baidu [Spider], Exabot [Bot] and 4 guests