Solved

Maybe I find a bug with madCodeHook

Posted on 2004-04-11
11
319 Views
Last Modified: 2010-04-05
Dear Madshi:
                         
      I think maybe I find a little bug in MadCodeHook -> CreateProcessEx()

      When I try use
const ExeFile = './xxx.exe';
          CreateProcessExA(nil, ExeFile,
                    nil, nil, False, 0, nil,
                    PChar(ExtractFileDir(Application.ExeName)),
                    si, pi, 'xxx.dll')
      It allways be crash in windows98/me (2k/xp works fine)
(I tryed CreateProcessEx, and that dll is an empty dll)

      and it works fine in the version before madCollection 2.1.0.1 version (release at 2004-03-08)

      sorry for my poor english....

I can't send this mail to dear@madshi.net so I post it here
Hope you can see this..

Question difficulty must be at least 20 points.
My 20 points....5555..
0
Comment
Question by:xmichen
  • 5
  • 5
11 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 10801352
Which one is crashing? The process which is calling CreateProcessEx? Or the newly created process?
0
 

Author Comment

by:xmichen
ID: 10801384
newly created process will crash...
I use createprocess then InjectLibrary It works now

that code works fine before I update my madcodehook to 2.1.0.1 version

and I tried use the empty dll...it still crash,,So I think that's a bug..
0
 
LVL 20

Expert Comment

by:Madshi
ID: 10801732
I can't reproduce it here with the current build ( htttp://madshi.net/madCollectionBeta.exe ). If you can still reproduce it with the build, could you please mail your files to me? I need all the xxx.dll and the xxx.dll and all the sources etc...

Thanks.
0
 

Author Comment

by:xmichen
ID: 10805918
Maybe I can't test it now..
because I use 2000/xp system in my pc...
that 98 bug is my friend help me tested...
We tried two day....

the source code in the exe file only has one procedure in formcreate...
and the dll file is an empty dll(I has tried the damo dll in madcodehook named HookLoadLibrary.dll, still crash)

Const
  ExeFile = '.\target.exe';

procedure TMainForm.FormCreate(Sender: TObject);
var
  si    :TStartupInfo;
  pi    :TProcessInformation;
begin
  ZeroMemory(@si, sizeOf(si));
  si.cb := sizeOf(si);
  try
    if not CreateProcessA(nil, PAnsiChar(ExeFile),
                    nil, nil, False, 0, nil,
                    PAnsiChar(ExtractFileDir(Application.ExeName)),
                    si, pi) then
    begin
      if MessageBoxA(0, 'can't createprocess!',
                  'error', MB_OK + MB_ICONERROR) = IDOK then
      begin
        Application.Terminate;
        Exit;
      end;
    end;
    InjectLibraryA(pi.hProcess, PAnsiChar(DLLName))
  Except
    MessageBoxA(0, 'failed',
                  'error', MB_OK + MB_ICONERROR);
    Application.Terminate;
    Exit;
  end;
end;
0
 
LVL 20

Expert Comment

by:Madshi
ID: 10806468
What can I say? I can't reproduce it on my 9x PC. Maybe I could reproduce it if you would send me the full files which crashed on your friend's PC. But without being able to reproduce the problem I see no chance to fix it.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:xmichen
ID: 10806852
reproduce = rebuild the source code?
sorry for my poor english:(....
0
 
LVL 20

Expert Comment

by:Madshi
ID: 10806971
reproduce means: I need to be able to see the crash on my PC.
0
 

Author Comment

by:xmichen
ID: 10807494
So that you mean that code does not crash in your pc?
then maybe is the target application's program.....

It's my program...sorry for waste your time..
I use InjectLibrary to let it work...

^_*
0
 
LVL 20

Accepted Solution

by:
Madshi earned 20 total points
ID: 10807857
I'm not sure what it is. At least I don't get that crash on my 98 PC.
0
 

Author Comment

by:xmichen
ID: 10811119
Maybe I find why the program crashed..

It looks the file path has unicode char..(We are chinese...)
So the CreateProcessEx doen't work bug CreateProcess worked fine...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now