Delphi

Discussion in 'Engineering & Reverse Engineering' started by Hivebrain, Jun 7, 2005.

Thread Status:
Not open for further replies.
  1. Hivebrain

    Hivebrain

    Administrator
    2,863
    18
    18
    53.4N, 1.5W
    HiveView
    Code (Text):
    1. procedure DoNu;
    2. var myFile: TSearchRec;
    3.   begin
    4.   if FindFirst((ParamStr(2)+'\*.bin'), faAnyFile, myFile) = 0 then
    5.     begin
    6.     repeat
    7.     NDecomp(PChar(ParamStr(2)+'\'+myFile.Name), PChar(ParamStr(3)+'\'+myFile.Name), 0);
    8.  &nbsp; &nbsp;until FindNext(myFile) <> 0;
    9.  &nbsp; &nbsp;FindClose(myFile);
    10.  &nbsp; &nbsp;end;
    11.  &nbsp;end;
    This is supposed to go through a folder, decompressing everything with Magus' Nemesis DLL from KENS. ParamStr(2) and ParamStr(3) are the names of the input and output folders. When the procedure is executed, it seems to cause a runtime error. Is there a mistake in the procedure?
     
  2. Korama

    Korama

    Tech Member
    272
    0
    0
    Could it be that you haven't called "NInit" or "NAvailable" before that procedure is executed?
    When you import the KENS DLLs dynamically (that's the default, set by a compiler switch in KENS.pas), then it's absolutely necessary that you call the XInit/XAvailable functions at least once before you can use the respective KENS functions, because they do the importing.
    I'd recommend using XAvailable and checking its result before using a KENS function. XAvailable will call XInit, but only when necessary. So, include a call to "NAvailable" in your code and the runtime error shouldn't happen anymore.
     
  3. Hivebrain

    Hivebrain

    Administrator
    2,863
    18
    18
    53.4N, 1.5W
    HiveView
    That'll be it - I didn't call those functions. Thanks!
     
Thread Status:
Not open for further replies.