String compare?

c++ / delphi package - dll injection and api hooking
Post Reply
neji
Posts: 155
Joined: Wed Mar 09, 2005 11:39 am
Contact:

String compare?

Post by neji »

I've a weird problem and i think its because of a wrong typecast.

I wrote a dll with an IPCQueue. Then my dll passes a pchar with the path of the prozess in which the dll is injected to my Application.

From my Applications Callbackprocedure i pass the pchar value to another function

Code: Select all

  // temp is a global declared String Var
  temp := StrPas(pchar(messageBuf));
Now i get a Pathname from an inifile in this function and want to compare it which the temp var which i passed to this function
But it never says that they're equal. In the "watches" list of the debugger the two strings look equal at all :(
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

You can simply do "temp := pchar(messageBuf)". Don't know why the strings are equal and not equal at the same time. I'd say log the length of both strings (e.g. "Length(temp)") plus log the content of both strings. Obviously there must be a difference somewhere.
sourcerer
Posts: 9
Joined: Sat Mar 19, 2005 5:33 pm

Post by sourcerer »

Not sure this makes sense but could it be escape characters (there are likely backslashes in the path) creates a problem somehow?

Kaj
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Sure. But it's not very probable that escape chars occur inside of a file path.
Post Reply